-
Notifications
You must be signed in to change notification settings - Fork 4
feat: provider registration payload v2 #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update the provider registration payload and IP address handling. A new Changes
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
dash/src/sml/masternode_list_entry/mod.rs (1)
45-63: Update error message in Decodable implementation.The error message still refers to "Invalid MasternodeType variant" despite the enum being renamed to
EntryMasternodeType.- msg: "Invalid MasternodeType variant".to_string(), + msg: "Invalid EntryMasternodeType variant".to_string(),dash/src/blockdata/transaction/special_transaction/provider_registration.rs (1)
60-81: Update error message in enum decoder.The error message still references "Invalid MasternodeType variant" which should be updated to reflect the actual enum name.
- msg: "Invalid MasternodeType variant".to_string(), + msg: "Invalid ProviderMasternodeType variant".to_string(),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
dash/src/blockdata/transaction/special_transaction/provider_registration.rs(5 hunks)dash/src/sml/masternode_list/scores_for_quorum.rs(2 hunks)dash/src/sml/masternode_list_entry/mod.rs(5 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
dash/src/blockdata/transaction/special_transaction/provider_registration.rs
364-364: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
370-370: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
376-376: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
546-546: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
552-552: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
558-558: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Tests (nightly, true, false, true)
- GitHub Check: Tests (beta, true, false)
- GitHub Check: Tests (stable, true, true, false)
- GitHub Check: Tests (nightly, true, false, true)
- GitHub Check: Tests (beta, true, false)
- GitHub Check: Tests (stable, true, true, false)
🔇 Additional comments (14)
dash/src/sml/masternode_list/scores_for_quorum.rs (2)
8-8: Type import renamed correctly.The import has been correctly updated to use the new
EntryMasternodeTypeenum name, ensuring compatibility with the renamed type in the masternode list entry module.
64-64: Match pattern updated properly.The pattern matching has been correctly updated to use the renamed
EntryMasternodeTypeenum, maintaining consistency with the type renaming across the codebase.dash/src/sml/masternode_list_entry/mod.rs (4)
20-23: Enum renamed from MasternodeType to EntryMasternodeType.The enum has been successfully renamed to be more specific about its purpose, which helps differentiate it from the new
ProviderMasternodeTypein the provider registration module.
25-43: Encodable implementation updated for renamed enum.The
Encodableimplementation has been correctly updated to use the new enum name, with the same encoding logic maintained.
86-86: Struct field type updated correctly.The field type in the
MasternodeListEntrystruct has been properly updated to use the renamed enum.
139-143: Default enum variant updated in decoder.The conditional decoding logic has been correctly updated to use the renamed enum type.
dash/src/blockdata/transaction/special_transaction/provider_registration.rs (8)
41-41: Added SocketAddr import for combined address handling.Using
SocketAddrfrom the standard library is a good approach to simplify address management by combining IP and port into a single field.
51-58: New ProviderMasternodeType enum introduced.The new enum with
RegularandHighPerformancevariants properly encapsulates the masternode types, improving type safety compared to the previous numeric representation.
101-102: Field names renamed for clarity and consistency.The fields have been renamed from
provider_type/provider_modetomasternode_type/masternode_mode, which better reflects their purpose and aligns with the new enum.
104-104: Combined service address field.Replacing separate
ip_addressandportfields with a singleservice_addressof typeSocketAddrreduces code duplication and leverages the standard library's robust networking types.
111-114: Added optional platform fields for high-performance masternodes.These new optional fields support the extended functionality required for high-performance masternodes in version 2 of the payload.
184-191: Conditional encoding of platform fields.The implementation correctly encodes the platform-specific fields only when the version is ≥2 and the masternode type is
HighPerformance. The use ofunwrap_or_elseandunwrap_or_defaultelegantly handles the optional values.
226-234: Conditional decoding of platform fields.The implementation correctly decodes the platform-specific fields only when the version is ≥2 and the provider type is
HighPerformance.
681-694: Good test coverage for version 2 payload.The new test ensures that the serialization and deserialization of version 2 payloads with platform-specific fields works correctly, which is essential for maintaining backward compatibility.
SocketAddrto reduce code duplicationSummary by CodeRabbit
These changes improve clarity and resilience in provider registration and network communication.