Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions op-chain-ops/crossdomain/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func MigrateWithdrawals(withdrawals []*LegacyWithdrawal, db vm.StateDB, l1CrossD

legacyValue := db.GetState(predeploys.LegacyMessagePasserAddr, legacySlot)
if legacyValue != abiTrue {
return fmt.Errorf("%w: %s", errLegacyStorageSlotNotFound, legacyValue)
return fmt.Errorf("%w: %s", errLegacyStorageSlotNotFound, legacySlot)
}

withdrawal, err := MigrateWithdrawal(legacy, l1CrossDomainMessenger, l1StandardBridge)
Expand All @@ -37,7 +37,7 @@ func MigrateWithdrawals(withdrawals []*LegacyWithdrawal, db vm.StateDB, l1CrossD

slot, err := withdrawal.StorageSlot()
if err != nil {
return err
return fmt.Errorf("cannot compute withdrawal storage slot: %w", err)
}

db.SetState(predeploys.L2ToL1MessagePasserAddr, slot, abiTrue)
Expand Down
20 changes: 10 additions & 10 deletions op-chain-ops/genesis/db_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,46 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, l

db, err := state.New(header.Root, state.NewDatabase(ldb), nil)
if err != nil {
return err
return fmt.Errorf("cannot open StateDB: %w", err)
}

// Convert all of the messages into legacy withdrawals
withdrawals, err := migrationData.ToWithdrawals()
if err != nil {
return err
return fmt.Errorf("cannot serialize withdrawals: %w", err)
}

if err := CheckWithdrawals(db, withdrawals); err != nil {
return err
return fmt.Errorf("withdrawals mismatch: %w", err)
}

// Now start the migration
if err := SetL2Proxies(db); err != nil {
return err
return fmt.Errorf("cannot set L2Proxies: %w", err)
}

storage, err := NewL2StorageConfig(config, l1Block, l2Addrs)
if err != nil {
return err
return fmt.Errorf("cannot create storage config: %w", err)
}

immutable, err := NewL2ImmutableConfig(config, l1Block, l2Addrs)
if err != nil {
return err
return fmt.Errorf("cannot create immutable config: %w", err)
}

if err := SetImplementations(db, storage, immutable); err != nil {
return err
return fmt.Errorf("cannot set implementations: %w", err)
}

err = crossdomain.MigrateWithdrawals(withdrawals, db, &l2Addrs.L1CrossDomainMessengerProxy, &l2Addrs.L1StandardBridgeProxy)
if err != nil {
return err
return fmt.Errorf("cannot migrate withdrawals: %w", err)
}

addrs := migrationData.Addresses()
if err := ether.MigrateLegacyETH(ldb, addrs, migrationData.OvmAllowances, int(config.L1ChainID)); err != nil {
return err
return fmt.Errorf("cannot migrate legacy eth: %w", err)
}

if !commit {
Expand All @@ -75,7 +75,7 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, l

root, err := db.Commit(true)
if err != nil {
return err
return fmt.Errorf("cannot commit state db: %w", err)
}

// Create the bedrock transition block
Expand Down