Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix migration test #81

Merged
merged 22 commits into from
Jan 23, 2025
Merged

fix migration test #81

merged 22 commits into from
Jan 23, 2025

Conversation

tbro
Copy link

@tbro tbro commented Jan 21, 2025

Migration test fixes and improvements.

  • Fixes naming of DeployAndInitEspressoSequencerInbox
  • adds readability and reliability improvements to migration-test script
  • adds a migration CI workflow

sveitser and others added 14 commits January 22, 2025 14:14
- Rename deploy script used in test to `...ForTest`.
- Add missing variable `IS_REVERT` to .env file.
- Remove most logs because they are noisy but keep them if DEBUG=true,
  use DEBUG=true in CI.
- Remove repeated calls to `forge update`.
- Recursively init submodules to make sure we have submodules of
  submodules.
- Print out how long we are waiting for confirmed nodes.
- Output environment variables we are setting.
- Hide docker compose warnings due to orphan containers. These warnings
  show up a lot because of the ephemeral script containers.
This reverts commit b9e0c81.
@sveitser
Copy link
Collaborator

@tbro, Jeremy fixed the test it was broken due to my accidental change to one of the scripts used.

@sveitser
Copy link
Collaborator

@ImJeremyHe @zacshowa @Sneh1999 this should be ready for review.

@sveitser
Copy link
Collaborator

The test output (without DEBUG=true) looks like this now

$  espresso-tests/migration-test.bash                                                                                                                    6.035s  tb/fix_migration-test  ❄  13:42:51
# Ensuring docker compose project is stopped
>>> docker compose down -v --remove-orphans
Volume nitro-testnode_validator-data  Removed
>>> cd /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode/orbit-actions

# Ensuring submodules are checked out
>>> git submodule update --init --recursive

# Ensuring nodejs dependencies are installed
>>> yarn
Done in 8.24s.
# Ensuring we can compile the migration smart contracts
>>> forge build
No files changed, compilation skipped
>>> cd /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode

# Deploying a vanilla Nitro stack locally, to be migrated to Espresso later.
>>> ./test-node.bash --simple --init-force --tokenbridge --detach --no-build-utils

# This command starts up an entire Nitro stack. It takes a long time.
# Run `tail -f /tmp/nitro-test-node-logs-itbad6XA` to see logs, if necessary.

# Starting a local Espresso confirmation layer development node
>>> docker compose up espresso-dev-node --detach

# Run `tail -f /tmp/espresso-dev-node-logs-oowedfBf` to see logs, if necessary.

# Load environment variables in /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode/espresso-tests/.env
>>> . /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode/espresso-tests/.env


# Loaded env vars:

    # Environment variables for chain name and rpc_url
    # These are essential for the upgrade
    PARENT_CHAIN_CHAIN_ID="1337"
    CHILD_CHAIN_CHAIN_NAME="412346"
    PARENT_CHAIN_RPC_URL="http://localhost:8545"
    CHILD_CHAIN_RPC_URL="http://localhost:8547"
    # Environment variables for new OSP deployment
    # These are essential for the upgrade
    PARENT_CHAIN_UPGRADE_EXECUTOR="0x513D9F96d4D0563DEbae8a0DC307ea0E46b10ed7"
    CHILD_CHAIN_UPGRADE_EXUCTOR_ADDRESS="0xD59870177729b1Fa7CCdA1d2E245C57C6ad5F9F6"
    # Environment variables for osp migration action contract
    ROLLUP_ADDRESS="0x0DFDF1473B14D2330A40F6a42bb6d601DD121E6b"
    PROXY_ADMIN_ADDRESS="0x2A1f38c9097e7883570e0b02BFBE6869Cc25d8a3"
    # Environment variables for ArbOS upgrade action.
    UPGRADE_TIMESTAMP="1723664126"

    # The reader addr is only important if the parent chain is not an arbitrum chain, this is important for the batch poster.
    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"
    BATCH_POSTER_MANAGER_ADDRESS="0xe2148eE53c0755215Df69b2616E552154EdC584f"

declare -x ROLLUP_ADDRESS="0x7d98BA231d29D5C202981542C0291718A7358c63"
declare -x INBOX_ADDRESS="0x9f8c1c641336A371031499e3c362e40d58d0f254"
declare -x L1_TOKEN_BRIDGE_CREATOR_ADDRESS="0x3DF948c956e14175f43670407d5796b95Bb219D8"
declare -x CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS="0xD59870177729b1Fa7CCdA1d2E245C57C6ad5F9F6"
declare -x PRIVATE_KEY="0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36"
declare -x OWNER_ADDRESS="0x5E1497dD1f08C87b2d8FE23e9AAB6c1De833D927"
>>> cd /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode/orbit-actions

# Deploying mock espresso TEE verifier
>>> forge script --chain 1337 ../espresso-tests/DeployMockVerifier.s.sol:DeployMockVerifier --rpc-url http://localhost:8545 --broadcast -vvvv

declare -x ESPRESSO_TEE_VERIFIER_ADDRESS="0xBcDcAD01Fc0559688e082DC3Dfe198238636dF43"
# Deploying and initializing Espresso SequencerInbox
>>> forge script --chain 1337 ../espresso-tests/DeployAndInitEspressoSequencerInboxForTest.s.sol:DeployAndInitEspressoSequencerInbox --rpc-url http://localhost:8545 --broadcast -vvvv --skip-simulation

