Skip to content
Draft
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: 10 additions & 2 deletions dev/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@ x-postgres-image: &x-postgres-image postgres:16
services:
db:
image: *x-postgres-image
profiles: ["single", "dual"]
profiles: ["single", "dual", "triple"]
environment:
POSTGRES_PASSWORD: xmtp
ports:
- 8765:5432

db2:
image: *x-postgres-image
profiles: ["dual"]
profiles: ["dual", "triple"]
environment:
POSTGRES_PASSWORD: xmtp
ports:
- 8766:5432

db3:
image: *x-postgres-image
profiles: ["triple"]
environment:
POSTGRES_PASSWORD: xmtp
ports:
- 8767:5432

chain:
platform: linux/amd64
image: ghcr.io/xmtp/contracts:v2026.02.10-1
Expand Down
20 changes: 17 additions & 3 deletions dev/docker/up
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eo pipefail
if [ -z "$1" ]; then
profile="single"
echo "No profile provided, defaulting to single"
elif [ "$1" = "single" ] || [ "$1" = "dual" ]; then
elif [ "$1" = "single" ] || [ "$1" = "dual" ] || [ "$1" = "triple" ]; then
profile="$1"
else
echo "Invalid profile '$1', defaulting to single"
Expand Down Expand Up @@ -51,8 +51,8 @@ run_cli \
--add \
--node-id=100

# Register and enable node 2 (dual only)
if [ "${profile}" = "dual" ]; then
# Register and enable node 2 (dual or triple)
if [ "${profile}" = "dual" ] || [ "${profile}" = "triple" ]; then
run_cli \
nodes register \
--owner-address="${ANVIL_ACC_2_ADDRESS}" \
Expand All @@ -65,4 +65,18 @@ if [ "${profile}" = "dual" ]; then
--node-id=200
fi

# Register and enable node 3 (triple only)
if [ "${profile}" = "triple" ]; then
run_cli \
nodes register \
--owner-address="${ANVIL_ACC_3_ADDRESS}" \
--signing-key-pub="${ANVIL_ACC_3_PUBLIC_KEY}" \
--http-address="${NODE_3_HTTP_ADDRESS}"

run_cli \
nodes canonical-network \
--add \
--node-id=300
fi

echo
6 changes: 6 additions & 0 deletions dev/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export ANVIL_ACC_2_PUBLIC_KEY="0x039d9031e97dd78ff8c15aa86939de9b1e791066a0224e3
export ANVIL_ACC_2_ADDRESS="0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
export NODE_2_HTTP_ADDRESS="http://localhost:5051"

# Account 3. Used to register local node 3.
export ANVIL_ACC_3_PRIVATE_KEY="0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"
export ANVIL_ACC_3_PUBLIC_KEY="0x0220b871f3ced029e14472ec4ebc3c0448164942b123aa6af91a3386c1c403e0eb"
export ANVIL_ACC_3_ADDRESS="0x90F79bf6EB2c4f870365E785982E1f101E93b906"
export NODE_3_HTTP_ADDRESS="http://localhost:5052"

# Top Level Options Default Node
export XMTPD_SIGNER_PRIVATE_KEY=$ANVIL_ACC_1_PRIVATE_KEY
export XMTPD_SIGNER_PUBLIC_KEY=$ANVIL_ACC_1_PUBLIC_KEY
Expand Down
17 changes: 17 additions & 0 deletions dev/run-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -eu

. dev/local.env

export XMTPD_SIGNER_PRIVATE_KEY=$ANVIL_ACC_3_PRIVATE_KEY
export XMTPD_PAYER_PRIVATE_KEY=$XMTPD_SIGNER_PRIVATE_KEY
export XMTPD_DB_WRITER_CONNECTION_STRING="postgres://postgres:xmtp@localhost:8767/postgres?sslmode=disable"

export XMTPD_REFLECTION_ENABLE=true
export XMTPD_API_ENABLE=true
export XMTPD_SYNC_ENABLE=true
export XMTPD_INDEXER_ENABLE=true
export XMTPD_CONTRACTS_ENVIRONMENT=anvil

go run -ldflags="-X main.Version=$(git describe HEAD --tags --long)" cmd/replication/main.go -p 5052 "$@"
23 changes: 23 additions & 0 deletions dev/run-no-chain
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Run node with --no-blockchain experiment flags.
# Usage: dev/run-no-chain [1|2|3] [extra-args...]
#
# Node 1 (port 5050, node ID 100): handles commits
# Node 2 (port 5051, node ID 200): handles identity updates
# Node 3 (port 5052, node ID 300): handles regular messages
#
# All nodes accept all message types with --no-blockchain.

set -eu

NODE=${1:-1}
shift 2>/dev/null || true

NO_CHAIN_FLAGS="--payer.no-blockchain --payer.commit-node-id=100 --payer.identity-node-id=200 --api.no-blockchain"

case $NODE in
1) exec dev/run $NO_CHAIN_FLAGS "$@" ;;
2) exec dev/run-2 $NO_CHAIN_FLAGS "$@" ;;
3) exec dev/run-3 $NO_CHAIN_FLAGS "$@" ;;
*) echo "Unknown node: $NODE (use 1, 2, or 3)"; exit 1 ;;
esac
Loading
Loading