Skip to content

fix: handle missing fields in ProUpServTx v2 encode#417

Open
xdustinface wants to merge 1 commit intov0.42-devfrom
fix/serialize-pro-up-serv-tx
Open

fix: handle missing fields in ProUpServTx v2 encode#417
xdustinface wants to merge 1 commit intov0.42-devfrom
fix/serialize-pro-up-serv-tx

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Feb 4, 2026

The encoder was missing mn_type and platform fields that the decoder reads for version 2 payloads. This caused blocks containing v2 ProUpServTx transactions to be stored with fewer bytes than the decoder expected, leading to failure in deserialization.

Fixes issues like:

Failed to create disk storage manager: Read failed: Failed to decode item: unknown special transaction type: 18546

Summary by CodeRabbit

  • New Features

    • Enhanced provider update service transactions with improved protocol version support.
  • Tests

    • Added comprehensive test coverage for transaction encoding and decoding validation.

The encoder was missing `mn_type` and `platform` fields that the decoder
reads for version 2 payloads. This caused blocks containing v2
`ProUpServTx` transactions to be stored with fewer bytes than the
decoder expected, leading to failure in deserialization.

Fixes issues like:
```
Failed to create disk storage manager: Read failed: Failed to decode item: unknown special transaction type: 18546
```
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

ProviderUpdateServicePayload serialization and deserialization logic is extended to support BasicBLS (v2+) protocol, adding conditional encoding/decoding of mn_type and Evo platform fields (platform_node_id, platform_p2p_port, platform_http_port) based on version and masternode type. Tests are updated with round-trip validation for v2 scenarios.

Changes

Cohort / File(s) Summary
ProviderUpdateServicePayload v2 Support
dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
Extended serialization and deserialization to conditionally encode/decode mn_type for BasicBLS (v2+), and platform fields for Evo masternodes. Updated size() calculation for new fields. Replaced legacy size() test with round-trip tests for v2 regular and Evo masternodes, adding block parsing scaffolding.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A hop through the blockchain we go,
With BasicBLS, our protocol's flow,
Platform nodes skip and platform ports play,
Round-trip tests verify every byte's way,
Version two masternodes ready, hurray! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: fixing the handling of missing fields (mn_type and platform fields) in ProUpServTx v2 encoding, which is the core issue resolved by this PR.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/serialize-pro-up-serv-tx

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 and usage tips.

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.

1 participant