Skip to content

fix(platform-wallet): build version-3 ProUpServTx for Core v24 masternodes - #5408

Merged
shumkov merged 2 commits into
v5.0-devfrom
core24-v50-proupserv-v3
Oct 18, 2026
Merged

shumkov merged 2 commits into
v5.0-devfrom
core24-v50-proupserv-v3

Conversation

@shumkov

@shumkov shumkov commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

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 against dashpay/dash v24.0.0-rc.3):

  • bad-protx-version-disallowed: after V24, CheckProUpServTx rejects every ProUpServTx with nVersion < 3 for an EvoNode (specialtxman.cpp:1358-1361), legacy EvoNodes included.
  • A v2 update for a v3 regular masternode is accepted, but ApplyProUpServTx then replaces its whole ExtNetInfo with 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.

List entry V24 active (inferred) Payload built
version 3, any type (implied) v3, the entry's ExtNetInfo copied verbatim
legacy EvoNode yes v3, converted: CoreP2P = legacy address, PlatformP2P = its IP with the caller's P2P port, PlatformHttps = its IP with the entry's HTTP port, the same conversion Core's protx update_service_evo does for bare ports
legacy EvoNode no v2, as before
legacy regular masternode any v2, as before

Details:

  • V24 signal. V24 counts as active when any entry in the synced list has version ≥ 3. This is sound because v3 states exist only after V24.
    • Caveat. Right after activation, before the first v3 ProRegTx, ProUpServTx or ProUpRegTx is mined, the list still reads pre-V24 (a quiet devnet may never mine one). In that window a legacy EvoNode gets a v2 update. Core rejects it (bad-protx-version-disallowed), the reserved inputs are released, and a retry works once a v3 entry exists.
  • P2P port for a v3 EvoNode. It is optional; if given, it must match a port the entry lists under PlatformP2P. A mismatch is refused, and the error names both ports.
  • Mainnet guard, added after review with the coordinator's approval. Before v3, Core requires a mainnet EvoNode's P2P port to be 26656 (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 is NEVER_ACTIVE in rc.3.
  • Nothing to re-assert. An entry registered without addresses (an empty v3 map, or a legacy [::]:0) is refused before funding.
  • No panic across the FFI. The payload finalizer now hashes through base_payload_data_encode and returns BuilderError::InvalidData when the payload version and address form disagree. Before, it called dashcore's base_payload_hash(), whose expect panics in that case; iOS builds with panic = "abort", so that would crash the host app. key-wallet releases the reservation on the error.
  • New accessor. SpvRuntime::masternode_list_entries() (pub(crate), async) reads the tip list's raw entries, with the same lock order as masternode_list_summaries(). Only the raw entry carries the ExtNetInfo.
  • Doc comments only, no signature changes: platform_p2p_port in the Rust params, the FFI extern and both Swift wrappers; MasternodeListSummary::has_extended_net_info. There is no Kotlin/JNI binding for update-service.
  • No persisted-format change and no rust-dashcore change: everything needed is at the pinned 6c5775cf.

Decisions taken with Ivan:

  • Q1. Revive-only, no new address input. The Rust, FFI and Swift/Kotlin signatures stay unchanged.
  • Q2. Legacy regular masternodes stay on v2 after V24. v2 stays valid for them and doesn't move a v2 state to v3.
  • Q3. V24 status for legacy EvoNodes is inferred from "the synced list holds a v3 entry", with the caveat above.
  • A P2P port given for a v3 EvoNode must match.

Commits

  1. refactor(platform-wallet): no behaviour change. The placeholder now takes the raw MasternodeListEntry, plus the network and V24 flag, which it doesn't use yet. Adds the accessor and the pure update_service_target lookup, and ports the existing tests to raw-entry fixtures. It deletes placeholder_refuses_an_entry_without_a_plain_service_address, whose case can no longer be built from a raw entry.
  2. fix(platform-wallet): the behaviour change above. It deletes placeholder_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:

Test Commit 1 Commit 2
should_reassert_a_v3_evonode_entry_as_core_encoded_it ✖ (v3 refused) ✔
should_reassert_a_v3_regular_masternode_entry_verbatim ✖ (v3 refused) ✔
should_convert_a_legacy_evonode_to_cores_v3_encoding_after_v24 ✖ (v2 built) ✔
should_hold_a_mainnet_legacy_evonode_conversion_to_port_26656 ✖ (26657 accepted at v2) ✔
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 ✖ (panicked in dashcore base_payload_hash) ✔
should_keep_version_2_for_a_legacy_evonode_before_v24 ✔ (guard) ✔
should_keep_version_2_for_a_legacy_regular_masternode_after_v24 ✔ (guard) ✔
should_size_and_sign_a_version_3_pro_up_serv_tx ✔ (guard) ✔
should_find_the_entry_in_wire_order_and_read_v24_from_the_whole_list ✔ (lookup lands in commit 1) ✔

Against Core's own bytes. The re-assert and conversion tests rebuild the real Core v24 v3 ProUpServTx mined on devnet Jameson (txid 7c58d977…, EvoNode a9cbebcd…, already in tests/vectors/core_v24_devnet/). Both paths, re-asserting its ExtNetInfo and converting 68.67.122.237:20001 plus ports 26656/1443 (also from an IPv4-mapped address), produce:

  • base-payload bytes equal to Core's raw slice;
  • a sign hash equal to a constant computed outside dashcore (SHA256d, 27fb283c…a21c72b6 in display order);
  • a payload equal, field by field, to the decoded vector, with its signature zeroed.

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:

  • the mainnet P2P-port guard;
  • a v3 regular re-assert test;
  • refusing the HTTPS port as a P2P port;
  • requiring the P2P port for the conversion;
  • Core's real empty address [::]:0 in the refusal test;
  • matching on mn_type directly, which removes two unreachable refusals;
  • host-facing doc wording: pass the port for every EvoNode, and it can't be changed by the wallet after conversion.

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 + testmempoolaccept before broadcast:

  • U0: dry run on a9cbebcd…, nothing broadcast.
  • U1: re-assert the v3 EvoNode a9cbebcd….
  • U2: re-assert a v3 regular masternode. Note: the v3 registrations R1 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.
  • U3: a legacy regular masternode, which stays v2 after V24.
  • U4: a legacy EvoNode, converted to v3. This is irreversible and needs a separate go.

Breaking Changes

None. No public, FFI, Swift or Kotlin signature changes; prepare_update_service_placeholder is crate-private. Behaviour changes, all intended:

  • v3 entries are now re-asserted instead of refused;
  • legacy EvoNodes get v3 once V24 is active;
  • address-less entries are refused before funding instead of being rejected by Core.

Forward merge to v5.1-dev (which pins rust-dashcore d036d844, with the same ProUpServTx v3 types): expect only the known test-import conflict, dashcore::blsful vs dpp::bls.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · bfe8cdb

  • Bots — coderabbitai skipped after its own rate limit · thepastaclaw ✓
  • Self-review — post /self-reviewed
  • Reviewer requests paused — your 5 review slots are occupied; this PR is excluded from reviewers' queues. Required approvals still count without a slot.
  • Build green
  • Approvals
    • rs-platform-wallet-ffi (packages/rs-platform-wallet-ffi/src/masternode_update_service.rs) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • rs-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 romchornyi
    • swift-sdk (packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerMasternodes.swift, packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerTrackedMasternodes.swift) — llbartekll or romchornyi

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

shumkov and others added 2 commits October 13, 2026 18:21
…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]>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: dashpay/platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 198fa9c7-32bc-44d6-8582-82c77e434ab3
📥 Commits

Reviewing files that changed from the base of the PR and between 5cbe01e and bfe8cdb.

📒 Files selected for processing (6)
  • packages/rs-platform-wallet-ffi/src/masternode_update_service.rs
  • 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
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerMasternodes.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerTrackedMasternodes.swift
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added this to the v5.0.0 milestone Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 13, 2026
@thepastaclaw

thepastaclaw commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit bfe8cdb) · triage: critical

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: critical by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 14, 2026
@shumkov
shumkov merged commit ea16eb9 into v5.0-dev Oct 18, 2026
23 of 24 checks passed
@shumkov
shumkov deleted the core24-v50-proupserv-v3 branch October 18, 2026 05:34
thepastaclaw pushed a commit to thepastaclaw/platform that referenced this pull request Oct 27, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants