Skip to content

Commit

Permalink
Merge branch 'integration' of github.com:EspressoSystems/nitro-testno…
Browse files Browse the repository at this point in the history
…de into set-chain-config
  • Loading branch information
zacshowa committed Oct 23, 2024
2 parents 5a6d2dc + b33fc8d commit f3a9475
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 7 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'integration/')}}


jobs:
smoke_test:

strategy:
matrix:
test-script: [ ./smoke-test.bash, ./smoke-test-l3.bash, ./smoke-test-nitro-simple.bash, ./smoke-test-full-node.bash ]
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,
]

runs-on: ubuntu-24.04

Expand All @@ -30,6 +35,15 @@ jobs:
with:
submodules: recursive

# Install wscat for finality node smoke test to listen to sequencer feed
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install wscat
run: npm install -g wscat

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ services:
depends_on:
- geth

sequencer-espresso-finality:
pid: host # allow debugging
image: nitro-node-dev-testnode
entrypoint: /usr/local/bin/nitro
ports:
- "127.0.0.1:8549:8547"
- "127.0.0.1:8550:8548"
- "127.0.0.1:9645:9642"
volumes:
- "seqdata_espresso_finality:/home/user/.arbitrum/local/nitro"
- "l1keystore:/home/user/l1keystore"
- "config:/config"
- "tokenbridge-data:/tokenbridge-data"
command: --conf.file /config/espresso_finality_sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain *
depends_on:
- geth

sequencer_b:
pid: host # allow debugging
image: nitro-node-dev-testnode
Expand Down Expand Up @@ -451,6 +468,7 @@ volumes:
seqdata_b:
seqdata_c:
seqdata_d:
seqdata_espresso_finality:
unsafestaker-data:
validator-data:
poster-data:
Expand Down
23 changes: 21 additions & 2 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,27 @@ function writeConfigs(argv: any) {
} else {
sequencerConfig.node["seq-coordinator"].enable = true
}
fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig))


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,
namespace: 412346,
};
fs.writeFileSync(
path.join(consts.configpath, "espresso_finality_sequencer_config.json"),
JSON.stringify(sequencerConfig)
);
} else {
fs.writeFileSync(
path.join(consts.configpath, "sequencer_config.json"),
JSON.stringify(sequencerConfig)
);
}

let posterConfig = JSON.parse(baseConfJSON)
if (argv.espresso) {
posterConfig.node.feed.input.url.push("ws://sequencer:9642")
Expand Down
1 change: 1 addition & 0 deletions scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ async function main() {
lightClientAddress: { string: true, description: 'address of the light client contract', default: ''},
switchDelayThreshold: { string: true, description: 'integer used to determine when hotshot is live', default: '10'},
migration: {boolean: true, description: 'Build l2 config that is espresso compatible, but without enabling espresso behavior', default: false},
enableEspressoFinalityNode: {boolean: true, description: 'enable finality node', default: false},
})
.command(bridgeFundsCommand)
.command(bridgeToL3Command)
Expand Down
26 changes: 26 additions & 0 deletions smoke-test-espresso-finality-node.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

listen_to_sequencer_feed() {
# Listen to the sequencer feed and check if the sender address is detected
while read -r message; do
# Check if the message contains the specific sender address
if [[ "$message" == *"\"sender\":\"0xdd6bd74674c356345db88c354491c7d3173c6806\""* ]]; then
echo "Sender address detected"
break
fi
done < <(wscat -c ws://127.0.0.1:9642)
}


./test-node.bash --espresso --latest-espresso-image --validate --tokenbridge --init-force --detach --espresso-finality-node

# Start the espresso finality node
docker compose up -d sequencer-espresso-finality --wait --detach

# Sending L2 transaction
./test-node.bash script send-l2 --ethamount 100 --to user_l2user --wait

listen_to_sequencer_feed

docker compose down
14 changes: 12 additions & 2 deletions test-node.bash
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ l1chainid=1337
migration=false
simple=true
simple_with_validator=false

while [[ $# -gt 0 ]]; do
case $1 in
--init)
Expand Down Expand Up @@ -107,6 +106,10 @@ while [[ $# -gt 0 ]]; do
l2_espresso=true
shift
;;
--espresso-finality-node)
enableEspressoFinalityNode=true
shift
;;
--latest-espresso-image)
latest_espresso_image=true
shift
Expand Down Expand Up @@ -242,6 +245,7 @@ while [[ $# -gt 0 ]]; do
echo --espresso launch an espresso compatible node
echo --latest-espresso-image Pull the latest image for the espresso node
echo --migration Build l2 chain config in a manner that would allow migrating to Espresso.
echo --enable-finality-node enable espresso finality node
echo
echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help
exit 0
Expand Down Expand Up @@ -303,6 +307,7 @@ if [ $batchposters -gt 2 ]; then
fi



if $validate; then
NODES="$NODES validator"
elif ! $simple; then
Expand All @@ -317,6 +322,7 @@ if $l3node; then
export ESPRESSO_DEPLOYER_ALT_MNEMONICS="indoor dish desk flag debris potato excuse depart ticket judge file exit"
export ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES="6"
fi

if $blockscout; then
NODES="$NODES blockscout"
fi
Expand Down Expand Up @@ -406,6 +412,7 @@ if $force_init; then
docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /keystore"
docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /config"


if $consensusclient; then
echo == Writing configs
docker compose run scripts write-geth-genesis-config
Expand Down Expand Up @@ -468,7 +475,10 @@ if $force_init; then
else
echo == Writing configs
docker compose run scripts write-config --espresso $l2_espresso --lightClientAddress $lightClientAddr

if $enableEspressoFinalityNode; then
echo == Writing configs for finality node
docker compose run scripts write-config --espresso $l2_espresso --enableEspressoFinalityNode --lightClientAddress $lightClientAddr
fi
echo == Initializing redis
docker compose up --wait redis
docker compose run scripts redis-init --redundancy $redundantsequencers
Expand Down

0 comments on commit f3a9475

Please sign in to comment.