Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Revert bug fix#4151

Merged
pirapira merged 6 commits intodevelopfrom
revert-bug-fix
Jun 20, 2017
Merged

Revert bug fix#4151
pirapira merged 6 commits intodevelopfrom
revert-bug-fix

Conversation

@pirapira
Copy link
Copy Markdown
Member

This fixes #4130 .

Before Metropolis, when an address collision happens, an existing non-empty code could be overwritten. The journaling system didn't remember the old code, so it could not recover the old code. This PR fixes that problem.

@chfast chfast self-requested a review June 19, 2017 14:08
break;
case Change::NewCode:
account.resetCode();
if (change.oldCode.empty())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here I would go with account.setNewCode(std::move(change.oldCode)); all the time. Moving empty bytes is not more costly than reset.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

account.resetCode();
else
account.setNewCode(std::move(change.oldCode));
account.setNewCode(std::move(change.oldCode));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm... after these changes it looks we should also rename .setNewCode() to just .setCode().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's true. I'll add a commit to this PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

@chfast
Copy link
Copy Markdown
Member

chfast commented Jun 20, 2017

The best!

pirapira added 6 commits June 20, 2017 15:49
This addresses #4130 together with the corresponding change in the test.
Rebased after the snark tests because the snark precompiles are already implemented on cpp-ethereum:develop
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jun 20, 2017

Codecov Report

Merging #4151 into develop will decrease coverage by 0.09%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           develop    #4151     +/-   ##
==========================================
- Coverage    67.08%   66.99%   -0.1%     
==========================================
  Files          299      299             
  Lines        23141    23148      +7     
==========================================
- Hits         15525    15508     -17     
- Misses        7616     7640     +24
Impacted Files Coverage Δ
libethereum/Account.h 100% <ø> (ø) ⬆️
test/tools/libtesteth/FillJsonFunctions.cpp 20.56% <ø> (ø) ⬆️
libethereum/Account.cpp 83.33% <100%> (ø) ⬆️
libethereum/Block.cpp 84.4% <100%> (ø) ⬆️
test/unittests/libethereum/StateUnitTests.cpp 94.11% <100%> (ø) ⬆️
libethereum/Executive.cpp 60.33% <100%> (ø) ⬆️
libethereum/State.cpp 73.14% <100%> (+0.16%) ⬆️
libethereum/State.h 95.12% <100%> (+0.83%) ⬆️
libethash/internal.c 71.51% <0%> (-12.03%) ⬇️
libethashseal/EthashAux.cpp 70.68% <0%> (-2.59%) ⬇️
... and 5 more

@pirapira
Copy link
Copy Markdown
Member Author

All green!

@pirapira pirapira merged commit 28f59c5 into develop Jun 20, 2017
@pirapira pirapira deleted the revert-bug-fix branch June 20, 2017 16:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants