Remove ReadOnlyStateDB, rely on StaticCall #200
Closed
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.
I has been stated that StaticCall can do modifications to the state in multiple places in the geth code base. Therefore, we first did a copy of the state to avoid changes and later switched to used the ReadOnlyStateDB to achieve the same result with better performance.
Upon closer examination, the only state change that StaticCall actually does is "touching" the called address, which only makes a difference on legacy Ethereum chains, but not on Celo chains. So we can skip the ReadOnlyStateDB and rely on StaticCall to ensure that no changes to the state are done.
The read-only-guarantee is less obvious with StaticCall, but considering the problems brought up in
https://github.com/celo-org/celo-blockchain-planning/issues/355, the reduction in code size and the full support for all read-only operations, this looks like a clear improvement.
With the removal of ReadOnlyStateDB, further testing of it is pointless: Closes https://github.com/celo-org/celo-blockchain-planning/issues/355