Why the local copy exists
PR #4258 surfaces a "which masternodes does this voting key control?" lookup to
Kotlin, for contested-username voting after the dashj engine is held
post-cutover. It needs rust-dashcore's
MasternodeList::masternodes_by_voting_key, which is not on the Dash-owned
rust-dashcore revision this workspace pins (70d4bf8e36057c58e02d56769a6e9760f701dd06).
The helper does exist upstream, but only as the last of four commits on
dashpay/rust-dashcore#916 (branch feat/owner-tagged-reservations) — a PR whose
main subject is owner-tagged reservations, and which is currently
CHANGES_REQUESTED, conflicting against dev, and whose reviewer has asked for
it to be split. Waiting on it is therefore open-ended.
Pinning the workspace to a revision that carries the helper meant redirecting
all eight rust-dashcore workspace dependencies at a personal fork
(bfoss765/rust-dashcore), which also dragged in ~528 lines of unrelated
owner-tagged-reservation and asset-lock behaviour. That fork pin was rejected in
review on #4258. The workspace therefore stays on the Dash-owned revision and
#4258 carries a small local copy of the filter instead.
The filter reads only long-standing public SML fields (key_id_voting,
pro_reg_tx_hash), so the local copy is low-risk — but it is duplication, and
this issue exists so it does not become permanent.
The duplication site
- File:
packages/rs-platform-wallet/src/spv/runtime.rs
- Function to delete: private free fn
masternodes_by_voting_key(list: &MasternodeList, voting_key_id: &PubkeyHash) -> Vec<[u8; 32]>
- Its tests:
#[cfg(test)] mod masternodes_by_voting_key_tests in the same file
- Sole caller:
SpvRuntime::masternodes_by_voting_key_blocking
The local function folds the ProTxHash -> [u8; 32] (internal byte order)
conversion into the same pass; the upstream helper returns Vec<ProTxHash>, so
the conversion has to come back when swapping.
What to do once the helper lands upstream
- Move the workspace rust-dashcore pin in
Cargo.toml (all 8 deps) and
Cargo.lock to a Dash-owned revision that contains
MasternodeList::masternodes_by_voting_key.
- Delete the private
masternodes_by_voting_key free function in
runtime.rs.
- In
SpvRuntime::masternodes_by_voting_key_blocking, replace
masternodes_by_voting_key(list, voting_key_id) with the upstream call plus
the byte-order conversion:
list.masternodes_by_voting_key(voting_key_id)
.into_iter()
.map(|pro_tx| {
let mut out = [0u8; 32];
out.copy_from_slice(pro_tx.as_ref());
out
})
.collect()
- Delete
mod masternodes_by_voting_key_tests, or keep it as a regression test
against the upstream helper — it only touches public API, so it compiles
either way.
- Drop the
use dashcore::sml::masternode_list::MasternodeList; import from
runtime.rs if nothing else there needs it.
Links
Why the local copy exists
PR #4258 surfaces a "which masternodes does this voting key control?" lookup to
Kotlin, for contested-username voting after the dashj engine is held
post-cutover. It needs rust-dashcore's
MasternodeList::masternodes_by_voting_key, which is not on the Dash-ownedrust-dashcore revision this workspace pins (
70d4bf8e36057c58e02d56769a6e9760f701dd06).The helper does exist upstream, but only as the last of four commits on
dashpay/rust-dashcore#916 (branch
feat/owner-tagged-reservations) — a PR whosemain subject is owner-tagged reservations, and which is currently
CHANGES_REQUESTED, conflicting againstdev, and whose reviewer has asked forit to be split. Waiting on it is therefore open-ended.
Pinning the workspace to a revision that carries the helper meant redirecting
all eight rust-dashcore workspace dependencies at a personal fork
(
bfoss765/rust-dashcore), which also dragged in ~528 lines of unrelatedowner-tagged-reservation and asset-lock behaviour. That fork pin was rejected in
review on #4258. The workspace therefore stays on the Dash-owned revision and
#4258 carries a small local copy of the filter instead.
The filter reads only long-standing public SML fields (
key_id_voting,pro_reg_tx_hash), so the local copy is low-risk — but it is duplication, andthis issue exists so it does not become permanent.
The duplication site
packages/rs-platform-wallet/src/spv/runtime.rsmasternodes_by_voting_key(list: &MasternodeList, voting_key_id: &PubkeyHash) -> Vec<[u8; 32]>#[cfg(test)] mod masternodes_by_voting_key_testsin the same fileSpvRuntime::masternodes_by_voting_key_blockingThe local function folds the
ProTxHash -> [u8; 32](internal byte order)conversion into the same pass; the upstream helper returns
Vec<ProTxHash>, sothe conversion has to come back when swapping.
What to do once the helper lands upstream
Cargo.toml(all 8 deps) andCargo.lockto a Dash-owned revision that containsMasternodeList::masternodes_by_voting_key.masternodes_by_voting_keyfree function inruntime.rs.SpvRuntime::masternodes_by_voting_key_blocking, replacemasternodes_by_voting_key(list, voting_key_id)with the upstream call plusthe byte-order conversion:
mod masternodes_by_voting_key_tests, or keep it as a regression testagainst the upstream helper — it only touches public API, so it compiles
either way.
use dashcore::sml::masternode_list::MasternodeList;import fromruntime.rsif nothing else there needs it.Links
4d927c15(
feat(sml): masternodes_by_voting_key lookup on MasternodeList)