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

Efficient reverts clean dirty state cache #102

Merged

Conversation

dvush
Copy link
Contributor

@dvush dvush commented Aug 21, 2023

📝 Summary

Fixes bug in efficient reverts branch.

There is a bad interaction between our multi tx snapshot and journal that is used to revert changes for internal calls. That was happening because accounts that were changed and then reverted according to journal were not considered "dirty" when finalizing so their dirty state was not cleaned.

Later this state would be used for state root calculation when finalized for each object is called too.

This adds a unit test that was failing before these changes were introduced.


@dvush dvush requested a review from Wazzymandias August 21, 2023 09:22
Copy link
Contributor

@Wazzymandias Wazzymandias left a comment

Choose a reason for hiding this comment

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

🔥

@Wazzymandias Wazzymandias merged commit 0259e06 into efficient-reverts Aug 21, 2023
@Wazzymandias Wazzymandias deleted the effircient-reverts-clean-dirty-state-cache branch August 21, 2023 19:23
@Wazzymandias Wazzymandias restored the effircient-reverts-clean-dirty-state-cache branch August 21, 2023 19:23
avalonche pushed a commit that referenced this pull request Aug 24, 2023
* fix issue with geth not shutting down (#97)
* Add eth_callBundle rpc method (#14)
* flashbots: add eth_estimateGasBundle (#102)
* feat(ethash): flashbots_getWork RPC with profit (#106)
* Calculate megabundle as soon as it's received (#112)
* Add v0.5 specification link (#118)
Wazzymandias added a commit that referenced this pull request Sep 27, 2023
* Initial commit for efficient revert experimentation

* Add additional unit tests and fix unit test errors, reduce duplicate code, add support for sbundles, expose CLI flag and environment variable to enable multi-tx-snapshots

* Update godoc, remove unused getter for access list, add CLI flag to builder flag list, update log level for multi-tx-snap error

* Add retry logic for multi-tx-snapshot block build algorithm

* Update unit tests to test EnableMultiTxSnap

* Change account touch tracer to access list tracer for env changes

* Update greedy builder to use passed in algorithm configuration rather than default

* Add new multi-transaction snapshot stack to support more than one active snapshot, useful for cases like nested bundle applying and rollback, optional bundle discard, and bundle merging

* Clean up code, add comprehensive stack tests with fuzzing, fix edge cases where merge operation for stack commit was not properly updated

* Add refund support to efficient revert so state returns to correct refund value on discard

Address PR feedback, separate block build function initializing to de-dupe logic, split types into separate definitions

Add panic if copy is performed with non-empty stack of snapshots

Update env changes method name

Fix unit test and update log to trace

Remove refund in case it causes bad state

* Add unit tests for state comparison, potential fix for gas and root mismatch through snapshot revert and removal of tx rollback

* Debug commit

* DRY profit logic

* Revert commit

This rolls back to commit before fc32a84.


* Add fuzz state using state smart contract, add Copy method for multi-tx, pass gas limit for test setup, add abigen bindings and abi for compiled state fuzz test smart contract

* fix a bug with state reverts of accounts that are not touched according to the journal (#102)

* Simplify test

* Use different builders instead of configuration switch since major refactor required to handle more dynamic configurations.

* Update env changes to reduce redundancy and make control flow easier to follow

* Remove debug validation

* Update comments, add touch change to state fuzz test smart contract

* Add fuzz tests for transient storage and account touch operations

* Remove unused code

---------

Co-authored-by: Vitaly Drogan <vitaliy.drogan@gmail.com>
vazha pushed a commit to vazha/builder that referenced this pull request Feb 2, 2024
* fix issue with geth not shutting down (flashbots#97)
* Add eth_callBundle rpc method (flashbots#14)
* flashbots: add eth_estimateGasBundle (flashbots#102)
* feat(ethash): flashbots_getWork RPC with profit (flashbots#106)
* Calculate megabundle as soon as it's received (flashbots#112)
* Add v0.5 specification link (flashbots#118)
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.

2 participants