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

ethereum: metropolis #3757

Closed
wants to merge 13 commits into from
Closed

ethereum: metropolis #3757

wants to merge 13 commits into from

Conversation

obscuren
Copy link
Contributor

@obscuren obscuren commented Mar 7, 2017

The Metropolis PR

This Pull Requests contains all code for the Metropolis PR, which used to be separated in to several smaller PRs.

Please note that this is a Work In Progress: any of the parameters may change at any given time and this PR should not be considered leading. Please refer to the individual EIPs for more information.


EIP #198: Big Integer modexp
EIP #140: REVERT opcode
EIP #116: STATIC CALL opcode
EIP #100: Difficulty adjustment including uncles
EIP #98: Receipt state root removal
EIP #86: Account abstraction
EIP #XXX: Pairing pre-compile
EIP #197: bn256 scalar mul and add pre-compiles
EIP #XXX: RETURNDATA{COPY, SIZE} opcodes

API Changes

  • CHANGED: ethash.CalcDifficulty(time, parentTime uint64, parentNumber, parentDifficulty, *big.Int) -> ethash.CalcDifficulty(time uint64, parent *types.Header) and all child calls (e.g. calcHomesteadDifficulty) no implementation changes other than using the parent header and added metropolis difficulty calculation function.
  • CHANGED: statedb.StartRecord -> statedb.Prepare (no implementation changes)
  • NEW: statedb.Finalise: used post metropolis and deletes all suicided objects and cleans up the journal. Called after a transaction has been processed but prior to creating the transaction receipt. Is similar to IntermediateRoot with the exception that it does not calculate the intermediate root.

@mention-bot
Copy link

@obscuren, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fjl, @karalabe and @Gustav-Simonsson to be potential reviewers.

@holiman
Copy link
Contributor

holiman commented Mar 8, 2017

I browsed the changes a bit, although I know it's still WIP.

One question: during the window that the code is released, and the actual fork, the ops will be invalid operations, and throw error like this . However, they'll still be defined with stack requirements and gascost. So, afaict, the operations will verify stack and gas prior to erroring out due to invalidness. Is there any way that this can cause unforseen consequences, e.g. by having an OOG instead of invalidoperation error?

@obscuren
Copy link
Contributor Author

obscuren commented Mar 8, 2017

@holiman it shouldn't matter. The only err check that is performed is done on the errRevert, which, now that I think about it, will be removed as well. I'm trying to avoid error specific checking to prevent issues like the one you mentioned. Any error should be considered to do 1. revert state 2. consume all gas.

@fjl
Copy link
Contributor

fjl commented Mar 23, 2017

Please submit crypto/bn256 separately. It can go in long before metropolis.

core/vm, crypto/bn256: added bn256 curve and added precompile
core/vm: use crypto/bn256
crypto/bn256: exported P constant
core/vm, crypto/bn256: pairing pre-compile
core/vm: added pairing test
core, crypto, internal/ethapi, params: fixed tests
core/vm: fixed nil length input for pairing
The REVERT op codes reverts the state by returning an error from the
instruction. The instruction was checked during in the EVM. This error
would then determine whether any gas should be consumed or not. If the
error was an errRevert, no gas was further reduced and only state was
reverted.

This solution is error prone as you'll need an err check in multiple
locations and removes the no-err check requirement of the evm. This has
been solved by passing the snapshot to the interpreter and letting the
interpreter do the state reverting if the operation so requires.
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.

5 participants