Repository navigation
Description
Problem
DashSpvClient::get_quorum_at_height(height, llmq_type, quorum_hash)
(dash-spv/src/client/queries.rs) returns one error,
SpvError::QuorumLookupError(String), for every miss. A caller cannot tell
two different situations apart:
- The quorum is absent. The engine holds the masternode lists that would
contain the quorum atheight, and none of them has it. The response that
named the quorum is wrong, and a client verifying it should treat the node
that sent it as faulty. - The engine cannot say. It no longer holds, or never held, the lists
that would contain the quorum atheight. Nothing is known about the
quorum, and the node that sent the response may be honest.
Dash Platform verifies proofs with these keys (dashpay/platform#3417). Its SDK
bans a node whose proof fails to verify, so treating case 2 as case 1 bans
honest nodes. This happens for any proof at a height below the engine's
retained history. fetch_blocks and fetch_owner_transactions_in_block ask
for old heights on purpose. It also happens just after a catch-up, at heights
between two retained lists.
Why a caller cannot work it out today
At c9aeac0d (and at dev 089fee2a; these files are unchanged):
quorum_entry_for_hash_at_or_before_height
(sml_engine/helpers.rs) searches
masternode_lists.range(height - 4 * active_window ..= height), newest
first. An empty range and a quorum missing from the lists in range both give
None.prune_after_extendingdrops lists belowtip - retention_window(). It
keeps the diff base and the next QRInfo's base and their cycles.sml_engine,storageandsyncare private modules, and
masternode_list_engine()ispub(crate).- The public API exposes only the newest list (
latest_masternode_list[_blocking],
latest_coinbase) and headers. Headers are not pruned along with lists. MasternodesProgresshas no oldest-list height.SyncEvent::MasternodeStateUpdated { height }reports new heights only. It
does not report pruning, or the lists restored on start.
A caller that rebuilt the retention rule from LLMQ parameters would copy a
private policy. That copy would drift, and it would still be wrong, because
the stored lists are sparse.
Proposal
The engine decides, in one place, whether its lists cover a lookup, and
get_quorum_at_height reports a third outcome:
pub enum SpvError {
// …
/// The retained masternode lists do not cover `height` for this quorum
/// type, so whether the quorum exists there is unknown.
QuorumHistoryNotCovered { height: u32, llmq_type: LLMQType, oldest_retained: Option<u32> },
// QuorumLookupError keeps meaning: covered, and the quorum is absent.
}A lookup at height is covered only if both edges hold:
- Lower edge: the oldest retained list is at or below
height - 4 * active_window(llmq_type), the start of the walk-back. A quorum
that was already retired byheightis found only in older lists. - Upper edge: the newest list at or below
heightis at or after the end
of the last mining window ofllmq_typethat ends at or belowheight.
An update diffs from the newest list straight to the header tip, QRInfo
history keeps one list per cycle,truncate_abovedrops lists above a fork
point, and a restart restores only the stored lists. So without this edge, a
quorum mined between that list andheightreads as absent. Aheight
above the newest list is not covered.
An alternative is a public oldest_masternode_list_height(). It is weaker:
the caller would also need the walk-back width and the mining windows, both of
which are engine internals, so the engine is the right place to decide.
Tests
- Below the lower edge: a lookup below the lower edge after
prune_after_extendingreturnsQuorumHistoryNotCovered. - Gap between lists: take two retained lists L1 < L2 and a quorum mined
between them. A lookup at a height in (L1, L2) whose last mining window ends
after L1 returnsQuorumHistoryNotCovered. At L2 it finds the quorum. - Above the newest list: a lookup there returns
QuorumHistoryNotCovered. - Covered and absent: a lookup inside covered history for a quorum no list
holds still returnsQuorumLookupError. - After a restart: restored lists only. Lookups outside them are not
covered.
Platform side, after it lands (for the #3417 follow-up, not for the issue)
- platform-wallet keeps the distinction.
SpvRuntime::get_quorum_public_key
mapsQuorumHistoryNotCoveredto its own error variant instead of
stringifying it intoSpvError, andSpvQuorumSourcereports a distinct
ContextProviderErrorvariant. - The height cannot decide this on its own. It comes from the response
before that response is verified. If "not covered" simply became
QuorumSourceUnavailable, a malicious node could nameheight = 1and
never be banned: the SDK only steps over it for 2 s. - Each SDK call site decides:
- Block queries that ask for old heights on purpose spare the node:
verify_block_answer, used byfetch_blocksand
fetch_owner_transactions_in_block. - Current-state verification keeps banning, because an honest node's height
is near the tip:verify_fetching_quorum_key.
- Block queries that ask for old heights on purpose spare the node:
- Strict SPV still fails closed and never falls back to trusted keys.
Auto with SPV ready never asks trusted on an SPV miss today. Sending "not
covered" to trusted in Auto would not weaken Auto's documented guarantee,
but it is a separate decision. - Rejected: mapping every miss while SPV runs to
QuorumSourceUnavailable, because of the ban evasion above. - Test: a historical block proof below retained history bans no node in
strict SPV, and a current-state proof naming an uncovered height still bans
it.
Activity
lklimek commentedon Nov 26, 2026
Possibly related: #1534 reports intermittent "Quorum not found" and
Skipped(NotMarkedForVerification)results for platform quorums on a fast-rotating devnet, with log lines (dash-spvf0ddfd45).