-
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 all 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,46 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Usage: run_bg_args.sh <main command> <background commands>... | ||
# Runs the main command with output logging and background commands without logging. | ||
# Finishes when the main command exits. | ||
|
||
# Check if at least two commands are provided (otherwise what is the point) | ||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 <main-command> <background commands>..." | ||
exit 1 | ||
fi | ||
|
||
main_cmd="$1" | ||
shift | ||
|
||
# Function to run a command and prefix the output | ||
function run_command() { | ||
local cmd="$1" | ||
while IFS= read -r line; do | ||
echo "[$cmd] $line" | ||
done < <($cmd 2>&1) | ||
} | ||
|
||
# Run the main command, piping output through the run_command function | ||
run_command "$main_cmd" & | ||
main_pid=$! | ||
|
||
# Run background commands without logging output | ||
declare -a bg_pids | ||
for cmd in "$@"; do | ||
run_command "$cmd" & | ||
bg_pids+=($!) | ||
done | ||
|
||
# Wait for the main command to finish and capture its exit code | ||
wait $main_pid | ||
main_exit_code=$? | ||
|
||
# Kill any remaining background jobs | ||
for pid in "${bg_pids[@]}"; do | ||
kill "$pid" 2>/dev/null || true | ||
done | ||
|
||
# Exit with the same code as the main command | ||
exit $main_exit_code |
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,50 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
# Usage: tmux_splits_args.sh <session-name> <main command> <background commands>... | ||
# Runs commands in parallel in a tmux window. | ||
# *Finishes when the main command exits.* | ||
|
||
# Check if at least two commands are provided (otherwise what is the point) | ||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 <main-command> <background commands>..." | ||
exit 1 | ||
fi | ||
|
||
# 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 | ||
|
||
# Ensure this finishes when pane 0 is finished | ||
tmux set-hook -t "$session_name" pane-exited "if-shell -F '#{==:#{pane_index},0}' 'kill-session -t \"$session_name\"'" | ||
|
||
# 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
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ export class DeployProvenTx<TContract extends Contract = Contract> extends Prove | |
*/ | ||
public override send(): DeploySentTx<TContract> { | ||
const promise = (() => { | ||
return this.wallet.sendTx(this); | ||
return this.wallet.sendTx(this.getPlainDataTx()); | ||
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. just checking that this was meant to be in this PR? 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. Yes, this is needed to fix serialization. Signed off by grego |
||
})(); | ||
|
||
return new DeploySentTx(this.wallet, promise, this.postDeployCtor, this.instance); | ||
|
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
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
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
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,3 @@ | ||
l1-contracts.env | ||
l2-contracts.env | ||
*.log |
41 changes: 41 additions & 0 deletions
41
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,41 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Get the name of the script without the path and extension | ||
SCRIPT_NAME=$(basename "$0" .sh) | ||
|
||
# Redirect stdout and stderr to <script_name>.log while also printing to the console | ||
exec > >(tee -a "$(dirname $0)/logs/${SCRIPT_NAME}.log") 2> >(tee -a "$(dirname $0)/logs/${SCRIPT_NAME}.log" >&2) | ||
|
||
# Starts the Boot Node | ||
|
||
# Set environment variables | ||
export PORT="8080" | ||
export LOG_LEVEL="debug" | ||
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="127.0.0.1:40400" | ||
export P2P_UDP_ANNOUNCE_ADDR="127.0.0.1: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 | ||
echo "Done waiting." | ||
|
||
source "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env | ||
|
||
function filter_noise() { | ||
grep -Ev "node_getProvenBlockNumber|getBlocks|Last block mined|Running random nodes query|Not creating block because not enough txs in the pool|Peers to connect" | ||
} | ||
|
||
# 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 2>&1 | filter_noise |
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