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
8e69a7f6
Commit
8e69a7f6
authored
Jun 26, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: cleanup
parent
712d7919
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
main.go
op-chain-ops/cmd/check-l2/main.go
+13
-5
No files found.
op-chain-ops/cmd/check-l2/main.go
View file @
8e69a7f6
...
...
@@ -48,7 +48,9 @@ func main() {
log
.
Info
(
"Checking predeploy proxy config"
)
g
:=
new
(
errgroup
.
Group
)
// All admin slots should be set
// Check that all proxies are configured correctly
// Do this in parallel but not too quickly to allow for
// querying against rate limiting RPC backends
count
:=
uint64
(
2048
)
for
i
:=
uint64
(
0
);
i
<
count
;
i
++
{
i
:=
i
...
...
@@ -68,9 +70,9 @@ func main() {
}
log
.
Info
(
"All predeploy proxies are set correctly"
)
// Check that all of the
predeploy proxies are set
for
name
:=
range
predeploys
.
Predeploys
{
log
.
Info
(
"Checking predeploy"
,
"name"
,
name
)
// Check that all of the
defined predeploys are set up correctly
for
name
,
addr
:=
range
predeploys
.
Predeploys
{
log
.
Info
(
"Checking predeploy"
,
"name"
,
name
,
"address"
,
addr
.
Hex
()
)
if
err
:=
checkPredeployConfig
(
clients
.
L2Client
,
name
);
err
!=
nil
{
return
err
}
...
...
@@ -84,6 +86,7 @@ func main() {
}
}
// checkPredeployConfig checks that the defined predeploys are configured correctly
func
checkPredeployConfig
(
client
*
ethclient
.
Client
,
name
string
)
error
{
predeploy
:=
predeploys
.
Predeploys
[
name
]
if
predeploy
==
nil
{
...
...
@@ -93,11 +96,14 @@ func checkPredeployConfig(client *ethclient.Client, name string) error {
g
:=
new
(
errgroup
.
Group
)
if
predeploys
.
IsProxied
(
p
)
{
// Check that an implementation is set. If the implementation has been upgraded,
// it will be considered non-standard. Ensure that there is code set at the implementation.
g
.
Go
(
func
()
error
{
impl
,
err
:=
getEIP1967ImplementationAddress
(
client
,
p
)
if
err
!=
nil
{
return
err
}
log
.
Info
(
name
,
"implementation"
,
impl
.
Hex
())
standardImpl
,
err
:=
genesis
.
AddressToCodeNamespace
(
p
)
if
err
!=
nil
{
return
err
...
...
@@ -115,6 +121,7 @@ func checkPredeployConfig(client *ethclient.Client, name string) error {
return
nil
})
// Ensure that the code is set to the proxy bytecode as expected
g
.
Go
(
func
()
error
{
proxyCode
,
err
:=
client
.
CodeAt
(
context
.
Background
(),
p
,
nil
)
if
err
!=
nil
{
...
...
@@ -129,9 +136,9 @@ func checkPredeployConfig(client *ethclient.Client, name string) error {
}
return
nil
})
}
// Check the predeploy specific config is correct
g
.
Go
(
func
()
error
{
switch
p
{
case
predeploys
.
LegacyMessagePasserAddr
:
...
...
@@ -723,6 +730,7 @@ func getEIP1967ImplementationAddress(client *ethclient.Client, addr common.Addre
return
impl
,
nil
}
// checkPredeploy ensures that the predeploy at index i has the correct proxy admin set
func
checkPredeploy
(
client
*
ethclient
.
Client
,
i
uint64
)
error
{
bigAddr
:=
new
(
big
.
Int
)
.
Or
(
genesis
.
BigL2PredeployNamespace
,
new
(
big
.
Int
)
.
SetUint64
(
i
))
addr
:=
common
.
BigToAddress
(
bigAddr
)
...
...
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