Skip to content

Commit b33fc8d

Browse files
authored
Add smoke test for finality node (OffchainLabs#58)
* Add smoke test for finality node * add smoke test to ci * use wscat * use wscat * update bash * fix yaml * cleanup * cleanup * fix smoke test * fix smoke test
1 parent 884a63c commit b33fc8d

6 files changed

Lines changed: 95 additions & 7 deletions

File tree

.github/workflows/smoke-test.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}
1515
cancel-in-progress: ${{ !contains(github.ref, 'integration/')}}
1616

17-
1817
jobs:
1918
smoke_test:
20-
2119
strategy:
2220
matrix:
23-
test-script: [ ./smoke-test.bash, ./smoke-test-l3.bash, ./smoke-test-nitro-simple.bash, ./smoke-test-full-node.bash ]
21+
test-script:
22+
[
23+
./smoke-test.bash,
24+
./smoke-test-l3.bash,
25+
./smoke-test-nitro-simple.bash,
26+
./smoke-test-full-node.bash,
27+
./smoke-test-espresso-finality-node.bash,
28+
]
2429

2530
runs-on: ubuntu-24.04
2631

@@ -30,6 +35,15 @@ jobs:
3035
with:
3136
submodules: recursive
3237

38+
# Install wscat for finality node smoke test to listen to sequencer feed
39+
- name: Set up Node.js
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: "16"
43+
44+
- name: Install wscat
45+
run: npm install -g wscat
46+
3347
- name: Install Foundry
3448
uses: foundry-rs/foundry-toolchain@v1
3549
with:

docker-compose.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,23 @@ services:
182182
depends_on:
183183
- geth
184184

185+
sequencer-espresso-finality:
186+
pid: host # allow debugging
187+
image: nitro-node-dev-testnode
188+
entrypoint: /usr/local/bin/nitro
189+
ports:
190+
- "127.0.0.1:8549:8547"
191+
- "127.0.0.1:8550:8548"
192+
- "127.0.0.1:9645:9642"
193+
volumes:
194+
- "seqdata_espresso_finality:/home/user/.arbitrum/local/nitro"
195+
- "l1keystore:/home/user/l1keystore"
196+
- "config:/config"
197+
- "tokenbridge-data:/tokenbridge-data"
198+
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 *
199+
depends_on:
200+
- geth
201+
185202
sequencer_b:
186203
pid: host # allow debugging
187204
image: nitro-node-dev-testnode
@@ -451,6 +468,7 @@ volumes:
451468
seqdata_b:
452469
seqdata_c:
453470
seqdata_d:
471+
seqdata_espresso_finality:
454472
unsafestaker-data:
455473
validator-data:
456474
poster-data:

