You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
commitment tree: return a typed witness outcome instead of a flattened error string #1069
grovedb_commitment_tree's witness call (client/client_persistent_commitment_tree.rs and client/client_memory_commitment_tree.rs, witness) wraps shardtree's query errors into CommitmentTreeError::InvalidData(format!("witness failed: {e}")). A caller cannot tell "no checkpoint at this depth covers the position" (shardtree QueryError::NotContained / CheckpointPruned) from a storage or path failure without parsing the message.
dashpay/platform#6276 needs that distinction: the wallet reports a note no checkpoint covers yet as retryable ("wait for the next sync") and every other witness failure as a store error. To get it today, FileBackedShieldedStore::witness_at_depth (packages/rs-platform-wallet/src/wallet/shielded/file_store.rs) reads SqliteShardStore's own table before witnessing:
SELECT position FROM commitment_tree_checkpoints ORDER BY checkpoint_id DESCLIMIT1 OFFSET ?depth
That copies a table name, a column and an ordering GroveDB owns. A change to the checkpoint schema or to how depth maps onto checkpoints would break wallet spends at that precheck while GroveDB's witness API still works.
Proposal
Return the outcome typed from the commitment tree's witness API, using shardtree's existing checkpoint lookup, for example:
Ok(Some(path)) — witnessed;
Ok(None) or a dedicated error variant — no checkpoint at this depth covers the position (not contained, or the depth does not exist);
Err(..) — storage failure, or a covered position the tree cannot witness (unmarked or pruned).
Once that lands, the wallet drops its SQL precheck and maps the typed outcome directly.
Not this
#653 tracks the storage abstraction, not this witness outcome.
Activity