-
Notifications
You must be signed in to change notification settings - Fork 679
feat: add eth_createAccessList
RPC method (#3321)
#3321
base: develop
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
async #applySimulationOverrides(overrides: CallOverrides): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is largely unchanged from how it was in the run-call file. To port it over to here, the function no longer receives stateTrie
and vm
parameters and just pulls it from the class properties instead.
} | ||
} | ||
|
||
#validateStorageOverride = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is largely unchanged from how it was in the run-call file.
accessList?: AccessList; | ||
}; | ||
|
||
type CallOverride = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change was made to the CallOverride
or CallOverrides
type, it was just moved over from run-call
Notes for reviewers: The This class could probably also be used to include parts of the setup for the blockchain's In the |
src/chains/ethereum/ethereum/tests/api/eth/createAccessList.test.ts
Outdated
Show resolved
Hide resolved
src/chains/ethereum/ethereum/tests/api/eth/createAccessList.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a partial review
d615faa
to
a3c1982
Compare
I've incorporated most comments from y'all @tenthirtyone @jeffsmale90 @davidmurdoch. I've also rebased to include the console.log PR, which introduced some changes to the |
src/chains/ethereum/ethereum/tests/api/eth/contracts/Inspector.sol
Outdated
Show resolved
Hide resolved
a139a9f
to
de82b14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I answered all questions. Let me know if I missed anything!
bc77b3b
to
8c65117
Compare
src/chains/ethereum/ethereum/tests/api/eth/createAccessList.test.ts
Outdated
Show resolved
Hide resolved
src/chains/ethereum/ethereum/tests/api/eth/createAccessList.test.ts
Outdated
Show resolved
Hide resolved
src/chains/ethereum/ethereum/tests/api/eth/createAccessList.test.ts
Outdated
Show resolved
Hide resolved
eth_createAccessList
RPC methodeth_createAccessList
RPC method (#3321)
previousAccessList = accessList; | ||
} | ||
iterations++; | ||
} while (iterations < MAX_ITERATIONS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured that might be the case 👍
Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Co-authored-by: David Murdoch <david@davidmurdoch.com>
…il`'s `Address` (#3777)
This change adds the
eth_createAccessList
RPC method in accordance with Geth's spec. This RPC method returns an access list and an estimate of the gas consumed by running the transaction with the generated access list included.For those of us that need a refresher, an access list is a list of addresses and storage keys that will be accessed by the transaction. It essentially tells the EVM "hey, heads up, I'm going to reference this here data", which gives you a discount on the gas usage of accessing that data. However, sending a transaction with an access list incurs and extra base fee, so it isn't always cheaper to include one. How do you know if it's best to include an access list in your transaction? Enter
eth_createAccessList
.To call this method, you'll need to send a transaction plus the block number or tag to run the transaction on, since some transactions will touch different addresses and storage keys depending on the block the transaction is running on. Here's how to use it!
As a cool note about the EVM, a transaction could also touch different addresses and storage when sent on the same block if just the
accessList
that is passed in as part of the transaction changes. Because the access list can impact the gas usage of certain opcodes, a contract that branches based off of gas usage can have vastly different behavior depending on the access list that is used. Oureth_createAccessList
implementation recursively runs the result of generating an access list until the resultant access list stops being different from the previous run. This results in an access list that we call the "best" one, but it does not mean that this access list will yield the least gas usage when sent with your transaction. There are many cases in which it is cheaper to omit the access list, so user beware!*Note: An address or storage key being "touched" by a transaction happens when certain opcodes are used in running the transaction. This is defined in EIPs 2929 and 2930. For our implementation, we rely on the awesome work of ethereumjs to handle the opcode dissecting.
Fixes #1056.