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

Istanbul: EIP-2200 net gas metering for SSTORE #590

Merged
merged 11 commits into from
Sep 10, 2019
Merged

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Sep 4, 2019

Reference for implementation and tests: ethereum/go-ethereum#19964

@coveralls
Copy link

coveralls commented Sep 4, 2019

Coverage Status

Coverage increased (+0.4%) to 95.71% when pulling f2215c0 on istanbul/eip-2200 into 2d9cdd8 on master.

lib/evm/opFns.ts Outdated Show resolved Hide resolved
@s1na
Copy link
Contributor Author

s1na commented Sep 5, 2019

Also merged in master. Had to update the blake2Round param because master has upgraded to the new Common release.

@holgerd77 holgerd77 mentioned this pull request Sep 6, 2019
18 tasks
Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some first review. Implementation looks good, numbers in tests are not fitting, can you have a look?

lib/evm/opFns.ts Show resolved Hide resolved
lib/evm/opFns.ts Show resolved Hide resolved
lib/evm/opFns.ts Show resolved Hide resolved
lib/evm/opFns.ts Show resolved Hide resolved
lib/evm/opFns.ts Show resolved Hide resolved
lib/evm/opFns.ts Show resolved Hide resolved
{ original: new BN(1), code: '600060005560016000556000600055', used: 10818, refund: 19200 }, // 1 -> 0 -> 1 -> 0
{ original: new BN(1), gas: new BN(2306), code: '6001600055', used: 2306, refund: 0, err: ERROR.OUT_OF_GAS }, // 1 -> 1 (2300 sentry + 2xPUSH)
{ original: new BN(1), gas: new BN(2307), code: '6001600055', used: 806, refund: 0 } // 1 -> 1 (2301 sentry + 2xPUSH)
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the numbers in the test cases differ to what is listed in the EIP? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, these test cases have been added after I created the PR: ethereum/EIPs@01b66af

It seems the EIP document has also been modified. Will have to look into it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameters in the EIP are also named very much differently than here (and in Go), did this also change? Or is this an intentional deviation to be in line with the old Constantinople naming?

If this changed we should likely do the extra round sigh on the Common library and change the parameter names (and eventually delete some?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the test vectors that were recently added to the EIP are for an older version of the EIP which assumed cost of SLOAD to be 200 instead of 800. See comment: ethereum/EIPs#2200 (comment)

About the param names, as long as we're conforming to test cases it should be fine. I don't think every client uses the same param names. The EIP is also somewhat under-specified. I'm more confident in geth's code as that's what eventually makes it into mainnet. But we can wait until the EIP's PR is merged, hopefully by then things will be more clear.

@holgerd77
Copy link
Member

See also #591.

@holgerd77
Copy link
Member

@s1na Ok, I think I would approve here. Can you update the branch and remove the update to common v1.3.2 per commit in here?

@holgerd77
Copy link
Member

Update: ah, just seeing that the last 2 commits this branch is lacking are not from the Common update. Will then update the branch here via GitHub and approve.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@holgerd77 holgerd77 merged commit 7d9cc76 into master Sep 10, 2019
@holgerd77 holgerd77 deleted the istanbul/eip-2200 branch September 10, 2019 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants