-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: native tmux-based network e2e #9036
Merged
Merged
Changes from 5 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
96882cd
start of helm-based native tests
ludamad 21b3925
start of helm-based native tests
ludamad 5ca483e
checkin
ludamad 50f03e0
update
ludamad aef20d0
commit all files
ludamad 2084456
revert
ludamad 2eaa3b0
ci vs not scripts
ludamad 2fa5e68
better tests
ludamad 4ac2fb2
rename
ludamad 4d601f8
rename
ludamad 3f778ed
go after improper usage
ludamad 64f7ac9
iteration
ludamad d1da81d
improve script logging
ludamad 15fd463
boot node no deploy redundantly
ludamad befc67c
iteration on tmux splits
ludamad ebea082
fixes
ludamad f9eb2bb
better errors
ludamad 945594f
improve logging
ludamad 8a9f242
Merge branch 'master' into ad/native-tmux-e2e
ludamad f87078f
try to stabilize network with 0 validators
ludamad 2346ded
Iterative
ludamad df723cc
proverless fix
ludamad c1490f9
add waitForProven flag
ludamad e9a29f3
skip proof wait fix
ludamad d6a40fe
fix serialization issue with DeployProvenTx
ludamad 09a6168
Merge remote-tracking branch 'origin/ad/native-tmux-e2e' into ad/nati…
ludamad e386ff2
Update action.yml
ludamad 149c5f9
fix tx bot
ludamad 0ed4ba5
revert
ludamad 9d4b673
Merge remote-tracking branch 'origin/ad/native-tmux-e2e' into ad/nati…
ludamad 65839a7
fix status
ludamad b52f8a9
Merge branch 'master' into ad/native-tmux-e2e
ludamad e568c10
Merge branch 'master' into ad/native-tmux-e2e
ludamad aedb22e
Merge branch 'master' into ad/native-tmux-e2e
ludamad fc8179d
formatting
ludamad d75ea98
Merge remote-tracking branch 'origin/ad/native-tmux-e2e' into ad/nati…
ludamad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,7 @@ terraform.tfstate* | |
.bb_tmp | ||
|
||
# Terraform | ||
*.tfvars | ||
*.tfvars | ||
|
||
# tmux | ||
tmux-client-*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
set -eux | ||
# Launches tmux with 1 window that has as many panes as lines of input | ||
session_name=$1 | ||
|
||
# Kill any existing tmux session with the same name | ||
tmux kill-session -t "$session_name" || true | ||
|
||
# Start a new tmux session | ||
tmux new-session -d -s "$session_name" | ||
|
||
# Read commands from stdin into an array | ||
commands=() | ||
while IFS= read -r command; do | ||
commands+=("$command") | ||
done | ||
|
||
# Create the necessary number of panes | ||
num_commands=${#commands[@]} | ||
for ((i=1; i<num_commands; i++)); do | ||
# Split the first pane each time | ||
tmux split-window -t "$session_name:0.0" -h | ||
tmux select-layout -t "$session_name:0" tiled | ||
done | ||
|
||
# Now send commands to each pane | ||
for ((i=0; i<num_commands; i++)); do | ||
tmux send-keys -t "$session_name:0.$i" "${commands[$i]}" C-m | ||
done | ||
|
||
echo "Commands have been queued in tmux session '${session_name}'." | ||
echo "You can attach to this session with 'tmux attach-session -t ${session_name}' from a terminal." | ||
echo "To detach, use backtick (`) (or your prefix) then d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
# Usage: tmux-splits-stdin <session-name> <command1> <command2>... | ||
|
||
# Launches tmux with 1 window that has as many panes as commands | ||
session_name=$1 | ||
|
||
# Kill any existing tmux session with the same name | ||
tmux kill-session -t "$session_name" 2>/dev/null || true | ||
|
||
# Start a new tmux session | ||
tmux new-session -d -s "$session_name" | ||
|
||
shift 1 | ||
commands=("$@") | ||
|
||
# Set pane-border-status to top and pane-border-format to display pane title | ||
tmux set-option -t "$session_name" pane-border-status top | ||
tmux set-option -t "$session_name" pane-border-format "#{pane_title}" | ||
|
||
# Create the necessary number of panes and set titles | ||
num_commands=${#commands[@]} | ||
for ((i=0; i<num_commands; i++)); do | ||
if [[ $i -gt 0 ]]; then | ||
# Split the first pane each time | ||
tmux split-window -t "$session_name:0.0" -h | ||
tmux select-layout -t "$session_name:0" tiled | ||
fi | ||
# Set the pane title | ||
tmux select-pane -t "$session_name:0.$i" -T "${commands[i]}" | ||
done | ||
|
||
# Now send commands to each pane | ||
for ((i=0; i<num_commands; i++)); do | ||
tmux send-keys -t "$session_name:0.$i" "${commands[$i]}" C-m | ||
done | ||
|
||
# Attach to the session | ||
tmux attach-session -t "$session_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
import subprocess | ||
import json | ||
import heapq | ||
|
||
# Get the list of pods | ||
pods = subprocess.check_output( | ||
['kubectl', 'get', 'pods', '-n', 'transfer', '-o', 'custom-columns=:metadata.name', '--no-headers'], | ||
universal_newlines=True | ||
).splitlines() | ||
|
||
# Create a min-heap for sorting logs based on timestamp | ||
heap = [] | ||
|
||
for pod in pods: | ||
# Get logs for each pod | ||
logs = subprocess.check_output(['kubectl', 'logs', '-n', 'transfer', pod], universal_newlines=True).splitlines() | ||
for line in logs: | ||
# Prefix with pod name | ||
prefixed_line = f'[{pod}] {line}' | ||
try: | ||
# Remove the pod prefix | ||
if line.startswith('['): | ||
closing_bracket_index = line.find(']') | ||
if closing_bracket_index != -1: | ||
# Assume there's a space after the closing bracket | ||
json_part = line[closing_bracket_index + 2:] | ||
else: | ||
json_part = line # No closing bracket found | ||
else: | ||
json_part = line | ||
|
||
# Parse the JSON part | ||
log_json = json.loads(json_part) | ||
|
||
# Ensure log_json is a dictionary | ||
if isinstance(log_json, dict): | ||
timestamp = log_json.get('timestamp') | ||
if timestamp: | ||
# Use timestamp as the key for sorting | ||
heapq.heappush(heap, (timestamp, prefixed_line)) | ||
else: | ||
# log_json is not a dictionary; skip this line | ||
continue | ||
except (json.JSONDecodeError, ValueError, AttributeError) as e: | ||
# Optionally print the error and the problematic line for debugging | ||
# print(f"Error parsing line: {line}\nError: {e}") | ||
continue # Skip lines that are not valid JSON dictionaries | ||
|
||
# Extract and print logs in order | ||
while heap: | ||
_, log_line = heapq.heappop(heap) | ||
print(log_line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
l1-contracts.env | ||
l2-contracts.env |
34 changes: 34 additions & 0 deletions
34
yarn-project/end-to-end/scripts/native-network/boot-node.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
set -eu | ||
# Starts the Boot Node | ||
|
||
# Set environment variables | ||
export PORT="8080" | ||
export LOG_LEVEL="debug" | ||
export LOG_JSON="1" | ||
export DEBUG="aztec:*,-aztec:avm_simulator:*" | ||
export ETHEREUM_HOST="http://127.0.0.1:8545" | ||
export P2P_ENABLED="true" | ||
export VALIDATOR_DISABLED="true" | ||
export SEQ_MAX_SECONDS_BETWEEN_BLOCKS="0" | ||
export SEQ_MIN_TX_PER_BLOCK="1" | ||
export P2P_TCP_ANNOUNCE_ADDR="0.0.0.0:40400" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recall in the past i had issues where the announce addresses was not |
||
export P2P_UDP_ANNOUNCE_ADDR="0.0.0.0:40400" | ||
export P2P_TCP_LISTEN_ADDR="0.0.0.0:40400" | ||
export P2P_UDP_LISTEN_ADDR="0.0.0.0:40400" | ||
export VALIDATOR_PRIVATE_KEY="0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a" | ||
REPO=$(git rev-parse --show-toplevel) | ||
|
||
echo "Waiting for l1 contracts to be deployed..." | ||
until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env ] ; do | ||
sleep 1 | ||
done | ||
|
||
source "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env | ||
|
||
# Wait for anvil and deploy contracts | ||
# source this script to get the L1 contract addresses in env | ||
source "$REPO"/yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh | ||
|
||
# Start the Aztec node with the sequencer and archiver | ||
node --no-warnings "$REPO"/yarn-project/aztec/dest/bin/index.js start --node --archiver --sequencer --pxe |
38 changes: 38 additions & 0 deletions
38
yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
# Deploys L1 contracts and captures the output | ||
|
||
set -eu | ||
|
||
echo "Waiting for Anvil to be up at port 8545..." | ||
until curl -s -X POST -H 'Content-Type: application/json' \ | ||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ | ||
http://127.0.0.1:8545 2>/dev/null | grep -q 'result' ; do | ||
sleep 1 | ||
done | ||
|
||
# Run the deploy-l1-contracts command and capture the output | ||
export ETHEREUM_HOST="http://127.0.0.1:8545" | ||
output=$(node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts) | ||
|
||
echo "$output" | ||
|
||
# Extract contract addresses using grep and regex | ||
ROLLUP_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'Rollup Address: \K0x[a-fA-F0-9]{40}') | ||
REGISTRY_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'Registry Address: \K0x[a-fA-F0-9]{40}') | ||
INBOX_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}') | ||
OUTBOX_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'L2 -> L1 Outbox Address: \K0x[a-fA-F0-9]{40}') | ||
FEE_JUICE_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'Fee Juice Address: \K0x[a-fA-F0-9]{40}') | ||
FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}') | ||
|
||
# Save contract addresses to l1-contracts.env | ||
cat << EOCONFIG > $(git rev-parse --show-toplevel)/yarn-project/end-to-end/scripts/native-network/l1-contracts.env | ||
export ROLLUP_CONTRACT_ADDRESS=$ROLLUP_CONTRACT_ADDRESS | ||
export REGISTRY_CONTRACT_ADDRESS=$REGISTRY_CONTRACT_ADDRESS | ||
export INBOX_CONTRACT_ADDRESS=$INBOX_CONTRACT_ADDRESS | ||
export OUTBOX_CONTRACT_ADDRESS=$OUTBOX_CONTRACT_ADDRESS | ||
export FEE_JUICE_CONTRACT_ADDRESS=$FEE_JUICE_CONTRACT_ADDRESS | ||
export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$FEE_JUICE_PORTAL_CONTRACT_ADDRESS | ||
EOCONFIG | ||
|
||
echo "Contract addresses saved to l1-contracts.env" |
21 changes: 21 additions & 0 deletions
21
yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Deploys L2 contracts | ||
|
||
set -eu | ||
|
||
# Wait for PXE service to be ready | ||
echo "Waiting for PXE service..." | ||
until curl -s -X POST -H 'content-type: application/json' \ | ||
-d '{"jsonrpc":"2.0","method":"pxe_getNodeInfo","params":[],"id":67}' \ | ||
http://127.0.0.1:8079 | grep -q '"enr:-'; do | ||
sleep 1 | ||
done | ||
echo "PXE service is ready!" | ||
|
||
# Deploy L2 contracts | ||
export AZTEC_NODE_URL="http://127.0.0.1:8080" | ||
node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-protocol-contracts | ||
echo "Deployed L2 contracts" | ||
# Use file just as done signal | ||
echo "" > l2-contracts.env |
14 changes: 14 additions & 0 deletions
14
yarn-project/end-to-end/scripts/native-network/ethereum.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
set -eu | ||
# Starts the Ethereum node using Anvil | ||
|
||
# Ensure anvil is installed | ||
command -v anvil >/dev/null 2>&1 || { echo >&2 "Anvil is not installed. Aborting."; exit 1; } | ||
|
||
# Start Anvil with specified parameters | ||
anvil \ | ||
--host 0.0.0.0 \ | ||
--block-time 12 \ | ||
--chain-id 31337 \ | ||
--gas-limit 1000000000 \ | ||
-p 8545 |
33 changes: 33 additions & 0 deletions
33
yarn-project/end-to-end/scripts/native-network/prover-node.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Starts the Prover Node | ||
REPO=$(git rev-parse --show-toplevel) | ||
|
||
echo "Waiting for l1 contracts to be deployed..." | ||
until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env ] ; do | ||
sleep 1 | ||
done | ||
|
||
source "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env | ||
|
||
# Get node info from the boot node | ||
output=$(node --no-warnings "$REPO"/yarn-project/aztec/dest/bin/index.js get-node-info -u $BOOT_NODE_URL) | ||
|
||
# Extract boot node ENR | ||
export BOOTSTRAP_NODES=$(echo "$output" | grep -oP 'Node ENR: \K.*') | ||
|
||
# Set environment variables | ||
export PORT="8080" | ||
export LOG_LEVEL="debug" | ||
export LOG_JSON="1" | ||
export DEBUG="aztec:*" | ||
export ETHEREUM_HOST="http://127.0.0.1:8545" | ||
export PROVER_REAL_PROOFS="false" | ||
export PROVER_AGENT_ENABLED="true" | ||
export PROVER_PUBLISHER_PRIVATE_KEY="0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97" | ||
export PROVER_COORDINATION_NODE_URL="127.0.0.1:8080" | ||
export AZTEC_NODE_URL="127.0.0.1:8080" | ||
|
||
# Start the Prover Node with the prover and archiver | ||
node --no-warnings "$REPO"/yarn-project/aztec/dest/bin/index.js start --prover-node --prover --archiver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Starts the PXE (Private eXecution Environment) service | ||
# Set environment variables | ||
export ETHEREUM_HOST="http://127.0.0.1:8545" | ||
export AZTEC_NODE_URL="http://127.0.0.1:8080" | ||
export LOG_JSON="1" | ||
export LOG_LEVEL="debug" | ||
export DEBUG="aztec:*" | ||
export PXE_PORT="http://127.0.0.1:8079" | ||
|
||
echo "Waiting for Aztec Node..." | ||
until curl -s http://127.0.0.1:8080/status; do | ||
sleep 1 | ||
done | ||
|
||
# Start the PXE service | ||
node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js start --pxe |
32 changes: 32 additions & 0 deletions
32
yarn-project/end-to-end/scripts/native-network/transaction-bot.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
set -eu | ||
# Starts the transaction bot | ||
|
||
# Wait for the Aztec Node to be ready | ||
echo "Waiting for Aztec Node..." | ||
until curl -s http://127.0.0.1:8080/status; do | ||
sleep 1 | ||
done | ||
|
||
echo "Waiting for l2 contracts to be deployed..." | ||
until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/l2-contracts.env ] ; do | ||
sleep 1 | ||
done | ||
|
||
# Set environment variables | ||
export ETHEREUM_HOST="http://127.0.0.1:8545" | ||
export AZTEC_NODE_URL="http://127.0.0.1:8080" | ||
export LOG_JSON="1" | ||
export LOG_LEVEL="debug" | ||
export DEBUG="aztec:*" | ||
export BOT_PRIVATE_KEY="0xcafe" | ||
export BOT_TX_INTERVAL_SECONDS="5" | ||
export BOT_PRIVATE_TRANSFERS_PER_TX="1" | ||
export BOT_PUBLIC_TRANSFERS_PER_TX="0" | ||
export BOT_NO_WAIT_FOR_TRANSFERS="true" | ||
export BOT_NO_START="false" | ||
export PXE_PROVER_ENABLED="false" | ||
export PROVER_REAL_PROOFS="false" | ||
|
||
# Start the bot | ||
node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js start --pxe --bot |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundled because useful