Repository navigation
fix(platform-wallet): build version-3 ProUpServTx for Core v24 masternodes - #5408
Conversation
…the raw list entry Read the masternode list's raw entries for a ProUpServTx instead of the typed summaries. Only the raw entry carries a version-3 entry's extended address map, and only the whole list shows whether V24 is active. No behaviour change: the placeholder still refuses a version-3 entry and always builds version 2. - SpvRuntime::masternode_list_entries(): a crate-private async read of the tip list's raw entries, with the same lock order as masternode_list_summaries(). - update_service_target(): finds the entry by wire-order proTxHash and reports whether any entry is version 3, which only exists once V24 is active. Tested with the Core v24 vector's proTxHash, since the [seed; 32] fixtures read the same in either byte order. - prepare_update_service_placeholder() takes the raw entry, the wallet's network and a V24 flag; it does not use the last two yet. - The existing tests move to raw-entry fixtures next to list::test_support's summaries. Deleted test: placeholder_refuses_an_entry_without_a_plain_service_address. A raw legacy entry always carries an IP:port, and an extended one is refused before that check, so its case can no longer be built. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nodes
Once V24 is active, Dash Core refuses any ProUpServTx below version 3 for
an EvoNode (bad-protx-version-disallowed). A version-2 update for a
version-3 masternode replaces its whole extended address map with one
address. The wallet's revive (update-service) action built version 2 only
and refused version-3 entries, so after V24 it could revive no EvoNode
and no masternode registered after activation.
The action stays revive-only and re-asserts what the list entry says:
- a version-3 entry, of any type: version 3, with its ExtNetInfo copied
verbatim;
- a legacy EvoNode once V24 is active: version 3, with CoreP2P = the
legacy address, PlatformP2P = its IP with the caller's P2P port, and
PlatformHttps = its IP with the entry's HTTP port, as Core's
`protx update_service_evo` converts bare ports;
- anything else (legacy regular masternodes at any time, legacy EvoNodes
before V24): version 2, as before.
V24 is inferred from the synced list: any version-3 entry proves it.
Until the first one appears the list reads as pre-V24, so a legacy
EvoNode gets a version-2 update; Core rejects it and the inputs are
released.
A version-3 EvoNode's P2P port is optional and, when given, must match a
port its PlatformP2P entries list. On mainnet the legacy-EvoNode
conversion takes only port 26656: Core holds a pre-v3 mainnet EvoNode to
that port, and the version-3 address map has no such rule, so another
port would be accepted and the wallet could never correct it. An entry
with nothing to re-assert (an empty address map, or an unspecified
legacy address) is refused before funding.
The payload finalizer now hashes through base_payload_data_encode and
returns BuilderError::InvalidData when the payload version and address
form disagree. It no longer calls base_payload_hash(), which panics on
that and would abort a host app across the FFI.
Doc comments on platform_p2p_port (the Rust params, the FFI extern and
the Swift wrappers) and on MasternodeListSummary::has_extended_net_info
are updated. No signature changes.
Tests. The new test module was run against the previous commit's
implementation first:
✖ → ✔ should_reassert_a_v3_evonode_entry_as_core_encoded_it
✖ → ✔ should_reassert_a_v3_regular_masternode_entry_verbatim
✖ → ✔ should_convert_a_legacy_evonode_to_cores_v3_encoding_after_v24
✖ → ✔ should_hold_a_mainnet_legacy_evonode_conversion_to_port_26656
✖ → ✔ should_keep_the_operator_payout_script_at_version_3
✖ → ✔ should_accept_a_v3_evonode_p2p_port_only_when_it_matches
✖ → ✔ should_refuse_an_entry_with_nothing_to_reassert
✖ → ✔ should_refuse_rather_than_panic_on_a_version_and_address_mismatch
(before: panicked in dashcore's base_payload_hash)
Guards, green on both commits:
✔ should_keep_version_2_for_a_legacy_evonode_before_v24
✔ should_keep_version_2_for_a_legacy_regular_masternode_after_v24
✔ should_size_and_sign_a_version_3_pro_up_serv_tx
The re-assert and conversion tests compare against Core's raw bytes from
the mined version-3 vector (7c58d977…) and a sign hash computed outside
dashcore.
Deleted test: placeholder_refuses_a_v3_extended_net_info_entry, which
should_reassert_a_v3_regular_masternode_entry_verbatim inverts.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit bfe8cdb) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Static verification of the complete PR range at the exact head found no actionable in-scope defects: v3 endpoint maps are preserved, legacy payload selection follows the documented policy, and fallible payload hashing removes the identified panic path without changing FFI signatures. The supplied CI snapshot reports successful Rust wallet, Swift, and Kotlin checks; broader workspace and E2E jobs were skipped, devnet transaction-acceptance testing remains unrun, and PR Hygiene is pending. The confirmed pre-existing masternode-list authentication gap is retained only as a separate follow-up.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The intricate transaction-construction changes in packages/rs-platform-wallet/src/masternode/update_service.rs also modify finalize_update_service_payload's hashing of the BLS-signed payload, directly changing a signature-critical surface. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Authenticate masternode-list service metadata before operator signing — At the unchanged rust-dashcore revision 6c5775cf3293c9906367c04ac243a764ef836349, the MnListDiff handler in dash-spv/src/sync/masternodes/sync_manager.rs passes requested diffs to MasternodeListEngine::apply_diff. That storage path and the downstream list constructors do not authenticate coinbase inclusion against the synced header or validate the reconstructed masternode-list root against the coinbase commitment; the existing has_valid_mn_list_root helper is not invoked there. Consequently, the list metadata consumed by operator signing lacks this authentication boundary. The baseline v2 update-service path already trusted the same metadata, and this PR leaves the dependency revision unchanged, so this is a concrete upstream follow-up rather than an in-scope blocker.
- Follow-up: Track a separate security issue to verify coinbase inclusion and the reconstructed masternode-list commitment before exposing list entries to signing callers, with negative tests for unauthenticated or inconsistent service metadata.
|
Bots are done — your move: post |
Brings 5.0.0-rc.5, rc.6 and rc.7 (v5.0-dev 79693ec) into v5.1-dev. Conflict resolutions: - Cargo.toml: GroveDB moves to 6.1.1 (2128ea18, dashpay#5499; fast-forward of fc7028d8). rust-dashcore stays on dev aca02026; v5.0-dev's v0.45.0 pin (d631aaca) is not taken. - Cargo.lock: v5.1-dev's lockfile, re-resolved for GroveDB 6.1.1, with dashpay#5499's RUSTSEC bumps replayed via cargo update --precise (h2 0.4.20, rustls 0.23.46, rustls-webpki 0.103.15, quinn-proto 0.11.19, crossbeam-epoch 0.9.21, rust_decimal 1.43.0, anyhow 1.0.104, event-listener 5.4.2, chacha20 0.10.2, spin 0.9.9). - CHANGELOG.md: [Unreleased] on top, then the rc.7, rc.6 and rc.5 entries. - rs-dpp serialization/mod.rs: keeps v5.1's dashcore module gate and takes dashpay#5498's serde-conversion gate for the json module. - rs-sdk dpns_usernames, put_document: dashpay#5409's ResponseMetadata import with v5.1's dpp::secp256k1 rand imports. - platform-wallet masternode/update_service.rs (dashpay#5408, dashpay#5497): v5.0's file ported to dpp::bls. rust-dashcore dev does not expose the coinbase of applied masternode list diffs, so the coinbase source is optional: with none, V24 is read from the list alone (any version-3 entry), as dashpay#5408 did, instead of refusing every legacy evonode update. - platform-wallet spv/runtime.rs: masternode_list_entries reads through DashSpvClient::latest_masternode_list (the engine is crate-private on dev); latest_coinbase is not carried over. - platform-wallet platform_wallet_traits.rs: both branches forwarded unrecorded_spend_heights and note_chain_lock_height; one forward each is kept, and the tests of both branches. - platform-wallet identity/network/profile.rs: v5.1's rs-sdk profile path (dashpay#5470). dashpay#5409's proven-balance persistence for profile writes follows in a separate commit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Issue being fixed or feature implemented
The wallet's masternode revive / unban action (
rs-platform-wallet's update-service, a ProUpServTx) always built a version-2 payload with a legacy address, and refused any masternode whose list entry is version 3. Dash Core v24 breaks both once V24 is active (rules checked againstdashpay/dashv24.0.0-rc.3):bad-protx-version-disallowed: after V24,CheckProUpServTxrejects every ProUpServTx withnVersion < 3for an EvoNode (specialtxman.cpp:1358-1361), legacy EvoNodes included.ApplyProUpServTxthen replaces its wholeExtNetInfowith the one legacy address. That is why the wallet refused v3 entries.So after V24 the wallet could revive no EvoNode and no masternode registered after activation. Follow-up to #5392, which taught Platform to decode Core v24 blocks and transactions.
What was done?
The action stays revive-only: it re-asserts what the synced list entry already says.
ExtNetInfocopied verbatimprotx update_service_evodoes for bare portsDetails:
bad-protx-version-disallowed), the reserved inputs are released, and a retry works once a v3 entry exists.providertx.cpp:243-246). v3 has no such rule, so a mistyped port would be accepted, and a revive-only wallet could never correct it afterwards. On mainnet the legacy-EvoNode conversion therefore accepts only 26656. Today this can't trigger: mainnet V24 isNEVER_ACTIVEin rc.3.[::]:0) is refused before funding.base_payload_data_encodeand returnsBuilderError::InvalidDatawhen the payload version and address form disagree. Before, it called dashcore'sbase_payload_hash(), whoseexpectpanics in that case; iOS builds withpanic = "abort", so that would crash the host app. key-wallet releases the reservation on the error.SpvRuntime::masternode_list_entries()(pub(crate), async) reads the tip list's raw entries, with the same lock order asmasternode_list_summaries(). Only the raw entry carries theExtNetInfo.platform_p2p_portin the Rust params, the FFI extern and both Swift wrappers;MasternodeListSummary::has_extended_net_info. There is no Kotlin/JNI binding for update-service.6c5775cf.Decisions taken with Ivan:
Commits
refactor(platform-wallet): no behaviour change. The placeholder now takes the rawMasternodeListEntry, plus the network and V24 flag, which it doesn't use yet. Adds the accessor and the pureupdate_service_targetlookup, and ports the existing tests to raw-entry fixtures. It deletesplaceholder_refuses_an_entry_without_a_plain_service_address, whose case can no longer be built from a raw entry.fix(platform-wallet): the behaviour change above. It deletesplaceholder_refuses_a_v3_extended_net_info_entry, which the new v3 re-assert tests invert.How Has This Been Tested?
Red → green. Commit 2's test module was run unchanged against commit 1's implementation first:
should_reassert_a_v3_evonode_entry_as_core_encoded_itshould_reassert_a_v3_regular_masternode_entry_verbatimshould_convert_a_legacy_evonode_to_cores_v3_encoding_after_v24should_hold_a_mainnet_legacy_evonode_conversion_to_port_26656should_keep_the_operator_payout_script_at_version_3should_accept_a_v3_evonode_p2p_port_only_when_it_matchesshould_refuse_an_entry_with_nothing_to_reassertshould_refuse_rather_than_panic_on_a_version_and_address_mismatchbase_payload_hash)should_keep_version_2_for_a_legacy_evonode_before_v24should_keep_version_2_for_a_legacy_regular_masternode_after_v24should_size_and_sign_a_version_3_pro_up_serv_txshould_find_the_entry_in_wire_order_and_read_v24_from_the_whole_listAgainst Core's own bytes. The re-assert and conversion tests rebuild the real Core v24 v3 ProUpServTx mined on devnet Jameson (txid
7c58d977…, EvoNodea9cbebcd…, already intests/vectors/core_v24_devnet/). Both paths, re-asserting itsExtNetInfoand converting68.67.122.237:20001plus ports 26656/1443 (also from an IPv4-mapped address), produce:27fb283c…a21c72b6in display order);The sign/size test checks the finalized v3 payload is 220 bytes, the vector's length, and that the fee covers the serialized size at 1 duff/byte.
Local runs on the final HEAD:
cargo test -p platform-wallet: 1211 passed, 0 failed, 1 ignored (test_spv_sync_and_balance, an existing#[ignore]network test).cargo test -p platform-wallet-ffi: 419 passed, 0 failed, 5 ignored (all existing#[ignore]s).cargo test -p rs-unified-sdk-jni: 43 passed.cargo clippy -p platform-wallet -p platform-wallet-ffi -p rs-unified-sdk-jni --all-targets -- -D warnings: clean.cargo fmt --all -- --check: clean.Review. Four independent review agents (Core fidelity against rc.3, FFI panic safety, test quality, simplicity) found no must-fix in the logic. Folded in from them:
[::]:0in the refusal test;mn_typedirectly, which removes two unreachable refusals;Devnet E2E: not run. Cards U0-U4 need Ivan's go, on Jameson (Core v24.0.0-rc.3, V24 active since 15000), each with
decoderawtransaction+testmempoolacceptbefore broadcast:a9cbebcd…, nothing broadcast.a9cbebcd….20814c48…, R2 and R3 were registered with an empty address map. Unless one was given addresses later, this PR refuses it as "nothing to re-assert", so U2 needs a v3 regular masternode that has addresses.Breaking Changes
None. No public, FFI, Swift or Kotlin signature changes;
prepare_update_service_placeholderis crate-private. Behaviour changes, all intended:Forward merge to
v5.1-dev(which pins rust-dashcored036d844, with the same ProUpServTx v3 types): expect only the known test-import conflict,dashcore::blsfulvsdpp::bls.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
bfe8cdb/self-reviewedrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/masternode_update_service.rs) — HashEngineering or ZocoLini or llbartekll or romchornyirs-platform-wallet(packages/rs-platform-wallet/src/masternode/list.rs,packages/rs-platform-wallet/src/masternode/update_service.rs,packages/rs-platform-wallet/src/spv/runtime.rs) — HashEngineering or ZocoLini or llbartekll or romchornyiswift-sdk(packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerMasternodes.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerTrackedMasternodes.swift) — llbartekll or romchornyiWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.