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

CREATE2 gas cost update #1204

Merged
merged 3 commits into from
Oct 5, 2018
Merged

CREATE2 gas cost update #1204

merged 3 commits into from
Oct 5, 2018

Conversation

mkalinin
Copy link
Contributor

@mkalinin mkalinin commented Oct 4, 2018

Includes:

  • Latest update to EIP-1014 regarding SHA3 gas cost addition
  • a bit of refactor

Reference implementation:

@mkalinin mkalinin added this to the 1.9.0-Constantinople milestone Oct 4, 2018
DataWord size = stack.get(stack.size() - 2);
long chunkUsed = (size.longValueSafe() + 31) / 32;
long size = stack.get(stack.size() - 2).longValueSafe();
if (size == Long.MAX_VALUE) {
Copy link
Member

Choose a reason for hiding this comment

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

What is this check for?

Copy link
Contributor Author

@mkalinin mkalinin Oct 4, 2018

Choose a reason for hiding this comment

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

This check is similar to check in mem gas calculation code. And looks like it's already done in a call to calcMemGas prior to this check. I'll remove it in favor of code readability.

@@ -396,6 +400,12 @@ else if (!currentValue.isZero() && newValue.isZero()) {
case CREATE2:
gasCost = gasCosts.getCREATE() + calcMemGas(gasCosts, oldMemSize,
memNeeded(stack.get(stack.size() - 2), stack.get(stack.size() - 3)), 0);
long codeSize = stack.get(stack.size() - 3).longValueSafe();
if (codeSize == Long.MAX_VALUE) {
Copy link
Member

Choose a reason for hiding this comment

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

What is this check for?

@coveralls
Copy link

coveralls commented Oct 4, 2018

Coverage Status

Coverage decreased (-0.03%) to 56.605% when pulling fe10be2 on feature/create2-gas-cost-update into c27dc0f on develop.

Copy link
Collaborator

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

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

I like words count instead of magic. Great!

@mkalinin mkalinin merged commit b2bdc82 into develop Oct 5, 2018
@mkalinin mkalinin deleted the feature/create2-gas-cost-update branch December 26, 2018 06:34
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.

4 participants