Fix: Correct ProUpServTx (v2) serialization and parsing (DIP3 / DIP23 compliance) #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 mainport.✅ Added optional
platformNodeID,platformP2PPort,platformHTTPPortfields formn_type == 1.✅ Implemented dual-mode signature encoding:
✅ Defensive checks for all field sizes (
proTxHash,inputsHash,payloadSig).2. Deserialization (
read_vds)mn_typeonly for version ≥ 2.inputsHash.3.
__str__improvements✅ Extended string representation with:
mn_typeplatformNodeIDand platform ports✅ Improved readability and conditional formatting for optional fields.
Compatibility
Testing
Added and verified round-trip tests using real raw transactions:
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
ProUpRegTxandProUpRevTxare planned for a future PR.References
src/evo/specialtxes.cpp,bls_basic_scheme.cpp)