mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
internal/ethapi: return an error in eth_createAccessList on too many authorizations
This commit is contained in:
parent
6e18588f80
commit
19c1f8ebcd
1 changed files with 12 additions and 10 deletions
|
|
@ -1172,17 +1172,19 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent redundant operations if args contain more authorizations than EVM may handle
|
// Prevent redundant operations if args contain more authorizations than EVM may handle
|
||||||
maxAuthorizations := uint64(*args.Gas) / params.TxAuthTupleGas
|
maxAuthorizations := uint64(*args.Gas) / params.CallNewAccountGas
|
||||||
if uint64(len(args.AuthorizationList)) <= maxAuthorizations {
|
if uint64(len(args.AuthorizationList)) > maxAuthorizations {
|
||||||
for _, auth := range args.AuthorizationList {
|
return nil, 0, nil, fmt.Errorf("insufficient gas to process all authorizations")
|
||||||
// Duplicating stateTransition.validateAuthorization() logic
|
}
|
||||||
if (!auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig().ChainID) != 0) || auth.Nonce+1 < auth.Nonce {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if authority, err := auth.Authority(); err == nil {
|
for _, auth := range args.AuthorizationList {
|
||||||
addressesToExclude[authority] = struct{}{}
|
// Duplicating stateTransition.validateAuthorization() logic
|
||||||
}
|
if (!auth.ChainID.IsZero() && auth.ChainID.CmpBig(b.ChainConfig().ChainID) != 0) || auth.Nonce+1 < auth.Nonce {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if authority, err := auth.Authority(); err == nil {
|
||||||
|
addressesToExclude[authority] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue