• Mark Tyneway's avatar
    contracts-bedrock: in place handling of immutables · a32e68ac
    Mark Tyneway authored
    This updates the hardhat task `genesis-l2` to handle
    setting the immutables in the deployed bytecode. This
    is necessary because the predeploys "live" in the L2
    state and are not deployed. Any immutables must be manually
    placed into the bytecode by looking at the compiler output
    and then finding the offsets and slicing in the values.
    
    A high level API is exposed for setting arbitrary immutables
    with the `replaceImmutables` function. This was inspired by
    smock's `computeStorageSlots`.
    
    Longer term, this code will be rewritten in go and be able to
    operate on either a LevelDB database (upgrade an existing system)
    or a `genesis.json` (good for starting a new network). This is
    a requirement because the state surgery is large enough such that
    it must bind directly to LevelDB and be in a language that is
    relatively fast.
    a32e68ac
cool-items-smell.md 107 Bytes