From 4e58e661262a05f9f6ebd57ed4720980a80e0096 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Sun, 24 Nov 2024 17:10:46 -0500 Subject: [PATCH 1/4] Celestia integration --- .github/workflows/smoke-test.yml | 11 +---------- rollupcreator/Dockerfile | 7 +++---- scripts/config.ts | 28 +--------------------------- test-node.bash | 4 ++-- 4 files changed, 7 insertions(+), 43 deletions(-) diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 5031cae6..fbd5ac21 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -18,16 +18,7 @@ jobs: smoke_test: strategy: matrix: - test-script: - [ - ./smoke-test.bash, - ./smoke-test-l3.bash, - ./smoke-test-nitro-simple.bash, - ./smoke-test-full-node.bash, - ./smoke-test-espresso-finality-node.bash, - ./smoke-test-altlayer.bash, - ./smoke-test-caldera.bash, - ] + test-script: [./smoke-test.bash, ./smoke-test-l3.bash] runs-on: ubuntu-24.04 diff --git a/rollupcreator/Dockerfile b/rollupcreator/Dockerfile index 3ae9349e..fe3ea472 100644 --- a/rollupcreator/Dockerfile +++ b/rollupcreator/Dockerfile @@ -1,11 +1,10 @@ FROM node:18-bullseye-slim -ARG NITRO_CONTRACTS_BRANCH=main -ARG NITRO_CONTRACTS_REPO=https://github.com/OffchainLabs/nitro-contracts.git +ARG NITRO_CONTRACTS_BRANCH=celestia-integration +ARG NITRO_CONTRACTS_REPO=https://github.com/EspressoSystems/nitro-contracts.git RUN apt-get update && \ apt-get install -y git docker.io python3 build-essential curl jq WORKDIR /workspace -RUN git clone --no-checkout ${NITRO_CONTRACTS_REPO} ./ -RUN git checkout ${NITRO_CONTRACTS_BRANCH} +RUN git clone --branch ${NITRO_CONTRACTS_BRANCH} --recurse-submodules ${NITRO_CONTRACTS_REPO} ./ RUN curl -L https://foundry.paradigm.xyz | bash ENV PATH="${PATH}:/root/.foundry/bin" RUN foundryup diff --git a/scripts/config.ts b/scripts/config.ts index 81b06507..8daa93c1 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -246,7 +246,7 @@ function writeConfigs(argv: any) { url: argv.validationNodeUrl, jwtsecret: valJwtSecret, }, - "dangerous": {"reset-block-validation": false}, + dangerous: { "reset-block-validation": false }, }, feed: { input: { @@ -292,15 +292,8 @@ function writeConfigs(argv: any) { if (argv.espresso) { let config = baseConfig as any; - config.node["block-validator"]["espresso"] = false; - config.node["block-validator"]["light-client-address"] = ""; config.node["batch-poster"]["hotshot-url"] = ""; config.node["batch-poster"]["light-client-address"] = ""; - config.node["transaction-streamer"] = { - "sovereign-sequencer-enabled": false, - "hotshot-url": "", - "espresso-namespace": 412346, - }; } baseConfig.node["data-availability"]["sequencer-inbox-address"] = @@ -318,12 +311,6 @@ function writeConfigs(argv: any) { simpleConfig.node["delayed-sequencer"].enable = true; simpleConfig.node["batch-poster"].enable = true; simpleConfig.node["batch-poster"]["redis-url"] = ""; - if (argv.espresso) { - simpleConfig.node["transaction-streamer"]["hotshot-url"] = - argv.espressoUrl; - simpleConfig.node["transaction-streamer"]["sovereign-sequencer-enabled"] = - true; - } simpleConfig.execution["sequencer"].enable = true; if (argv.anytrust) { @@ -334,9 +321,6 @@ function writeConfigs(argv: any) { simpleConfig.node["batch-poster"]["hotshot-url"] = argv.espressoUrl; simpleConfig.node["batch-poster"]["light-client-address"] = argv.lightClientAddress; - simpleConfig.node["block-validator"]["espresso"] = true; - simpleConfig.node["block-validator"]["light-client-address"] = - argv.lightClientAddress; simpleConfig.node["block-validator"]["dangerous"][ "reset-block-validation" ] = true; @@ -386,9 +370,6 @@ function writeConfigs(argv: any) { validatorConfig.node.staker.enable = true; validatorConfig.node.staker["use-smart-contract-wallet"] = true; if (argv.espresso) { - validatorConfig.node["block-validator"]["espresso"] = true; - validatorConfig.node["block-validator"]["light-client-address"] = - argv.lightClientAddress; validatorConfig.node["block-validator"]["dangerous"][ "reset-block-validation" ] = true; @@ -412,7 +393,6 @@ function writeConfigs(argv: any) { sequencerConfig.node["delayed-sequencer"].enable = true; if (argv.espresso) { - sequencerConfig.execution.sequencer["enable-espresso-sovereign"] = true; sequencerConfig.node.feed.output.enable = true; sequencerConfig.node.dangerous["no-sequencer-coordinator"] = true; } else { @@ -422,7 +402,6 @@ function writeConfigs(argv: any) { if (argv.espresso && argv.enableEspressoFinalityNode) { sequencerConfig.execution.sequencer["enable-espresso-finality-node"] = true; - sequencerConfig.execution.sequencer["enable-espresso-sovereign"] = false; sequencerConfig.execution.sequencer["espresso-finality-node-config"] = { "hotshot-url": argv.espressoUrl, "start-block": 0, @@ -445,10 +424,6 @@ function writeConfigs(argv: any) { posterConfig.node["batch-poster"]["hotshot-url"] = argv.espressoUrl; posterConfig.node["batch-poster"]["light-client-address"] = argv.lightClientAddress; - posterConfig.node["transaction-streamer"]["hotshot-url"] = - argv.espressoUrl; - posterConfig.node["transaction-streamer"]["sovereign-sequencer-enabled"] = - true; } else { posterConfig.node["seq-coordinator"].enable = true; } @@ -481,7 +456,6 @@ function writeConfigs(argv: any) { l3Config.node["batch-poster"].enable = true; l3Config.node["batch-poster"]["redis-url"] = ""; if (argv.espresso) { - l3Config.execution.sequencer["enable-espresso-sovereign"] = true; l3Config.node.feed.output.enable = true; l3Config.node.dangerous["no-sequencer-coordinator"] = true; } diff --git a/test-node.bash b/test-node.bash index 897e0ab1..0bc211f9 100755 --- a/test-node.bash +++ b/test-node.bash @@ -10,7 +10,7 @@ BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 DEFAULT_NITRO_CONTRACTS_VERSION="99c07a7db2fcce75b751c5a2bd4936e898cda065" DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.2" -ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:latest +ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:celestia-integration # Set default versions if not overriden by provided env vars : ${NITRO_CONTRACTS_REPO:=$DEFAULT_NITRO_CONTRACTS_REPO} @@ -317,7 +317,7 @@ done if $espresso; then NITRO_CONTRACTS_REPO=https://github.com/EspressoSystems/nitro-contracts.git - NITRO_CONTRACTS_BRANCH=develop + NITRO_CONTRACTS_BRANCH=celestia-integration export NITRO_CONTRACTS_REPO export NITRO_CONTRACTS_BRANCH echo "Running espresso mode" From 07c4d3eaae5ea1ed7cf6882ccbd5ea0b2bc30f64 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Sun, 24 Nov 2024 18:08:18 -0500 Subject: [PATCH 2/4] Remove l3 smoke test --- .github/workflows/smoke-test.yml | 2 +- ngrok.yml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 ngrok.yml diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index fbd5ac21..ca478af9 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -18,7 +18,7 @@ jobs: smoke_test: strategy: matrix: - test-script: [./smoke-test.bash, ./smoke-test-l3.bash] + test-script: [./smoke-test.bash] runs-on: ubuntu-24.04 diff --git a/ngrok.yml b/ngrok.yml new file mode 100644 index 00000000..5b118d91 --- /dev/null +++ b/ngrok.yml @@ -0,0 +1,19 @@ +version: 3 +agent: + authtoken: 4WbBxrSPTeyFPqqttL3oJ_26L6T88VKRJxfukSamH8D +tunnels: + tunnel1: + addr: 127.0.0.1:8546 + proto: http + schemes: + - http + tunnel2: + addr: 127.0.0.1:41000 + proto: http + schemes: + - http + tunnel3: + addr: 127.0.0.1:9642 + proto: http + schemes: + - http From cff153e6e42def7bac6fdaa3457a3a5a33ea6d64 Mon Sep 17 00:00:00 2001 From: ImJeremyHe Date: Mon, 2 Dec 2024 15:22:46 +0800 Subject: [PATCH 3/4] Fix the batch poster In this commit, a dummy TEE Verifier address is being used, we will use a correct one later --- scripts/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index 8daa93c1..318336b0 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -523,8 +523,8 @@ function writeL2ChainConfig(argv: any) { }; if (argv.espresso) { let chainConfig = l2ChainConfig as any; - chainConfig.arbitrum["EnableEspresso"] = true; - chainConfig["espresso"] = true; + chainConfig.arbitrum["EspressoTEEVerifierAddress"] = + "0x5eCF728ffC5C5E802091875f96281B5aeECf6C49"; } const l2ChainConfigJSON = JSON.stringify(l2ChainConfig); fs.writeFileSync( From 947fb4483e5f260cb3a4a8609f95bfd0a8888a6f Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Wed, 4 Dec 2024 13:08:12 -0500 Subject: [PATCH 4/4] Update migration test for TEE integration (#73) * Update migration test for TEE integration This commit updates the migration-test.bash script to reflect the new migration flow for the TEE integration. It also adds some utility scripts and updates some exsisting example files to assist in the migration test. * Remove changes to docker-compose.yml * Respond to review feedback --- .github/workflows/ci.yml | 2 +- docker-compose.yaml | 4 - espresso-tests/.env | 15 +-- espresso-tests/DeployMockVerifier.s.sol | 14 +++ ...create-espresso-integrated-nitro-node.bash | 2 +- espresso-tests/migration-test.bash | 92 ++++++++++--------- espresso-tests/test-chain-config.json | 29 ++++++ rollupcreator/Dockerfile | 2 + scripts/index.ts | 1 + 9 files changed, 104 insertions(+), 57 deletions(-) create mode 100644 espresso-tests/DeployMockVerifier.s.sol create mode 100644 espresso-tests/test-chain-config.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd2eb2a4..a77da3c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: jobs: build_and_run: - runs-on: ubuntu-8 + runs-on: ubuntu-latest strategy: matrix: pos: [pos, no-pos] diff --git a/docker-compose.yaml b/docker-compose.yaml index d2d828e0..e73f6d89 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,8 +15,6 @@ services: bin/blockscout eval "Elixir.Explorer.ReleaseTasks.create_and_migrate()" node init/install.js postgres 5432 bin/blockscout start - extra_hosts: - - "host.docker.internal:host-gateway" env_file: - ./blockscout/nitro.env environment: @@ -444,8 +442,6 @@ services: timeout: 10s retries: 5 start_period: 40s - extra_hosts: - - "host.docker.internal:host-gateway" # Reads from sequencer feed, forwards transactions to sequencer full-node: diff --git a/espresso-tests/.env b/espresso-tests/.env index 9cb0f2bc..0787e2d7 100644 --- a/espresso-tests/.env +++ b/espresso-tests/.env @@ -6,18 +6,19 @@ 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 -HOTSHOT_ADDRESS="0xb6eb235fa509e3206f959761d11e3777e16d0e98" PARENT_CHAIN_UPGRADE_EXECUTOR="0x513D9F96d4D0563DEbae8a0DC307ea0E46b10ed7" CHILD_CHAIN_UPGRADE_EXUCTOR_ADDRESS="0xD59870177729b1Fa7CCdA1d2E245C57C6ad5F9F6" # Environment variables for osp migration action contract -CURRENT_OSP_ENTRY="0x9C2eD9F57D053FDfAEcBF1B6Dfd7C97e2e340B84" ROLLUP_ADDRESS="0x0DFDF1473B14D2330A40F6a42bb6d601DD121E6b" -PROXY_ADMIN="0x2A1f38c9097e7883570e0b02BFBE6869Cc25d8a3" +PROXY_ADMIN_ADDRESS="0x2A1f38c9097e7883570e0b02BFBE6869Cc25d8a3" # Environment variables for ArbOS upgrade action. UPGRADE_TIMESTAMP="1723664126" -NEW_WASM_MODULE_ROOT="0x2422802a7cda99737209430b103689205bc8e56eab8b08c6ad409e65e45c3145" -CURRENT_WASM_MODULE_ROOT="0xbc1026ff45c20ea97e9e6057224a5668ea78d8f885c9b14fc849238e8ef5c5dc" +# 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" -#Environment variables used in test assertions -CHALLENGE_MANAGER_ADDRESS="0x784FC11476F3d06801A76b944795E6367391b12e" +MAX_DATA_SIZE="117964" +OLD_BATCH_POSTER_ADDRESS="0xe2148eE53c0755215Df69b2616E552154EdC584f" +NEW_BATCH_POSTER_ADDRESS="0xe2148eE53c0755215Df69b2616E552154EdC584f" +BATCH_POSTER_MANAGER_ADDRESS="0xe2148eE53c0755215Df69b2616E552154EdC584f" diff --git a/espresso-tests/DeployMockVerifier.s.sol b/espresso-tests/DeployMockVerifier.s.sol new file mode 100644 index 00000000..cdc60a11 --- /dev/null +++ b/espresso-tests/DeployMockVerifier.s.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.9; + +import "forge-std/Script.sol"; +import "nitro-contracts/mocks/EspressoTEEVerifier.sol"; + +contract DeployMockVerifier is Script { + function run() external { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + vm.startBroadcast(deployerPrivateKey); + EspressoTEEVerifierMock mockVerifier = new EspressoTEEVerifierMock(); + vm.stopBroadcast(); + } +} diff --git a/espresso-tests/create-espresso-integrated-nitro-node.bash b/espresso-tests/create-espresso-integrated-nitro-node.bash index 3670c7c1..c8a73bc9 100755 --- a/espresso-tests/create-espresso-integrated-nitro-node.bash +++ b/espresso-tests/create-espresso-integrated-nitro-node.bash @@ -2,7 +2,7 @@ set -euo pipefail set -x # print each command before executing it, for debugging -ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:integration +ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:celestia-integration lightClientAddr=0xb6eb235fa509e3206f959761d11e3777e16d0e98 espresso=true simpleWithValidator=false diff --git a/espresso-tests/migration-test.bash b/espresso-tests/migration-test.bash index b2da49f7..a390e47a 100755 --- a/espresso-tests/migration-test.bash +++ b/espresso-tests/migration-test.bash @@ -19,23 +19,24 @@ ORBIT_ACTIONS_DIR="$TESTNODE_DIR/orbit-actions" cd "$ORBIT_ACTIONS_DIR" git submodule update --init +forge update yarn # 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 +./test-node.bash --simple --init-force --tokenbridge --detach --no-build-utils # 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 # Export environment variables in .env file -# A similar env file should be supplied for whatever +# A similar env file should be supplied for whatever . "$TEST_DIR/.env" # 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. +#* 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') # A convoluted way to get the address of the child chain upgrade executor, maybe there's a better way? @@ -50,51 +51,64 @@ CHILD_CHAIN_UPGRADE_EXECUTOR_ADDRESS=$(cast call $L1_TOKEN_BRIDGE_CREATOR_ADDRES 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')" -# Echo for debug -echo "Deploying Espresso Osp" -# Change directory to orbit actions dir for the following commands. cd $ORBIT_ACTIONS_DIR -# ** Essential migration step ** Forge script to deploy new OSP entry. We do this to later point the rollups challenge manager to the espresso integrated OSP. -forge script --chain $PARENT_CHAIN_CHAIN_ID contracts/parent-chain/espresso-migration/DeployEspressoOsp.s.sol:DeployEspressoOsp --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv +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 + +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 + +# Echo for debug +echo "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 contracts/parent-chain/espresso-migration/DeployAndInitEspressoSequencerInbox.s.sol:DeployAndInitEspressoSequencerInbox --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv # 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_OSP_ENTRY=$(cat broadcast/DeployEspressoOsp.s.sol/1337/run-latest.json | jq -r '.transactions[4].contractAddress'| cast to-checksum) - +NEW_SEQUENCER_INBOX_IMPL_ADDRESS=$(cat broadcast/DeployAndInitEspressoSequencerInbox.s.sol/1337/run-latest.json | jq -r '.transactions[0].contractAddress'| cast to-checksum) # Echo for debugging. -echo "Deployed new OspEntry at $NEW_OSP_ENTRY" +echo "Deployed new SequencerInbox at $NEW_SEQUENCER_INBOX_IMPL_ADDRESS" # Echo for debug -echo "Deploying Espresso Osp migration action" +echo "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/DeployEspressoOspMigrationAction.s.sol --rpc-url $PARENT_CHAIN_RPC_URL --broadcast -vvvv +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. -OSP_MIGRATION_ACTION=$(cat broadcast/DeployEspressoOspMigrationAction.s.sol/1337/run-latest.json | jq -r '.transactions[0].contractAddress') +SEQUENCER_MIGRATION_ACTION=$(cat broadcast/DeployEspressoSequencerMigrationAction.s.sol/1337/run-latest.json | jq -r '.transactions[0].contractAddress' | cast to-checksum) -echo "Deployed new OspMigrationAction at $OSP_MIGRATION_ACTION" +echo "Deployed new EspressoSequencerMigrationAction at $SEQUENCER_MIGRATION_ACTION" -# 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)" $OSP_MIGRATION_ACTION $(cast calldata "perform()") --rpc-url $PARENT_CHAIN_RPC_URL --private-key $PRIVATE_KEY - -echo "Executed OspMigrationAction via UpgradeExecutor" +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 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)') -# Shutdown nitro node +# 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') -# This is part of the migration but the mechanics of this can be left up to operators. -# ** Essential migration step ** The previous sequencer that is not compatible with espresso must be shut down so that we can start a new sequencer node that can have it's ArbOS version updated to signify the upgrade has occurred. -docker stop nitro-testnode-sequencer-1 +# 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 # Start nitro node in new docker container with espresso image ./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 + +echo "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)') + # 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 programatically determined during a live migration. @@ -108,25 +122,20 @@ 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 -echo "Deploying ArbOS Upgrade action" - cd $ORBIT_ACTIONS_DIR -# 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/arbos-upgrade/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') - -# Echo information for debugging. -echo "Deployed ArbOSUpgradeAction at $ARBOS_UPGRADE_ACTION" - # 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 @@ -144,11 +153,6 @@ if [ $ARBOS_VERSION_AFTER_UPGRADE != "90" ]; then fail "ArbOS version not updated: Expected 90, Actual $ARBOS_VERSION_AFTER_UPGRADE" fi -# Test for new OSP address -CHALLENGE_MANAGER_OSP_ADDRESS=$(cast call $CHALLENGE_MANAGER_ADDRESS "osp()(address)" --rpc-url $PARENT_CHAIN_RPC_URL) -if [ $NEW_OSP_ENTRY != $CHALLENGE_MANAGER_OSP_ADDRESS ]; then - fail "OSP has not been set to newly deployed OSP: \n Newly deployed: $NEW_OSP_ENTRY \n Currently set OSP: $CHALLENGE_MANAGER_OSP_ADDRESS" -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) diff --git a/espresso-tests/test-chain-config.json b/espresso-tests/test-chain-config.json new file mode 100644 index 00000000..44cfdb4d --- /dev/null +++ b/espresso-tests/test-chain-config.json @@ -0,0 +1,29 @@ +{ + "chainId":412346, + "homesteadBlock":0, + "daoForkSupport":true, + "eip150Block":0, + "eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000", + "eip155Block":0, + "eip158Block":0, + "byzantiumBlock":0, + "constantinopleBlock":0, + "petersburgBlock":0, + "istanbulBlock":0, + "muirGlacierBlock":0, + "berlinBlock":0, + "londonBlock":0, + "clique":{ + "period":0, + "epoch":0 + }, + "arbitrum":{ + "EnableArbOS":true, + "AllowDebugPrecompiles":true, + "DataAvailabilityCommittee":false, + "InitialArbOSVersion":30, + "InitialChainOwner":"0x5E1497dD1f08C87b2d8FE23e9AAB6c1De833D927", + "GenesisBlockNum":0, + "EspressoTEEVerifierAddress": "0x0" + } +} diff --git a/rollupcreator/Dockerfile b/rollupcreator/Dockerfile index fe3ea472..90632886 100644 --- a/rollupcreator/Dockerfile +++ b/rollupcreator/Dockerfile @@ -8,6 +8,8 @@ RUN git clone --branch ${NITRO_CONTRACTS_BRANCH} --recurse-submodules ${NITRO_CO RUN curl -L https://foundry.paradigm.xyz | bash ENV PATH="${PATH}:/root/.foundry/bin" RUN foundryup +RUN forge update lib/forge-std +RUN git submodule update --init --recursive RUN touch scripts/config.ts RUN yarn install RUN yarn build:all diff --git a/scripts/index.ts b/scripts/index.ts index 59e03d96..e63b38ae 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -41,6 +41,7 @@ async function main() { espressoUrl: { string: true, description: 'Espresso Sequencer url', default: 'http://espresso-dev-node:41000' }, lightClientAddress: { string: true, description: 'address of the light client contract', default: ''}, enableEspressoFinalityNode: {boolean: true, description: 'enable finality node', default: false}, + simpleWithValidator: {boolean: true, description: 'start a simple node that validates', default: false}, }) .command(bridgeFundsCommand) .command(bridgeToL3Command)