Skip to content

Commit 19c1f8e

Browse files
author
sashabeton
committed
internal/ethapi: return an error in eth_createAccessList on too many authorizations
1 parent 6e18588 commit 19c1f8e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

internal/ethapi/api.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,17 +1172,19 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
11721172
}
11731173

11741174
// Prevent redundant operations if args contain more authorizations than EVM may handle
1175-
maxAuthorizations := uint64(*args.Gas) / params.TxAuthTupleGas
1176-
if uint64(len(args.AuthorizationList)) <= maxAuthorizations {
1177-
for _, auth := range args.AuthorizationList {
1178-
// Duplicating stateTransition.validateAuthorization() logic
1179-
if (!auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig().ChainID) != 0) || auth.Nonce+1 < auth.Nonce {
1180-
continue
1181-
}
1175+
maxAuthorizations := uint64(*args.Gas) / params.CallNewAccountGas
1176+
if uint64(len(args.AuthorizationList)) > maxAuthorizations {
1177+
return nil, 0, nil, fmt.Errorf("insufficient gas to process all authorizations")
1178+
}
11821179

1183-
if authority, err := auth.Authority(); err == nil {
1184-
addressesToExclude[authority] = struct{}{}
1185-
}
1180+
for _, auth := range args.AuthorizationList {
1181+
// Duplicating stateTransition.validateAuthorization() logic
1182+
if (!auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig().ChainID) != 0) || auth.Nonce+1 < auth.Nonce {
1183+
continue
1184+
}
1185+
1186+
if authority, err := auth.Authority(); err == nil {
1187+
addressesToExclude[authority] = struct{}{}
11861188
}
11871189
}
11881190

0 commit comments

Comments
 (0)