Skip to content

Check consensus traces across nodes - #8924

Draft
cjen1-msft wants to merge 4 commits into
cjen1-msft-special-fortnightfrom
cjen1-msft-animated-fortnight
Draft

cjen1-msft wants to merge 4 commits into
cjen1-msft-special-fortnightfrom
cjen1-msft-animated-fortnight

Conversation

@cjen1-msft

@cjen1-msft cjen1-msft commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #8916, which validates each node's consensus trace alone and so cannot show that a received packet was ever sent, or that two nodes hold the same log.
This is a first increment of the cross-node checks, run by validate after the nodes validate alone.

What it checks

  • Every receive has a send. Each Step.receive of a validated group must match a NativeSend traced by its source, as a multiset of (source, destination, packet). A sent packet need not be received, and one send received twice is an error.
  • Logs behind signatures align. Whenever a node's model log gains a signature, the entries behind it (back to the previous signature, inclusive) are recorded under the signature's (index, term). Any other node that gains the same signature must hold the same entries: term, signature flag, configuration, retirements. Signature by signature, this gives the same log up to it.

Cut-short captures

A killed node can lose the tail of its trace although its packets were delivered.
With --lenient, a receive with no traced send is therefore not an error; the result reports the number in a new unsent field (0 without --lenient).
Log alignment only compares what nodes did observe, so a disagreement is an error with --lenient too.
Per-node validation and the watermark are unchanged.

Enforcement in e2e CI

A node that exits cleanly logs Fluentd exporter shutdown: N dropped events once per trace sink; a killed node logs nothing.
When a network stops, tests/infra/network.py reads the stdout log of every node that was given the capture's sink (always the node's last sink) and, if each one's last report is 0, appends a capture.complete record to the capture.
Replay skips it like any record of another tag.
tests/cft_trace_validation.py still runs every capture with --lenient, and now fails a capture that ends with that record and has unsent > 0; other captures only report unsent.
The Lean workflow runs the scenario captures without --lenient, so the check is always enforced there.

New surface: the unsent result field, Result.unsent, one private Lean helper signatures, and the capture.complete record. No new flags, files or statuses.

Evidence

  • All 69 cft_scenario_test captures validate without --lenient.
  • check-per-node.py gains three cases that fail on Add single-node consensus trace validation mode #8916: a receive whose send was removed (error; unsent == 1 with --lenient), a packet received twice but sent once, and a follower applying a different configuration than the leader appended behind a shared signature (error in both modes).
  • The applied-configuration-mismatch fixture, which Add single-node consensus trace validation mode #8916 removed because it passes per node, is restored and rejected.
  • e2e, built locally on an earlier base of this branch: e2e_logging, governance_test, code_update_test and reconfiguration_test_suite produced 29 captures, all marked complete, all accepted with unsent 0 and watermark 1; validating all 29 took about 1.4 s.
  • An ad hoc 3-node run was marked complete when stopped cleanly and left unmarked when a backup was killed with SIGKILL.
  • A synthetic capture with a removed send is accepted unmarked and rejected once marked complete.
  • Fixture corpus: 5/5 valid accepted, 15/15 invalid rejected. lake build --wfail, check-imports, fmt --check, and the doc, ASCII, release-note, prettier, black and ruff checks pass.

Not done

  • A node that misses a signature is not compared. The alignment check is keyed on signatures a node gains, so a follower that applies a transaction where the leader appended a signature (applied-signature-mismatch in Check applied entries and snapshots against the consensus trace #8925) is accepted.
  • A joiner's snapshot is not compared: its entries are inferred, so only signatures it applies afterwards are checked. snapshot-configuration-mismatch and snapshot-term-history-mismatch from Check applied entries and snapshots against the consensus trace #8925 are accepted.
  • No causal order: packets pair by fields only; ts is not used, so a receive "before" its send, or a joiner starting from a signature not yet committed (uncommitted-snapshot), is not detected.
  • A receive in a final group that --lenient leaves unvalidated is not matched against sends.
  • No committed test of the completeness marker: the clean/killed and marked/unmarked cases above were run by hand.
  • No Merkle root. Alignment compares the model's entries, not the ledger's; tracing the root that a signature signs is the stronger follow-up.

@cjen1-msft
cjen1-msft requested a review from a team as a code owner December 3, 2026 00:02
@cjen1-msft
cjen1-msft marked this pull request as draft December 3, 2026 00:05
@cjen1-msft
cjen1-msft force-pushed the cjen1-msft-animated-fortnight branch from 5583ae2 to 2582715 Compare December 3, 2026 00:18
@cjen1-msft
cjen1-msft added this pull request to stack #8928 December 3, 2026 09:13
Reduce one node's events, run its groups on Node.step, and report the least fraction of any node's events that were reduced and validated. The interpreter's global scheduler becomes a per-node validate, which builds a received message and a joiner's log from the node's own events; checking nodes against each other is left to a later change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cjen1-msft and others added 3 commits December 3, 2026 11:14
… signatures align

After each node validates alone, validate matches every receive against
the sends its source traced, as a multiset, and requires nodes holding
the same signature (index, term) to hold the same entries behind it.
With --lenient a receive with no traced send is counted as unsent rather
than rejected, since a node's trace can end before its last sends.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A node that exits cleanly logs how many events each trace sink dropped;
a killed node logs nothing. If every node of a network reports none for
the capture's sink, the test infrastructure ends the capture with a
capture.complete record, and cft_trace_validation.py then requires
unsent to be 0. Other captures still only report it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per-node validation accepts it; nodes holding the same signature must
now hold the same entries behind it, which rejects it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cjen1-msft
cjen1-msft force-pushed the cjen1-msft-animated-fortnight branch from 2582715 to 63acaaf Compare December 3, 2026 11:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant