This repository was archived by the owner on Oct 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1919 "maxFeePerGas" : "0xa862145e" ,
2020 "maxPriorityFeePerGas" : "0xa8621440" ,
2121 "paymasterAndData" : "0x" ,
22- "preVerificationGas" : "0xc869 " ,
22+ "preVerificationGas" : "0xc539 " ,
2323 "signature" : "0xa925dcc5e5131636e244d4405334c25f034ebdd85c0cb12e8cdb13c15249c2d466d0bade18e2cafd3513497f7f968dcbb63e519acd9b76dcae7acd61f11aa8421b" ,
2424 }
2525 MockByteCode = common .Hex2Bytes ("6080604052" )
Original file line number Diff line number Diff line change @@ -4,12 +4,24 @@ import (
44 "fmt"
55 "math/big"
66
7+ "github.com/stackup-wallet/stackup-bundler/pkg/gas"
78 "github.com/stackup-wallet/stackup-bundler/pkg/userop"
89)
910
1011// ValidateGasAvailable checks that the max available gas is less than the batch gas limit.
1112func ValidateGasAvailable (op * userop.UserOperation , maxBatchGasLimit * big.Int ) error {
12- if op .GetMaxGasAvailable ().Cmp (maxBatchGasLimit ) > 0 {
13+ // This calculation ensures that we are only checking the gas used for execution. In rollups, the PVG also
14+ // includes the L1 callData cost. If the L1 gas component spikes, it can cause the PVG value of legit ops
15+ // to be greater than the maxBatchGasLimit. For non-rollups, the results would be the same as just calling
16+ // op.GetMaxGasAvailable().
17+ static , err := gas .NewDefaultOverhead ().CalcPreVerificationGas (op )
18+ if err != nil {
19+ return err
20+ }
21+ mgl := big .NewInt (0 ).Sub (op .GetMaxGasAvailable (), op .PreVerificationGas )
22+ mga := big .NewInt (0 ).Add (mgl , static )
23+
24+ if mga .Cmp (maxBatchGasLimit ) > 0 {
1325 return fmt .Errorf ("gasLimit: exceeds maxBatchGasLimit of %s" , maxBatchGasLimit .String ())
1426 }
1527
You can’t perform that action at this time.
0 commit comments