Skip to content

Commit 367c38c

Browse files
authored
chore(seq)!: disable sequencer and disable validator as one env var, update p2p listen port names (#9266)
## Overview Breaking change as SEQ_DISABLE is removed When validator is disabled - the sequencer is also disabled, update TCP_LISTEN_ADDR to be P2P_LISTEN_ADDR that is used in config files fixes: #9262
1 parent 2a4188c commit 367c38c

29 files changed

+265
-99
lines changed

scripts/run_native_testnet.sh

+45-24
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This script sets up and runs a native testnet for the Aztec network.
55
66
Steps:
7-
1. Parse command-line arguments for custom test script and number of validators.
7+
1. Parse command-line arguments for custom test script, number of validators, and logging level.
88
2. Set up the base command for running the native network test, including:
99
- Running the specified test script
1010
- Deploying L1 and L2 contracts
@@ -21,9 +21,7 @@ Usage:
2121
./run_native_testnet.sh [options]
2222
2323
Options:
24-
-h: Display help message
25-
-t: Specify a custom test script (default: ./test-transfer.sh)
26-
-v: Specify the number of validators (default: 3)
24+
see display_help() below
2725
'
2826

2927
# Function to display help message
@@ -33,51 +31,74 @@ display_help() {
3331
echo "Options:"
3432
echo " -h Display this help message"
3533
echo " -t Specify the test script file (default: ./test-transfer.sh)"
36-
echo " -v Specify the number of validators (default: 3)"
34+
echo " -val Specify the number of validators (default: 3)"
35+
echo " -v Set logging level to verbose"
36+
echo " -vv Set logging level to debug"
37+
echo " -i Run interleaved (default: false)"
3738
echo
3839
echo "Example:"
39-
echo " $0 -t ./custom-test.sh -v 5"
40+
echo " $0 -t ./custom-test.sh -val 5 -v"
4041
}
4142

4243
# Default values
4344
TEST_SCRIPT="./test-transfer.sh"
4445
NUM_VALIDATORS=3
46+
LOG_LEVEL="info"
47+
INTERLEAVED=false
4548

4649
# Parse command line arguments
47-
while getopts "ht:v:" opt; do
48-
case $opt in
49-
h)
50+
while [[ $# -gt 0 ]]; do
51+
case $1 in
52+
-h)
5053
display_help
5154
exit 0
5255
;;
53-
t) TEST_SCRIPT="$OPTARG"
56+
-t)
57+
TEST_SCRIPT="$2"
58+
shift 2
5459
;;
55-
v) NUM_VALIDATORS="$OPTARG"
60+
-val)
61+
NUM_VALIDATORS="$2"
62+
shift 2
5663
;;
57-
\?) echo "Invalid option -$OPTARG" >&2
58-
display_help
59-
exit 1
64+
-v)
65+
if [[ $LOG_LEVEL == "info" ]]; then
66+
LOG_LEVEL="verbose"
67+
elif [[ $LOG_LEVEL == "verbose" ]]; then
68+
LOG_LEVEL="debug"
69+
fi
70+
shift
71+
;;
72+
-i)
73+
INTERLEAVED=true
74+
shift
75+
;;
76+
-vv)
77+
LOG_LEVEL="debug"
78+
shift
79+
;;
80+
*)
81+
echo "Invalid option: $1" >&2
82+
display_help
83+
exit 1
6084
;;
6185
esac
6286
done
6387

