Skip to content

Commit fb9334c

Browse files
authored
feat(protocol): increase GAS_OVERHEAD value based on testnet data (#16769)
1 parent 57cae81 commit fb9334c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/protocol/contracts/bridge/Bridge.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contract Bridge is EssentialContract, IBridge {
4343
/// @dev The gas overhead for both receiving and invoking a message, as well as the proof
4444
/// calldata cost.
4545
/// This value should be fine-tuned with production data.
46-
uint32 public constant GAS_OVERHEAD = 60_000;
46+
uint32 public constant GAS_OVERHEAD = 120_000;
4747

4848
/// @dev The amount of gas not to charge fee per cache operation.
4949
uint256 private constant _GAS_REFUND_PER_CACHE_OPERATION = 20_000;
@@ -262,11 +262,9 @@ contract Bridge is EssentialContract, IBridge {
262262
if (msg.sender != _message.destOwner && _message.gasLimit != 0) {
263263
unchecked {
264264
uint256 refund = numCacheOps * _GAS_REFUND_PER_CACHE_OPERATION;
265-
stats.gasUsedInFeeCalc = stats.start - gasleft();
266-
267-
uint256 gasCharged =
268-
(GAS_OVERHEAD + stats.gasUsedInFeeCalc).max(refund) - refund;
265+
stats.gasUsedInFeeCalc = GAS_OVERHEAD + stats.start - gasleft();
269266

267+
uint256 gasCharged = stats.gasUsedInFeeCalc.max(refund) - refund;
270268
uint256 maxFee = gasCharged * _message.fee / _message.gasLimit;
271269
uint256 baseFee = gasCharged * block.basefee;
272270
uint256 fee =

0 commit comments

Comments
 (0)