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
7c4c6c22
Unverified
Commit
7c4c6c22
authored
May 29, 2023
by
OptimismBot
Committed by
GitHub
May 29, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5809 from ethereum-optimism/fix/check-l2-mainnet
contracts-bedrock: make check-l2 script faster
parents
5a24e0a4
61f072b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
check-l2.ts
packages/contracts-bedrock/tasks/check-l2.ts
+21
-5
No files found.
packages/contracts-bedrock/tasks/check-l2.ts
View file @
7c4c6c22
...
...
@@ -38,10 +38,15 @@ const checkPredeploys = async (
predeploys
.
ProxyAdmin
,
])
// We only check predeploys 0x420..00 through 0x420..FF on the mainnet network to
// reduce the probability of an RPC timeout. After the migration, all predeploys
// from 0x420..00 through 0x420..07FF should be checked.
const
maxCheck
=
hre
.
network
.
name
===
'
mainnet
'
?
256
:
2048
const
codeReq
=
[]
const
slotReq
=
[]
// First loop for requests
for
(
let
i
=
0
;
i
<
2048
;
i
++
)
{
for
(
let
i
=
0
;
i
<
maxCheck
;
i
++
)
{
const
num
=
hre
.
ethers
.
utils
.
hexZeroPad
(
'
0x
'
+
i
.
toString
(
16
),
2
)
const
addr
=
hre
.
ethers
.
utils
.
getAddress
(
hre
.
ethers
.
utils
.
hexConcat
([
prefix
,
num
])
...
...
@@ -57,7 +62,7 @@ const checkPredeploys = async (
const
slotRes
=
await
Promise
.
all
(
slotReq
)
// Second loop for response checks
for
(
let
i
=
0
;
i
<
2048
;
i
++
)
{
for
(
let
i
=
0
;
i
<
maxCheck
;
i
++
)
{
const
num
=
hre
.
ethers
.
utils
.
hexZeroPad
(
'
0x
'
+
i
.
toString
(
16
),
2
)
const
addr
=
hre
.
ethers
.
utils
.
getAddress
(
hre
.
ethers
.
utils
.
hexConcat
([
prefix
,
num
])
...
...
@@ -79,7 +84,7 @@ const checkPredeploys = async (
throw
new
Error
(
`incorrect admin slot in
${
addr
}
`
)
}
if
(
i
%
200
===
0
)
{
if
(
i
%
(
maxCheck
/
4
)
===
0
)
{
console
.
log
(
`Checked through
${
addr
}
`
)
}
}
...
...
@@ -186,7 +191,16 @@ const checkGenesisMagic = async (
const
L2OutputOracle
=
new
hre
.
ethers
.
Contract
(
address
,
[
abi
],
l1Provider
)
startingBlockNumber
=
await
L2OutputOracle
.
startingBlockNumber
()
// In the migration, the L2OutputOracle proxy is not yet initialized when we
// want to run this script. Fall back on the local config if we get an error
// fetching the starting block number.
try
{
startingBlockNumber
=
await
L2OutputOracle
.
startingBlockNumber
()
}
catch
(
e
)
{
console
.
log
(
`Error fetching startingBlockNumber:\n
${
e
.
message
}
`
)
console
.
log
(
'
Falling back to local config.
'
)
startingBlockNumber
=
hre
.
deployConfig
.
l2OutputOracleStartingBlockNumber
}
}
else
{
// We do not have a connection to the L1 chain, use the local config
// The `--network` flag must be set to the L1 network
...
...
@@ -200,7 +214,9 @@ const checkGenesisMagic = async (
const
extradata
=
block
.
extraData
if
(
extradata
!==
magic
)
{
throw
new
Error
(
'
magic value in extradata does not match
'
)
throw
new
Error
(
`magic value in extradata does not match: got
${
extradata
}
, expected
${
magic
}
`
)
}
}
...
...
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