-
Notifications
You must be signed in to change notification settings - Fork 669
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
Support for the Paris
hard fork ("The Merge")
#2080
Conversation
5b8e3d1
to
1be70a9
Compare
a06784a
to
541495b
Compare
8beb3fa
to
e20500d
Compare
This PR has the rough implementation necessary to pass all the logic behind the merge but I think what comes after this should be the cleaning up of nomenclature around mining, etc... to be a bit more generalized, at least in the I created #2079 to track that. |
Paris
hard fork (Merge
)
Paris
hard fork (Merge
)Paris
hard fork ("The Merge")
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.
Added a few notes that still need addressing [PR is ready]
ed19891
to
41b7029
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.
lgtm!
3037669
to
68be1f5
Compare
68be1f5
to
22cdd72
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.
Awesome! This looks good to me! I just had a couple of clarifying questions, but nothing to stop merging this.
- Use the block header class for the appropriate VM by validating up to the previous VM, extracting the params, and plugging into the appropriate VM class. - Remove unnecessary fields in London state since they are already inheritted and do not need to be re-imported / overwritten
- Add ``Paris`` fork VM classes. - Supplant ``DIFFICULTY`` opcode at ``0x44`` with ``PREVRANDAO``. - Allow ``mix_hash`` to be retrieved from the execution context and add ``mixhash`` opcode logic function to be used in new ``PREVRANDAO`` opcode. - Some renaming of "Mining" nomenclature found within more general classes / methods - created an issue at ethereum#2079 to track more of these changes in a separate PR. - Minor cleanups along the way.
- Turn on ``ethereum/tests`` "Merge" tests to test against ``Paris`` VM implementations. - Skip slow tests related to previous VM tests (london and berlin mostly). - Update ``eth-typing`` and pull in updated ``ForkName`` enum with ``Paris`` added. - Fix some blips and get tests to pass.
- Our header db relied on difficulty to generate keys. Since the merge / PoS, difficulty is always ``0`` so this led to overwriting values due to the same key being generated (e.g. new_score = old_score + block.difficulty). Use the block number instead for PoS (or when difficulty=0). - The ``coinbase`` account is always touched, even when it receives a transaction fee with a value of ``0```. With recent changes for the ``Merge`` implementation, this was creating an issue for "Merge" tests where the ``stateRoot`` did not match. This seems to be because in every case for PoW, the ``coinbase`` account will get a block reward. This means that if the transaction fee was ``0``, it wouldn't matter because the ``coinbase`` would never end up with ``0`` balance, so all tests before PoS pass. Now that we are in a PoS context, there is no block reward, thus, when the transaction fee is ``0``, we will touch the account and leave it at a zeroed state. In order to implement EIP-161 correctly, if the ``coinbase`` account has ``0`` balance, empty code, ``0`` nonce, and no storage, it should be marked for deletion and not be included in the state root calculation.
d1c4d84
to
6ee3af6
Compare
What was wrong?
Paris
"the merge" fork support is needed.How was it fixed?
Support for
Paris
logic added:DIFFICULTY
opcode withPREVRANDAO
.ethereum/tests
.0
now. This caused issues with overwriting same values for keys.0
and going to thecoinbase
address never triggeredEIP-161
to actually remove the account from state trie calculation if the fee recipient account was in a zero-state at the end of the computation. For the last 15 remaining tests, this ended up being what was causing a wrong state root. (i.e. Thecoinbase
account is always touched, so if it is in a zero-state after the computation we have to mark it for deletion)Todo:
Cute Animal Picture