-
Matthew Slipper authored
* op-chain-ops: Fix state migration, add post-checks This PR fixes a bug in `op-chain-ops` that could cause state to become erroneously erased during the L2 migration. While testing the Goerli migration in check mode, I encountered an issue where `db.GetState` was returning null storage slots for the legacy message passer during the withdrawals portion of the migration. Upon further inspection, I discovered that we were using `db.CreateAccount` in the `setProxies` method. `db.CreateAccount` will erase the state associated with the passed-in address, so I updated `setProxies` to check if the account exists first. I also added a map of predeploys that should _not_ be touched as part of the migration process at all. At the end of the migration process, I iterate over these "untouchable" contracts and make sure that their code matches a preset list of code hashes and sample up to 5,000 storage slots before and after the migration to make sure the match. Additionally, I found a bug in the witness generation data within `l2geth`. The witness generation code for the message passer does not take reverts into account. There's no easy way to do this, since we don't have access to the call frame in which the revert occurred. To work around this, I added the ability to ignore reverted storage slots in the `ParamsByChainId` structure. Lastly, I made a few miscellaneous changes to improve our confidence in the migration script: - I added checks to the OVM ETH migration to ensure that state slots are properly preserved. - I added a read cache to the underlying state DB so that repeated read calls are faster. I have verified that this migration script works end-to-end with check mode enabled against a forked Goerli L1. * Add hash checking in addition to sampling
a1ced6ad