Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
9ad7f593
Unverified
Commit
9ad7f593
authored
Jan 11, 2023
by
mergify[bot]
Committed by
GitHub
Jan 11, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4598 from ethereum-optimism/sc/ops-proxy-admin-owns-self
feat: make ProxyAdmin self-owned Proxy
parents
2706c9bf
ae83842b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
14 deletions
+15
-14
check.go
op-chain-ops/genesis/check.go
+6
-2
layer_two_test.go
op-chain-ops/genesis/layer_two_test.go
+2
-2
setters.go
op-chain-ops/genesis/setters.go
+3
-9
check-l2.ts
packages/contracts-bedrock/tasks/check-l2.ts
+3
-0
predeploys.md
specs/predeploys.md
+1
-1
No files found.
op-chain-ops/genesis/check.go
View file @
9ad7f593
...
...
@@ -55,7 +55,7 @@ var (
// Slot 0x00 (0) is a combination of spacer_0_0_20, _initialized, and _initializing
common
.
Hash
{}
:
common
.
HexToHash
(
"0x0000000000000000000000010000000000000000000000000000000000000000"
),
// Slot 0x33 (51) is _owner. Requires custom check, so set to a garbage value
L2XDMOwnerSlot
:
common
.
HexToHash
(
"0xbadbadbadbad
0xbadbadbadbadbadbadbadbad0xbadbadbadbad0x
badbadbad0"
),
L2XDMOwnerSlot
:
common
.
HexToHash
(
"0xbadbadbadbad
badbadbadbadbadbadbadbadbadbadbadbadbadbad
badbadbad0"
),
// Slot 0x97 (151) is _status
common
.
Hash
{
31
:
0x97
}
:
common
.
HexToHash
(
"0x0000000000000000000000000000000000000000000000000000000000000001"
),
// Slot 0xcc (204) is xDomainMsgSender
...
...
@@ -75,7 +75,11 @@ var (
// ProxyAdmin is not a proxy, and only has the _owner slot set.
predeploys
.
ProxyAdminAddr
:
{
// Slot 0x00 (0) is _owner. Requires custom check, so set to a garbage value
ProxyAdminOwnerSlot
:
common
.
HexToHash
(
"0xbadbadbadbad0xbadbadbadbadbadbadbadbad0xbadbadbadbad0xbadbadbad0"
),
ProxyAdminOwnerSlot
:
common
.
HexToHash
(
"0xbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbad0"
),
// EIP-1967 storage slots
AdminSlot
:
common
.
HexToHash
(
"0x0000000000000000000000004200000000000000000000000000000000000018"
),
ImplementationSlot
:
common
.
HexToHash
(
"0x000000000000000000000000c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d30018"
),
},
predeploys
.
BaseFeeVaultAddr
:
eip1967Slots
(
predeploys
.
BaseFeeVaultAddr
),
predeploys
.
L1FeeVaultAddr
:
eip1967Slots
(
predeploys
.
L1FeeVaultAddr
),
...
...
op-chain-ops/genesis/layer_two_test.go
View file @
9ad7f593
...
...
@@ -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
,
234
2
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
234
3
,
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
,
232
0
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
232
1
,
len
(
gen
.
Alloc
))
}
op-chain-ops/genesis/setters.go
View file @
9ad7f593
...
...
@@ -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
())
}
db
.
SetState
(
*
address
,
ImplementationSlot
,
codeAddr
.
Hash
())
if
err
:=
setupPredeploy
(
db
,
deployResults
,
storage
,
name
,
*
address
,
codeAddr
);
err
!=
nil
{
return
err
...
...
packages/contracts-bedrock/tasks/check-l2.ts
View file @
9ad7f593
...
...
@@ -577,6 +577,9 @@ const check = {
const
addressManager
=
await
ProxyAdmin
.
addressManager
()
console
.
log
(
` - addressManager:
${
addressManager
}
`
)
await
checkProxy
(
hre
,
'
ProxyAdmin
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
ProxyAdmin
'
,
signer
.
provider
)
},
// BaseFeeVault
// - check version
...
...
specs/predeploys.md
View file @
9ad7f593
...
...
@@ -254,7 +254,7 @@ maintaining L1 context in L2. This allows for L1 state to be accessed in L2.
Address:
`0x4200000000000000000000000000000000000018`
The
`ProxyAdmin`
is the owner of all of the proxy contracts set at the
predeploys. It is
not behind a proxy itself
. The owner of the
`ProxyAdmin`
will
predeploys. It is
itself behind a proxy
. The owner of the
`ProxyAdmin`
will
have the ability to upgrade any of the other predeploy contracts.
## SequencerFeeVault
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment