Adding the consensus committee¶
The committee puts a BFT agreement step in front of the relayer: an event is executed only after a committee of virtual relayer nodes has agreed on it.
It exists for experiments comparing an honest committee with one containing crashed or Byzantine
members, not for production. It is off unless CONSENSUS_ENABLED=true.
You will learn / You need
You will learn: how to turn the committee on, what its nodes accept, how the four Byzantine
presets behave, which CSV columns it adds, and where it stops protecting you.
You need: a working bridge setup (the committee sits in front of BridgeAA) and the
ideas in Agreement: the consensus committee. Every CONSENSUS_*
variable is in Configuration.
flowchart LR
L[event_listener] --> I["consensus_committee<br/>n CometBFT nodes"]
I -- "signed delivery<br/>after ⌊(n−1)/3⌋+1 reports" --> H[event_handler]
H --> AA[BridgeAA]
How it works¶
- Nodes. One container runs every node: one CometBFT v0.38 process per validator, each driving its own ABCI application in the Rust process, all on loopback.
- What honest nodes accept. An event that the executor's own
intent_from_eventaccepts, whosesource_senderis in the destination ACL, and which the node observed itself and has not seen committed. The last check rejects forged, altered and replayed events. - Delivery. Once ⌊(n−1)/3⌋+1 nodes report a commit, the committee posts the event to
event_handler, signed with HMAC-SHA256 underCONSENSUS_DELIVERY_KEY. The handler answers 403 to anything unsigned, including events posted to it directly, and executes each delivery once. - Liveness. If crashes at runtime leave no quorum,
/healthand ingest answer 503, so the listener keeps its cursor. A committee configured without a quorum stays up, since that stall is the experiment.
Running it¶
# in stealth_name_service/backend/.env
CONSENSUS_ENABLED=true
CONSENSUS_DELIVERY_KEY=<output of: openssl rand -hex 32>
CONSENSUS_NODES=4
CONSENSUS_BYZANTINE_NODES=1
CONSENSUS_FAULTY_NODES=0
CONSENSUS_BYZANTINE_STRATEGY=forge
./deploy.sh bridge
docker exec $(docker ps -qf name=consensus_committee) curl -s localhost:5000/api/status
deploy.sh stops before touching the running stack if the key is missing or shorter than 32
characters. Each node's CometBFT home and cometbft.log go to ./consensus_data, wiped on every
start. .env_sample documents every other CONSENSUS_* setting, including the timeouts and the
localhost network tuning.
Try it¶
Byzantine presets¶
Set with CONSENSUS_BYZANTINE_STRATEGY:
| Strategy | What Byzantine nodes do | Expected with f ≤ ⌊(n−1)/3⌋ |
|---|---|---|
forge |
Propose tampered and fabricated events; accept any proposal | Rejected; only real events commit |
censor |
Propose empty blocks | Events commit later, through honest proposers |
delay |
Propose honestly, CONSENSUS_BYZANTINE_DELAY_MS late |
Added latency |
equivocate |
A twin process with the same key votes the opposite way | Duplicate-vote evidence is committed |
CONSENSUS_FAULTY_NODES are crash-stop: in the validator set but never started. Past the bound the
committee only warns. Too many crashed nodes stall it; too many forgers commit forged events, which
are logged as UNSAFE COMMIT and then executed.
Testing and comparing¶
consensus_smoke.sh runs the committee locally against real CometBFT and a mock executor, with no
stack, chain or gas. It then checks the outcome and exits non-zero on failure. all runs every
preset plus the two past-bound cases:
cd stealth_name_service/backend
./consensus_smoke.sh all
./consensus_smoke.sh 4 1 0 equivocate 15 # nodes, byzantine, faulty, strategy, events
consensus_compare.sh deploys each configuration in turn (baseline, honest, 2 crashed, 2 Byzantine
per strategy, honest with a 200 ms commit timeout; all but the baseline are 7-validator committees), runs the same load from the host, and writes
results/consensus_compare_<timestamp>/summary.md.
Spends gas
consensus_compare.sh sends real transactions and asks before starting. --scenarios, --reps,
--agents, --requests and --interval adjust the run.
Metrics¶
With the committee on, bridge_results.csv gains these columns. Without it, the file is unchanged.
| Column | Meaning |
|---|---|
consensus_height |
Committee block the event was committed in |
consensus_observed_at_ms |
When the committee ingested the event; empty for a forged commit |
consensus_committed_at_ms |
When the first node reported the commit |
consensus_delivered_at_ms |
When the delivery threshold was reached |
consensus_latency_ms |
Observed to committed: the latency the committee adds |
consensus_observed |
false means a forged commit |
committee_nodes, committee_faulty, committee_byzantine, committee_strategy |
The run's configuration; the strategy is none without Byzantine nodes |
Limitations¶
- The executor is still a single point of trust.
BridgeAAchecks one relayer signature, so whoever holds the relayer key orCONSENSUS_DELIVERY_KEYcan get an intent signed without the committee. Fixing it needs k-of-n signatures checked on-chain. - Observation is shared. Every node gets the same feed from the one listener: a forged proposal is caught, a lying listener is not.
- One host. Network latency and partitions are not realistic.
- No state across restarts. Events ingested but not yet committed when the committee restarts are lost.
- Invalid events are dropped at ingest, counted in
/api/status, and get no row inbridge_results.csv.
Check it worked¶
docker exec $(docker ps -qf name=consensus_committee) curl -s localhost:5000/api/statusanswers with the committee's status.- With
CONSENSUS_BYZANTINE_STRATEGY=forgeinside the bound, forged events do not appear inbridge_results.csv, and every row hasconsensus_observedtrue. - An event posted straight to
event_handleris answered with 403.
Next¶
- Comparing committee scenarios: run the smoke and compare scripts and read
summary.md. - The consensus committee inside: how the nodes and the ABCI application are built.