Transaction: EIP-2930 (Berlin): Per-transaction extra access list

Add `accessList` to the `runComputation` API for EIP-2930 transactions.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
This commit is contained in:
Jamie Lokier 2021-05-26 16:05:18 +01:00
parent 76031ccbe4
commit f6cc6e3ed1
No known key found for this signature in database
GPG Key ID: CBC25C68435C30A2
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@ type
isCreate*: bool # True if this is a contract creation. isCreate*: bool # True if this is a contract creation.
value*: HostValue # Value sent from sender to recipient. value*: HostValue # Value sent from sender to recipient.
input*: seq[byte] # Input data. input*: seq[byte] # Input data.
accessList*: AccessList # EIP-2930 (Berlin) tx access list.
# Standard call result. (Some fields are beyond what EVMC can return, # Standard call result. (Some fields are beyond what EVMC can return,
# and must only be used from tests because they will not always be set). # and must only be used from tests because they will not always be set).
@ -70,6 +71,12 @@ proc initialAccessListEIP2929(call: CallParams) =
for c in activePrecompiles(): for c in activePrecompiles():
db.accessList(c) db.accessList(c)
# EIP2930 optional access list.
for account in call.accessList:
db.accessList(account.address)
for key in account.storageKeys:
db.accessList(account.address, UInt256.fromBytesBE(key))
proc setupCall(call: CallParams, useIntrinsic: bool): TransactionHost = proc setupCall(call: CallParams, useIntrinsic: bool): TransactionHost =
let vmState = call.vmState let vmState = call.vmState
vmState.setupTxContext( vmState.setupTxContext(