This repository was archived by the owner on Oct 28, 2021. It is now read-only.
Merged
Conversation
chfast
suggested changes
Jun 19, 2017
libethereum/State.cpp
Outdated
| break; | ||
| case Change::NewCode: | ||
| account.resetCode(); | ||
| if (change.oldCode.empty()) |
Member
There was a problem hiding this comment.
Here I would go with account.setNewCode(std::move(change.oldCode)); all the time. Moving empty bytes is not more costly than reset.
chfast
approved these changes
Jun 19, 2017
libethereum/State.cpp
Outdated
| account.resetCode(); | ||
| else | ||
| account.setNewCode(std::move(change.oldCode)); | ||
| account.setNewCode(std::move(change.oldCode)); |
Member
There was a problem hiding this comment.
Hm... after these changes it looks we should also rename .setNewCode() to just .setCode().
Member
Author
There was a problem hiding this comment.
That's true. I'll add a commit to this PR.
pirapira
added a commit
that referenced
this pull request
Jun 20, 2017
Member
|
The best! |
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 Report
@@ 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
|
Member
Author
|
All green! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.