Geth-Dumper is a special purpose geth state dumper that performs several unique tasks to generate an initial OVM state with specific contract addresses. It does the following:
- Deploys some initcode to a blank state
- Creates a state dump
- Replaces all instances of the initial contract addresses with some hardcoded addresses
- Prints out the state dump
This tool is used for generating the initial OVM state (with an ExecutionManager & StateManager, etc) at specific addresses.
Tested with go version go1.14.3 darwin/amd64.
If you want to replace state dump input txs, you'll need to generate a new deployment-tx-data.json
file. Do this when you make changes to the ExecutionManager and you'd like them reflected in the initial OVM state.
To generate a new deployment-tx-data.json file, follow these steps:
- Find the Geth Input Dump test file here.
- Change
.skip
to.only
in the test file to run the test and generate adeployment-tx-data.json
file. - Copy the
deployment-tx-data.json
file into the root directory of this project.
To generate a state dump, follow these steps:
- Install Geth-Dumper with
go install
. - Run Geth-Dumper with
go run main.go
. - The tool will print out a lot of information.
- Copy the dump hex from the output and paste it into
ovm_constants.go
in the L2Geth project. - The state dump is also saved in
state-dump.hex
(in hex format) andstate-dump.json
(in JSON string format) for your reference.
You can ingest either the JSON version of the state dump or the hexified version of the state dump, depending on your preference.
I'm actively working on making this process cleaner and more automated. Apologize for any inconvenience caused by the current tooling. Stay tuned for updates! Thank you for your understanding. Let's make the state dumping process even more beautiful! 🌟🚀😊