88+
## Set log level for all child commands
89+
export LOG_LEVEL
90+
6491
# Base command
65-
BASE_CMD="./yarn-project/end-to-end/scripts/native_network_test.sh \
92+
BASE_CMD="INTERLEAVED=$INTERLEAVED ./yarn-project/end-to-end/scripts/native_network_test.sh \
6693
$TEST_SCRIPT \
6794
./deploy-l1-contracts.sh \
6895
./deploy-l2-contracts.sh \
6996
./boot-node.sh \
7097
./ethereum.sh \
71-
\"./prover-node.sh false\" \
98+
\"./prover-node.sh 8078 false\" \
7299
./pxe.sh \
73-
./transaction-bot.sh"
74-
75-
# Generate validator commands
76-
for ((i=0; i<NUM_VALIDATORS; i++))
77-
do
78-
PORT=$((8081 + i))
79-
BASE_CMD+=" \"./validator.sh $PORT\""
80-
done
100+
./transaction-bot.sh \
101+
\"./validators.sh $NUM_VALIDATORS\""
81102

82103
# Execute the command
83104
eval $BASE_CMD

scripts/tmux_split_args.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ session_name=$1
1616
# Kill any existing tmux session with the same name
1717
tmux kill-session -t "$session_name" 2>/dev/null || true
1818

19-
# Start a new tmux session
20-
tmux new-session -d -s "$session_name"
19+
# Start a new tmux session with log level set
20+
tmux new-session -d -s "$session_name" -e LOG_LEVEL=${LOG_LEVEL:-"debug"}
2121

2222
shift 1
2323
commands=("$@")

spartan/aztec-network/templates/_helpers.tpl

+8
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ http://{{ include "aztec-network.fullname" . }}-boot-node-0.{{ include "aztec-ne
7474
{{- end -}}
7575
{{- end -}}
7676

77+
{{- define "aztec-network.validatorUrl" -}}
78+
{{- if .Values.validator.externalTcpHost -}}
79+
http://{{ .Values.validator.externalTcpHost }}:{{ .Values.validator.service.nodePort }}
80+
{{- else -}}
81+
http://{{ include "aztec-network.fullname" . }}-validator-0.{{ include "aztec-network.fullname" . }}-validator.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.validator.service.nodePort }}
82+
{{- end -}}
83+
{{- end -}}
84+
7785
{{- define "aztec-network.metricsHost" -}}
7886
http://{{ include "aztec-network.fullname" . }}-metrics.{{ .Release.Namespace }}
7987
{{- end -}}

spartan/aztec-network/templates/pxe.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ spec:
2828
echo "Waiting for boot node..."
2929
sleep 5
3030
done
31+
- name: wait-for-validator-service
32+
image: {{ .Values.images.curl.image }}
33+
command:
34+
- /bin/sh
35+
- -c
36+
- |
37+
until curl --head --silent {{ include "aztec-network.validatorUrl" . }}/status; do
38+
echo "Waiting for validator service..."
39+
sleep 5
40+
done
3141
containers:
3242
- name: pxe
3343
image: "{{ .Values.images.aztec.image }}"

yarn-project/Earthfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,16 @@ network-test-fake-proofs:
289289
COPY ../scripts/+scripts/run_interleaved.sh scripts/run_interleaved.sh
290290
WORKDIR /usr/src/yarn-project
291291
# All script arguments are in the end-to-end/scripts/native-network folder
292+
ENV LOG_LEVEL=verbose
292293
RUN INTERLEAVED=true end-to-end/scripts/native_network_test.sh \
293294
./test-transfer.sh \
294295
./deploy-l1-contracts.sh \
295296
./deploy-l2-contracts.sh \
296297
./boot-node.sh \
297298
./ethereum.sh \
298-
"./prover-node.sh false" \
299-
./pxe.sh
299+
"./prover-node.sh 8078 false" \
300+
./pxe.sh \
301+
"./validator.sh 8081 40401"
300302

301303
publish-npm:
302304
FROM +build

yarn-project/archiver/src/archiver/archiver.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,14 @@ export class Archiver implements ArchiveSource {
537537
if (number === 'latest') {
538538
number = await this.store.getSynchedL2BlockNumber();
539539
}
540-
const headers = await this.store.getBlockHeaders(number, 1);
541-
return headers.length === 0 ? undefined : headers[0];
540+
try {
541+
const headers = await this.store.getBlockHeaders(number, 1);
542+
return headers.length === 0 ? undefined : headers[0];
543+
} catch (e) {
544+
// If the latest is 0, then getBlockHeaders will throw an error
545+
this.log.error(`getBlockHeader: error fetching block number: ${number}`);
546+
return undefined;
547+
}
542548
}
543549

