From b5932549a1461557bb6e1eba27280ac0605ef50a Mon Sep 17 00:00:00 2001 From: tbro <48967308+tbro@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:21:27 -0300 Subject: [PATCH] fix migration test (#81) Migration test fixes and improvements. * Fixes naming of DeployAndInitEspressoSequencerInbox * adds readability and reliability improvements to migration-test script * adds a migration CI workflow --------- Co-authored-by: tbro Co-authored-by: sveitser Co-authored-by: Jeremy <297323986@qq.com> Co-authored-by: Zach Showalter --- .github/workflows/migration.yaml | 43 +++ espresso-tests/.env | 1 + ...ndInitEspressoSequencerInboxForTest.s.sol} | 2 +- ...create-espresso-integrated-nitro-node.bash | 4 +- espresso-tests/migration-test.bash | 261 ++++++++++++------ flake.nix | 1 + orbit-actions | 2 +- 7 files changed, 221 insertions(+), 93 deletions(-) create mode 100644 .github/workflows/migration.yaml rename espresso-tests/{DeployAndInitEspressoSequencerInboxTest.s.sol => DeployAndInitEspressoSequencerInboxForTest.s.sol} (96%) diff --git a/.github/workflows/migration.yaml b/.github/workflows/migration.yaml new file mode 100644 index 00000000..d4e603e0 --- /dev/null +++ b/.github/workflows/migration.yaml @@ -0,0 +1,43 @@ +name: Migration Test +run-name: CI triggered from @${{ github.actor }} of ${{ github.head_ref }} + +on: + workflow_dispatch: + merge_group: + push: + schedule: + # Run at the end of every day + - cron: "0 0 * * *" + +# Cancel in-progress jobs except for integration branch +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ !contains(github.ref, 'integration/')}} + +jobs: + migration_test: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Enable Cachix + uses: cachix/cachix-action@v15 + continue-on-error: true + with: + name: espresso-systems-private + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + extraPullNames: nix-community + skipPush: ${{ github.actor == 'dependabot[bot]' }} + + - name: Migration Test + run: | + nix develop --accept-flake-config --option sandbox relaxed \ + -c espresso-tests/migration-test.bash + timeout-minutes: 45 diff --git a/espresso-tests/.env b/espresso-tests/.env index 64ef26e8..bbe56b74 100644 --- a/espresso-tests/.env +++ b/espresso-tests/.env @@ -18,6 +18,7 @@ UPGRADE_TIMESTAMP="1723664126" READER_ADDRESS="0x7DD3F2a3fAeF3B9F2364c335163244D3388Feb83" IS_USING_FEE_TOKEN="false" IS_MIGRATION_TEST="true" +IS_REVERT="false" MAX_DATA_SIZE="117964" OLD_BATCH_POSTER_ADDRESS="0xe2148eE53c0755215Df69b2616E552154EdC584f" NEW_BATCH_POSTER_ADDRESS="0xe2148eE53c0755215Df69b2616E552154EdC584f" diff --git a/espresso-tests/DeployAndInitEspressoSequencerInboxTest.s.sol b/espresso-tests/DeployAndInitEspressoSequencerInboxForTest.s.sol similarity index 96% rename from espresso-tests/DeployAndInitEspressoSequencerInboxTest.s.sol rename to espresso-tests/DeployAndInitEspressoSequencerInboxForTest.s.sol index f213bc41..f52c050d 100644 --- a/espresso-tests/DeployAndInitEspressoSequencerInboxTest.s.sol +++ b/espresso-tests/DeployAndInitEspressoSequencerInboxForTest.s.sol @@ -9,7 +9,7 @@ import "nitro-contracts/bridge/ISequencerInbox.sol"; /// with the espresso confirmation layer /// @dev BATCH_POSTER_ADDRS should be a comma delimited list that includes addresses. This list will give batch posting affordances to those addresses /// For chains using the Espresso TEE integration, this will be the address of your new batch poster, if you decide to change it. -contract DeployAndInitEspressoSequencerInboxTest is Script { +contract DeployAndInitEspressoSequencerInbox is Script { function run() external { bool isMigrationTest = vm.envBool("IS_MIGRATION_TEST"); // Grab addresses from env diff --git a/espresso-tests/create-espresso-integrated-nitro-node.bash b/espresso-tests/create-espresso-integrated-nitro-node.bash index 3670c7c1..f946ca6e 100755 --- a/espresso-tests/create-espresso-integrated-nitro-node.bash +++ b/espresso-tests/create-espresso-integrated-nitro-node.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -set -x # print each command before executing it, for debugging +# set -x # print each command before executing it, for debugging ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:integration lightClientAddr=0xb6eb235fa509e3206f959761d11e3777e16d0e98 @@ -18,5 +18,5 @@ docker compose run scripts-espresso write-config --simple --simpleWithValidator # do whatever other espresso setup is needed. -# run esprsso-integrated nitro node for sequencing. +# run Espresso integrated nitro node for sequencing. docker compose up sequencer-on-espresso --detach diff --git a/espresso-tests/migration-test.bash b/espresso-tests/migration-test.bash index 1b063751..8d88f080 100755 --- a/espresso-tests/migration-test.bash +++ b/espresso-tests/migration-test.bash @@ -6,105 +6,223 @@ fail(){ set -euo pipefail set -a # automatically export all variables -set -x # print each command before executing it, for debugging +# set -x # print each command before executing it, for debugging +# CI is "true" in the CI +CI="${CI:-false}" +# Output debug information on CI +DEBUG="${DEBUG:-false}" +if [ "$CI" = "true" ]; then + set -x + DEBUG=true +fi + +# Show the command we are running, then run it. Due to piping this spawns a +# subshell so does not work for command like `cd` or `source`. +function run { + echo -e "\033[34m>>> $*\033[0m" + "$@" 2>&1 | fmt +} + +function cd { + emph "cd $*" + builtin cd "$@" +} + +function emph { + echo -e "\033[34m>>> $*\033[0m\n" +} + +# Display only the last line of piped input, continuously updating +function fmt { + # Leave output unchanged in DEBUG mode + if [ "$DEBUG" = "true" ]; then + cat + return + fi + # rewrite the last line to avoid noisy output + while read -r line; do + tput cr + tput el + echo "$line" | cut -c -"$(tput cols)" | tr -d '\r\n' + done + echo +} + +# Show something with a comment in front, to distinguish it from console output. +function info { + echo "# $@" +} + +# Remove log files on exit +trap "exit" INT TERM +trap cleanup EXIT +function cleanup { + exit_code=$? + if [ $exit_code -ne 0 ]; then + echo + echo "An error occurred." + if [ -s "$ESPRESSO_DEVNODE_LOG_FILE" ]; then + echo "Espresso dev node logs:" + cat "$ESPRESSO_DEVNODE_LOG_FILE" + exit $exit_code + elif [ -s "$TESTNODE_LOG_FILE" ]; then + echo "Nitro testnode logs:" + cat "$TESTNODE_LOG_FILE" + exit $exit_code + fi + else + rm -vf "$TESTNODE_LOG_FILE" + rm -vf "$ESPRESSO_DEVNODE_LOG_FILE" + fi +} # Find directory of this script, the project, and the orbit-actions submodule TEST_DIR="$(dirname $(readlink -f $0))" +TESTNODE_LOG_FILE=$(mktemp -t nitro-test-node-logs-XXXXXXXX) +ESPRESSO_DEVNODE_LOG_FILE=$(mktemp -t espresso-dev-node-logs-XXXXXXXX) TESTNODE_DIR="$(dirname "$TEST_DIR")" ORBIT_ACTIONS_DIR="$TESTNODE_DIR/orbit-actions" +ENV_FILE="$TEST_DIR/.env" +# Hide docker compose warnings about orphaned containers. +export COMPOSE_IGNORE_ORPHANS=true + +info Ensuring docker compose project is stopped +run docker compose down -v --remove-orphans # Change to orbit actions directory, update the submodule, and install any dependencies for the purposes of the test. cd "$ORBIT_ACTIONS_DIR" -git submodule update --init -forge update -yarn +info "Ensuring submodules are checked out" +run git submodule update --init --recursive + +info "Ensuring nodejs dependencies are installed" +run yarn + +info "Ensuring we can compile the migration smart contracts" +run forge build # Change to the top level directory for the purposes of the test. cd "$TESTNODE_DIR" -# Initialize a standard network not compatible with espresso to simulate a pre-upgrade orbit network e.g. not needed for the real migration -./test-node.bash --simple --init-force --tokenbridge --detach --no-build-utils +# NOTE: the test-node.bash script (or potentially docker compose) does not work +# well with the `fmt` utility function and hangs at the end. I don't know why. +# Furthermore the long warning lines don't work with the `fmt` function but I +# can't work out a way to be able to filter the lines (e. g. grep -v WARN) and +# still have the output show up. + +info Deploying a vanilla Nitro stack locally, to be migrated to Espresso later. +emph ./test-node.bash --simple --init-force --tokenbridge --detach --no-build-utils +if [ "$DEBUG" = "true" ]; then + ./test-node.bash --simple --init-force --tokenbridge --detach --no-build-utils +else + info "This command starts up an entire Nitro stack. It takes a long time." + info "Run \`tail -f $TESTNODE_LOG_FILE\` to see logs, if necessary." + echo + ./test-node.bash --simple --init-force --tokenbridge --detach --no-build-utils > "$TESTNODE_LOG_FILE" 2>&1 +fi # Start espresso sequencer node for the purposes of the test e.g. not needed for the real migration. -docker compose up espresso-dev-node --detach +info "Starting a local Espresso confirmation layer development node" +emph docker compose up espresso-dev-node --detach +if [ "$DEBUG" = "true" ]; then + docker compose up espresso-dev-node --detach +else + info "Run \`tail -f $ESPRESSO_DEVNODE_LOG_FILE\` to see logs, if necessary." + echo + docker compose up espresso-dev-node --detach > "$ESPRESSO_DEVNODE_LOG_FILE" 2>&1 +fi -# Export environment variables in .env file +info "Load environment variables in $ENV_FILE" # A similar env file should be supplied for whatever +emph . "$TEST_DIR/.env" . "$TEST_DIR/.env" +echo +info "Loaded env vars:" +echo +cat "$TEST_DIR/.env" | sed 's/^/ /' +echo + +function trim-last { + tail -n 1 | tr -d '\r\n' + +} +function get-addr { + local file="$1" + local path="$2" + docker compose run --entrypoint cat scripts $file | jq -r "$path" | trim-last +} # Overwrite the ROLLUP_ADDRESS for this test, it might not be the same as the one in the .env file #* Essential migration sub step * This address (the rollup proxy address) is likely a known address to operators. -ROLLUP_ADDRESS=$(docker compose run --entrypoint cat scripts /config/deployed_chain_info.json | jq -r '.[0].rollup.rollup' | tail -n 1 | tr -d '\r\n') +ROLLUP_ADDRESS=$(get-addr /config/deployed_chain_info.json '.[0].rollup.rollup') +declare -p ROLLUP_ADDRESS # A convoluted way to get the address of the child chain upgrade executor, maybe there's a better way? # These steps below are just for the purposes of the test. In a real deployment operators will likely already know their child-chain's upgrade executor address, and it should be included in a .env file for the migration run. -INBOX_ADDRESS=$(docker compose run --entrypoint cat scripts /config/deployed_chain_info.json | jq -r '.[0].rollup.inbox' | tail -n 1 | tr -d '\r\n') -L1_TOKEN_BRIDGE_CREATOR_ADDRESS=$(docker compose run --entrypoint cat scripts /tokenbridge-data/network.json | jq -r '.l1TokenBridgeCreator' | tail -n 1 | tr -d '\r\n') +INBOX_ADDRESS=$(get-addr /config/deployed_chain_info.json '.[0].rollup.inbox') +declare -p INBOX_ADDRESS + +L1_TOKEN_BRIDGE_CREATOR_ADDRESS=$(get-addr /tokenbridge-data/network.json '.l1TokenBridgeCreator') +declare -p L1_TOKEN_BRIDGE_CREATOR_ADDRESS + CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS=$(cast call $L1_TOKEN_BRIDGE_CREATOR_ADDRESS 'inboxToL2Deployment(address)(address,address,address,address,address,address,address,address,address)' $INBOX_ADDRESS | tail -n 2 | head -n 1 | tr -d '\r\n') +declare -p CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS # Export l2 owner private key and address # These commands are exclusive to the test. # * Essential migration sub step * These addresses are likely known addresses to operators in the event of a real migration -PRIVATE_KEY="$(docker compose run scripts print-private-key --account l2owner | tail -n 1 | tr -d '\r\n')" -OWNER_ADDRESS="$(docker compose run scripts print-address --account l2owner | tail -n 1 | tr -d '\r\n')" +PRIVATE_KEY="$(docker compose run scripts print-private-key --account l2owner 2>/dev/null | trim-last)" +# This is a private key used for testing, save to print +declare -p PRIVATE_KEY + +OWNER_ADDRESS="$(docker compose run scripts print-address --account l2owner 2>/dev/null | trim-last)" +declare -p OWNER_ADDRESS cd $ORBIT_ACTIONS_DIR -forge update -echo "Deploying mock espresso tee verifier" -forge script --chain $PARENT_CHAIN_CHAIN_ID ../espresso-tests/DeployMockVerifier.s.sol:DeployMockVerifier --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv +info "Deploying mock espresso TEE verifier" +run forge script --chain $PARENT_CHAIN_CHAIN_ID ../espresso-tests/DeployMockVerifier.s.sol:DeployMockVerifier --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv ESPRESSO_TEE_VERIFIER_ADDRESS=$(cat broadcast/DeployMockVerifier.s.sol/1337/run-latest.json | jq -r '.transactions[0].contractAddress' | cast to-checksum) -echo "Mock TEE Address:" -echo $ESPRESSO_TEE_VERIFIER_ADDRESS +declare -p ESPRESSO_TEE_VERIFIER_ADDRESS # Echo for debug -echo "Deploying and initializing Espresso SequencerInbox" +info "Deploying and initializing Espresso SequencerInbox" # ** Essential migration step ** Forge script to deploy the new SequencerInbox. We do this to later point the rollups challenge manager to the espresso integrated OSP. -forge script --chain $PARENT_CHAIN_CHAIN_ID ../espresso-tests/DeployAndInitEspressoSequencerInboxTest.s.sol:DeployAndInitEspressoSequencerInboxTest --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv --skip-simulation +run forge script --chain $PARENT_CHAIN_CHAIN_ID ../espresso-tests/DeployAndInitEspressoSequencerInboxForTest.s.sol:DeployAndInitEspressoSequencerInbox --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv --skip-simulation -# Extract new_osp_entry address from run-latest.json # * Essential migration sub step * These addresses are likely known addresses to operators in the event of a real migration after they have deployed the new OSP contracts, however, if operators create a script for the migration, this command is useful. -NEW_SEQUENCER_INBOX_IMPL_ADDRESS=$(cat broadcast/DeployAndInitEspressoSequencerInbox.s.sol/1337/run-latest.json | jq -r '.transactions[0].contractAddress'| cast to-checksum) +NEW_SEQUENCER_INBOX_IMPL_ADDRESS=$(cat broadcast/DeployAndInitEspressoSequencerInboxForTest.s.sol/1337/run-latest.json | jq -r '.receipts[0].contractAddress'| cast to-checksum) +declare -p NEW_SEQUENCER_INBOX_IMPL_ADDRESS + # Echo for debugging. -echo "Deployed new SequencerInbox at $NEW_SEQUENCER_INBOX_IMPL_ADDRESS" +info "Deployed new SequencerInbox at $NEW_SEQUENCER_INBOX_IMPL_ADDRESS" # Echo for debug -echo "Deploying Espresso SequencerInbox migration action" +info "Deploying Espresso SequencerInbox migration action" # ** Essential migration step ** Forge script to deploy Espresso OSP migration action -forge script --chain $PARENT_CHAIN_CHAIN_ID contracts/parent-chain/espresso-migration/DeployEspressoSequencerMigrationAction.s.sol:DeployEspressoSequencerMigrationAction --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv +run forge script --chain $PARENT_CHAIN_CHAIN_ID contracts/parent-chain/espresso-migration/DeployEspressoSequencerMigrationAction.s.sol:DeployEspressoSequencerMigrationAction --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv # Capture new OSP address # * Essential migration sub step ** Essential migration sub step * operators will be able to manually determine this address while running the upgrade, but this can be useful if they wish to make a script. SEQUENCER_MIGRATION_ACTION=$(cat broadcast/DeployEspressoSequencerMigrationAction.s.sol/1337/run-latest.json | jq -r '.transactions[0].contractAddress' | cast to-checksum) +declare -p SEQUENCER_MIGRATION_ACTION -echo "Deployed new EspressoSequencerMigrationAction at $SEQUENCER_MIGRATION_ACTION" - -echo "Deploying ArbOS Upgrade action" -# Forge script to deploy the Espresso ArbOS upgrade action. -# ** Essential migration step ** the ArbOS upgrade signifies that the chain is now espresso compatible. -forge script --chain $CHILD_CHAIN_CHAIN_NAME contracts/child-chain/espresso-migration/DeployArbOSUpgradeAction.s.sol:DeployArbOSUpgradeAction --rpc-url $CHILD_CHAIN_RPC_URL --broadcast -vvvv - -# Get the address of the newly deployed upgrade action. -ARBOS_UPGRADE_ACTION=$(cat broadcast/DeployArbOSUpgradeAction.s.sol/412346/run-latest.json | jq -r '.transactions[0].contractAddress') +info "Deployed new EspressoSequencerMigrationAction at $SEQUENCER_MIGRATION_ACTION" -# Echo information for debugging. -echo "Deployed ArbOSUpgradeAction at $ARBOS_UPGRADE_ACTION" - -# Change directories to start nitro node in new docker container with espresso image cd $TESTNODE_DIR -docker stop nitro-testnode-sequencer-1 -docker wait nitro-testnode-sequencer-1 +run docker stop nitro-testnode-sequencer-1 +run docker wait nitro-testnode-sequencer-1 + # Start nitro node in new docker container with espresso image -./espresso-tests/create-espresso-integrated-nitro-node.bash +run ./espresso-tests/create-espresso-integrated-nitro-node.bash # Use cast to call the upgradeExecutor and execute the L1 upgrade actions.This will point the challenge manager at the new OSP entry, as well as update the wasmModuleRoot for the rollup. ** Essential migration step ** -cast send $PARENT_CHAIN_UPGRADE_EXECUTOR "execute(address, bytes)" $SEQUENCER_MIGRATION_ACTION $(cast calldata "perform()") --rpc-url $PARENT_CHAIN_RPC_URL --private-key $PRIVATE_KEY +run cast send $PARENT_CHAIN_UPGRADE_EXECUTOR "execute(address, bytes)" $SEQUENCER_MIGRATION_ACTION $(cast calldata "perform()") --rpc-url $PARENT_CHAIN_RPC_URL --private-key $PRIVATE_KEY -echo "Executed SequencerMigrationAction via UpgradeExecutor" +info "Executed SequencerMigrationAction via UpgradeExecutor" # Get the number of confirmed nodes before the upgrade to ensure the staker is still working. NUM_CONFIRMED_NODES_BEFORE_UPGRADE=$(cast call --rpc-url $PARENT_CHAIN_RPC_URL $ROLLUP_ADDRESS 'latestConfirmed()(uint256)') @@ -113,54 +231,14 @@ NUM_CONFIRMED_NODES_BEFORE_UPGRADE=$(cast call --rpc-url $PARENT_CHAIN_RPC_URL $ # Wait for CHILD_CHAIN_RPC_URL to be available # * Essential migration sub step * This is technically essential to the migration, but doesn't usually take long and shouldn't need to be programmatically determined during a live migration. while ! curl -s $CHILD_CHAIN_RPC_URL > /dev/null; do - echo "Waiting for $CHILD_CHAIN_RPC_URL to be available..." + info "Waiting for $CHILD_CHAIN_RPC_URL to be available..." sleep 5 done -# Echo for debugging -echo "Adding child chain upgrade executor as an L2 chain owner" -# This step is done for the purposes of the test, as there should already be an upgrade executor on the child chain that is a chain owner -cast send 0x0000000000000000000000000000000000000070 'addChainOwner(address)' $CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS --rpc-url $CHILD_CHAIN_RPC_URL --private-key $PRIVATE_KEY - -cd $ORBIT_ACTIONS_DIR -# Grab the pre-upgrade ArbOS version for testing. -ARBOS_VERSION_BEFORE_UPGRADE=$(cast call "0x0000000000000000000000000000000000000064" "arbOSVersion()(uint64)" --rpc-url $CHILD_CHAIN_RPC_URL) - -# Use the Upgrde executor on the child chain to execute the ArbOS upgrade to signify that the node is now operating in espresso mode. This is essential for the migration. -# ** Essential migration step ** This step can technically be done before all of the others as it is just scheduling the ArbOS upgrade. The unix timestamp at which the upgrade occurrs can be determined by operators, but for the purposes of the test we use 0 to upgrade immediately. -cast send $CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS "execute(address, bytes)" $ARBOS_UPGRADE_ACTION $(cast calldata "perform()") --rpc-url $CHILD_CHAIN_RPC_URL --private-key $PRIVATE_KEY -cd $TEST_DIR -# write tee verifier address into chain config -jq -r '.arbitrum.EspressoTEEVerifierAddress |= $ESPRESSO_TEE_VERIFIER_ADDRESS' test-chain-config.json > sent-chain-config.json --arg ESPRESSO_TEE_VERIFIER_ADDRESS $ESPRESSO_TEE_VERIFIER_ADDRESS -CHAIN_CONFIG=$(cat sent-chain-config.json) - -cast send $CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS $(cast calldata "executeCall(address, bytes)" "0x0000000000000000000000000000000000000070" $(cast calldata "setChainConfig(string)" "$CHAIN_CONFIG")) --rpc-url $CHILD_CHAIN_RPC_URL --private-key $PRIVATE_KEY -# Set the chain config - -# Check the upgrade happened - -# Grab the post upgrade ArbOS version. -ARBOS_VERSION_AFTER_UPGRADE=$(cast call "0x0000000000000000000000000000000000000064" "arbOSVersion()(uint64)" --rpc-url $CHILD_CHAIN_RPC_URL) -# Wait to observe the ArbOS version update. (potentially add a timeout or max retry number before failing) -while [ $ARBOS_VERSION_BEFORE_UPGRADE == $ARBOS_VERSION_AFTER_UPGRADE ] -do - sleep 5 - ARBOS_VERSION_AFTER_UPGRADE=$(cast call "0x0000000000000000000000000000000000000064" "arbOSVersion()(uint64)" --rpc-url $CHILD_CHAIN_RPC_URL) -done - -# We are upgrading the ArbOS version to 35 so the expect the return value to be 55 + 35 = 90 -if [ $ARBOS_VERSION_AFTER_UPGRADE != "90" ]; then - fail "ArbOS version not updated: Expected 90, Actual $ARBOS_VERSION_AFTER_UPGRADE" -fi - -# Check for balance before transfer. -# The following sequence is to check that transactions are still successfully being sequenced on the L2 -ORIGINAL_OWNER_BALANCE=$(cast balance $OWNER_ADDRESS -e --rpc-url $CHILD_CHAIN_RPC_URL) - -# Send 1 eth as the owner +info "Testing if the Espresso integration works by doing an Eth transfer." RECIPIENT_ADDRESS=0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BALANCE_ORIG=$(cast balance $RECIPIENT_ADDRESS -e --rpc-url $CHILD_CHAIN_RPC_URL) -cast send $RECIPIENT_ADDRESS --value 1ether --rpc-url $CHILD_CHAIN_RPC_URL --private-key $PRIVATE_KEY +run cast send $RECIPIENT_ADDRESS --value 1ether --rpc-url $CHILD_CHAIN_RPC_URL --private-key $PRIVATE_KEY # Get the new balance after the transfer. BALANCE_NEW=$(cast balance $RECIPIENT_ADDRESS -e --rpc-url $CHILD_CHAIN_RPC_URL) @@ -172,15 +250,20 @@ fi # Echo successful balance update echo "Balance of $RECIPIENT_ADDRESS changed from $BALANCE_ORIG to $BALANCE_NEW" -# Check that the staker is making progress after the upgrade +info Check that the staker is making progress after the upgrade +echo + +START=$SECONDS +echo "Waiting for confirmed nodes." while [ "$NUM_CONFIRMED_NODES_BEFORE_UPGRADE" == "$(cast call --rpc-url $PARENT_CHAIN_RPC_URL $ROLLUP_ADDRESS 'latestConfirmed()(uint256)')" ]; do - echo "Waiting for confirmed nodes ..." sleep 5 + echo "Waited $(( SECONDS - START )) seconds for confirmed nodes." done + # Echo to confirm that stakers are behaving normally. echo "Confirmed nodes have progressed" # Echo to signal that test has been successful echo "Migration successfully completed!" -docker compose down +run docker compose down -v --remove-orphans diff --git a/flake.nix b/flake.nix index 1a367bb5..eb5fdfeb 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,7 @@ packages = with pkgs; [ bashInteractive jq + jnv # interactive JSON filter, useful to search forge broadcast files nodejs yarn openssl # used by test-node.bash diff --git a/orbit-actions b/orbit-actions index c44e3451..e7535cde 160000 --- a/orbit-actions +++ b/orbit-actions @@ -1 +1 @@ -Subproject commit c44e345109976d6cc12828087de5961ae201a785 +Subproject commit e7535cde6891a911dd28adcbb16e4f4bd3a57927