-
Notifications
You must be signed in to change notification settings - Fork 20.9k
Refactor chain configuration #19735
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
Refactor chain configuration #19735
Conversation
This |
This PR now made it through all forks including byzantium, will take some more time for it to reach Constantinople. |
This is no longer considered 'wip', although we should wait with merging until the node has synced up to head. |
This PR now made it past all forks, including Constantinople. It's about |
params/protocol_params.go
Outdated
// CreateBySuicide occurs when the refunded account is one that does | ||
// not exist. This logic is similar to call. | ||
// Introduced in Tangerine Whistle (Eip 150) | ||
CreateBySuicideGas uint64 = 25000 |
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.
Nit, lets rename Suicide
everywhere to Selfdestruct. Now's a good time imho.
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've renamed it everywhere where I've already touched things, so param names and opcode internals. It's still in use within e.g. statedb and stateobject. I figure it's better to do that change in a PR which does not contain any functional changes.
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.
Generally LGTM. I've enumerated some insignificant nits. One thing that I'm pondering about is an introduced slight confusion in the gas method now.
Previously all opcodes either cost a constant, or if they were dynamic, they had a fully encompassing method. Now we have three combos: fully constant, fully dynamic, or constant + dynamic. This last class seems a bit error prone, because looking at the method name gasSStore
vs gasSha3
, both seem to convey that they are standalone, whereas the latter actually has a constant component outside.
Would it perhaps make sense to have gasXYZ
be the naming convention if it's fully self contained, or dyngasXYZ
if it's just part of the gas. That would make the code clearer that there's something funky going on there.
I've addressed the nitpicks. Regarding the other slight confusion, one thing to have in mind is that most of these contants are named to be (somewhat) consistent with the YP, which defines things like
For reference btw, there aren't many cases where things have only dynamic gas any more;
If you want to, I can change all the methods that are only the dynamic part into |
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
I'll do the updates later this evening (you won't be able to push to my branch, so it'll be easier if I do it myself, but thanks for the offer!)
|
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
Nits fixed. Some follow-up work that might be worth doing in other PRs is to ...
|
Our chain is configured a bit spread out across several different abstractions, one of them being a gastable. This PR ries to make the configuration more coherent, and remove the need to keep a separate gastable and instead encapsulate everything inside the instruction sets.
This PR makes use of a previously unused recent change, the division between
constantGas
anddynamicGas
for an operation, and the fact that an operation can have both, which makes certain simplifications possible.The end goal is to simplify for a future PR where we can more easily add features (EIPS) to an existing defined fork, to make it simpler to execute state tests which focus on a particular feature (e..g
Constantinople+1884
) even if the whole (future) fork is still not defined.