Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions aztec-up/bin/aztec
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,12 @@ case ${1:-} in
"
else
# Export p2p port forwarding only if set in env vars
if [ -n "${P2P_TCP_LISTEN_ADDR:-}" ]; then
P2P_TCP_PORT=${P2P_TCP_LISTEN_ADDR##*:}
P2P_TCP_LISTEN_MAPPING="$P2P_TCP_PORT:$P2P_TCP_PORT"
if [ -n "${P2P_PORT:-}" ]; then
P2P_TCP_LISTEN_MAPPING="$P2P_PORT:$P2P_PORT"

PORTS_TO_EXPOSE="${PORTS_TO_EXPOSE:-} $P2P_TCP_LISTEN_MAPPING"
fi

if [ -n "${P2P_UDP_LISTEN_ADDR:-}" ]; then
P2P_UDP_PORT=${P2P_UDP_LISTEN_ADDR##*:}
P2P_UDP_LISTEN_MAPPING="$P2P_UDP_PORT:$P2P_UDP_PORT/udp"

PORTS_TO_EXPOSE="${PORTS_TO_EXPOSE:-} $P2P_UDP_LISTEN_MAPPING"
fi

exec $(dirname $0)/.aztec-run aztec-start \
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js "$@"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ P2P_ENABLED='false' # A flag to enable P2P networking for this node. (default: f
P2P_BLOCK_CHECK_INTERVAL_MS=100 # The frequency in which to check for new L2 blocks.
P2P_PEER_CHECK_INTERVAL_MS=1000 # The frequency in which to check for peers.
P2P_L2_BLOCK_QUEUE_SIZE=1000 # Size of queue of L2 blocks to store.
P2P_TCP_LISTEN_ADDR=0.0.0.0:40400 # The tcp address on which the P2P service should listen for connections.(default: 0.0.0.0:40400)
P2P_UDP_LISTEN_ADDR=0.0.0.0:40400 # The udp address on which the P2P service should listen for peer discovery requests.(default: 0.0.0.0:40400)
P2P_IP='' # Announce IP of the peer. Defaults to working it out using discV5, otherwise set P2P_QUERY_FOR_IP if you are behind a NAT
P2P_LISTEN_ADDR=0.0.0.0 # The address on which the P2P service should listen for connections.(default: 0.0.0.0)
P2P_PORT=40400 # The Port that will be used for sending & listening p2p messages (default: 40400)
PEER_ID_PRIVATE_KEY='' # An optional peer id private key. If blank, will generate a random key.
BOOTSTRAP_NODES='' # A list of bootstrap peers to connect to, separated by commas
P2P_TCP_ANNOUNCE_ADDR='' # TCP Address to announce to the p2p network. Format: <address>:<port>
P2P_UDP_ANNOUNCE_ADDR='' # UDP Hostname to announce to the p2p network (used for peer discovery). Uses TCP announce addr if not provided
P2P_ANNOUNCE_PORT='' # Port to announce to the p2p network
P2P_NAT_ENABLED='false' # Whether to enable NAT from libp2p
P2P_MAX_PEERS=100 # The maximum number of peers (a peer count above this will cause the node to refuse connection attempts)
Expand Down Expand Up @@ -91,10 +90,10 @@ PXE_L2_STARTING_BLOCK=1 # L2 Block to start synching the PXE from (default: 1)
The P2P Bootstrap node is a standalone app whose purpose is to assist new P2P network participants in acquiring peers.

```sh
P2P_UDP_LISTEN_ADDR=0.0.0.0:40400 # The udp address on which the P2P service should listen for peer discovery requests. (default: 0.0.0.0:40400)
PEER_ID_PRIVATE_KEY='' # The private key to be used by the peer for secure communications with other peers. This key will also be used to derive the Peer ID.
P2P_UDP_ANNOUNCE_ADDR='' # The IPAddress/Hostname that other peers should use to connect to this node, this may be different to P2P_TCP_LISTEN_ADDR if e.g. the node is behind a NAT.
P2P_ANNOUNCE_PORT='' # The port that other peers should use to connect to this node, this may be different to P2P_UDP_LISTEN_ADDR if e.g. the node is behind a NAT.
P2P_IP='' # Announce IP of the peer. Defaults to working it out using discV5, otherwise set P2P_QUERY_FOR_IP if you are behind a NAT
P2P_LISTEN_ADDR=0.0.0.0 # The address on which the P2P service should listen for connections.(default: 0.0.0.0)
P2P_PORT=40400 # The Port that will be used for sending & listening p2p messages (default: 40400)
```

## Cheat Codes
Expand Down
32 changes: 16 additions & 16 deletions docs/docs/run_node/guides/run_nodes/how_to_run_sequencer_draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ Once you connect and begin to see gossiped messages such as attestations, propos

The `aztec-spartan.sh` script will set the following required variables on your behalf. You can ofcourse override the variables set by the script by simply changing the `.env` file directly and re-running `./aztec-spartan.sh`

| Variable | Description |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Variable | Description |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| ETHEREUM_HOSTS | List of URLs of Ethereum nodes (comma separated). For as long as we're on private networks, please use the value in `aztec-spartan.sh` |
| BOOTNODE_URL | URL to a bootnode that supplies L1 contract addresses and the ENR of the bootstrap nodes. |
| IMAGE | The docker image to run |
| BOOTNODE_URL | URL to a bootnode that supplies L1 contract addresses and the ENR of the bootstrap nodes. |
| IMAGE | The docker image to run |

In addition, the user is prompted to enter 1) an IP Address and a P2P port to be used for the TCP and UDP addresses (defaults to 40400) 2) A port for your node (8080) 3) an Ethereum private key 4) `COINBASE` which is the Ethereum address associated with the private key and 5) a path to a local directory to store node data if you don't opt for a named volume.

