Skip to content

Commit

Permalink
internal/ethapi: fix panic in accesslist creation (ethereum#23225)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed May 29, 2024
1 parent 138c917 commit 3155da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/vm/access_list_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (al accessList) equal(other accessList) bool {
func (al accessList) accessList() types.AccessList {
acl := make(types.AccessList, 0, len(al))
for addr, slots := range al {
tuple := types.AccessTuple{Address: addr}
tuple := types.AccessTuple{Address: addr, StorageKeys: []common.Hash{}}
for slot := range slots {
tuple.StorageKeys = append(tuple.StorageKeys, slot)
}
Expand Down
10 changes: 5 additions & 5 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2030,12 +2030,12 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
}
// Copy the original db so we don't modify it
statedb := db.Copy()
feeCapacity := state.GetTRC21FeeCapacityFromState(statedb)
var balanceTokenFee *big.Int
if value, ok := feeCapacity[to]; ok {
balanceTokenFee = value
// Set the accesslist to the last al
args.AccessList = &accessList
msg, err := args.ToMessage(b, block.Number(), b.RPCGasCap(), header.BaseFee)
if err != nil {
return nil, 0, nil, err
}
msg := types.NewMessage(args.from(), args.To, uint64(*args.Nonce), args.Value.ToInt(), uint64(*args.Gas), args.GasPrice.ToInt(), big.NewInt(0), big.NewInt(0), args.data(), accessList, false, balanceTokenFee, header.Number)

// Apply the transaction with the access list tracer
tracer := vm.NewAccessListTracer(accessList, args.from(), to, precompiles)
Expand Down

0 comments on commit 3155da3

Please sign in to comment.