Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit b14d8bb

Browse files
authored
Add support for legacy fee mode (#153)
1 parent 2b3e2db commit b14d8bb

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

pkg/entrypoint/transaction/handleops.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,12 @@ func HandleOps(
9191
if err != nil {
9292
return nil, nil, err
9393
}
94-
tip, err := eth.SuggestGasTipCap(context.Background())
95-
if err != nil {
96-
return nil, nil, err
97-
}
9894

9995
auth, err := bind.NewKeyedTransactorWithChainID(eoa.PrivateKey, chainID)
10096
if err != nil {
10197
return nil, nil, err
10298
}
10399
auth.GasLimit = gas
104-
auth.GasTipCap = tip
105100

106101
txn, err = ep.HandleOps(auth, toAbiType(batch), beneficiary)
107102
if err != nil {
@@ -131,19 +126,14 @@ func CreateRawHandleOps(
131126
if err != nil {
132127
return "", err
133128
}
134-
tip, err := eth.SuggestGasTipCap(context.Background())
135-
if err != nil {
136-
return "", err
137-
}
138129

139130
auth, err := bind.NewKeyedTransactorWithChainID(eoa.PrivateKey, chainID)
140131
if err != nil {
141132
return "", err
142133
}
143134
auth.GasLimit = gas
144-
auth.GasTipCap = tip
145-
auth.GasFeeCap = big.NewInt(0).Add(baseFee, tip)
146135
auth.NoSend = true
136+
147137
tx, err := ep.HandleOps(auth, toAbiType(batch), beneficiary)
148138
if err != nil {
149139
return "", err

pkg/modules/checks/gasfee.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,22 @@ import (
77
)
88

99
// ValidateFeePerGas checks the maxFeePerGas is sufficiently high to be included with the current
10-
// block.basefee.
10+
// block.basefee. Alternatively, if basefee is not supported, then check that maxPriorityFeePerGas is equal to
11+
// maxFeePerGas as a fallback.
1112
func ValidateFeePerGas(op *userop.UserOperation, gbf GetBaseFeeFunc) error {
1213
bf, err := gbf()
1314
if err != nil {
1415
return err
1516
}
1617

18+
if bf == nil {
19+
if op.MaxPriorityFeePerGas.Cmp(op.MaxFeePerGas) != 0 {
20+
return fmt.Errorf("legacy fee mode: maxPriorityFeePerGas must equal maxFeePerGas")
21+
}
22+
23+
return nil
24+
}
25+
1726
if op.MaxFeePerGas.Cmp(bf) < 0 {
1827
return fmt.Errorf("maxFeePerGas: must be equal to or greater than current block.basefee")
1928
}

0 commit comments

Comments
 (0)