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
block, common: set constants block headers fields for The Merge #1393
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
38f64d8
to
a201a59
Compare
a201a59
to
c3acf43
Compare
c3acf43
to
ea6f549
Compare
Ok, I've rebased here and squashed several commits. I already removed the CHANGELOG entries again as per my comment on Discord. It is also generally far too early for release notes on this I guess since we are far far from the situation that we have even a somewhat clear picture on where this will lead too. 😋 Sorry that I am cutting so harshly through the woods here and also don't worry. It's actually super couragious that you gave this some start, great that we even already have some initial test cases! 😀 I've some more comments, will do separately a bit later. |
This EIP-3675 config in Common definitely needs to be added as some base selector, just to confirm the existing work. And I think we can (and should) also directly add "The Merge" as a hardfork. As some note on the switch discussion: if you want to do this "by hardfork" you can use the What I had in mind as an additional switch is the ability to switch the consensus engine (type) setting in Common (see e.g. goerli.json also on a per-hardfork basis (in addition to the existing per-chain basis) and adopt the associated Common methods The advantage of this is that this frees us from this process of always needing to go through this Merge HF for getting into a PoS state and it would allow e.g. also for things like setting up a pure PoS test network which just runs on PoS from the beginning. So the differentiation would be: for everything which is just pure PoS and is not just triggered by this Merge transition we should use a `common.consensusType() === 'pos' switch (and at some point it would really be nice to also switch to enums there, especially with this close 'poa', 'pos',... strings). For everthing which just one-time happens if there is an Eth1 chain available which need to be transitioned we should use checks based on the EIP or hardfork (I would actually prefer the hardfork checks since in this case we will (likely?) only have one EIP anyhow and this would improve readability I guess). So in the case of these validation checks and header field adjustments these would clearly be Does this make sense? I would directly integrate this in Common now and push here later on. |
(please read the last comment on site, many later-on updates and corrections) |
ea6f549
to
2458769
Compare
… correct values are provided
@gabrocheleau Ok, handinging it over again. 😄 I know I've edited an insane amount of the initial code, but really nothing to worry about. Getting a start on these specs is pretty pretty hard, especially when it comes to such unchartered territory like the Merge and it's really great that we have gotten a start on really substantially modfiying and updating our base libraries. |
Ok, I just checked from this list from the specification:
I guess apart from this event based check in the last rule - which is likely happening on another level together with client communication or something - we already have the relevant checks covered (some are just implicitly covered, e.g. these uncle checks we have in our library now always pass since uncles are guaranteed to be null. So eventually if things are otherwise accepted on review we might already be able to merge this in. |
5c5602d
to
294e309
Compare
@@ -59,6 +59,7 @@ export enum Hardfork { | |||
Berlin = 'berlin', | |||
London = 'london', | |||
Shanghai = 'shanghai', | |||
TheMerge = 'theMerge', |
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.
@holgerd77 what do you think about just calling it merge
for short? (what do others think?)
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.
either merge
or theMerge(tm)
Them (tm)
is important!
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.
Ok, let's do merge
😛 😅 (feel free everyone to update on occasion).
* e.g. "ethash" for "pow" consensus type, | ||
* "clique" for "poa" consensus type or | ||
* "casper" for "pos" consensus type. |
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.
after using enums for chain
and hardfork
I wish we also had them for these 🤔
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.
Yeah, for sure. Note sure, maybe we keep the strings in our json files, but expose these enums for users and also use these internally for comparisons in the code base?
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.
That sounds nice to me, we took the same approach with the chain/hardfork enums by just introducing them as additional input options first.
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.
wohoo, looks great, nice work everyone @gabrocheleau @holgerd77 @acolytec3!
This PR