@@ -35,7 +35,7 @@ contract AtlasVerification is EIP712, NonceManager, DAppIntegration {
35
35
address atlas ,
36
36
address l2GasCalculator
37
37
)
38
- EIP712 ("AtlasVerification " , "1.6 " )
38
+ EIP712 ("AtlasVerification " , "1.6.3 " )
39
39
DAppIntegration (atlas, l2GasCalculator)
40
40
{ }
41
41
@@ -679,38 +679,43 @@ contract AtlasVerification is EIP712, NonceManager, DAppIntegration {
679
679
}
680
680
681
681
allSolversCalldataGas =
682
- GasAccLib.calldataGas (solverDataLenSum + (_SOLVER_OP_BASE_CALLDATA * solverOps.length ), L2_GAS_CALCULATOR);
682
+ GasAccLib.calldataGas (solverDataLenSum + (_SOLVER_OP_STATIC_LENGTH * solverOps.length ), L2_GAS_CALCULATOR);
683
683
684
684
// NOTE: On Monad, _FIXED_GAS_OFFSET is added here to ensure we have enough gas for the whole metacall upfront.
685
685
// But it is not added to the _gasMarker tracker at the start of metacall(), because winning solver must pay all
686
686
// remaining gas in _settle() anyway - i.e. they do not get a rebate of gasleft().
687
- uint256 metacallExecutionGas = _BASE_TX_GAS_USED + AccountingMath._FIXED_GAS_OFFSET + userOpGas
688
- + dConfig.dappGasLimit + allSolversExecutionGas;
687
+ uint256 metacallExecutionGas = _BASE_TX_GAS_USED + _PRE_EXECUTE_METACALL_GAS + _POST_SETTLE_METACALL_GAS
688
+ + userOpGas + dConfig.dappGasLimit + allSolversExecutionGas;
689
+ // NOTE: On Monad, the _EXECUTE_SOLVER_OVERHEAD per solverOp is not included in the suggested gas limit.
689
690
690
691
// In both exPostBids and normal bid modes, solvers pay for their own execution gas.
691
692
allSolversGasLimit = allSolversExecutionGas;
692
693
693
694
if (dConfig.callConfig.exPostBids ()) {
694
695
// Add extra execution gas for bid-finding loop of each solverOp
695
- bidFindOverhead = ( solverOpsLen * _BID_FIND_OVERHEAD) + allSolversExecutionGas;
696
+ bidFindOverhead = solverOpsLen * _BID_FIND_OVERHEAD + allSolversExecutionGas;
696
697
metacallExecutionGas += bidFindOverhead;
697
698
// NOTE: allSolversGasLimit excludes calldata in exPostBids mode.
698
699
} else {
699
700
// Solvers only pay for their calldata if exPostBids = false
700
701
allSolversGasLimit += allSolversCalldataGas;
701
702
}
702
703
703
- uint256 _execGasUpperTolerance = _UPPER_BASE_EXEC_GAS_TOLERANCE + solverOpsLen * _TOLERANCE_PER_SOLVER;
704
- uint256 _execGasLowerTolerance = _LOWER_BASE_EXEC_GAS_TOLERANCE + solverOpsLen * _TOLERANCE_PER_SOLVER;
704
+ // If checkMetacallGasLimit is enabled, verify that the execution gas measured by gasleft() at the start of the
705
+ // metacall is in line with the expected gas limit, based on the userOp, solverOps, and dAppOp.
706
+ if (dConfig.callConfig.checkMetacallGasLimit ()) {
707
+ uint256 _execGasUpperTolerance = _UPPER_BASE_EXEC_GAS_TOLERANCE + solverOpsLen * _TOLERANCE_PER_SOLVER;
708
+ uint256 _execGasLowerTolerance = _LOWER_BASE_EXEC_GAS_TOLERANCE + solverOpsLen * _TOLERANCE_PER_SOLVER;
705
709
706
- // Gas limit set by the bundler cannot be too high or too low. Use Simulator contract to estimate gas limit.
707
- // If gas limit is too low, the bonded balance threshold checked may not cover all gas reimbursements.
708
- if (metacallGasLeft < metacallExecutionGas - _execGasLowerTolerance) {
709
- verifyCallsResult = ValidCallsResult.MetacallGasLimitTooLow;
710
- }
711
- // If gas limit is too high, the bonded balance threshold checked could unexpectedly price out solvers.
712
- if (metacallGasLeft > metacallExecutionGas + _execGasUpperTolerance) {
713
- verifyCallsResult = ValidCallsResult.MetacallGasLimitTooHigh;
710
+ // Gas limit set by the bundler cannot be too high or too low. Use Simulator contract to estimate gas limit.
711
+ // If gas limit is too low, the bonded balance threshold checked may not cover all gas reimbursements.
712
+ if (metacallGasLeft < metacallExecutionGas - _execGasLowerTolerance) {
713
+ verifyCallsResult = ValidCallsResult.MetacallGasLimitTooLow;
714
+ }
715
+ // If gas limit is too high, the bonded balance threshold checked could unexpectedly price out solvers.
716
+ if (metacallGasLeft > metacallExecutionGas + _execGasUpperTolerance) {
717
+ verifyCallsResult = ValidCallsResult.MetacallGasLimitTooHigh;
718
+ }
714
719
}
715
720
716
721
return (verifyCallsResult, allSolversGasLimit, allSolversCalldataGas, bidFindOverhead);
0 commit comments