Skip to content

Conversation

@LexxXell
Copy link

Summary

This PR fixes and modernizes the serialization and deserialization logic for ProUpServTx special transactions according to DIP-3 and DIP-23 specifications (Dash Core ≥ v19).
It also improves backward compatibility with legacy (v1) payloads and adds proper handling of optional Platform fields for mn_type == 1.


Changes

1. Serialization (serialize)

  • ✅ Added structured docstring and explicit field layout (DIP-3/DIP-23 reference).

  • ✅ Corrected port endianness → Big-endian (network byte order) for main port.

  • ✅ Added optional platformNodeID, platformP2PPort, platformHTTPPort fields for mn_type == 1.

  • ✅ Implemented dual-mode signature encoding:

    • v1: CompactSize-prefixed varbytes (legacy BLS).
    • v2: Raw bytes (90–96 B, Basic BLS), no varint prefix.
  • ✅ Defensive checks for all field sizes (proTxHash, inputsHash, payloadSig).

  • ⚠️ Noted a known discrepancy: platform ports are serialized as LE, although documentation specifies BE — confirmed by actual network payloads.

2. Deserialization (read_vds)

  • ✅ Reads mn_type only for version ≥ 2.
  • ✅ Reads IP (16 B), port (BE), payout script (varbytes), and 32 B inputsHash.
  • ✅ Handles optional platform fields and auto-detects payloadSig length (90 / 96 B).
  • ✅ Supports legacy CompactSize signatures (v1).
  • ✅ Converts IPv6-mapped IPv4 addresses to readable strings.

3. __str__ improvements

  • ✅ Extended string representation with:

    • mn_type
    • optional platformNodeID and platform ports
  • ✅ Improved readability and conditional formatting for optional fields.


Compatibility

  • Backward-compatible with all previously serialized v1 ProUpServTx payloads.
  • Forward-compatible with current Dash Core v20+ ProUpServTx payloads (Basic BLS).
  • No impact on other special transaction types (ProRegTx, ProUpRegTx, ProUpRevTx).

Testing

  • Added and verified round-trip tests using real raw transactions:

    • ✅ ProUpServTx (v2, mn_type = 1)
    • ✅ ProRegTx (v2)
  • Verified correct txid() against known hashes.

  • Confirmed serialized payload matches expected field layout and byte order.

  • Checked fallback handling for legacy payloads (CompactSize + varbytes signature).


Notes

  • The platform port endianness inconsistency remains intentionally preserved to match real on-chain payloads.
  • Further unit tests for ProUpRegTx and ProUpRevTx are planned for a future PR.

References


def initializePage(self):
self.parent.setButtonText(QWizard.CommitButton, 'Save')
self.parent.setButtonText(QWizard.CommitButton, 'Saveppppp')
Copy link
Owner

Choose a reason for hiding this comment

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

Should not be here I believe

Copy link
Author

Choose a reason for hiding this comment

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

yep
fixed

@pshenmic pshenmic merged commit 32eda7f into pshenmic:develop Nov 14, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants