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

core, core/state: fixed consensus issue added touch revert #3341

Merged
merged 2 commits into from
Nov 24, 2016

Conversation

obscuren
Copy link
Contributor

No description provided.

@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.

@@ -232,6 +232,12 @@ func (c *StateObject) AddBalance(amount *big.Int) {
// EIP158: We must check emptiness for the objects such that the account
// clearing (0,0,0 objects) can take effect.
if amount.Cmp(common.Big0) == 0 && !c.empty() {
if c.empty() {
Copy link
Member

Choose a reason for hiding this comment

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

this can never be true, since the line above it is true

@obscuren obscuren force-pushed the touch-delete-fix branch 3 times, most recently from 7b414d5 to 325a359 Compare November 24, 2016 16:57
@GitCop
Copy link

GitCop commented Nov 24, 2016

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 1e36facf41899c2fa1631011170794e7aab13688
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

GitCop commented Nov 24, 2016

Thank you for your contribution! Your commits seem to not adhere to the repository coding standards

  • Commit: 8c28caa7ec3659756a7f96a2096c48ea2f0b235c
  • Commits must be prefixed with the package(s) they modify

Please check the contribution guidelines for more details.


This message was auto-generated by https://gitcop.com

@obscuren obscuren force-pushed the touch-delete-fix branch 2 times, most recently from 28dc41f to 8e8cc02 Compare November 24, 2016 21:01
Implemented proper touch revert journal entries and copied a Parity
consensus bug in order to remain in sync with the current longest chain.
@fjl fjl changed the title core, core/state: fixes core, core/state: fixed consensus issue added touch revert Nov 24, 2016
Copy link
Contributor

@fjl fjl left a comment

Choose a reason for hiding this comment

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

👍

var ripemd = common.HexToAddress("0000000000000000000000000000000000000003")

func (ch touchChange) undo(s *StateDB) {
if !ch.prev && *ch.account != ripemd {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this depend on ripemd?

Copy link
Member

@karalabe karalabe Nov 24, 2016

Choose a reason for hiding this comment

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

Parity has a bad implementation of EIP 161. That caused account 0000000000000000000000000000000000000003 to be deleted in block 2675119, even though the deletion should have been reverted due to an out of gas error. Geth didn't handle revertals at all (hence today's bug), but because of this, there wasn't a consensus failure 2 days ago. To avoid rewinding the chain, we added this special case for the Parity bug.

Copy link
Contributor

@holiman holiman Nov 24, 2016

Choose a reason for hiding this comment

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

Good question. If I have this right... :

The 00...003 was one of the accounts touched by the attacker, and also by the statesweep. When it was touched by the statesweep, the actual 'touch', in the form of a CALL, went OOG.

This was at block 2675119 , at this tx. When the geth-bug causing the consensus failure today was fixed initially, it was discovered that the Parity implementation was also flawed; the OOG actually did not revert the deletion of 0..3 (ripemd). So the original fix resulted in consensus fail at 2675119 instead.

TLDR; geth failed to revert on OOG-transactions, and Parity failed to revert OOG sub-calls, basically. And the fix above is a hack to sync up with parity.

@fjl fjl merged commit fa0e057 into ethereum:master Nov 24, 2016
@obscuren obscuren deleted the touch-delete-fix branch November 24, 2016 22:09
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Apr 11, 2017
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Apr 11, 2017
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Apr 12, 2017
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Apr 28, 2017
pirapira added a commit to pirapira/yellowpaper that referenced this pull request Jan 19, 2018
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.

None yet

7 participants