declare -x NEW_SEQUENCER_INBOX_IMPL_ADDRESS="0x165155D6aBB370Cb10ad1bF835e723F662d51C86"
# Deployed new SequencerInbox at 0x165155D6aBB370Cb10ad1bF835e723F662d51C86
# Deploying Espresso SequencerInbox migration action
>>> forge script --chain 1337 contracts/parent-chain/espresso-migration/DeployEspressoSequencerMigrationAction.s.sol:DeployEspressoSequencerMigrationAction --rpc-url http://localhost:8545 --broadcast -vvvv

declare -x SEQUENCER_MIGRATION_ACTION="0x43202b1afae6c0c2B2a04dA9030434D73579A0FF"
# Deployed new EspressoSequencerMigrationAction at 0x43202b1afae6c0c2B2a04dA9030434D73579A0FF
# Deploying ArbOS Upgrade action
>>> forge script --chain 412346 contracts/child-chain/espresso-migration/DeployArbOSUpgradeAction.s.sol:DeployArbOSUpgradeAction --rpc-url http://localhost:8547 --broadcast -vvvv

declare -x ARBOS_UPGRADE_ACTION="0x4e5b65fb12d4165e22f5861d97a33ba45c006114"
# Deployed ArbOSUpgradeAction at 0x4e5b65fb12d4165e22f5861d97a33ba45c006114
>>> cd /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode

>>> docker stop nitro-testnode-sequencer-1
nitro-testnode-sequencer-1
>>> docker wait nitro-testnode-sequencer-1
0
>>> ./espresso-tests/create-espresso-integrated-nitro-node.bash
Container nitro-testnode-sequencer-on-espresso-1  Started
>>> cast send 0x513D9F96d4D0563DEbae8a0DC307ea0E46b10ed7 execute(address, bytes) 0x43202b1afae6c0c2B2a04dA9030434D73579A0FF 0xb147f40c --rpc-url http://localhost:8545 --private-key 0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36
to                      0x513D9F96d4D0563DEbae8a0DC307ea0E46b10ed7
# Executed SequencerMigrationAction via UpgradeExecutor
# Adding child chain upgrade executor as an L2 chain owner
>>> cast send 0x0000000000000000000000000000000000000070 addChainOwner(address) 0xD59870177729b1Fa7CCdA1d2E245C57C6ad5F9F6 --rpc-url http://localhost:8547 --private-key 0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36
l1BlockNumber             "0x158"
>>> cd /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode/orbit-actions

>>> cast send 0xD59870177729b1Fa7CCdA1d2E245C57C6ad5F9F6 execute(address, bytes) 0x4e5b65fb12d4165e22f5861d97a33ba45c006114 0xb147f40c --rpc-url http://localhost:8547 --private-key 0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36
l1BlockNumber             "0x158"
>>> cd /home/lulu/r/EspressoSystems/nitro-espresso-integration/nitro-testnode/espresso-tests

>>> cast send 0xD59870177729b1Fa7CCdA1d2E245C57C6ad5F9F6 0xbca8c7b5000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000344eda73212000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002f77b0a202022636861696e4964223a203431323334362c0a202022686f6d657374656164426c6f636b223a20302c0a20202264616f466f726b537570706f7274223a20747275652c0a202022656970313530426c6f636b223a20302c0a20202265697031353048617368223a2022307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030222c0a202022656970313535426c6f636b223a20302c0a202022656970313538426c6f636b223a20302c0a20202262797a616e7469756d426c6f636b223a20302c0a202022636f6e7374616e74696e6f706c65426c6f636b223a20302c0a20202270657465727362757267426c6f636b223a20302c0a202022697374616e62756c426c6f636b223a20302c0a2020226d756972476c6163696572426c6f636b223a20302c0a2020226265726c696e426c6f636b223a20302c0a2020226c6f6e646f6e426c6f636b223a20302c0a202022636c69717565223a207b0a2020202022706572696f64223a20302c0a202020202265706f6368223a20300a20207d2c0a202022617262697472756d223a207b0a2020202022456e61626c654172624f53223a20747275652c0a2020202022416c6c6f774465627567507265636f6d70696c6573223a20747275652c0a202020202244617461417661696c6162696c697479436f6d6d6974746565223a2066616c73652c0a2020202022496e697469616c4172624f5356657273696f6e223a2033302c0a2020202022496e697469616c436861696e4f776e6572223a2022307835453134393764443166303843383762326438464532336539414142366331446538333344393237222c0a202020202247656e65736973426c6f636b4e756d223a20302c0a2020202022457370726573736f544545566572696669657241646472657373223a2022307842634463414430314663303535393638386530383244433344666531393832333836333664463433220a20207d0a7d00000000000000000000000000000000000000000000000000000000000000000000000000 --rpc-url http://localhost:8547 --private-key 0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36
l1BlockNumber             "0x158"
# Check the ArbOS upgrade happened
# Testing if the Espresso integration works by doing an Eth transfer.
>>> cast send 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --value 1ether --rpc-url http://localhost:8547 --private-key 0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36
l1BlockNumber             "0x158"
Balance of 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA changed from 0.000000000000000000 to 1.000000000000000000
# Check that the staker is making progress after the upgrade

Waiting for confirmed nodes.
Waited 5 seconds for confirmed nodes.
Waited 10 seconds for confirmed nodes.
Confirmed nodes have progressed
Migration successfully completed!

Copy link
Member

@zacshowa zacshowa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment on lines +23 to +79
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
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love these improvements!

@tbro tbro merged commit b593254 into integration Jan 23, 2025
8 of 9 checks passed
Copy link

Backport failed for celestia-integration, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin celestia-integration
git worktree add -d .worktree/backport-81-to-celestia-integration origin/celestia-integration
cd .worktree/backport-81-to-celestia-integration
git switch --create backport-81-to-celestia-integration
git cherry-pick -x b5932549a1461557bb6e1eba27280ac0605ef50a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants