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
1ec75d82
Unverified
Commit
1ec75d82
authored
Dec 04, 2023
by
clabby
Committed by
GitHub
Dec 04, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8413 from ethereum-optimism/feat/fix-test-race
ctb: Fix multithreaded test race
parents
179aea69
f1ec8e63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
24 deletions
+53
-24
generate-l2-genesis.sh
packages/contracts-bedrock/scripts/generate-l2-genesis.sh
+53
-24
No files found.
packages/contracts-bedrock/scripts/generate-l2-genesis.sh
View file @
1ec75d82
...
@@ -18,30 +18,59 @@ TESTDATA_DIR="$CONTRACTS_DIR/.testdata"
...
@@ -18,30 +18,59 @@ TESTDATA_DIR="$CONTRACTS_DIR/.testdata"
OUTFILE_L2
=
"
$TESTDATA_DIR
/genesis.json"
OUTFILE_L2
=
"
$TESTDATA_DIR
/genesis.json"
OUTFILE_ROLLUP
=
"
$TESTDATA_DIR
/rollup.json"
OUTFILE_ROLLUP
=
"
$TESTDATA_DIR
/rollup.json"
mkdir
-p
"
$TESTDATA_DIR
"
if
[
!
-f
"
$DEPLOY_ARTIFACT
"
]
;
then
LOCKDIR
=
"/tmp/lock-generate-l2-genesis"
cleanup
()
{
rm
-rf
--
"
$LOCKDIR
"
}
# Wait for the L2 outfile to be over 8M for up to $2 iterations
# of $1 seconds. This is a hack to ensure that the outfile is fully
# written before the solidity tests try to read it
wait_l2_outfile
()
{
i
=
1
while
[
$i
-le
$2
]
;
do
i
=
$((
$i
+
1
))
if
[
!
-f
"
$OUTFILE_L2
"
]
;
then
sleep
$1
continue
fi
if
[
$(
du
-m
"
$OUTFILE_L2
"
|
cut
-f1
)
-lt
8
]
;
then
sleep
$1
continue
fi
exit
0
done
echo
"L2 genesis file not generated in time. Exiting."
exit
1
}
# Directory creations are atomic, so we can use mkdir to
# create a lockfile that prevents subsequent invocations
# of the script from running concurrently.
if
mkdir
--
"
$LOCKDIR
"
>
/dev/null 2>&1
;
then
trap
'cleanup'
EXIT
mkdir
-p
"
$TESTDATA_DIR
"
if
[
!
-f
"
$DEPLOY_ARTIFACT
"
]
;
then
forge script
$CONTRACTS_DIR
/scripts/Deploy.s.sol:Deploy
>
/dev/null 2>&1
forge script
$CONTRACTS_DIR
/scripts/Deploy.s.sol:Deploy
>
/dev/null 2>&1
fi
fi
if
[
!
-f
"
$OUTFILE_L2
"
]
;
then
if
[
!
-f
"
$OUTFILE_L2
"
]
;
then
go run
$OP_NODE
genesis l2
\
go run
$OP_NODE
genesis l2
\
--deploy-config
"
$CONTRACTS_DIR
/deploy-config/hardhat.json"
\
--deploy-config
"
$CONTRACTS_DIR
/deploy-config/hardhat.json"
\
--l1-deployments
"
$DEPLOY_ARTIFACT
"
\
--l1-deployments
"
$DEPLOY_ARTIFACT
"
\
--l1-starting-block
"
$L1_STARTING_BLOCK_PATH
"
\
--l1-starting-block
"
$L1_STARTING_BLOCK_PATH
"
\
--outfile
.l2
"
$OUTFILE_L2
"
\
--outfile
.l2
"
$OUTFILE_L2
"
\
--outfile
.rollup
"
$OUTFILE_ROLLUP
"
>
/dev/null 2>&1
--outfile
.rollup
"
$OUTFILE_ROLLUP
"
>
/dev/null 2>&1
fi
# Wait for the L2 outfile to be over 8M for up to 2 seconds
# This is a hack to ensure that the outfile is fully written
# before the solidity tests try to read it
for
i
in
{
1..8
}
;
do
if
[
$(
du
-m
"
$OUTFILE_L2
"
|
cut
-f1
)
-ge
8
]
;
then
exit
0
fi
fi
sleep
0.25
else
done
# Wait up to 5 minutes for the lock to be released
wait_l2_outfile 0.25 1200
echo
"L2 genesis file not generated in time. Exiting."
fi
exit
1
\ No newline at end of file
\ No newline at end of file
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