Skip to content

Commit

Permalink
Add smoke test for finality node (#58)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Sneh1999 authored Oct 18, 2024
1 parent 884a63c commit b33fc8d
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 @@ -352,8 +352,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 @@ -36,6 +36,7 @@ async function main() {
espresso: { boolean: true, decription: 'use Espresso Sequencer for sequencing and DA', default: false },
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},
})
.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 @@ -63,7 +63,6 @@ devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659
l1chainid=1337
simple=true
simple_with_validator=false

while [[ $# -gt 0 ]]; do
case $1 in
--init)
Expand Down Expand Up @@ -106,6 +105,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 @@ -234,6 +237,7 @@ while [[ $# -gt 0 ]]; do
echo --no-tokenbridge don\'t build or launch tokenbridge
echo --no-run does not launch nodes \(useful with build or init\)
echo --no-simple run a full configuration with separate sequencer/batch-poster/validator/relayer
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 @@ -294,6 +298,7 @@ if [ $batchposters -gt 2 ]; then
fi



if $validate; then
NODES="$NODES validator"
elif ! $simple; then
Expand All @@ -308,6 +313,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 @@ -397,6 +403,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 @@ -454,7 +461,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 b33fc8d

Please sign in to comment.