This document describes the Priority protocol used for achieving cluster-wide consensus on ordered lists of arbitrary priorities across distributed validator nodes.
The Priority protocol enables distributed validator nodes to reach cluster-wide consensus on ordered preference lists. This is essential for coordinating behavior across independent nodes that may have different capabilities, versions, or configurations.
This document specifies the generic mechanism. Its one production use is InfoSync, which defines the concrete topics, the trigger cadence, and how the agreed result selects the cluster's consensus protocol.
Distributed validators are composed of multiple independent nodes that need to coordinate on shared preferences. For example:
-
Consensus protocol selection: When a cluster needs to agree on which consensus protocol to use (e.g., QBFT v2.0 or future protocols), each node may support different versions. The priority protocol allows nodes to exchange their preferences and converge on the best protocol supported by threshold nodes.
-
Version monitoring: During cluster upgrades, nodes running different Charon versions exchange version information. This information is monitored and logged, providing visibility into cluster version heterogeneity.
-
Proposal type preferences: Nodes may prefer different block proposal strategies (full blocks, builder/blinded blocks, or synthetic proposals). The priority protocol ensures the cluster uses proposal types supported by threshold nodes.
This document describes:
- Over-the-wire message shapes and fields
- Protocol identifiers and exchange patterns
- Result calculation and scoring logic
Out of scope: cryptographic signature routines, consensus algorithm implementation, transport reliability
n: number of participating nodes in the clustert: threshold required for consensus (typically ceil(2n/3))Duty: a validator responsibility at a specific slotTopic: a named grouping of related priorities (e.g., "protocol", "version", "proposal")Priority: an arbitrary piece of data being prioritized within a topicScore: calculated weight of a priority based on peer count and positionExchange timeout: maximum time allowed for priority message exchange (typically 6 seconds)
Priority has two protocol IDs for the same protocol, listed here in order of precedence:
/charon/priority/2.0.0 preferred
charon/priority/2.0.0 legacy, no leading "/"
The legacy spelling is missing its leading /, unlike every other protocol in
this specification — a historical accident in Charon
(core/priority/prioritiser.go) that put the bare string on the wire. Charon
normalised the ID and kept the old spelling as an alias, so the wire format is
identical under either and the version stays at 2.0.0.
Three rules follow, and an implementation needs all three to interoperate:
- Dialling: offer both IDs, the preferred one first, and use whichever the
peer negotiates. Charon obtains this ordering with
p2p.WithDelimitedProtocol, which prepends. - Listening: serve both IDs, registering a handler for each one separately, as an exact match.
- Do not register the two IDs together under a common prefix. They share no
common prefix, so a combined registration reduces that prefix to the bare
wildcard
*— and libp2p identify then advertises*to peers in place of either real protocol ID.
Warning: serving only the preferred ID is not sufficient. Every Charon release up to and including
v1.11.0-rc1speaks the legacy spelling alone, so an implementation that drops it cannot exchange priorities with any released Charon. Charon's own code targetsv1.12for the preferred ID andv1.14for removing the alias.
Priority implements a two-phase request-response pattern:
-
Initiation: When a priority protocol instance is triggered (typically for
DutyInfoSyncat the last slot of each epoch), a node creates aPriorityMsgcontaining:- The duty being performed
- One or more topics, each with an ordered list of priorities
- The node's peer ID
- A cryptographic signature
-
Broadcast phase: Each node in the cluster independently initiates the priority protocol by sending its
PriorityMsgto all other peers using libp2pSendReceive. All nodes perform this broadcast in parallel. -
Handler response: Each peer that receives a
PriorityMsgrequest immediately responds with its ownPriorityMsgfor the same duty. -
Collection: Each node collects priority messages from peers. Messages are deduplicated by peer ID (only the first message from each peer is kept). Duplicates can occur because nodes both send their own broadcast AND respond to incoming requests from other nodes.
-
Exchange completion: The exchange phase completes when either:
- Messages from all peers have been received, or
- The exchange timeout expires (typically 6 seconds)
-
Result calculation: Once the exchange phase completes, each node deterministically calculates cluster-wide priorities from the collected messages.
-
Consensus proposal: Each node proposes its calculated
PriorityResultto the consensus protocol (typically QBFT). -
Consensus output: Consensus is reached when threshold peers propose the same result, which is then delivered to all subscribers.
The following protobuf definitions are used over the wire:
- priority.proto - Priority protocol message definitions
- core.proto - Common core type definitions (Duty)
See the Python reference implementation: PriorityMsg, PriorityTopicProposal, PriorityResult, PriorityTopicResult and PriorityScoredResult, and Duty.
When initiating a priority instance:
msg := PriorityMsg{
duty: duty, // field 1
topics: [topics...], // field 2
peer_id: own_peer_id,// field 3
signature: nil // field 4
}
hash := ssz_hash(deterministic_marshal(msg))
msg.signature = secp256k1_sign(private_key, hash)
The signature is computed over the entire message with the signature field set to nil.
Because the signature covers the encoding, the field numbers are part of the
protocol: topics is field 2 and peer_id is field 3, per
proto/priority.proto.
Transposing the two yields a signing root no peer can reproduce, so no signature
verifies. scripts/check_proto_parity.py pins this against Charon.
Send the signed message to all peers concurrently:
for each peer in peers:
if peer != self:
go sendReceive(peer, own_msg, response_channel)
Each peer's handler responds immediately with its own priorities for the same duty.
When receiving a priority request from a peer:
-
Validate request:
- Verify message signature using peer's public key
- Verify duty is not expired
- Verify peer_id matches sender
-
Enqueue request: Add request to instance-specific request buffer
-
Generate response: Return own
PriorityMsgfor the same duty via response channel
The instance collects responses until:
- All peer messages received (including own message)
- Exchange timeout expires (6 seconds)
Deduplication: Only the first message from each peer is kept.
Once exchange completes, calculate the cluster-wide result:
-
Validate messages:
- All messages must have the same duty
- No duplicate peer IDs
- Each peer's topics must not have duplicates
- Each topic must not exceed 1000 priorities
- Each topic must not have duplicate priorities
-
Group by topic: Collect all priority proposals for each topic across all peers
-
Score calculation: For each priority in each topic:
count = number of peers that included this priority position_scores = sum of (1000 - position) for each peer overall_score = (count * 1000) + position_scoresThis scoring ensures priorities are ordered by:
- First, by how many peers included them (more peers = higher priority)
- Second, by their average position across peers (earlier position = higher priority)
-
Filter by threshold: Only include priorities that appear in at least
minRequiredpeer messages -
Sort priorities: Within each topic, sort by score descending. The sort must be stable, so equal-scoring priorities keep the order in which they were first seen — which is why the messages are processed in ascending peer ID order.
-
Deterministic ordering: Sort topics by hash for deterministic output
Start a consensus round proposing the calculated result. The consensus protocol ensures all nodes agree on the same result.
All received priority messages must be cryptographically verified:
-
Extract sender's public key from peer ID (secp256k1 public key)
-
Clone message and set signature field to nil
-
Hash message:
hash = ssz_hash(deterministic_protobuf_marshal(msg)) -
Recover public key from signature:
recovered_pubkey = secp256k1_recover(hash, signature) -
Verify match:
if recovered_pubkey != sender_pubkey: reject message
Before processing a priority message:
- Verify
dutyfield is non-nil - Verify
peer_idmatches the sender - Verify signature is valid
- Verify duty has not expired based on deadliner
Before starting consensus:
- Messages contain no duplicate peers
- All messages reference the same duty
- No peer has duplicate topics
- No topic exceeds 1000 priorities
- No topic has duplicate priorities
The scoring algorithm ensures deterministic, fair prioritization:
-
Count weight: A priority appearing in more peer lists always ranks higher than one appearing in fewer, regardless of position
-
Position weight: For priorities with equal peer counts, earlier positions rank higher
-
Score formula:
count_weight = 1000 // constant for each peer that included priority: peer_position = index of priority in peer's list (0-based) position_score = count_weight - peer_position total_position_score += position_score overall_score = (peer_count * count_weight) + total_position_score -
Example:
- Priority "A" appears in 3 peers at positions [0, 1, 2]
- score = (3 × 1000) + (1000 + 999 + 998) = 5997
- Priority "B" appears in 2 peers at positions [0, 0]
- score = (2 × 1000) + (1000 + 1000) = 4000
- Result: "A" ranks higher despite "B" having better average position
- Priority "A" appears in 3 peers at positions [0, 1, 2]
- Deterministic calculation: All nodes calculate the same result from the same inputs
- Threshold-based filtering: Only priorities supported by threshold peers are included
- Score-based ordering: Priorities ordered by peer count, then position
- Signature-authenticated: All messages cryptographically signed and verified
- Idempotent: Duplicate messages from same peer are ignored
- Duty-scoped: Each instance operates on a specific duty
-
Protocol versioning: Both
/charon/priority/2.0.0and the legacycharon/priority/2.0.0identify version2.0.0of this protocol and must both be served (see Protocol Identifiers); future versions may use different IDs -
Signature algorithm: Uses secp256k1 ECDSA signatures with recovery; public keys derived from libp2p peer IDs
-
Hash function: Uses SSZ (Simple Serialize) hashing over deterministic protobuf marshalling for message signing and priority deduplication
-
Protobuf Any encoding: Topics and priorities are encoded as protobuf
Anytypes for flexibility; current implementation usesstructpb.StringValuefor both -
Exchange timeout: Fixed at 6 seconds (half a slot) to allow sufficient time for all peers to exchange while staying within slot boundaries
-
Maximum priorities: Limited to 1000 priorities per topic to prevent unbounded message growth and calculation overhead
-
Consensus backend: Currently uses QBFT v2.0 as the consensus protocol
-
Topic ordering: Topics in results are ordered by their SSZ hash for deterministic output across all peers
-
Tie breaking: When priorities have identical scores, the one first proposed wins, taking peers in ascending peer ID order. This requires a stable sort by score over messages pre-sorted by peer ID; it is not a tie-break by priority hash (that ordering applies to topics, not to priorities within a topic). Charon sorts stably as of
6054bcb2; releases up tov1.11.0-rc1used a non-stable sort that agreed only because Go's pdqsort falls back to insertion sort below thirteen elements -
Minimum required: Typically set to threshold (ceil(2n/3)); priorities appearing in fewer peer messages are excluded from results
-
Request buffering: Each duty instance maintains its own request buffer; peer requests are queued and responded to by the running instance
-
Empty topics: Topics with no priorities meeting the threshold are included in results with empty priority lists