Skip to content

Commit ebfc2a5

Browse files
ethapi: fix eth_createAccessList unmarshaling error (#524)
* fix: solves eth_createAccessList unmarshaling error * added back state * ethapi: preserve NotFound error, retrieve state once --------- Co-authored-by: protolambda <proto@protolambda.com>
1 parent f488db7 commit ebfc2a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/ethapi/api.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ type accessListResult struct {
12821282

12831283
// CreateAccessList creates an EIP-2930 type AccessList for the given transaction.
12841284
// Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.
1285-
func (api *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, state *state.StateDB, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error) {
1285+
func (api *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error) {
12861286
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
12871287
if blockNrOrHash != nil {
12881288
bNrOrHash = *blockNrOrHash
@@ -1302,7 +1302,7 @@ func (api *BlockChainAPI) CreateAccessList(ctx context.Context, args Transaction
13021302
}
13031303
}
13041304

1305-
acl, gasUsed, vmerr, err := AccessList(ctx, api.b, bNrOrHash, args, state)
1305+
acl, gasUsed, vmerr, err := AccessList(ctx, api.b, bNrOrHash, args)
13061306
if err != nil {
13071307
return nil, err
13081308
}
@@ -1316,12 +1316,13 @@ func (api *BlockChainAPI) CreateAccessList(ctx context.Context, args Transaction
13161316
// AccessList creates an access list for the given transaction.
13171317
// If the accesslist creation fails an error is returned.
13181318
// If the transaction itself fails, an vmErr is returned.
1319-
func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrHash, args TransactionArgs, state *state.StateDB) (acl types.AccessList, gasUsed uint64, vmErr error, err error) {
1319+
func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrHash, args TransactionArgs) (acl types.AccessList, gasUsed uint64, vmErr error, err error) {
13201320
// Retrieve the execution context
13211321
db, header, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
13221322
if db == nil || err != nil {
13231323
return nil, 0, nil, err
13241324
}
1325+
state := db
13251326

13261327
// Ensure any missing fields are filled, extract the recipient and input data
13271328
if err = args.setFeeDefaults(ctx, b, header); err != nil {

0 commit comments

Comments
 (0)