feat: decode SML ProTx v3 entries#797
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds ProTx v3 masternode support by introducing BIP155-based extended network info encoding/decoding, wrapping legacy and extended addresses in a MasternodeNetInfo enum, updating consensus serialization logic to handle v3 versioning, and integrating the new type throughout address-consuming functions with comprehensive fixture-based tests. ChangesProTx v3 Extended Network Info Support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #797 +/- ##
==========================================
+ Coverage 72.67% 72.77% +0.09%
==========================================
Files 322 323 +1
Lines 71363 71745 +382
==========================================
+ Hits 51866 52210 +344
- Misses 19497 19535 +38
|
|
Confirmed — this branch fixes SML ProTx-v3 decoding for us. ✅ We hit the exact No (Our e2e test runs well past mn-list sync and only stops later at an unrelated operator precondition — the test bank's Platform credit balance — so nothing further here reflects on this PR.) Thanks for the quick turnaround! 🤖 Co-authored by Claudius the Magnificent AI Agent |
Dash Core 23.1 introduced ProTx version 3 (`ProTxVersion::ExtAddr`). `CSimplifiedMNListEntry` gates two things on `nVersion >= 3`: the service address switches from the legacy fixed 18-byte `MnNetInfo` to a variable-length `ExtNetInfo`, and Evo nodes no longer serialize the inline `platformHTTPPort` (only `platformNodeID` is inline, the HTTP port lives in `ExtNetInfo` under `PLATFORM_HTTPS`). The previous decoder always read a fixed 18-byte address, desyncing the stream on v3 entries and failing with `Invalid MasternodeType variant`.
Add a faithful `net_info` module with `Bip155Network`, `NetInfoEntry`, `NetInfoPurpose` and `ExtNetInfo` types decoding the ADDRV2/BIP155 wire form (per-network address-length validation, big-endian ports, version short-circuit). Introduce `MasternodeNetInfo::{Legacy, Extended}` for `MasternodeListEntry::service_address` with a version-driven decode/encode branch and a `primary_service_address()` accessor that reconstructs IPv4/IPv6 `SocketAddr`s. Inline the `mn_type` codec into the entry path so v3 Evo entries read only `platform_node_id` and source `platform_http_port` from the `PLATFORM_HTTPS` entry, while v2 Evo entries keep the inline port.
`MasternodeNetInfo` carries a hand-written `bincode` codec whose `Legacy` arm reuses the bare `SocketAddr` layout so existing persisted engine snapshots keep decoding.
Also fix `QuorumSnapshot::consensus_encode` to write the compact-size `activeQuorumMembers` count that the decoder already consumed, which the byte-exact `qrinfo` round-trip requires.
Consumers (`peer_addresses`, `masternode_helpers`, `masternode-seeds-fetcher`) now go through `primary_service_address()`.
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
2a68c38 to
65aea9a
Compare
Dash Core 23.1 introduced ProTx version 3 (
ProTxVersion::ExtAddr).CSimplifiedMNListEntrygates two things onnVersion >= 3: the service address switches from the legacy fixed 18-byteMnNetInfoto a variable-lengthExtNetInfo, and Evo nodes no longer serialize the inlineplatformHTTPPort(onlyplatformNodeIDis inline, the HTTP port lives inExtNetInfounderPLATFORM_HTTPS). The previous decoder always read a fixed 18-byte address, desyncing the stream on v3 entries and failing withInvalid MasternodeType variant.Add a faithful
net_infomodule withBip155Network,NetInfoEntry,NetInfoPurposeandExtNetInfotypes decoding the ADDRV2/BIP155 wire form (per-network address-length validation, big-endian ports, version short-circuit). IntroduceMasternodeNetInfo::{Legacy, Extended}forMasternodeListEntry::service_addresswith a version-driven decode/encode branch and aprimary_service_address()accessor that reconstructs IPv4/IPv6SocketAddrs. Inline themn_typecodec into the entry path so v3 Evo entries read onlyplatform_node_idand sourceplatform_http_portfrom thePLATFORM_HTTPSentry, while v2 Evo entries keep the inline port.MasternodeNetInfocarries a hand-writtenbincodecodec whoseLegacyarm reuses the bareSocketAddrlayout so existing persisted engine snapshots keep decoding.Also fix
QuorumSnapshot::consensus_encodeto write the compact-sizeactiveQuorumMemberscount that the decoder already consumed, which the byte-exactqrinforound-trip requires.Consumers (
peer_addresses,masternode_helpers,masternode-seeds-fetcher) now go throughprimary_service_address().Based on:
QuorumSnapshotencode #796Summary by CodeRabbit
Release Notes
New Features
Bug Fixes