Skip to content

Types reorg and vote serialization - #3255

Open
michael-yxchen wants to merge 11 commits into
michael/cadence-serdefrom
michael/signing-ser
Open

michael-yxchen wants to merge 11 commits into
michael/cadence-serdefrom
michael/signing-ser

Conversation

@michael-yxchen

Copy link
Copy Markdown
Contributor

Reorganized Slot and ProposalScope to a top level module common_types so it's only instantiated once. Otherwise prod types won't compile

Implemented proper serialization for IsVote trait: adding SigningDomain, and prepend it to a RLP list serialization of [scope, vote]. mvba preprepare is only a placeholder

xinyuan-dev and others added 7 commits September 15, 2026 21:52
Replaces StubElection with NodeProposerSchedule, the RotatingProposerSchedule
instantiation, so the binary elects proposers the way consensus does.
ProposalCreation now takes the two facts the chaining gate needs,
handle_slot_open and handle_cap_advance, instead of SlotLifecycle. The
cadence task hands the runtime a named FinalizationObserver so the
conductor CloseSlots cap reaches the node as CadenceOutput::CapAdvance;
the previous closure only forwarded handle_finalization and dropped
handle_chain_advance on the floor.

OffsetProposalCreation still proposes at deadline - propose_before_deadline
and uses the cap only to prune due entries strictly below it. One behavior
change: due entries were previously dropped on SlotLifecycle::Completed,
which also fires when a slot faults. Pruning now follows the finalized
prefix, so a faulted-but-not-finalized slot keeps its due entry until the
cap passes it. A fault on one slot is no reason to stop proposing for an
earlier still-open one. Nothing grows without bound: poll drains every due
entry once its time passes, and cap-pruning only avoids proposing into
already-finalized slots.

Note for the next phase: the cap does not advance past a faulted slot, so
handle_cap_advance goes inert after the first fault. Harmless here, since
the gate is not live, but a liveness blocker before it can be.

fn new leaves the trait (inherent on OffsetProposalCreation) so a scripted
test double needs no EpochHandle; the schedule field is
Arc<dyn ProposerSchedule> so unit tests can use FixedProposerSchedule.

This code was generated using Claude Opus 5.
Replace OffsetProposalCreation with the tested ProposalPlanner behind
ProposalCreation. The planner's chaining gate is now live in the node:
the proposal for slot r is sealed only once slot r - y is chained, y =
observation_cutoff (3, read from the proposer schedule so the two cannot
drift). A node whose chained prefix lags more than y slots stops
proposing until it catches up. This is the spec's B_{r-y} prerequisite
and intentional back-pressure: a throughput cost, never a consensus one
(the index finalizes Negative).

The planner's wake commands collapse into a derived next_due(), so a
fact can move a slot's due time; poll returns (slot, index) and the
proposing task assembles the payload. The sim arms its seal alarm from
next_due after every fact. OffsetProposalCreation is deleted: with
observation_cutoff = 0 the planner is that policy.

This code was generated using Claude Opus 5.
`Slot`, `ProposalIndex` and `ProposalScope` are environment-independent,
so define them once in `common_types` where `spec` and `env` can name
them without picking a variant. `types` re-exports them.

This code was generated using Claude Fable 5.1.
Each vote type names a `SigningDomain`; the signed bytes are that
domain's prefix followed by the RLP list `[scope, vote]`. `IsVote`
requires `Encodable` and provides `signing_bytes`.

- spec::vote: `SigningDomain` (prefix `<len><name>\n`, checked at
  compile time), `signing_bytes`, and `signing_bytes_of` built with
  `alloy_rlp::encode_list` over `&[&dyn Encodable]`.
- One domain per vote kind across fast, dummy and mvba. Since
  `FallbackEntry` encodes like `Entry`, the domain alone separates them.
- mvba pre-prepare signs `[slot, view, entries, tc]`, with an absent
  TC encoded as an empty list.

This code was generated using Claude Fable 5.1.
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.

3 participants