From 7d036e6913f13e16bde8d5dee10e03786b60e506 Mon Sep 17 00:00:00 2001 From: ImJeremyHe Date: Fri, 29 Mar 2024 15:26:07 +0800 Subject: [PATCH] Fix the testnode --- .env | 3 ++- docker-compose.yaml | 19 +++++++++++++++++-- espresso.env | 3 ++- scripts/config.ts | 12 ++++++------ scripts/index.ts | 3 ++- test-node.bash | 12 ++++++------ 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.env b/.env index b1c0e745..70ed3802 100644 --- a/.env +++ b/.env @@ -26,7 +26,8 @@ ESPRESSO_SEQUENCER_L1_USE_LATEST_BLOCK_TAG=true # A special account for `espresso-sequencer`, check `scripts/accounts.ts` for details. ESPRESSO_COMMITMENT_ETH_MNEMONIC="indoor dish desk flag debris potato excuse depart ticket judge file exit" ESPRESSO_SEQUENCER_ETH_MNEMONIC="test test test test test test test test test test test junk" -ESPRESSO_SEQUENCER_HOTSHOT_ACCOUNT_INDEX=6 +ESPRESSO_DEPLOYER_ACCOUNT_INDEX=6 +ESPRESSO_SEQUENCER_HOTSHOT_ACCOUNT_INDEX=$ESPRESSO_DEPLOYER_ACCOUNT_INDEX ESPRESSO_COMMITMENT_TASK_PORT=60000 # Example sequencer demo private keys diff --git a/docker-compose.yaml b/docker-compose.yaml index 27b228a4..17777b00 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -439,11 +439,24 @@ services: geth: condition: service_started + deploy-contracts: + image: ghcr.io/espressosystems/espresso-sequencer/deploy:arbitrum-integrationmusl + environment: + - ESPRESSO_SEQUENCER_ORCHESTRATOR_URL + - ESPRESSO_SEQUENCER_L1_PROVIDER + - ESPRESSO_SEQUENCER_ETH_MNEMONIC=$ESPRESSO_COMMITMENT_ETH_MNEMONIC + - ESPRESSO_DEPLOYER_ACCOUNT_INDEX + - RUST_LOG + - RUST_LOG_FORMAT + - ASYNC_STD_THREAD_COUNT + depends_on: + orchestrator: + condition: service_healthy + commitment-task: image: ghcr.io/espressosystems/espresso-sequencer/commitment-task:arbitrum-integrationmusl ports: - "$ESPRESSO_COMMITMENT_TASK_PORT:$ESPRESSO_COMMITMENT_TASK_PORT" - command: commitment-task --deploy env_file: - espresso.env environment: @@ -452,7 +465,7 @@ services: - ESPRESSO_COMMITMENT_TASK_PORT - ESPRESSO_SEQUENCER_URL - ESPRESSO_SEQUENCER_L1_PROVIDER - - ESPRESSO_SEQUENCER_L1_USE_LATEST_BLOCK_TAG + - ESPRESSO_SEQUENCER_HOTSHOT_ADDRESS - RUST_LOG - RUST_LOG_FORMAT depends_on: @@ -464,6 +477,8 @@ services: condition: service_healthy geth: condition: service_started + deploy-contracts: + condition: service_completed_successfully state-relay-server: image: ghcr.io/espressosystems/espresso-sequencer/state-relay-server:main diff --git a/espresso.env b/espresso.env index 0cec9def..d8839db5 100644 --- a/espresso.env +++ b/espresso.env @@ -1 +1,2 @@ -ESPRESSO_SEQUENCER_HOTSHOT_ADDRESS="0x217788c286797d56cd59af5e493f3699c39cbbe8" +ESPRESSO_SEQUENCER_HOTSHOT_ADDRESS="0x75745a1124de342716a94cbdfdea12f4f93d1b80" +ESPRESSO_SEQUENCER_LIGHT_CLIENT_ADDRESS="0xae05733adeebc16f9e7f377c89b6ac7369fc9b07" diff --git a/scripts/config.ts b/scripts/config.ts index 55c9650b..df8b77ed 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -213,7 +213,9 @@ function writeConfigs(argv: any) { "signing-key": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" }, "wait-for-l1-finality": false - } + }, + "hotshot-url": "", + "light-client-address": "", }, "block-validator": { "validation-server" : { @@ -278,11 +280,7 @@ function writeConfigs(argv: any) { validatorConfig.node.staker["use-smart-contract-wallet"] = true if (argv.espresso) { validatorConfig.node["block-validator"]["espresso"] = true - // If we don't quote the address it is interpreted as a Number. - // The quotes however stick around and make it an invalid address. - // Remove the double quote from the hotshot address. - // There has to be a better way. - validatorConfig.node["block-validator"]["hotshot-address"] = argv["hotshot-address"].replace(/^"(.+(?="$))"$/, '$1') + validatorConfig.node["block-validator"]["hotshot-address"] = argv.hotshotAddress validatorConfig.node["block-validator"]["dangerous"]["reset-block-validation"] = true } let validconfJSON = JSON.stringify(validatorConfig) @@ -311,6 +309,8 @@ function writeConfigs(argv: any) { let posterConfig = JSON.parse(baseConfJSON) if (argv.espresso) { posterConfig.node.feed.input.url.push("ws://sequencer:9642") + posterConfig.node["batch-poster"]["hotshot-url"] = argv.espressoUrl + posterConfig.node["batch-poster"]["light-client-address"] = argv.lightClientAddress } else { posterConfig.node["seq-coordinator"].enable = true } diff --git a/scripts/index.ts b/scripts/index.ts index 6addce48..102456f4 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -34,7 +34,8 @@ async function main() { .options({ espresso: { boolean: true, decription: 'use Espresso Sequencer for sequencing and DA', default: false }, espressoUrl: { string: true, description: 'Espresso Sequencer url', default: 'http://espresso-sequencer0:50000' }, - hotshotAddress: { sring: true, description: 'address of the HotShot contract', default: '' } + hotshotAddress: { string: true, description: 'address of the HotShot contract', default: '' }, + lightClientAddress: { string: true, description: 'address of the light client contract', default: ''}, }) .command(bridgeFundsCommand) .command(bridgeToL3Command) diff --git a/test-node.bash b/test-node.bash index 4abc69c6..7dbb467e 100755 --- a/test-node.bash +++ b/test-node.bash @@ -32,7 +32,8 @@ tokenbridge=false l3node=false consensusclient=false redundantsequencers=0 -hotShotAddr=0x217788c286797d56cd59af5e493f3699c39cbbe8 +hotShotAddr=0x75745a1124de342716a94cbdfdea12f4f93d1b80 +lightClientAddr=0xae05733adeebc16f9e7f377c89b6ac7369fc9b07 dev_build_nitro=false dev_build_blockscout=false espresso=false @@ -361,10 +362,9 @@ if $force_init; then if $espresso; then echo == Deploying Espresso Contract - echo "" > espresso.env - docker compose up -d commitment-task espresso-sequencer0 espresso-sequencer1 --wait - hotShotAddr=`curl http://localhost:60000/api/hotshot_contract` - echo "ESPRESSO_SEQUENCER_HOTSHOT_ADDRESS=$hotShotAddr" > espresso.env + docker compose up -d commitment-task deploy-contracts espresso-sequencer0 espresso-sequencer1 --wait + addr=`curl http://localhost:60000/api/hotshot_contract` + echo $addr fi sequenceraddress=`docker compose run scripts print-address --account sequencer | tail -n 1 | tr -d '\r\n'` @@ -378,7 +378,7 @@ if $force_init; then docker compose run scripts write-config --simple else echo == Writing configs - docker compose run scripts write-config --espresso $espresso --hotshot-address $hotShotAddr + docker compose run scripts write-config --espresso $espresso --hotshot-address $hotShotAddr --light-client-address $lightClientAddr echo == Initializing redis docker compose up --wait redis