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
f04170e2
Unverified
Commit
f04170e2
authored
Jan 17, 2023
by
Mark Tyneway
Committed by
GitHub
Jan 17, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4696 from ethereum-optimism/fix/wait-tasks
contracts-bedrock: fix migration tasks
parents
d8e328ae
d0ec9aff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
wait-for-final-batch.ts
packages/contracts-bedrock/tasks/wait-for-final-batch.ts
+11
-6
wait-for-final-deposit.ts
packages/contracts-bedrock/tasks/wait-for-final-deposit.ts
+7
-2
No files found.
packages/contracts-bedrock/tasks/wait-for-final-batch.ts
View file @
f04170e2
...
@@ -48,26 +48,31 @@ task('wait-for-final-batch', 'Waits for the final batch to be submitted')
...
@@ -48,26 +48,31 @@ task('wait-for-final-batch', 'Waits for the final batch to be submitted')
const
wait
=
async
(
contract
:
Contract
)
=>
{
const
wait
=
async
(
contract
:
Contract
)
=>
{
let
height
=
await
l2Provider
.
getBlockNumber
()
let
height
=
await
l2Provider
.
getBlockNumber
()
let
totalElements
=
await
contract
.
getTotalElements
()
let
totalElements
=
await
contract
.
getTotalElements
()
// The genesis block was not batch submitted so subtract 1 from the height
console
.
log
(
` - height:
${
height
}
`
)
// when comparing with the total elements
console
.
log
(
` - totalElements:
${
totalElements
}
`
)
while
(
totalElements
!==
height
-
1
)
{
while
(
totalElements
.
toNumber
()
!==
height
)
{
console
.
log
(
'
Total elements does not match
'
)
console
.
log
(
'
Total elements does not match
'
)
console
.
log
(
` - real height:
${
height
}
`
)
console
.
log
(
` - height:
${
height
}
`
)
console
.
log
(
` - height:
${
height
-
1
}
`
)
console
.
log
(
` - totalElements:
${
totalElements
}
`
)
console
.
log
(
` - totalElements:
${
totalElements
}
`
)
console
.
log
(
`Waiting for
${
height
-
totalElements
}
elements to be submitted`
)
totalElements
=
await
contract
.
getTotalElements
()
totalElements
=
await
contract
.
getTotalElements
()
height
=
await
l2Provider
.
getBlockNumber
()
height
=
await
l2Provider
.
getBlockNumber
()
await
sleep
(
2
*
1000
)
await
sleep
(
5
*
1000
)
}
}
}
}
console
.
log
(
'
Waiting for the CanonicalTransactionChain...
'
)
console
.
log
(
'
Waiting for the CanonicalTransactionChain...
'
)
await
wait
(
CanonicalTransactionChain
)
await
wait
(
CanonicalTransactionChain
)
console
.
log
(
'
All transaction batches have been submitted
'
)
console
.
log
(
'
All transaction batches have been submitted
'
)
console
.
log
()
console
.
log
(
'
Waiting for the StateCommitmentChain...
'
)
console
.
log
(
'
Waiting for the StateCommitmentChain...
'
)
await
wait
(
StateCommitmentChain
)
await
wait
(
StateCommitmentChain
)
console
.
log
(
'
All state root batches have been submitted
'
)
console
.
log
(
'
All state root batches have been submitted
'
)
console
.
log
()
console
.
log
(
'
All batches have been submitted
'
)
console
.
log
(
'
All batches have been submitted
'
)
})
})
packages/contracts-bedrock/tasks/wait-for-final-deposit.ts
View file @
f04170e2
...
@@ -22,6 +22,7 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
...
@@ -22,6 +22,7 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
const
l1Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
const
l1Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
args
.
l1RpcUrl
args
.
l1RpcUrl
)
)
const
l2Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
const
l2Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
args
.
l2RpcUrl
args
.
l2RpcUrl
)
)
...
@@ -63,6 +64,9 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
...
@@ -63,6 +64,9 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
console
.
log
(
`DTL shutoff block
${
dtlShutoffBlock
.
toString
()}
`
)
console
.
log
(
`DTL shutoff block
${
dtlShutoffBlock
.
toString
()}
`
)
let
pending
=
await
CanonicalTransactionChain
.
getNumPendingQueueElements
()
console
.
log
(
`
${
pending
}
deposits must be batch submitted`
)
// Now query the number of queue elements in the CTC
// Now query the number of queue elements in the CTC
const
queueLength
=
await
CanonicalTransactionChain
.
getQueueLength
()
const
queueLength
=
await
CanonicalTransactionChain
.
getQueueLength
()
console
.
log
(
`Total number of deposits:
${
queueLength
}
`
)
console
.
log
(
`Total number of deposits:
${
queueLength
}
`
)
...
@@ -80,11 +84,10 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
...
@@ -80,11 +84,10 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
if
(
tx
.
queueOrigin
===
'
l1
'
)
{
if
(
tx
.
queueOrigin
===
'
l1
'
)
{
const
queueIndex
=
BigNumber
.
from
(
tx
.
queueIndex
).
toNumber
()
const
queueIndex
=
BigNumber
.
from
(
tx
.
queueIndex
).
toNumber
()
if
(
queueIndex
===
queueLength
)
{
if
(
queueIndex
===
queueLength
-
1
)
{
break
break
}
}
if
(
queueIndex
<
queueLength
)
{
if
(
queueIndex
<
queueLength
)
{
console
.
log
()
throw
new
Error
(
throw
new
Error
(
`Missed the final deposit. queueIndex
${
queueIndex
}
, queueLength
${
queueLength
}
`
`Missed the final deposit. queueIndex
${
queueIndex
}
, queueLength
${
queueLength
}
`
)
)
...
@@ -94,4 +97,6 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
...
@@ -94,4 +97,6 @@ task('wait-for-final-deposit', 'Waits for the final deposit to be ingested')
}
}
console
.
log
(
'
Final deposit has been ingested by l2geth
'
)
console
.
log
(
'
Final deposit has been ingested by l2geth
'
)
pending
=
await
CanonicalTransactionChain
.
getNumPendingQueueElements
()
console
.
log
(
`
${
pending
}
deposits must be batch submitted`
)
})
})
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