Skip to content

Commit 34f0e1c

Browse files
authored
Merge pull request #145 from OffchainLabs/ha/traffic-flag
add flags for l2 and l3 traffic
2 parents c7a5862 + e148d9a commit 34f0e1c

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

test-node.bash

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ build_utils=false
7070
force_build_utils=false
7171
build_node_images=false
7272

73+
# Create some traffic on L2 and L3 so blocks are reliably produced
74+
l2_traffic=true
75+
l3_traffic=true
76+
7377
while [[ $# -gt 0 ]]; do
7478
case $1 in
7579
--init)
@@ -280,6 +284,14 @@ while [[ $# -gt 0 ]]; do
280284
simple=false
281285
shift
282286
;;
287+
--no-l2-traffic)
288+
l2_traffic=false
289+
shift
290+
;;
291+
--no-l3-traffic)
292+
l3_traffic=false
293+
shift
294+
;;
283295
*)
284296
echo Usage: $0 \[OPTIONS..]
285297
echo $0 script [SCRIPT-ARGS]
@@ -306,6 +318,8 @@ while [[ $# -gt 0 ]]; do
306318
echo --tokenbridge deploy L1-L2 token bridge.
307319
echo --no-tokenbridge don\'t build or launch tokenbridge
308320
echo --no-run does not launch nodes \(useful with build or init\)
321+
echo --no-l2-traffic disables L2 spam transaction traffic \(default: enabled\)
322+
echo --no-l3-traffic disables L3 spam transaction traffic \(default: enabled\)
309323
echo --no-simple run a full configuration with separate sequencer/batch-poster/validator/relayer
310324
echo --build-dev-nitro rebuild dev nitro docker image
311325
echo --no-build-dev-nitro don\'t rebuild dev nitro docker image
@@ -590,6 +604,12 @@ if $force_init; then
590604
docker compose run scripts send-l1 --ethamount 1 --to address_0x0000000000000000000000000000000000000000 --wait
591605
docker compose run scripts send-l2 --ethamount 1 --to address_0x0000000000000000000000000000000000000000 --wait
592606

607+
if $l2_traffic; then
608+
echo == create l2 traffic
609+
docker compose run scripts send-l2 --ethamount 100 --to user_traffic_generator --wait
610+
docker compose run scripts send-l2 --ethamount 0.0001 --from user_traffic_generator --to user_traffic_generator --wait --delay 500 --times 1000000 > /dev/null &
611+
fi
612+
593613
if $l3node; then
594614
echo == Funding l3 users
595615
docker compose run scripts send-l2 --ethamount 1000 --to validator --wait
@@ -604,10 +624,6 @@ if $force_init; then
604624
docker compose run scripts send-l1 --ethamount 100 --to user_fee_token_deployer --wait
605625
docker compose run scripts send-l2 --ethamount 100 --to user_fee_token_deployer --wait
606626

607-
echo == create l2 traffic
608-
docker compose run scripts send-l2 --ethamount 100 --to user_traffic_generator --wait
609-
docker compose run scripts send-l2 --ethamount 0.0001 --from user_traffic_generator --to user_traffic_generator --wait --delay 500 --times 1000000 > /dev/null &
610-
611627
echo == Writing l3 chain config
612628
l3owneraddress=`docker compose run scripts print-address --account l3owner | tail -n 1 | tr -d '\r\n'`
613629
echo l3owneraddress $l3owneraddress
@@ -672,9 +688,11 @@ if $force_init; then
672688
echo == Deploy Stylus Deployer on L3
673689
docker compose run scripts create-stylus-deployer --deployer l3owner --l3
674690

675-
echo == create l3 traffic
676-
docker compose run scripts send-l3 --ethamount 10 --to user_traffic_generator --wait
677-
docker compose run scripts send-l3 --ethamount 0.0001 --from user_traffic_generator --to user_traffic_generator --wait --delay 5000 --times 1000000 > /dev/null &
691+
if $l3_traffic; then
692+
echo == create l3 traffic
693+
docker compose run scripts send-l3 --ethamount 10 --to user_traffic_generator --wait
694+
docker compose run scripts send-l3 --ethamount 0.0001 --from user_traffic_generator --to user_traffic_generator --wait --delay 5000 --times 1000000 > /dev/null &
695+
fi
678696
fi
679697
fi
680698

0 commit comments

Comments
 (0)