Commit 7078046b authored by Matthew Slipper's avatar Matthew Slipper

support different proxy admin

parent b6839a26
...@@ -205,6 +205,7 @@ func main() { ...@@ -205,6 +205,7 @@ func main() {
&config.L1CrossDomainMessengerProxy, &config.L1CrossDomainMessengerProxy,
config.L1ChainID, config.L1ChainID,
config.FinalSystemOwner, config.FinalSystemOwner,
config.ProxyAdminOwner,
&derive.L1BlockInfo{ &derive.L1BlockInfo{
Number: block.NumberU64(), Number: block.NumberU64(),
Time: block.Time(), Time: block.Time(),
......
...@@ -93,6 +93,7 @@ func PostCheckMigratedDB( ...@@ -93,6 +93,7 @@ func PostCheckMigratedDB(
l1XDM *common.Address, l1XDM *common.Address,
l1ChainID uint64, l1ChainID uint64,
finalSystemOwner common.Address, finalSystemOwner common.Address,
proxyAdminOwner common.Address,
info *derive.L1BlockInfo, info *derive.L1BlockInfo,
) error { ) error {
log.Info("Validating database migration") log.Info("Validating database migration")
...@@ -123,7 +124,7 @@ func PostCheckMigratedDB( ...@@ -123,7 +124,7 @@ func PostCheckMigratedDB(
return fmt.Errorf("cannot open StateDB: %w", err) return fmt.Errorf("cannot open StateDB: %w", err)
} }
if err := PostCheckPredeployStorage(db, finalSystemOwner); err != nil { if err := PostCheckPredeployStorage(db, finalSystemOwner, proxyAdminOwner); err != nil {
return err return err
} }
log.Info("checked predeploy storage") log.Info("checked predeploy storage")
...@@ -276,7 +277,7 @@ func PostCheckPredeploys(db *state.StateDB) error { ...@@ -276,7 +277,7 @@ func PostCheckPredeploys(db *state.StateDB) error {
// PostCheckPredeployStorage will ensure that the predeploys had their storage // PostCheckPredeployStorage will ensure that the predeploys had their storage
// wiped correctly. // wiped correctly.
func PostCheckPredeployStorage(db vm.StateDB, finalSystemOwner common.Address) error { func PostCheckPredeployStorage(db vm.StateDB, finalSystemOwner common.Address, proxyAdminOwner common.Address) error {
for name, addr := range predeploys.Predeploys { for name, addr := range predeploys.Predeploys {
if addr == nil { if addr == nil {
return fmt.Errorf("nil address in predeploys mapping for %s", name) return fmt.Errorf("nil address in predeploys mapping for %s", name)
...@@ -313,7 +314,7 @@ func PostCheckPredeployStorage(db vm.StateDB, finalSystemOwner common.Address) e ...@@ -313,7 +314,7 @@ func PostCheckPredeployStorage(db vm.StateDB, finalSystemOwner common.Address) e
for key, value := range expSlots { for key, value := range expSlots {
// The owner slots for the L2XDM and ProxyAdmin are special cases. // The owner slots for the L2XDM and ProxyAdmin are special cases.
// They are set to the final system owner in the config. // They are set to the final system owner in the config.
if (*addr == predeploys.L2CrossDomainMessengerAddr && key == L2XDMOwnerSlot) || (*addr == predeploys.ProxyAdminAddr && key == ProxyAdminOwnerSlot) { if *addr == predeploys.L2CrossDomainMessengerAddr && key == L2XDMOwnerSlot {
actualOwner := common.BytesToAddress(slots[key].Bytes()) actualOwner := common.BytesToAddress(slots[key].Bytes())
if actualOwner != finalSystemOwner { if actualOwner != finalSystemOwner {
return fmt.Errorf("expected owner for %s to be %s but got %s", name, finalSystemOwner, actualOwner) return fmt.Errorf("expected owner for %s to be %s but got %s", name, finalSystemOwner, actualOwner)
...@@ -322,6 +323,15 @@ func PostCheckPredeployStorage(db vm.StateDB, finalSystemOwner common.Address) e ...@@ -322,6 +323,15 @@ func PostCheckPredeployStorage(db vm.StateDB, finalSystemOwner common.Address) e
continue continue
} }
if *addr == predeploys.ProxyAdminAddr && key == ProxyAdminOwnerSlot {
actualOwner := common.BytesToAddress(slots[key].Bytes())
if actualOwner != proxyAdminOwner {
return fmt.Errorf("expected owner for %s to be %s but got %s", name, finalSystemOwner, actualOwner)
}
log.Debug("validated special case owner slot", "value", actualOwner, "name", name)
continue
}
if slots[key] != value { if slots[key] != value {
log.Debug("validated storage value", "key", key.String(), "value", value.String()) log.Debug("validated storage value", "key", key.String(), "value", value.String())
return fmt.Errorf("expected storage slot %s to be %s but got %s", key, value, slots[key]) return fmt.Errorf("expected storage slot %s to be %s but got %s", key, value, slots[key])
......
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