-
Notifications
You must be signed in to change notification settings - Fork 757
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
Add EIP-1884 support for Istanbul #581
Conversation
Tests are failing because I changed the base cost of One naive solution would be to keep base costs as they are and in the opcode handler, charge the extra gas when current HF is greater than Istanbul. I think what I'll do is have a list of opcodes modified (or added) in Istanbul as a separate array merge that with the base array if current HF is greater than Istanbul. This goes along the plan of having HF-configurable opcodes (#543). |
Apparently there has been some discussion on the last ACD about the |
800920c
to
56350e1
Compare
0x46: ['CHAINID', 2, false], | ||
0x47: ['SELFBALANCE', 5, false], | ||
0x54: ['SLOAD', 800, true], |
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.
Hmm, this breaks with the concept of having gas price changes collected in the Common library (e.g. for SLOAD), I only expected the Istanbul opcode list to include the newly introduced opcodes (SELFBALANCE
).
For the moment this would introduce a lot of inconsistency - we also have added other gas price changes for Istanbul in the istanbul.json file.
Do you have a bigger plan for a complete transition here respectively a strong reasoning for this break apart? Otherwise I would very much suggest we add the price changes to the Common library.
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.
Hmm, I didn't know the base cost of opcodes are also updated in Common (in addition to extra gas parameters like ecAdd
). If that has been the intention, there's no corresponding code in the VM to read those base gas costs from Common:
If we want to keep base gas costs in Common we'd have to:
- Make sure costs for all opcodes are in
Common
(not the case now, searchingswap
in ethereumjs-common returned empty) - Remove them from
opcodes.ts
to only have one source of truth - Modify
Interpreter
to read costs from Common
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.
Hmm, maybe we are talking side by side a bit? What is with SLOAD
e.g. - the EIP is stating that this is changing gas costs from 200 to 800 - and the 200 price is just "normally" defined in the tangerine whistle json file in the Common library (see link above).
This is just a "normal" gas price change, isn't it?
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.
Ah, just had another look. See the point, these gas costs are not taken by Common at all atm. Maybe this is just more of some inconsistency/incompleteness in the Common library.
Anyhow, you are right. Will approve here.
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.
Looks good.
Ok, I would relatively quickly target a What is with the stateless execution prototype #556 (not urgent), do you want to have that included? |
The stateless execution prototype we can defer to a future release. It should be however possible to include EIP-2028 (#570) also in the release. It depends on |
Makes very much sense to also include EIP-2028. |
I just added a basic test case to see
SELFBALANCE
works. It should be tested more thoroughly when Istanbul tests are merged intoethereumjs-testing
.Fixes #579