544550
public getTxEffect(txHash: TxHash): Promise<TxEffect | undefined> {

yarn-project/aztec-node/src/aztec-node/config.ts

-8
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ export type AztecNodeConfig = ArchiverConfig &
2222
WorldStateConfig &
2323
Pick<ProverClientConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> &
2424
P2PConfig & {
25-
/** Whether the sequencer is disabled for this node. */
26-
disableSequencer: boolean;
27-
2825
/** Whether the validator is disabled for this node */
2926
disableValidator: boolean;
3027
};
@@ -36,11 +33,6 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
3633
...proverClientConfigMappings,
3734
...worldStateConfigMappings,
3835
...p2pConfigMappings,
39-
disableSequencer: {
40-
env: 'SEQ_DISABLED',
41-
description: 'Whether the sequencer is disabled for this node.',
42-
...booleanConfigHelper(),
43-
},
4436
disableValidator: {
4537
env: 'VALIDATOR_DISABLED',
4638
description: 'Whether the validator is disabled for this node.',

yarn-project/aztec-node/src/aztec-node/server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class AztecNodeService implements AztecNode {
164164
const validatorClient = createValidatorClient(config, p2pClient, telemetry);
165165

166166
// now create the sequencer
167-
const sequencer = config.disableSequencer
167+
const sequencer = config.disableValidator
168168
? undefined
169169
: await SequencerClient.new(
170170
config,

yarn-project/aztec/src/cli/cmds/start_node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const startNode = async (
6464
}
6565

6666
if (!options.sequencer) {
67-
nodeConfig.disableSequencer = true;
67+
nodeConfig.disableValidator = true;
6868
} else {
6969
const sequencerConfig = extractNamespacedOptions(options, 'sequencer');
7070
let account;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
l1-contracts.env
2-
l2-contracts.env
3-
*.log
1+
state/*.env
2+
state/*.json
3+
*.log

yarn-project/end-to-end/scripts/native-network/boot-node.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ exec > >(tee -a "$(dirname $0)/logs/${SCRIPT_NAME}.log") 2> >(tee -a "$(dirname
1010
# Starts the Boot Node
1111

1212
# Set environment variables
13-
export PORT="8080"
14-
export LOG_LEVEL="debug"
15-
export DEBUG="aztec:*,-aztec:avm_simulator:*"
13+
export PORT=${PORT:-"8080"}
14+
export DEBUG=${DEBUG:-"aztec:*,-aztec:avm_simulator:*"}
15+
export LOG_LEVEL=${LOG_LEVEL:-"debug"}
1616
export ETHEREUM_HOST="http://127.0.0.1:8545"
1717
export P2P_ENABLED="true"
1818
export VALIDATOR_DISABLED="true"
@@ -22,16 +22,18 @@ export P2P_TCP_ANNOUNCE_ADDR="127.0.0.1:40400"
2222
export P2P_UDP_ANNOUNCE_ADDR="127.0.0.1:40400"
2323
export P2P_TCP_LISTEN_ADDR="0.0.0.0:40400"
2424
export P2P_UDP_LISTEN_ADDR="0.0.0.0:40400"
25+
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=""
26+
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=""
2527
export VALIDATOR_PRIVATE_KEY="0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"
2628
REPO=$(git rev-parse --show-toplevel)
2729

2830
echo "Waiting for l1 contracts to be deployed..."
29-
until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env ] ; do
31+
until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/state/l1-contracts.env ] ; do
3032
sleep 1
3133
done
3234
echo "Done waiting."
3335

34-
source "$REPO"/yarn-project/end-to-end/scripts/native-network/l1-contracts.env
36+
source "$REPO"/yarn-project/end-to-end/scripts/native-network/state/l1-contracts.env
3537

3638
function filter_noise() {
3739
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"

yarn-project/end-to-end/scripts/native-network/deploy-l1-contracts.sh

+16-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ exec > >(tee -a "$(dirname $0)/logs/${SCRIPT_NAME}.log") 2> >(tee -a "$(dirname
1010

1111
set -eu
1212

13+
# Check for validator addresses
14+
if [ $# -gt 0 ]; then
15+
INIT_VALIDATORS="true"
16+
VALIDATOR_ADDRESSES="$1"
17+
else
18+
INIT_VALIDATORS="false"
19+
fi
20+
1321
echo "Waiting for Anvil to be up at port 8545..."
1422
until curl -s -X POST -H 'Content-Type: application/json' \
1523
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
@@ -20,7 +28,11 @@ echo "Done waiting."
2028

2129
# Run the deploy-l1-contracts command and capture the output
2230
export ETHEREUM_HOST="http://127.0.0.1:8545"
23-
output=$(node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --salt 1337)
31+
if [ "$INIT_VALIDATORS" = "true" ]; then
32+
output=$(node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --validators "$VALIDATOR_ADDRESSES" --salt 1337)
33+
else
34+
output=$(node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --salt 1337)
35+
fi
2436

2537
echo "$output"
2638

@@ -32,8 +44,8 @@ OUTBOX_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'L2 -> L1 Outbox Address: \K
3244
FEE_JUICE_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'Fee Juice Address: \K0x[a-fA-F0-9]{40}')
3345
FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$(echo "$output" | grep -oP 'Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}')
3446

35-
# Save contract addresses to l1-contracts.env
36-
cat << EOCONFIG > $(git rev-parse --show-toplevel)/yarn-project/end-to-end/scripts/native-network/l1-contracts.env
47+
# Save contract addresses to state/l1-contracts.env
48+
cat << EOCONFIG > $(git rev-parse --show-toplevel)/yarn-project/end-to-end/scripts/native-network/state/l1-contracts.env
3749
export ROLLUP_CONTRACT_ADDRESS=$ROLLUP_CONTRACT_ADDRESS
3850
export REGISTRY_CONTRACT_ADDRESS=$REGISTRY_CONTRACT_ADDRESS
3951
export INBOX_CONTRACT_ADDRESS=$INBOX_CONTRACT_ADDRESS
@@ -42,4 +54,4 @@ export FEE_JUICE_CONTRACT_ADDRESS=$FEE_JUICE_CONTRACT_ADDRESS
4254
export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$FEE_JUICE_PORTAL_CONTRACT_ADDRESS
4355
EOCONFIG
4456

45-
echo "Contract addresses saved to l1-contracts.env"
57+
echo "Contract addresses saved to state/l1-contracts.env"

yarn-project/end-to-end/scripts/native-network/deploy-l2-contracts.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export PXE_URL="http://127.0.0.1:8079"
2828
node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts $ARGS
2929
echo "Deployed L2 contracts"
3030
# Use file just as done signal
31-
echo "" > l2-contracts.env
32-
echo "Wrote to l2-contracts.env to signal completion"
33-
sleep 5
34-
function close_tmux_pane() {
35-
tmux kill-pane -t $(tmux display -p '#{pane_id}')
36-
}
37-
close_tmux_pane 2>/dev/null || true
31+
echo "" > state/l2-contracts.env
32+
echo "Wrote to state/l2-contracts.env to signal completion"
33+
34+
# sleep 5
35+
# function close_tmux_pane() {
36+
# tmux kill-pane -t $(tmux display -p '#{pane_id}')
37+
# }
38+
# close_tmux_pane 2>/dev/null || true

0 commit comments

Comments
 (0)