Expand All @@ -72,15 +72,15 @@ The Publisher is the main node component that interacts with the Ethereum L1, fo

The Archiver's primary functions are data storage and retrieval (i.e. L1->L2 messages), state synchronization and re-org handling.

| Variable | Description |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Variable | Description |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ETHEREUM_HOSTS | List of L1 node URLs (comma separated) your validator will connect to. For as long as we're on private networks, please use the value in `aztec-spartan.sh` |
| L1_CHAIN_ID | Chain ID of the L1 |
| DATA_DIRECTORY | Optional dir to store archiver and world state data. If omitted will store in memory |
| ARCHIVER_POLLING_INTERVAL_MS | The polling interval in ms for retrieving new L2 blocks and encrypted logs |
| SEQ_PUBLISHER_PRIVATE_KEY | This should be the same as your validator private key |
| SEQ_PUBLISH_RETRY_INTERVAL_MS | The interval to wait between publish retries |
| SEQ_VIEM_POLLING_INTERVAL_TIME | The polling interval viem uses in ms |
| L1_CHAIN_ID | Chain ID of the L1 |
| DATA_DIRECTORY | Optional dir to store archiver and world state data. If omitted will store in memory |
| ARCHIVER_POLLING_INTERVAL_MS | The polling interval in ms for retrieving new L2 blocks and encrypted logs |
| SEQ_PUBLISHER_PRIVATE_KEY | This should be the same as your validator private key |
| SEQ_PUBLISH_RETRY_INTERVAL_MS | The interval to wait between publish retries |
| SEQ_VIEM_POLLING_INTERVAL_TIME | The polling interval viem uses in ms |

### Sequencer Config

