UtxoIndex: Key UTXOs by DAA score, adds pagnated and cursor-based api, exposes this via get_utxos_by_addresses_v2 RPC#991
Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
… index_utxoindex_by_daa_score
Co-authored-by: Copilot <copilot@github.com>
…e daa score. Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
|
Thanks -- the structural change is clean. DAA score moves into the per-entry key, the bucket-prefixed range scan is built on Three independent peer reviews ran (upstream review + algo peer review on the state machine + architect peer review on design surfaces); the issues consolidate into three MEDIUM concerns to fix before merge and a handful of LOW polish items. Algo correctness affirmations (independent re-derivation)Before the issue list -- the algo peer review independently re-derived the four invariants the algorithm needs (group cohesion, next-cursor points to first NOT-included, next-cursor
MEDIUM (recommend fix before merge)M1 -- migration nukes the DB dir but leaves the WAL subdir populated. When M2 -- M3 -- LOW (polish; not blockers)L1 -- migration uses L2 -- store-level L3 -- end-of-stream / limit-exactly-equals-total tests missing. The three new tests cover ordering+range, soft-limit-finishes-group (mid-stream), and resume-from-cursor. Not covered: L4 -- no test exercises the v0 -> v1 migration end-to-end. Construct a v0-shaped utxoindex DB, run migration, assert post-migration reads match. Highest test gap given M1/M2. L5 -- migration prompt does not warn about resync duration. L6 -- single-group page size is unbounded. The soft-limit semantic drains the current L7 -- address sort vs. DB byte order divergence is documentation-only. L8 -- CLI handler is positional and dense. L9 -- two unrelated trailing-whitespace cleanups bundled in. Process / surface notesP1 -- PR description under-represents the actual change surface. The body's "Backwards Compatibility" claim ("old
Suggest extending the PR description with a "Wider surface" section so reviewers don't miss them and downstream consumers know what to update on bump. P2 -- architect-level design questions worth considering for a follow-up (none blocking this PR):
Static evidence on HEADState machine traced by hand through |
Summary
start_address,start_daa_score) plus an optional softlimit, returningnext_address/next_daa_scorefor continuation.get_utxos_by_addresses_v2and wires it through RPC/gRPC/wasm.Behavior
from_daa_score/to_daa_scoredefine an inclusive range (defaults: None ->0and None ->u64::MAX).start_address/start_daa_scoreresume from a specific point inside the range (defaults: None -> first address inaddressesand None ->from_daa_scorei.e. functions as an entry point to use the call).next_address/next_daa_scoreindicate the next cursor;Nonemeans no more pages.limitis a soft cap on page size; a page may exceed it to finish the current SPK+DAA group (default: None -> u64::MAX).Testing
cargo test -p kaspa-utxoindex test_page_Backwards Compatibility