Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP 2929 - dynamic state access costs, by cache warmth #1986

Merged
merged 16 commits into from
Mar 16, 2021

Conversation

carver
Copy link
Contributor

@carver carver commented Mar 10, 2021

What was wrong?

Fix #1974
Fix #1975

How was it fixed?

Replace a bunch of opcodes that dynamically check the cache warmth and charge appropriately.

Bonus changes:

  • show stack in debug2 traces
  • refactor opcode tests to use less custom hackery and more actual computation-execution code (necessary for the BerlinTransactionExecutor implementation to be testable)
  • renamed the variables in the sstore logic to match the EIP-2200 names

To-Do

Cute Animal Picture

put a cute animal picture link inside the parentheses

@carver carver mentioned this pull request Mar 10, 2021
11 tasks
@carver
Copy link
Contributor Author

carver commented Mar 12, 2021

Fun, the new sstore costs make the benchmarking fail to fit in the block 👍 👍

@carver
Copy link
Contributor Author

carver commented Mar 12, 2021

@kclowes So I'm still pretty sure that the revert logic is not correct, but I think this is far enough along to start getting an early look. I'm happy to do a walkthrough tomorrow if you're around.

@kclowes
Copy link
Collaborator

kclowes commented Mar 12, 2021

@carver awesome! Happy to do a walkthrough any time!

@carver carver marked this pull request as ready for review March 12, 2021 19:21
eth/db/account.py Outdated Show resolved Hide resolved
kclowes and others added 14 commits March 16, 2021 14:40
- Test that Balance gas cost works when cold or warm
- Test precompiles are already in access_list
See: https://gist.github.com/holiman/174548cad102096858583c6fbbb0649a

- charges cheaper price when using account in transaction.to and .sender
- refactor tests to avoid custom/mock setup and test more "real" code
Be sure to calculate 63/64ths *after* charging for account load

Pass BlockchainTests/GeneralStateTests/VMTests/vmIOandFlowOperations/gas.json:gas_d0g0v0_Berlin
Pass fixtures/BlockchainTests/GeneralStateTests/VMTests/vmTests/suicide.json:suicide_d1g0v0_Berlin
For example, REVERT should *reset* any account that was marked as warm
since the CALL, so that it is considered cold on the next access again.
Mark created accounts as accessed, at no change to cost.

Pass fixtures/BlockchainTests/GeneralStateTests/stCallCodes/callcodeDynamicCode.json:callcodeDynamicCode_d0g0v0_Berlin
Pass fixtures/BlockchainTests/GeneralStateTests/stCodeSizeLimit/codesizeInit.json:codesizeInit_d0g0v0_Berlin
Also, rlp objects must be hashable.

Pass fixtures/BlockchainTests/GeneralStateTests/stEIP2930/addressOpcodes.json:addressOpcodes_d0g0v0_Berlin
@carver
Copy link
Contributor Author

carver commented Mar 16, 2021

Verbal 👍 from @kclowes

@carver carver merged commit 3bec679 into ethereum:master Mar 16, 2021
@carver carver deleted the eip-2929 branch March 16, 2021 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State access lists in transactions: EIP-2930 for Berlin State access gas cost changes: EIP-2929 for Berlin
2 participants