Commit d951af83 authored by Kelvin Fichter's avatar Kelvin Fichter

feat: make ProxyAdmin self-owned Proxy

Turns the ProxyAdmin into a Proxy that owns itself. Result of this is
that we can treat the ProxyAdmin as a Proxy which reduces some
complexity in the migration. We can then also upgrade the ProxyAdmin on
L2.
parent 9a2ffd11
......@@ -65,7 +65,7 @@ func TestBuildL2DeveloperGenesis(t *testing.T) {
require.Equal(t, adminSlot, predeploys.ProxyAdminAddr.Hash())
require.Equal(t, account.Code, depB)
}
require.Equal(t, 2342, len(gen.Alloc))
require.Equal(t, 2343, len(gen.Alloc))
if writeFile {
file, _ := json.MarshalIndent(gen, "", " ")
......@@ -92,5 +92,5 @@ func TestBuildL2DeveloperGenesisDevAccountsFunding(t *testing.T) {
gen, err := genesis.BuildL2DeveloperGenesis(config, block)
require.NoError(t, err)
require.Equal(t, 2320, len(gen.Alloc))
require.Equal(t, 2321, len(gen.Alloc))
}
......@@ -108,7 +108,7 @@ func setProxies(db vm.StateDB, proxyAdminAddr common.Address, namespace *big.Int
bigAddr := new(big.Int).Or(namespace, new(big.Int).SetUint64(i))
addr := common.BigToAddress(bigAddr)
if UntouchablePredeploys[addr] || addr == predeploys.ProxyAdminAddr {
if UntouchablePredeploys[addr] {
log.Info("Skipping setting proxy", "address", addr)
continue
}
......@@ -121,6 +121,7 @@ func setProxies(db vm.StateDB, proxyAdminAddr common.Address, namespace *big.Int
db.SetState(addr, AdminSlot, proxyAdminAddr.Hash())
log.Trace("Set proxy", "address", addr, "admin", proxyAdminAddr)
}
return nil
}
......@@ -156,18 +157,11 @@ func SetImplementations(db vm.StateDB, storage state.StorageConfig, immutable im
return fmt.Errorf("error converting to code namespace: %w", err)
}
// Proxy admin is a special case - it needs an impl set, but at its own address
if *address == predeploys.ProxyAdminAddr {
codeAddr = *address
}
if !db.Exist(codeAddr) {
db.CreateAccount(codeAddr)
}
if *address != predeploys.ProxyAdminAddr {
db.SetState(*address, ImplementationSlot, codeAddr.Hash())
}
if err := setupPredeploy(db, deployResults, storage, name, *address, codeAddr); err != nil {
return err
......@@ -178,6 +172,7 @@ func SetImplementations(db vm.StateDB, storage state.StorageConfig, immutable im
return fmt.Errorf("code not set for %s", name)
}
}
return nil
}
......
......@@ -577,6 +577,9 @@ const check = {
const addressManager = await ProxyAdmin.addressManager()
console.log(` - addressManager: ${addressManager}`)
await checkProxy(hre, 'ProxyAdmin')
await assertProxy(hre, 'ProxyAdmin')
},
// BaseFeeVault
// - check version
......
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