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

Reset code to empty in rollback #5641

Merged
merged 3 commits into from
Jun 27, 2019
Merged

Reset code to empty in rollback #5641

merged 3 commits into from
Jun 27, 2019

Conversation

gumb0
Copy link
Member

@gumb0 gumb0 commented Jun 26, 2019

I think we don't need to save the old code for rollback anymore, because overwriting the code is not allowed according to address collision rules (ethereum/EIPs#684 and https://eips.ethereum.org/EIPS/eip-689) and we never get to rolling back the overwritten code.

A bit of history of this code:
It was written as a fix of incorrect rollback of code overwrite in case of address collision (back then it was possible to overwrite the code)
#4130
#4151

Then in preparation for Byzantium new collision rules were introduced, which applied retroactively to all previous forks, too.
#4384

To quote EIP-689:

Regarding testing, this EIP relieves clients from supporting reversion of code overwriting.

This will simplify a little bit the implementation of EIP-1702 Generalized Account Versioning Scheme, because if we don't need to save the old code in journal, then we don't need to save the version either.

@codecov-io
Copy link

codecov-io commented Jun 26, 2019

Codecov Report

Merging #5641 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5641      +/-   ##
==========================================
+ Coverage   62.74%   62.76%   +0.01%     
==========================================
  Files         348      348              
  Lines       29670    29682      +12     
  Branches     3343     3343              
==========================================
+ Hits        18617    18629      +12     
- Misses       9841     9842       +1     
+ Partials     1212     1211       -1

…code.

Because it's not allowed to overwrite code now.
@chfast
Copy link
Member

chfast commented Jun 27, 2019

Why is the EIP-689 still a draft?

@gumb0
Copy link
Member Author

gumb0 commented Jun 27, 2019

@chfast Probably no one cared to accept it yet. There was some discussion recently on All Core Devs call, where @holiman mentioned that it's already implemented, see discussion of "Action 60.6" in https://github.com/ethereum/pm/blob/master/All%20Core%20Devs%20Meetings/Meeting%2061.md

@gumb0 gumb0 merged commit be6ce38 into master Jun 27, 2019
@gumb0 gumb0 deleted the rollback-empty-code branch June 27, 2019 12:57
@halfalicious
Copy link
Contributor

@gumb0 : When would we need to rollback to old code before EIP-689? When there's a chain reorg?

@gumb0
Copy link
Member Author

gumb0 commented Jul 9, 2019

@halfalicious No, rollback happens any time after exception during transaction execution (for example Out-of-gas or invalid instruction)

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.

None yet

4 participants