Optimistic Rollups: Chain migration - lukso-network/network-optimism-integration-test GitHub Wiki

In our opinion migration is possible but it's difficult. It will take some time to integrate (blockchain will stop for a moment or allow to produce empty blocks during migration/integration process).

Environment

  • We have fully working L1 testnet;
  • There are many transactions ongoing on network and many contracts deployed;
  • We decide to integrate with OVM L2 network from block #1000;
  • Block #999 is the latest block with EVM only;

Integration with Optimistic Rollups (L2 and OVM)

  • Optimistic rollup contracts must be deployed to L1 network (we must know contracts addresses);
  • Chain state migration (Image no. 2) must be done before runing Optimistic Rollup;
  • We must allow 0-999 chain to "integrate" with Optimistic Rollup (Image no. 1);

Patterns for Blockchain Migration

https://www.researchgate.net/profile/Dilum_Bandara/publication/333600904_Patterns_for_Blockchain_Migration/links/5d12dc14458515c11cf8953f/Patterns-for-Blockchain-Migration.pdf

Source: https://www.researchgate.net/

Pattern with snapshot:

First, decide on block numbers (time is not a good indicator due
to clock synchronization issues) to initiate the migration and to freeze
all TXs. Second, inform all instances of the BAL or BC nodes when to
freeze sufficiently in advance. Third, when the block number to initiate
migration is reached, extract all relevant accounts and their states/SCs.
If only the application-specific data is migrated, relevant accounts can
be found from the IDs DB. Fourth, recreate the collected states/SCs on
the target BC using related migration patterns. Fifth, when the block
number to freeze TXs is reached, stop processing all TXs related to the
application (or all TXs if entire BC to be migrated). Then wait till the
time for finality (also specified as a block number). Sixth, go through all
the blocks generated after the block number that initiated the migration
while extracting the states/SCs that got updated, their accounts, and 9
related TXs. Finally, recreate the updated states/SCs on the target BC
either by initializing them or replaying new TXs. Optionally add a PoE
entry to either source (if not decommissioned after migration) or target
BC to indicate the block number and hash of the snapshot data using the
off-chain data storage pattern.