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
5ed518a0
Unverified
Commit
5ed518a0
authored
Jan 12, 2023
by
Mark Tyneway
Committed by
GitHub
Jan 12, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4683 from ethereum-optimism/feat/wait-for-final-batch
contracts-bedrock: wait for final batch hh task
parents
db5284db
16ba4ab6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
index.ts
packages/contracts-bedrock/tasks/index.ts
+2
-1
wait-for-final-batch.ts
packages/contracts-bedrock/tasks/wait-for-final-batch.ts
+73
-0
No files found.
packages/contracts-bedrock/tasks/index.ts
View file @
5ed518a0
...
@@ -8,4 +8,5 @@ import './solidity'
...
@@ -8,4 +8,5 @@ import './solidity'
import
'
./accounts
'
import
'
./accounts
'
import
'
./check-l2
'
import
'
./check-l2
'
import
'
./update-dynamic-oracle-config
'
import
'
./update-dynamic-oracle-config
'
import
'
./wait-for-final-deposit
'
import
'
./wait-for-final-batch
'
import
'
./wait-for-final-deposit
'
\ No newline at end of file
packages/contracts-bedrock/tasks/wait-for-final-batch.ts
0 → 100644
View file @
5ed518a0
import
{
task
,
types
}
from
'
hardhat/config
'
import
'
@nomiclabs/hardhat-ethers
'
import
'
hardhat-deploy
'
import
{
HardhatRuntimeEnvironment
}
from
'
hardhat/types
'
import
{
Contract
}
from
'
ethers
'
import
{
sleep
}
from
'
@eth-optimism/core-utils
'
task
(
'
wait-for-final-batch
'
,
'
Waits for the final batch to be submitted
'
)
.
addParam
(
'
l1RpcUrl
'
,
'
L1 RPC URL remote node
'
,
'
http://127.0.0.1:8545
'
,
types
.
string
)
.
addParam
(
'
l2RpcUrl
'
,
'
L2 RPC URL remote node
'
,
'
http://127.0.0.1:9545
'
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
:
HardhatRuntimeEnvironment
)
=>
{
const
l1Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
args
.
l1RpcUrl
)
const
l2Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
args
.
l2RpcUrl
)
const
Deployment__CanonicalTransactionChain
=
await
hre
.
deployments
.
get
(
'
CanonicalTransactionChain
'
)
const
CanonicalTransactionChain
=
new
hre
.
ethers
.
Contract
(
Deployment__CanonicalTransactionChain
.
address
,
Deployment__CanonicalTransactionChain
.
abi
,
l1Provider
)
const
Deployment__StateCommitmentChain
=
await
hre
.
deployments
.
get
(
'
StateCommitmentChain
'
)
const
StateCommitmentChain
=
new
hre
.
ethers
.
Contract
(
Deployment__StateCommitmentChain
.
address
,
Deployment__StateCommitmentChain
.
abi
,
l1Provider
)
const
wait
=
async
(
contract
:
Contract
)
=>
{
let
height
=
await
l2Provider
.
getBlockNumber
()
let
totalElements
=
await
contract
.
getTotalElements
()
// The genesis block was not batch submitted so subtract 1 from the height
// when comparing with the total elements
while
(
totalElements
!==
height
-
1
)
{
console
.
log
(
'
Total elements does not match
'
)
console
.
log
(
` - real height:
${
height
}
`
)
console
.
log
(
` - height:
${
height
-
1
}
`
)
console
.
log
(
` - totalElements:
${
totalElements
}
`
)
totalElements
=
await
contract
.
getTotalElements
()
height
=
await
l2Provider
.
getBlockNumber
()
await
sleep
(
2
*
1000
)
}
}
console
.
log
(
'
Waiting for the CanonicalTransactionChain...
'
)
await
wait
(
CanonicalTransactionChain
)
console
.
log
(
'
All transaction batches have been submitted
'
)
console
.
log
(
'
Waiting for the StateCommitmentChain...
'
)
await
wait
(
StateCommitmentChain
)
console
.
log
(
'
All state root batches have been submitted
'
)
console
.
log
(
'
All batches have been 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