Commit c4ef0d1b authored by Mark Tyneway's avatar Mark Tyneway

op-chain-ops: address feedback

parent 499925b7
...@@ -17,8 +17,8 @@ var ( ...@@ -17,8 +17,8 @@ var (
errLegacyStorageSlotNotFound = errors.New("cannot find storage slot") errLegacyStorageSlotNotFound = errors.New("cannot find storage slot")
) )
// This takes a state db and a list of withdrawals // MigrateWithdrawals will migrate a list of pending withdrawals given a StateDB.
func MigrateWithdrawals(withdrawals []*PendingWithdrawal, db vm.StateDB) error { func MigrateWithdrawals(withdrawals []*PendingWithdrawal, db vm.StateDB, l1CrossDomainMessenger, l1StandardBridge *common.Address) error {
for _, legacy := range withdrawals { for _, legacy := range withdrawals {
legacySlot, err := legacy.StorageSlot() legacySlot, err := legacy.StorageSlot()
if err != nil { if err != nil {
...@@ -30,8 +30,7 @@ func MigrateWithdrawals(withdrawals []*PendingWithdrawal, db vm.StateDB) error { ...@@ -30,8 +30,7 @@ func MigrateWithdrawals(withdrawals []*PendingWithdrawal, db vm.StateDB) error {
return fmt.Errorf("%w: %s", errLegacyStorageSlotNotFound, legacyValue) return fmt.Errorf("%w: %s", errLegacyStorageSlotNotFound, legacyValue)
} }
// TODO: pass in args withdrawal, err := MigrateWithdrawal(&legacy.LegacyWithdrawal, l1CrossDomainMessenger, l1StandardBridge)
withdrawal, err := MigrateWithdrawal(&legacy.LegacyWithdrawal, &common.Address{}, &common.Address{})
if err != nil { if err != nil {
return err return err
} }
...@@ -52,6 +51,11 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger, l1S ...@@ -52,6 +51,11 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger, l1S
value := new(big.Int) value := new(big.Int)
isFromL2StandardBridge := *withdrawal.Sender == predeploys.L2StandardBridgeAddr isFromL2StandardBridge := *withdrawal.Sender == predeploys.L2StandardBridgeAddr
if withdrawal.Target == nil {
return nil, errors.New("withdrawal target cannot be nil")
}
isToL1StandardBridge := *withdrawal.Target == *l1StandardBridge isToL1StandardBridge := *withdrawal.Target == *l1StandardBridge
if isFromL2StandardBridge && isToL1StandardBridge { if isFromL2StandardBridge && isToL1StandardBridge {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment