@@ -64,146 +64,148 @@ else
6464 " $TESTNODE_DIR /test-node.bash" --espresso $( get_espresso_image_flag) --validate --tokenbridge --caff-node --init-force --detach > " $TESTNODE_LOG_FILE " 2>&1
6565fi
6666
67- # Start espresso sequencer node for the purposes of the test e.g. not needed for the real migration.
68- info " Starting a local Espresso confirmation layer development node"
69- if [ " $DEBUG " = " true" ]; then
70- docker compose up espresso-dev-node --detach
71- else
72- info " Run \` tail -f $ESPRESSO_DEVNODE_LOG_FILE \` to see logs, if necessary."
73- echo
74- docker compose up espresso-dev-node --detach > " $ESPRESSO_DEVNODE_LOG_FILE " 2>&1
75- fi
67+ docker compose down --remove-orphans
7668
69+ # # Start espresso sequencer node for the purposes of the test e.g. not needed for the real migration.
70+ # info "Starting a local Espresso confirmation layer development node"
71+ # if [ "$DEBUG" = "true" ]; then
72+ # docker compose up espresso-dev-node --detach
73+ # else
74+ # info "Run \`tail -f $ESPRESSO_DEVNODE_LOG_FILE\` to see logs, if necessary."
75+ # echo
76+ # docker compose up espresso-dev-node --detach > "$ESPRESSO_DEVNODE_LOG_FILE" 2>&1
77+ # fi
7778
78- info " Load environment variables in $ENV_FILE "
79- # A similar env file should be supplied for whatever
80- info " Sourcing $ENV_FILE "
81- . " $ENV_FILE "
82- echo
83- info " Loaded env vars:"
84- echo
85- cat " $TEST_DIR /.env" | sed ' s/^/ /'
86- echo
87-
88- trim-last () { tail -n 1 | tr -d ' \r\n' ; }
89- function get-addr {
90- local file=" $1 "
91- local path=" $2 "
92- docker compose run --entrypoint cat scripts $file | jq -r " $path " | trim-last
93- }
9479
80+ # info "Load environment variables in $ENV_FILE"
81+ # # A similar env file should be supplied for whatever
82+ # info "Sourcing $ENV_FILE"
83+ # . "$ENV_FILE"
84+ # echo
85+ # info "Loaded env vars:"
86+ # echo
87+ # cat "$TEST_DIR/.env" | sed 's/^/ /'
88+ # echo
89+
90+ # trim-last() { tail -n 1 | tr -d '\r\n'; }
91+ # function get-addr {
92+ # local file="$1"
93+ # local path="$2"
94+ # docker compose run --entrypoint cat scripts $file | jq -r "$path" | trim-last
95+ # }
9596
96- PARENT_CHAIN_UPGRADE_EXECUTOR=$( get-addr /config/deployed_chain_info.json ' .[0].rollup."upgrade-executor"' )
97- declare -p PARENT_CHAIN_UPGRADE_EXECUTOR
9897
99- SEQUENCER_INBOX =$( get-addr /config/deployed_chain_info.json ' .[0].rollup."sequencer-inbox "' )
100- declare -p SEQUENCER_INBOX
98+ # PARENT_CHAIN_UPGRADE_EXECUTOR =$(get-addr /config/deployed_chain_info.json '.[0].rollup."upgrade-executor "')
99+ # declare -p PARENT_CHAIN_UPGRADE_EXECUTOR
101100
102- INBOX_ADDRESS =$( get-addr /config/deployed_chain_info.json ' .[0].rollup.inbox' )
103- declare -p INBOX_ADDRESS
101+ # SEQUENCER_INBOX =$(get-addr /config/deployed_chain_info.json '.[0].rollup."sequencer- inbox" ')
102+ # declare -p SEQUENCER_INBOX
104103
105- echo " UPGRADE_EXECUTOR: $PARENT_CHAIN_UPGRADE_EXECUTOR "
106- echo " SEQUENCER_INBOX: $SEQUENCER_INBOX "
107- echo " Inbox: $INBOX_ADDRESS "
104+ # INBOX_ADDRESS=$(get-addr /config/deployed_chain_info.json '.[0].rollup.inbox')
105+ # declare -p INBOX_ADDRESS
108106
109- while true ; do
110- # Before setting the max delay verify that Caff node is running
111- CAFF_NODE_RESPONSE= $( cast balance 0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E --rpc-url http://127.0.0.1:8550 )
107+ # echo "UPGRADE_EXECUTOR: $PARENT_CHAIN_UPGRADE_EXECUTOR"
108+ # echo "SEQUENCER_INBOX: $SEQUENCER_INBOX"
109+ # echo "Inbox: $INBOX_ADDRESS"
112110
113- if [[ $CAFF_NODE_RESPONSE == " 0" ]]; then
114- echo " Caff node is catching up, wait"
115- sleep 10
116- else
117- break
118- fi
119- done
120-
121- PRIVATE_KEY=" $( docker compose run scripts print-private-key --account l2owner 2> /dev/null | trim-last) "
122- # This is a private key used for testing, save to print
123- declare -p PRIVATE_KEY
124-
125- # Set the max delay blocks to 10 blocks, future blocks to 120 blocks, delay seconds to 150 seconds, future seconds to 3600 seconds
126- cast send $PARENT_CHAIN_UPGRADE_EXECUTOR $( cast calldata " executeCall(address, bytes)" $SEQUENCER_INBOX $( cast calldata " setMaxTimeVariation((uint256,uint256,uint256,uint256))" " (10,120,150,3600)" ) ) --rpc-url $PARENT_CHAIN_RPC_URL --private-key $PRIVATE_KEY
127-
128- # First call the maxTimeVariation function to get the max time variation
129- {
130- read DELAY_BLOCKS
131- read FUTURE_BLOCKS
132- read DELAY_SECONDS
133- read FUTURE_SECONDS
134- } < <(
135- cast call --rpc-url " $PARENT_CHAIN_RPC_URL " " $SEQUENCER_INBOX " \
136- ' maxTimeVariation()(uint256,uint256,uint256,uint256)' |
137- awk ' {print $1}' # Extract only the first field (in case of extra text like "[8.64e4]")
138- )
139-
140- echo " DELAY_BLOCKS: $DELAY_BLOCKS "
141- echo " FUTURE_BLOCKS: $FUTURE_BLOCKS "
142- echo " DELAY_SECONDS: $DELAY_SECONDS "
143- echo " FUTURE_SECONDS: $FUTURE_SECONDS "
144-
145- # Now we stop the sequencer
146- docker stop nitro-testnode-sequencer-1 || true
147-
148- USER_L1_PRIVATE_KEY=" $( docker compose run scripts print-private-key --account funnel 2> /dev/null | trim-last) "
149- # This is a private key used for testing, save to print
150- declare -p USER_L1_PRIVATE_KEY
151-
152- # Add retry logic to send delayed message because sometimes it fails on the first attempt
153- MAX_RETRIES=5
154- RETRY_DELAY=5 # seconds between retries
155-
156- # Your original command
157- CMD=" cast send $INBOX_ADDRESS \$ (cast calldata \" sendL2MessageFromOrigin(bytes)\" \" 0x123456\" ) --rpc-url $PARENT_CHAIN_RPC_URL --private-key $USER_L1_PRIVATE_KEY --gas-limit 20000000"
158-
159- # Retry logic
160- retry_count=0
161- while [ $retry_count -lt $MAX_RETRIES ]; do
162- echo " Attempt $(( retry_count + 1 )) of $MAX_RETRIES ..."
163-
164- if eval " $CMD " ; then
165- echo " Command succeeded!"
166- break
167- else
168- echo " Command failed. Retrying in $RETRY_DELAY seconds..."
169- sleep $RETRY_DELAY
170- (( retry_count++ ))
171- fi
172- done
111+ # while true; do
112+ # # Before setting the max delay verify that Caff node is running
113+ # CAFF_NODE_RESPONSE=$(cast balance 0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E --rpc-url http://127.0.0.1:8550)
173114
174- if [ $retry_count -ge $MAX_RETRIES ]; then
175- echo " All retries failed. Exiting."
176- exit 1
177- fi
115+ # if [[ $CAFF_NODE_RESPONSE == "0" ]]; then
116+ # echo "Caff node is catching up, wait"
117+ # sleep 10
118+ # else
119+ # break
120+ # fi
121+ # done
122+
123+ # PRIVATE_KEY="$(docker compose run scripts print-private-key --account l2owner 2>/dev/null | trim-last)"
124+ # # This is a private key used for testing, save to print
125+ # declare -p PRIVATE_KEY
126+
127+ # # Set the max delay blocks to 10 blocks, future blocks to 120 blocks, delay seconds to 150 seconds, future seconds to 3600 seconds
128+ # cast send $PARENT_CHAIN_UPGRADE_EXECUTOR $(cast calldata "executeCall(address, bytes)" $SEQUENCER_INBOX $(cast calldata "setMaxTimeVariation((uint256,uint256,uint256,uint256))" "(10,120,150,3600)")) --rpc-url $PARENT_CHAIN_RPC_URL --private-key $PRIVATE_KEY
129+
130+ # # First call the maxTimeVariation function to get the max time variation
131+ # {
132+ # read DELAY_BLOCKS
133+ # read FUTURE_BLOCKS
134+ # read DELAY_SECONDS
135+ # read FUTURE_SECONDS
136+ # } < <(
137+ # cast call --rpc-url "$PARENT_CHAIN_RPC_URL" "$SEQUENCER_INBOX" \
138+ # 'maxTimeVariation()(uint256,uint256,uint256,uint256)' |
139+ # awk '{print $1}' # Extract only the first field (in case of extra text like "[8.64e4]")
140+ # )
141+
142+ # echo "DELAY_BLOCKS: $DELAY_BLOCKS"
143+ # echo "FUTURE_BLOCKS: $FUTURE_BLOCKS"
144+ # echo "DELAY_SECONDS: $DELAY_SECONDS"
145+ # echo "FUTURE_SECONDS: $FUTURE_SECONDS"
146+
147+ # # Now we stop the sequencer
148+ # docker stop nitro-testnode-sequencer-1 || true
149+
150+ # USER_L1_PRIVATE_KEY="$(docker compose run scripts print-private-key --account funnel 2>/dev/null | trim-last)"
151+ # # This is a private key used for testing, save to print
152+ # declare -p USER_L1_PRIVATE_KEY
153+
154+ # # Add retry logic to send delayed message because sometimes it fails on the first attempt
155+ # MAX_RETRIES=5
156+ # RETRY_DELAY=5 # seconds between retries
157+
158+ # # Your original command
159+ # CMD="cast send $INBOX_ADDRESS \$(cast calldata \"sendL2MessageFromOrigin(bytes)\" \"0x123456\") --rpc-url $PARENT_CHAIN_RPC_URL --private-key $USER_L1_PRIVATE_KEY --gas-limit 20000000"
160+
161+ # # Retry logic
162+ # retry_count=0
163+ # while [ $retry_count -lt $MAX_RETRIES ]; do
164+ # echo "Attempt $((retry_count + 1)) of $MAX_RETRIES..."
165+
166+ # if eval "$CMD"; then
167+ # echo "Command succeeded!"
168+ # break
169+ # else
170+ # echo "Command failed. Retrying in $RETRY_DELAY seconds..."
171+ # sleep $RETRY_DELAY
172+ # ((retry_count++))
173+ # fi
174+ # done
178175
179- sleep 120
176+ # if [ $retry_count -ge $MAX_RETRIES ]; then
177+ # echo "All retries failed. Exiting."
178+ # exit 1
179+ # fi
180180
181+ # sleep 120
182+
183+
184+ # # has_force_inclusion_log() {
185+ # # local container_name="caff-node-1"
186+ # # local search_string="force inclusion is going to happen"
187+ # # if docker logs "$container_name" 2>&1 | grep -q "$search_string"; then
188+ # # return 1
189+ # # else
190+ # # return 0
191+ # # fi
192+ # # }
181193
182- # has_force_inclusion_log() {
183- # local container_name="caff-node-1"
184- # local search_string="force inclusion is going to happen"
185- # if docker logs "$container_name" 2>&1 | grep -q "$search_string"; then
186- # return 1
187- # else
188- # return 0
189- # fi
190- # }
191194
195+ # # if has_force_inclusion_log "caff-node-1" "force inclusion is going to happen"; then
196+ # # echo "It printed force inclusion is going to happen log"
197+ # # docker compose down --remove-orphans
198+ # # exit 0
199+ # # else
200+ # # echo "Caff node did not print force inclusion log"
201+ # # exit 1
202+ # # fi
192203
193- # if has_force_inclusion_log "caff-node-1" "force inclusion is going to happen"; then
204+ # if docker logs "caff-node-1" 2>&1 | grep -q "force inclusion is going to happen"; then
194205# echo "It printed force inclusion is going to happen log"
195206# docker compose down --remove-orphans
196207# exit 0
197208# else
198209# echo "Caff node did not print force inclusion log"
199210# exit 1
200211# fi
201-
202- if docker logs " caff-node-1" 2>&1 | grep -q " force inclusion is going to happen" ; then
203- echo " It printed force inclusion is going to happen log"
204- docker compose down --remove-orphans
205- exit 0
206- else
207- echo " Caff node did not print force inclusion log"
208- exit 1
209- fi
0 commit comments