ethereum-optimism/superchain-registry

Add `remove-chain` and `clean-bytecodes` commands

Opened this issue · 2 comments

I realise that removing a chain may actually be not that straightforward for the following reason: all chains share a common database of deduplicated bytecodes.

So if, for arguments sake, we added to that database when we inserted chain A, and then inserted another chain B which had some of the same bytecode, removing chain A by reverting the insertion PR could break the other chain's genesis data so it could no longer be loaded.

I propose we solve this by:

  • writing a little script clean-bytecodes that cleans up the bytecodes folder by removing unnecessary data. We can even run this in CI to detect dirty bytecodes.
  • provide a CLI tool remove-chain which deletes all known named files and then runs the clean-bytecodes script.

I think in the short term it is not a big deal, if we remove a chain we can just make sure to not touch the bytecodes database. Then, when we address the ticket and can clean the bytecodes database safely, we do some tidy up.

#366 added a remove-chain command.