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
0aa7e8c0
Unverified
Commit
0aa7e8c0
authored
May 01, 2023
by
Maurelian
Committed by
GitHub
May 01, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5571 from ethereum-optimism/clabby/check-l2-optimizations
parents
a8605769
dff9f6b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
check-l2.ts
packages/contracts-bedrock/tasks/check-l2.ts
+29
-10
No files found.
packages/contracts-bedrock/tasks/check-l2.ts
View file @
0aa7e8c0
...
...
@@ -33,14 +33,37 @@ const checkPredeploys = async (
provider
:
providers
.
Provider
)
=>
{
console
.
log
(
'
Checking predeploys are configured correctly
'
)
const
admin
=
hre
.
ethers
.
utils
.
hexConcat
([
'
0x000000000000000000000000
'
,
predeploys
.
ProxyAdmin
,
])
const
codeReq
=
[]
const
slotReq
=
[]
// First loop for requests
for
(
let
i
=
0
;
i
<
2048
;
i
++
)
{
const
num
=
hre
.
ethers
.
utils
.
hexZeroPad
(
'
0x
'
+
i
.
toString
(
16
),
2
)
const
addr
=
hre
.
ethers
.
utils
.
getAddress
(
hre
.
ethers
.
utils
.
hexConcat
([
prefix
,
num
])
)
const
code
=
await
provider
.
getCode
(
addr
)
if
(
code
===
'
0x
'
)
{
codeReq
.
push
(
provider
.
getCode
(
addr
))
slotReq
.
push
(
provider
.
getStorageAt
(
addr
,
adminSlot
))
}
// Wait for all requests to finish
// The `JsonRpcBatchProvider` will batch requests in the background.
const
codeRes
=
await
Promise
.
all
(
codeReq
)
const
slotRes
=
await
Promise
.
all
(
slotReq
)
// Second loop for response checks
for
(
let
i
=
0
;
i
<
2048
;
i
++
)
{
const
num
=
hre
.
ethers
.
utils
.
hexZeroPad
(
'
0x
'
+
i
.
toString
(
16
),
2
)
const
addr
=
hre
.
ethers
.
utils
.
getAddress
(
hre
.
ethers
.
utils
.
hexConcat
([
prefix
,
num
])
)
if
(
codeRes
[
i
]
===
'
0x
'
)
{
throw
new
Error
(
`no code found at
${
addr
}
`
)
}
...
...
@@ -52,13 +75,7 @@ const checkPredeploys = async (
continue
}
const
slot
=
await
provider
.
getStorageAt
(
addr
,
adminSlot
)
const
admin
=
hre
.
ethers
.
utils
.
hexConcat
([
'
0x000000000000000000000000
'
,
predeploys
.
ProxyAdmin
,
])
if
(
admin
!==
slot
)
{
if
(
slotRes
[
i
]
!==
admin
)
{
throw
new
Error
(
`incorrect admin slot in
${
addr
}
`
)
}
...
...
@@ -686,7 +703,9 @@ task('check-l2', 'Checks a freshly migrated L2 system for correct migration')
if
(
args
.
l2RpcUrl
!==
''
)
{
console
.
log
(
'
Using CLI URL for provider instead of hardhat network
'
)
const
provider
=
new
hre
.
ethers
.
providers
.
JsonRpcProvider
(
args
.
l2RpcUrl
)
const
provider
=
new
hre
.
ethers
.
providers
.
JsonRpcBatchProvider
(
args
.
l2RpcUrl
)
signer
=
Wallet
.
createRandom
().
connect
(
provider
)
}
...
...
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