scripts/config.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,27 @@ function writeConfigs(argv: any) {
352352
} else {
353353
sequencerConfig.node["seq-coordinator"].enable = true
354354
}
355-
fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig))
356-
355+
356+
if (argv.espresso && argv.enableEspressoFinalityNode) {
357+
sequencerConfig.execution.sequencer["enable-espresso-finality-node"] =
358+
true;
359+
sequencerConfig.execution.sequencer["enable-espresso-sovereign"] = false;
360+
sequencerConfig.execution.sequencer["espresso-finality-node-config"] = {
361+
"hotshot-url": argv.espressoUrl,
362+
"start-block": 0,
363+
namespace: 412346,
364+
};
365+
fs.writeFileSync(
366+
path.join(consts.configpath, "espresso_finality_sequencer_config.json"),
367+
JSON.stringify(sequencerConfig)
368+
);
369+
} else {
370+
fs.writeFileSync(
371+
path.join(consts.configpath, "sequencer_config.json"),
372+
JSON.stringify(sequencerConfig)
373+
);
374+
}
375+
357376
let posterConfig = JSON.parse(baseConfJSON)
358377
if (argv.espresso) {
359378
posterConfig.node.feed.input.url.push("ws://sequencer:9642")

scripts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async function main() {
3636
espresso: { boolean: true, decription: 'use Espresso Sequencer for sequencing and DA', default: false },
3737
espressoUrl: { string: true, description: 'Espresso Sequencer url', default: 'http://espresso-dev-node:41000' },
3838
lightClientAddress: { string: true, description: 'address of the light client contract', default: ''},
39+
enableEspressoFinalityNode: {boolean: true, description: 'enable finality node', default: false},
3940
})
4041
.command(bridgeFundsCommand)
4142
.command(bridgeToL3Command)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
listen_to_sequencer_feed() {
5+
# Listen to the sequencer feed and check if the sender address is detected
6+
while read -r message; do
7+
# Check if the message contains the specific sender address
8+
if [[ "$message" == *"\"sender\":\"0xdd6bd74674c356345db88c354491c7d3173c6806\""* ]]; then
9+
echo "Sender address detected"
10+
break
11+
fi
12+
done < <(wscat -c ws://127.0.0.1:9642)
13+
}
14+
15+
16+
./test-node.bash --espresso --latest-espresso-image --validate --tokenbridge --init-force --detach --espresso-finality-node
17+
18+
# Start the espresso finality node
19+
docker compose up -d sequencer-espresso-finality --wait --detach
20+
21+
# Sending L2 transaction
22+
./test-node.bash script send-l2 --ethamount 100 --to user_l2user --wait
23+
24+
listen_to_sequencer_feed
25+
26+
docker compose down

test-node.bash

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659
6363
l1chainid=1337
6464
simple=true
6565
simple_with_validator=false
66-
6766
while [[ $# -gt 0 ]]; do
6867
case $1 in
6968
--init)
@@ -106,6 +105,10 @@ while [[ $# -gt 0 ]]; do
106105
l2_espresso=true
107106
shift
108107
;;
108+
--espresso-finality-node)
109+
enableEspressoFinalityNode=true
110+
shift
111+
;;
109112
--latest-espresso-image)
110113
latest_espresso_image=true
111114
shift
@@ -234,6 +237,7 @@ while [[ $# -gt 0 ]]; do
234237
echo --no-tokenbridge don\'t build or launch tokenbridge
235238
echo --no-run does not launch nodes \(useful with build or init\)
236239
echo --no-simple run a full configuration with separate sequencer/batch-poster/validator/relayer
240+
echo --enable-finality-node enable espresso finality node
237241
echo
238242
echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help
239243
exit 0
@@ -294,6 +298,7 @@ if [ $batchposters -gt 2 ]; then
294298
fi
295299

296300

301+
297302
if $validate; then
298303
NODES="$NODES validator"
299304
elif ! $simple; then
@@ -308,6 +313,7 @@ if $l3node; then
308313
export ESPRESSO_DEPLOYER_ALT_MNEMONICS="indoor dish desk flag debris potato excuse depart ticket judge file exit"
309314
export ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES="6"
310315
fi
316+
311317
if $blockscout; then
312318
NODES="$NODES blockscout"
313319
fi
@@ -397,6 +403,7 @@ if $force_init; then
397403
docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /keystore"
398404
docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /config"
399405

406+
400407
if $consensusclient; then
401408
echo == Writing configs
402409
docker compose run scripts write-geth-genesis-config
@@ -454,7 +461,10 @@ if $force_init; then
454461
else
455462
echo == Writing configs
456463
docker compose run scripts write-config --espresso $l2_espresso --lightClientAddress $lightClientAddr
457-
464+
if $enableEspressoFinalityNode; then
465+
echo == Writing configs for finality node
466+
docker compose run scripts write-config --espresso $l2_espresso --enableEspressoFinalityNode --lightClientAddress $lightClientAddr
467+
fi
458468
echo == Initializing redis
459469
docker compose up --wait redis
460470
docker compose run scripts redis-init --redundancy $redundantsequencers

0 commit comments

Comments
 (0)