Skip to content

Commit

Permalink
add caldera smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneh1999 committed Oct 24, 2024
1 parent dc95524 commit 5eb699d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
4 changes: 1 addition & 3 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,9 @@ function writeConfigs(argv: any) {
}
}


const baseConfJSON = JSON.stringify(baseConfig)

baseConfig.node["data-availability"]["sequencer-inbox-address"] = ethers.utils.hexlify(getChainInfo()[0]["rollup"]["sequencer-inbox"]);

const baseConfJSON = JSON.stringify(baseConfig)

if (argv.simple) {
let simpleConfig = JSON.parse(baseConfJSON)
Expand Down
39 changes: 39 additions & 0 deletions smoke-test-caldera.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail

# check that the relay is working
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:9652)
}


# Run caldera with batch poster, sequencer, full node, validator and an anytrust chain which runs the dasserver
./test-node.bash --init-force --validate --batchposters 1 --latest-espresso-image --detach --l2-anytrust
docker compose up -d full-node --detach

# Sending L2 transaction through the full-node's api
user=user_l2user
./test-node.bash script send-l2 --l2url ws://full-node:8548 --ethamount 100 --to $user --wait

# Check the balance from full-node's api
userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n')

while true; do
balance=$(cast balance $userAddress --rpc-url http://127.0.0.1:8947)
if [ ${#balance} -gt 0 ]; then
break
fi
sleep 1
done

listen_to_sequencer_feed

echo "Smoke test succeeded."
# docker compose down
15 changes: 8 additions & 7 deletions test-node.bash
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ if [ $batchposters -gt 2 ]; then
NODES="$NODES poster_c"
fi


NODES="$NODES relay"

if $validate; then
NODES="$NODES validator"
Expand Down Expand Up @@ -642,12 +642,6 @@ if $force_init; then
fi
docker compose run -e PARENT_WETH_OVERRIDE=$l2Weth -e ROLLUP_OWNER_KEY=$l3ownerkey -e ROLLUP_ADDRESS=$rollupAddress -e PARENT_RPC=http://sequencer:8547 -e PARENT_KEY=$deployer_key -e CHILD_RPC=http://l3node:3347 -e CHILD_KEY=$deployer_key tokenbridge deploy:local:token-bridge
docker compose run --entrypoint sh tokenbridge -c "cat network.json && cp network.json l2l3_network.json"

# set L3 UpgradeExecutor, deployed by token bridge creator in previous step, to be the L3 chain owner. L3owner (EOA) and alias of L2 UpgradeExectuor have the executor role on the L3 UpgradeExecutor
echo == Set L3 UpgradeExecutor to be chain owner
tokenBridgeCreator=`docker compose run --entrypoint sh tokenbridge -c "cat l2l3_network.json" | jq -r '.l1TokenBridgeCreator'`
docker compose run scripts transfer-l3-chain-ownership --creator $tokenBridgeCreator
echo
fi

echo == Fund L3 accounts
Expand All @@ -662,6 +656,13 @@ if $force_init; then
echo == Deploy CacheManager on L3
docker compose run -e CHILD_CHAIN_RPC="http://l3node:3347" -e CHAIN_OWNER_PRIVKEY=$l3ownerkey rollupcreator deploy-cachemanager-testnode

if $l3_token_bridge; then
# set L3 UpgradeExecutor, deployed by token bridge creator in previous step, to be the L3 chain owner. L3owner (EOA) and alias of L2 UpgradeExectuor have the executor role on the L3 UpgradeExecutor
echo == Set L3 UpgradeExecutor to be chain owner
tokenBridgeCreator=`docker compose run --entrypoint sh tokenbridge -c "cat l2l3_network.json" | jq -r '.l1TokenBridgeCreator'`
docker compose run scripts transfer-l3-chain-ownership --creator $tokenBridgeCreator
fi

fi
fi

Expand Down

0 comments on commit 5eb699d

Please sign in to comment.