Skip to content

Commit

Permalink
Add smoke test for finality node
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneh1999 committed Oct 17, 2024
1 parent 884a63c commit 4f0018a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
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: ''},
enableFinalityNode: {boolean: true, description: 'enable finality node', default: false},
})
.command(bridgeFundsCommand)
.command(bridgeToL3Command)
Expand Down
26 changes: 26 additions & 0 deletions smoke-test-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 < <(websocat 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
15 changes: 13 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)
enableFinalityNode=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 All @@ -418,6 +425,7 @@ if $force_init; then
docker compose up --wait prysm_validator
else
docker compose up --wait geth
# docker compose up --wait geth-espresso-finality
docker compose run scripts write-geth-genesis-config
fi

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

if $enableFinalityNode; then
echo == Writing configs for finality node
docker compose run scripts write-config --enableFinalityNode --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 4f0018a

Please sign in to comment.