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
7078046b
Commit
7078046b
authored
Jan 12, 2023
by
Matthew Slipper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support different proxy admin
parent
b6839a26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
main.go
op-chain-ops/cmd/op-migrate/main.go
+1
-0
check.go
op-chain-ops/genesis/check.go
+13
-3
No files found.
op-chain-ops/cmd/op-migrate/main.go
View file @
7078046b
...
@@ -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
(),
...
...
op-chain-ops/genesis/check.go
View file @
7078046b
...
@@ -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
])
...
...
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