Expand Down Expand Up @@ -117,11 +117,11 @@ The P2P client coordinates peer-to-peer communication between Nodes.
| Variable | Description |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| BOOTSTRAP_NODES | A list of bootstrap peer ENRs to connect to. Separated by commas. |
| P2P_TCP_ANNOUNCE_ADDR | Format: `<IP_ADDRESS>:<TCP_PORT>` |
| P2P_UDP_ANNOUNCE_ADDR | Format: `<IP_ADDRESS>:<UDP_PORT>` |
| P2P_TCP_LISTEN_ADDR | Format: `<IP_ADDRESS>:<TCP_PORT>` or can use `0.0.0.0:<TCP_PORT>` to listen on all interfaces |
| P2P_IP | The client's public IP address. Defaults to working it out using disv5, otherwise set P2P_QUERY_FOR_IP if you are behind a NAT |
| P2P_PORT | The port that will be used for sending / receiving p2p messages. Defaults to 40400. |
| P2P_LISTEN_ARR | Address to listen on for p2p messages. Defaults to 0.0.0.0 |
| P2P_UDP_LISTEN_ADDR | Format: `<IP_ADDRESS>:<TCP_PORT>` or can use `0.0.0.0:<UDP_PORT>` to listen on all interfaces |
| P2P_QUERY_FOR_IP | Useful in dynamic environments where your IP is not known in advance. Set this to True, and only supply `:TCP_PORT` and `:UDP_PORT` for the `ANNOUNCE_ADDR` variables. If you know your public IP address in advance, set this to False or just provide the full announce addresses. |
| P2P_QUERY_FOR_IP | Useful in dynamic environments where your IP is not known in advance. |
| P2P_ENABLED | Whether to run the P2P module. Defaults to False, so make sure to set to True |
| P2P_MAX_PEERS | The max number of peers to connect to. |
| P2P_BLOCK_CHECK_INTERVAL_MS | How milliseconds to wait between each check for new L2 blocks. |
Expand Down
2 changes: 1 addition & 1 deletion iac/network/bootnode/vm/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ resource "google_compute_instance" "vm" {
PEER_ID_PRIVATE_KEY = var.peer_id_private_keys[count.index],
LOCATION = "GCP",
DATA_STORE_MAP_SIZE_KB = 16777216,
P2P_PORT = var.p2p_udp_port,
P2P_PORT = var.p2p_port,
SSH_USER = local.ssh_user,
L1_CHAIN_ID = var.l1_chain_id,
NETWORK_NAME = var.network_name
Expand Down
4 changes: 2 additions & 2 deletions iac/network/bootnode/vm/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ variable "project_id" {
type = string
}

variable "p2p_udp_port" {
description = "The P2P UDP port"
variable "p2p_port" {
description = "The P2P port"
type = number
}

Expand Down
4 changes: 2 additions & 2 deletions iac/network/common/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ module "iam" {

module "firewall" {
source = "../../modules/firewall/gcp"
p2p_tcp_ports = var.p2p_tcp_ports
p2p_udp_ports = var.p2p_udp_ports
p2p_tcp_ports = var.p2p_ports
p2p_udp_ports = var.p2p_ports
}
9 changes: 2 additions & 7 deletions iac/network/common/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ variable "sa_account_id" {
type = string
}

variable "p2p_tcp_ports" {
description = "List of allowed P2P TCP ports"
type = list(string)
}

variable "p2p_udp_ports" {
description = "List of allowed P2P UDP ports"
variable "p2p_ports" {
description = "List of allowed P2P ports"
type = list(string)
}
8 changes: 4 additions & 4 deletions iac/network/modules/firewall/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ resource "google_compute_firewall" "inbound_p2p_tcp_rule" {

allow {
protocol = "tcp"
ports = var.p2p_tcp_ports
ports = var.p2p_ports
}

# Allow inbound traffic from any IP (0.0.0.0/0)
Expand All @@ -102,7 +102,7 @@ resource "google_compute_firewall" "inbound_p2p_udp_rule" {

allow {
protocol = "udp"
ports = var.p2p_udp_ports
ports = var.p2p_ports
}

# Allow inbound traffic from any IP (0.0.0.0/0)
Expand All @@ -117,7 +117,7 @@ resource "google_compute_firewall" "outbound_p2p_tcp_rule" {

allow {
protocol = "tcp"
ports = var.p2p_tcp_ports
ports = var.p2p_ports
}

# Allow inbound traffic from any IP (0.0.0.0/0)
Expand All @@ -134,7 +134,7 @@ resource "google_compute_firewall" "outbound_p2p_udp_rule" {

allow {
protocol = "udp"
ports = var.p2p_udp_ports
ports = var.p2p_ports
}

# Allow inbound traffic from any IP (0.0.0.0/0)
Expand Down
9 changes: 2 additions & 7 deletions iac/network/modules/firewall/gcp/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
variable "p2p_tcp_ports" {
description = "List of allowed P2P TCP ports"
type = list(string)
}

variable "p2p_udp_ports" {
description = "List of allowed P2P UDP ports"
variable "p2p_ports" {
description = "List of allowed P2P ports"
type = list(string)
}
13 changes: 5 additions & 8 deletions iac/network/scripts/deploy_bootnodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ L1_CHAIN_ID=${5:-}
PROJECT_ID=${6:-}
TAG=${7:-"latest"}

P2P_UDP_PORT=40400
P2P_TCP_PORT=40400
P2P_UDP_PORTS="[\"$P2P_UDP_PORT\"]"
P2P_TCP_PORTS="[\"$P2P_TCP_PORT\"]"
P2P_PORT=40400
P2P_PORTS="[\"$P2P_PORT\"]"

echo "NETWORK_NAME: $NETWORK_NAME"
echo "GCP_REGIONS: $GCP_REGIONS"
Expand Down Expand Up @@ -71,8 +69,7 @@ terraform init -backend-config="prefix=network/common/gcp"

terraform apply \
-var "sa_account_id=service-acc-nodes" \
-var "p2p_tcp_ports=$P2P_TCP_PORTS" \
-var "p2p_udp_ports=$P2P_UDP_PORTS" \
-var "p2p_ports=$P2P_PORTS" \
-var "project_id=$PROJECT_ID"

# Create the static IPs for the bootnodes
Expand Down Expand Up @@ -136,7 +133,7 @@ while read -r REGION IP; do
PRIVATE_KEY=$(gcloud secrets versions access latest --secret="${SECRET_NAME}")

# Now we can generate the enr
ENR=$(cd scripts && ./generate_encoded_enr.sh "$PRIVATE_KEY" "$IP" "$P2P_UDP_PORT" "$L1_CHAIN_ID" $TAG)
ENR=$(cd scripts && ./generate_encoded_enr.sh "$PRIVATE_KEY" "$IP" "$P2P_PORT" "$L1_CHAIN_ID" $TAG)

echo "ENR: $ENR"

Expand Down Expand Up @@ -179,6 +176,6 @@ terraform apply \
-var="peer_id_private_keys=$PRIVATE_KEYS_JSON" \
-var="machine_type=$GCP_MACHINE_TYPE" \
-var="project_id=$PROJECT_ID" \
-var="p2p_udp_port=$P2P_UDP_PORT" \
-var="p2p_port=$P2P_PORT" \
-var="l1_chain_id=$L1_CHAIN_ID" \
-var="image_tag=$TAG"
2 changes: 1 addition & 1 deletion iac/network/scripts/destroy_bootnodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ terraform apply \
-var="peer_id_private_keys=$PRIVATE_KEYS_TF_ARG" \
-var="machine_type=" \
-var="project_id=$PROJECT_ID" \
-var="p2p_udp_port=$P2P_PORT" \
-var="p2p_port=$P2P_PORT" \
-var="l1_chain_id=$L1_CHAIN_ID" \
-var="image_tag=$TAG" \
--destroy
7 changes: 3 additions & 4 deletions spartan/aztec-network/values/ignition-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ bootNode:
enabled: false
# unused.
externalHost: "http://localhost:8080"
manaTarget: 0

proverNode:
l1FixedPriorityFeePerGas: 3
l1GasLimitBufferPercentage: 15
l1GasPriceMax: 500
l1GasPriceMax: 1000

validator:
replicas: 3
l1FixedPriorityFeePerGas: 3
l1GasLimitBufferPercentage: 15
l1GasPriceMax: 500
l1GasPriceMax: 1000
sequencer:
minTxsPerBlock: 0
maxTxsPerBlock: 0
Expand All @@ -65,7 +64,7 @@ proverAgent:

ethereum:
chainId: "11155111"
l1GasPriceMax: 500
l1GasPriceMax: 1000
l1FixedPriorityFeePerGas: 3

jobs:
Expand Down
Loading