-
Notifications
You must be signed in to change notification settings - Fork 0
feat: basic ferment integration #60
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
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # Cargo.lock # dash/Cargo.toml # dash/src/blockdata/script/owned.rs # dash/src/blockdata/transaction/outpoint.rs # dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs # dash/src/blockdata/transaction/txin.rs # dash/src/blockdata/transaction/txout.rs # dash/src/blockdata/witness.rs # dash/src/bls_sig_utils.rs # hashes/Cargo.toml
# Conflicts: # Cargo.lock # dash/src/ephemerealdata/instant_lock.rs # dash/src/sml/masternode_list_entry/mod.rs
WalkthroughThis pull request introduces multiple structural updates across the codebase. An optional dependency ( Changes
Possibly related PRs
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (11)
🪧 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: 1
🧹 Nitpick comments (3)
dash/Cargo.toml (1)
75-76
: Verify the ferment dependencies are pinned to a specific version or commit.The newly added dependencies are fetched directly from a git repository without specifying a commit or tag, which could lead to build issues if the upstream code changes.
Consider pinning these dependencies to a specific tag, commit, or version:
-ferment = { git = "https://github.com/dashpay/ferment", package = "ferment" } -ferment-macro = { git = "https://github.com/dashpay/ferment", package = "ferment-macro" } +ferment = { git = "https://github.com/dashpay/ferment", package = "ferment", tag = "v0.1.0" } +ferment-macro = { git = "https://github.com/dashpay/ferment", package = "ferment-macro", tag = "v0.1.0" }Replace
v0.1.0
with the appropriate version.dash/src/blockdata/witness.rs (1)
35-35
: Consider documenting the implications of changing field visibility.You're making internal fields public and marking the struct for export with ferment, which changes the API contract. This could have implications for backward compatibility and encapsulation.
Consider adding documentation that explains:
- Why these fields are now public
- The intended use cases for direct field access
- Any constraints or invariants that users must maintain when modifying these fields
For example:
/// Fields are made public to support integration with the ferment serialization system. /// When modifying these fields directly, ensure that the internal invariants of the Witness /// structure are maintained to avoid breaking the witness validation logic. #[ferment_macro::export] pub struct Witness { // ... }Also applies to: 39-39, 45-45, 49-49
dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs (1)
184-189
: Ensure consistent access control across the codebase.Making fields public in
QuorumCommitmentPayload
is a significant change to the API contract. While this supports the ferment integration, it represents a shift from encapsulation to direct field access.Consider adding validation or update methods to ensure that when fields are modified directly, all invariants are maintained. For example:
impl QuorumCommitmentPayload { // Existing methods... /// Validates that the current state of the payload is consistent pub fn validate(&self) -> Result<(), SomeErrorType> { // Check version is valid // Check height is valid // Validate finalization_commitment Ok(()) } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (28)
dash/Cargo.toml
(1 hunks)dash/src/blockdata/script/mod.rs
(1 hunks)dash/src/blockdata/script/owned.rs
(1 hunks)dash/src/blockdata/transaction/mod.rs
(1 hunks)dash/src/blockdata/transaction/outpoint.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_lock.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/qualified_asset_unlock.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/request_info.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/coinbase.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/mod.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_registration.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs
(2 hunks)dash/src/blockdata/transaction/txin.rs
(1 hunks)dash/src/blockdata/transaction/txout.rs
(1 hunks)dash/src/blockdata/witness.rs
(1 hunks)dash/src/bls_sig_utils.rs
(2 hunks)dash/src/ephemerealdata/instant_lock.rs
(1 hunks)dash/src/sml/llmq_entry_verification.rs
(1 hunks)dash/src/sml/llmq_type/mod.rs
(1 hunks)dash/src/sml/masternode_list/mod.rs
(1 hunks)dash/src/sml/masternode_list_entry/mod.rs
(3 hunks)dash/src/sml/masternode_list_entry/qualified_masternode_list_entry.rs
(1 hunks)dash/src/sml/quorum_entry/qualified_quorum_entry.rs
(1 hunks)hashes/src/internal_macros.rs
(1 hunks)
✅ Files skipped from review due to trivial changes (15)
- dash/src/blockdata/transaction/txout.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
- dash/src/blockdata/transaction/special_transaction/asset_unlock/request_info.rs
- dash/src/sml/quorum_entry/qualified_quorum_entry.rs
- dash/src/blockdata/transaction/special_transaction/coinbase.rs
- dash/src/sml/masternode_list_entry/qualified_masternode_list_entry.rs
- dash/src/blockdata/transaction/txin.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
- dash/src/blockdata/transaction/special_transaction/mod.rs
- dash/src/blockdata/transaction/mod.rs
- hashes/src/internal_macros.rs
- dash/src/blockdata/transaction/special_transaction/provider_registration.rs
- dash/src/sml/masternode_list_entry/mod.rs
- dash/src/sml/llmq_entry_verification.rs
- dash/src/sml/llmq_type/mod.rs
🧰 Additional context used
🪛 GitHub Actions: Continuous integration
dash/Cargo.toml
[error] 1-1: Failed to parse manifest: feature quorum_validation
includes bls-signatures
, but bls-signatures
is not an optional dependency. A non-optional dependency of the same name is defined; consider adding optional = true
to its definition.
🔇 Additional comments (16)
dash/src/blockdata/transaction/special_transaction/provider_update_service.rs (1)
55-55
: Attribute added consistently with the rest of the codebase.The addition of
#[ferment_macro::export]
to theProviderUpdateServicePayload
struct is consistent with similar changes across the codebase as mentioned in the PR summary. This enables the struct to be properly exported through the ferment framework.dash/src/blockdata/script/owned.rs (1)
32-32
: Adds ferment export to ScriptBuf struct.Adding the
#[ferment_macro::export]
attribute to theScriptBuf
struct enables its export for use with the ferment macro system. This aligns with the PR objective of adding basic ferment integration.dash/src/blockdata/script/mod.rs (1)
72-72
: Makes the owned module public to support ferment exports.Changing the visibility of the
owned
module from private to public is necessary to allow external access to the now-exportedScriptBuf
struct. This change logically complements the export attribute added toScriptBuf
in the owned.rs file.dash/src/blockdata/transaction/outpoint.rs (1)
38-38
: Adds ferment export to OutPoint struct.Adding the
#[ferment_macro::export]
attribute to theOutPoint
struct makes it available for the ferment macro system. This is consistent with the pattern of adding ferment exports across the codebase.dash/src/blockdata/transaction/special_transaction/asset_unlock/qualified_asset_unlock.rs (1)
54-54
: Adds ferment export to AssetUnlockPayload struct.Adding the
#[ferment_macro::export]
attribute to theAssetUnlockPayload
struct enables its export for the ferment macro system. This continues the consistent pattern of adding ferment exports to key data structures throughout the codebase.dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs (2)
33-33
: Import path updated correctly.The import path for
TxOut
has been updated to use the more specific hierarchical path, which is consistent with the module reorganization in this PR.
42-42
: Added ferment export attribute.The
#[ferment_macro::export]
attribute has been properly added to theAssetUnlockBasePayload
struct, which aligns with the PR's goal of adding basic ferment integration.dash/src/sml/masternode_list/mod.rs (2)
18-18
: Import statement properly expanded.The hash types import has been expanded to include additional required types (
BlockHash
,ProTxHash
, andQuorumHash
), which provides more explicit dependencies.
27-27
: Added ferment export attribute.The
#[ferment_macro::export]
attribute has been properly added to theMasternodeList
struct, consistent with other structs in this PR.dash/src/ephemerealdata/instant_lock.rs (3)
5-9
: Simplified Vec imports.The conditional imports for
Vec
from bothalloc
andstd
libraries have been commented out, which suggests the code now relies on the standard prelude forVec
. This simplifies the import structure.
13-20
: Reorganized imports for better structure.The imports have been reorganized to be more specific and follow a consistent pattern throughout the codebase. The
OutPoint
import now correctly comes from theblockdata::transaction::outpoint
module, andQuorumHash
has been added to the hash types import.
27-27
: Added ferment export attribute.The
#[ferment_macro::export]
attribute has been properly added to theInstantLock
struct, aligning with the PR's goal of ferment integration.dash/src/blockdata/transaction/special_transaction/asset_lock.rs (2)
30-30
: Import path updated correctly.The import path for
TxOut
has been updated to use the more specific hierarchical pathcrate::blockdata::transaction::txout::TxOut
, which is consistent with the module reorganization in this PR.
44-44
: Added ferment export attribute.The
#[ferment_macro::export]
attribute has been properly added to theAssetLockPayload
struct, which aligns with the PR's goal of adding basic ferment integration.dash/src/bls_sig_utils.rs (1)
37-38
:❓ Verification inconclusive
Consider implications of exposing internal byte arrays.
By making the tuple struct fields public, you're exposing direct access to the raw byte arrays. This could potentially allow manipulations that bypass validation.
Ensure that any code that modifies these public byte arrays directly doesn't violate invariants expected by the BLS signature operations. Consider whether accessor methods or validator functions would be safer alternatives.
Also applies to: 96-97
🏁 Script executed:
#!/bin/bash # Check if there are any direct modifications to these byte arrays in the codebase rg -A 2 -B 2 "\.0\s*=\s*\[" --type rustLength of output: 41
Action Required: Verify Direct Access and Mutability of BLSPublicKey
No instances of direct modifications to the internal byte array were detected in our automated search. However, because the tuple struct exposes its &[u8; 48] field publicly, it's important to manually confirm that all usages of
BLSPublicKey
preserve the invariants expected by BLS signature operations. Consider whether helper methods—such as accessors or validators—could be introduced to restrict unsafe modifications.
- Verify that no code elsewhere bypasses validation by directly modifying
.0
.- Reassess the design for both instances (lines 37–38 and 96–97) to ensure future changes won’t inadvertently introduce invariant violations.
dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs (1)
42-43
: LGTM: QuorumEntry export annotation is consistent with project direction.The
#[ferment_macro::export]
annotation forQuorumEntry
aligns with the pattern of exposing key structures for external use through the ferment system.
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 (3)
dash/Cargo.toml (3)
36-36
: New "apple" Feature Integration:
The new"apple"
feature correctly aggregates the dependencies onferment
,ferment-macro
, and the specified sub-features frombls-signatures
. To improve maintainability, consider adding an explanatory comment in this section or updating your documentation to clarify the purpose and usage of the"apple"
feature.
76-76
: New "ferment" Dependency Added:
The newferment
dependency is added correctly with theoptional = true
flag. Ensure that any integrations or tests involving this dependency are updated accordingly, and consider documenting its usage if it isn’t already clearly explained.
77-77
: New "ferment-macro" Dependency Added:
Theferment-macro
dependency has been added as expected with the optional flag. Please verify that any modules using this macro are properly covered by tests and that the integration is documented for clarity.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (1)
dash/Cargo.toml
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Tests (stable, true, true, false)
- GitHub Check: Tests (beta, true, false)
🔇 Additional comments (1)
dash/Cargo.toml (1)
75-75
: Updated bls-signatures Dependency:
Thebls-signatures
dependency has been updated to use the tagged version"1.3.5"
and now includes theoptional = true
flag, which aligns with previous review recommendations.
* updated dashcore version * updated dashcore version
# Conflicts: # dash/Cargo.toml # dash/src/bip158.rs # dash/src/blockdata/transaction/mod.rs # dash/src/blockdata/transaction/special_transaction/asset_lock.rs # dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs # dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs # dash/src/blockdata/transaction/special_transaction/provider_update_service.rs # dash/src/blockdata/transaction/txin.rs # dash/src/consensus/encode.rs # dash/src/crypto/sighash.rs # dash/src/ephemerealdata/instant_lock.rs # dash/src/network/message_qrinfo.rs # dash/src/sml/masternode_list_engine/mod.rs # dash/src/sml/masternode_list_entry/qualified_masternode_list_entry.rs # dash/src/sml/quorum_entry/qualified_quorum_entry.rs # dash/src/taproot.rs # hashes/Cargo.toml # rpc-json/Cargo.toml
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: 2
🧹 Nitpick comments (2)
dash/src/blockdata/witness.rs (1)
39-39
: Consider potential risks of exposing internal fieldsChanging these previously private fields to public exposes implementation details that were deliberately encapsulated. While this change is likely necessary for ferment serialization to work properly, it introduces risks:
- External code could modify these fields directly and break internal invariants
- Future refactoring becomes more difficult as these fields are now part of the public API
- The complex relationship between these fields (as used in methods like
push
andelement_at
) could be violatedIf possible, consider these alternatives:
- Use getter methods instead of public fields
- Implement custom serialization logic in ferment that doesn't require field exposure
- Add documentation comments warning about the risks of directly modifying these fields
Also applies to: 45-45, 49-49
dash/src/sml/masternode_list_engine/mod.rs (1)
935-938
: Minor performance consideration for repeated lookups.
find_quorum_public_key
loops through allmasternode_lists
to find the first matching public key. While this is perfectly correct, if the code repeatedly calls this method at scale, you could store a precomputed(LLMQType, QuorumHash) -> BLSPublicKey
map for O(1) lookups. However, this is optional.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (37)
dash/Cargo.toml
(3 hunks)dash/src/bip158.rs
(1 hunks)dash/src/blockdata/script/mod.rs
(1 hunks)dash/src/blockdata/script/owned.rs
(1 hunks)dash/src/blockdata/transaction/mod.rs
(3 hunks)dash/src/blockdata/transaction/outpoint.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_lock.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/qualified_asset_unlock.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/request_info.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/coinbase.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/mod.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs
(2 hunks)dash/src/blockdata/transaction/txin.rs
(1 hunks)dash/src/blockdata/transaction/txout.rs
(1 hunks)dash/src/blockdata/witness.rs
(1 hunks)dash/src/bls_sig_utils.rs
(2 hunks)dash/src/consensus/encode.rs
(2 hunks)dash/src/crypto/sighash.rs
(1 hunks)dash/src/ephemerealdata/chain_lock.rs
(1 hunks)dash/src/lib.rs
(3 hunks)dash/src/network/message_qrinfo.rs
(3 hunks)dash/src/sml/llmq_entry_verification.rs
(1 hunks)dash/src/sml/llmq_type/mod.rs
(2 hunks)dash/src/sml/masternode_list/merkle_roots.rs
(1 hunks)dash/src/sml/masternode_list_engine/mod.rs
(7 hunks)dash/src/sml/masternode_list_entry/hash.rs
(1 hunks)dash/src/sml/masternode_list_entry/mod.rs
(2 hunks)dash/src/sml/masternode_list_entry/qualified_masternode_list_entry.rs
(2 hunks)dash/src/sml/quorum_entry/hash.rs
(1 hunks)dash/src/sml/quorum_entry/qualified_quorum_entry.rs
(2 hunks)dash/src/sml/quorum_validation_error.rs
(2 hunks)dash/src/taproot.rs
(1 hunks)hashes/src/internal_macros.rs
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- hashes/src/internal_macros.rs
🚧 Files skipped from review as they are similar to previous changes (34)
- dash/src/blockdata/transaction/outpoint.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
- dash/src/sml/masternode_list/merkle_roots.rs
- dash/src/blockdata/transaction/special_transaction/mod.rs
- dash/src/blockdata/transaction/txin.rs
- dash/src/blockdata/transaction/special_transaction/asset_unlock/request_info.rs
- dash/src/ephemerealdata/chain_lock.rs
- dash/src/blockdata/transaction/special_transaction/asset_unlock/qualified_asset_unlock.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
- dash/src/blockdata/transaction/special_transaction/coinbase.rs
- dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs
- dash/src/sml/llmq_type/mod.rs
- dash/src/bip158.rs
- dash/src/blockdata/script/owned.rs
- dash/src/sml/quorum_validation_error.rs
- dash/src/blockdata/script/mod.rs
- dash/src/sml/llmq_entry_verification.rs
- dash/src/crypto/sighash.rs
- dash/src/sml/quorum_entry/hash.rs
- dash/src/taproot.rs
- dash/src/blockdata/transaction/txout.rs
- dash/src/lib.rs
- dash/src/sml/masternode_list_entry/mod.rs
- dash/src/blockdata/transaction/special_transaction/asset_lock.rs
- dash/src/sml/masternode_list_entry/qualified_masternode_list_entry.rs
- dash/src/blockdata/transaction/mod.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
- dash/src/sml/masternode_list_entry/hash.rs
- dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs
- dash/src/network/message_qrinfo.rs
- dash/src/sml/quorum_entry/qualified_quorum_entry.rs
- dash/src/consensus/encode.rs
- dash/Cargo.toml
- dash/src/bls_sig_utils.rs
🧰 Additional context used
🧬 Code Definitions (1)
dash/src/sml/masternode_list_engine/mod.rs (3)
dash/src/blockdata/witness.rs (1)
clear
(243-247)dash/src/network/constants.rs (1)
known_genesis_block_hash
(152-176)dash/src/sml/masternode_list/mod.rs (1)
find_quorum_public_key
(54-59)
🔇 Additional comments (4)
dash/src/blockdata/witness.rs (2)
35-35
: Added ferment export attribute to support apple featureThis attributes the Witness struct to be exported through the ferment serialization framework when the "apple" feature is enabled, which is consistent with the PR's objective of integrating ferment.
35-49
: Add explicit tests for ferment serialization of WitnessAfter reviewing the repository structure and past comments, it appears there may not be dedicated tests confirming that the Witness struct's serialized representation is correctly handled by the ferment integration.
Please add unit or integration tests specifically for the Witness struct to verify that serialization and deserialization by ferment handle the internal structure correctly, especially testing:
- Proper handling of witness with multiple elements
- Modification operations (like
push
) still work after serialization/deserialization- Edge cases with empty witnesses or large contents
#!/bin/bash # Search for existing ferment tests for the Witness struct echo "Checking for tests related to ferment serialization of Witness" rg -l "ferment.*Witness" --type rust echo "Checking for ferment-related test files" fd ".*ferment.*test.*\.rs$" echo "Checking for other structs with similar export attributes that have tests" rg "#\[cfg_attr\(feature = \"apple\", ferment_macro::export\)\]" -A 5 -B 5 --type rust | rg "struct|enum"dash/src/sml/masternode_list_engine/mod.rs (2)
3-3
: Public module export looks good.Exposing
message_request_verification
aligns with your changes, allowing external crates/modules to access this functionality as needed.
29-29
: Import path update is consistent with new module structure.Switching the import to
use crate::blockdata::transaction::special_transaction::quorum_commitment::QuorumEntry;
reflects the reorganized module hierarchy and should work seamlessly with the rest of the codebase.
# Conflicts: # dash/src/sml/masternode_list_engine/mod.rs
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
♻️ Duplicate comments (1)
dash/Cargo.toml (1)
75-75
: Confirm Updated "bls-signatures" Revision
Thebls-signatures
dependency has been updated to use the revisiona0fec2f4da2bdbb753e6287b0546ae0b08e74e02
and is correctly marked as optional. This update aligns with previous feedback requiring the optional attribute. Please ensure this revision meets the expected stability and feature support for theapple
feature.
🧹 Nitpick comments (1)
dash/Cargo.toml (1)
66-66
: Validate New Dependency "bincode_derive"
The addition ofbincode_derive
with the version pinned to=2.0.0-rc.3
and marked as optional is clear and follows the intended dependency versioning strategy. Consider if pinning to an exact pre-release version is required or if a compatible version range might be more maintainable in the long run.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
dash/Cargo.toml
(3 hunks)
🔇 Additional comments (3)
dash/Cargo.toml (3)
36-36
: Review New Feature "apple"
The new feature flagapple
has been correctly added with its dependency list. Please verify that all the dependencies referenced here (such as"ferment"
,"ferment-macro"
, and the variousbls-signatures/*
features) are correctly declared in the[dependencies]
section and are available as optional dependencies.
76-76
: Check New Dependency "ferment"
The new dependencyferment
is added with version"0.2"
, correctly referenced via its package name and marked as optional. Confirm that this dependency integrates well with theapple
feature and does not conflict with existing versions used elsewhere.
77-77
: Review Addition of "ferment-macro" Dependency
Similarly, theferment-macro
dependency is added with the version"0.2"
, properly set as optional. Ensure that enabling theapple
feature triggers the intended macro exports and that this addition is consistent with the project's dependency strategy.
# Conflicts: # dash/Cargo.toml # dash/src/bip158.rs # dash/src/blockdata/transaction/mod.rs # dash/src/blockdata/transaction/special_transaction/asset_lock.rs # dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs # dash/src/blockdata/transaction/special_transaction/provider_registration.rs # dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs # dash/src/blockdata/transaction/special_transaction/provider_update_service.rs # dash/src/blockdata/transaction/txin.rs # dash/src/consensus/encode.rs # dash/src/crypto/sighash.rs # dash/src/ephemerealdata/instant_lock.rs # dash/src/network/message_qrinfo.rs # dash/src/sml/masternode_list_entry/qualified_masternode_list_entry.rs # dash/src/taproot.rs
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: 1
🧹 Nitpick comments (1)
dash/src/blockdata/witness.rs (1)
39-39
: Field visibility changes increase exposure of internal implementation details.Changing these fields from private to public exposes implementation details that were previously encapsulated. The
Witness
struct uses a complex internal representation for performance reasons, with specific invariants between these fields that must be maintained.Consider adding more robust documentation to these newly public fields explaining:
- The invariants that must be maintained between them
- How they should be manipulated safely (or preferably not at all directly)
- That direct manipulation could break the correctness of the
Witness
structWhile making these fields public may be necessary for ferment serialization, it increases the risk of improper usage. Ideally, there should be comprehensive tests that verify the fields can be safely accessed and modified through ferment without breaking the struct's behavior.
Also applies to: 45-45, 49-49
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (33)
dash/Cargo.toml
(2 hunks)dash/src/bip158.rs
(1 hunks)dash/src/blockdata/script/mod.rs
(1 hunks)dash/src/blockdata/script/owned.rs
(1 hunks)dash/src/blockdata/transaction/mod.rs
(3 hunks)dash/src/blockdata/transaction/outpoint.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_lock.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/qualified_asset_unlock.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/request_info.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/coinbase.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/mod.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_registration.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
(1 hunks)dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
(2 hunks)dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs
(2 hunks)dash/src/blockdata/witness.rs
(1 hunks)dash/src/consensus/encode.rs
(2 hunks)dash/src/crypto/sighash.rs
(1 hunks)dash/src/ephemerealdata/chain_lock.rs
(1 hunks)dash/src/hash_types.rs
(1 hunks)dash/src/network/message_qrinfo.rs
(3 hunks)dash/src/sml/llmq_entry_verification.rs
(1 hunks)dash/src/sml/llmq_type/mod.rs
(2 hunks)dash/src/sml/masternode_list/merkle_roots.rs
(1 hunks)dash/src/sml/masternode_list_engine/mod.rs
(7 hunks)dash/src/sml/masternode_list_entry/hash.rs
(1 hunks)dash/src/sml/quorum_entry/hash.rs
(1 hunks)dash/src/sml/quorum_validation_error.rs
(2 hunks)dash/src/taproot.rs
(1 hunks)hashes/Cargo.toml
(1 hunks)rpc-json/Cargo.toml
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (32)
- dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
- dash/src/blockdata/transaction/special_transaction/mod.rs
- dash/src/sml/quorum_entry/hash.rs
- dash/src/sml/masternode_list/merkle_roots.rs
- dash/src/blockdata/script/owned.rs
- dash/src/blockdata/transaction/special_transaction/coinbase.rs
- dash/src/hash_types.rs
- dash/src/blockdata/transaction/outpoint.rs
- dash/src/sml/quorum_validation_error.rs
- dash/src/bip158.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
- dash/src/crypto/sighash.rs
- dash/src/blockdata/script/mod.rs
- dash/src/blockdata/transaction/special_transaction/asset_lock.rs
- dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
- dash/src/sml/masternode_list_entry/hash.rs
- dash/src/blockdata/transaction/special_transaction/asset_unlock/qualified_asset_unlock.rs
- hashes/Cargo.toml
- rpc-json/Cargo.toml
- dash/src/blockdata/transaction/special_transaction/asset_unlock/request_info.rs
- dash/src/sml/llmq_type/mod.rs
- dash/src/ephemerealdata/chain_lock.rs
- dash/src/blockdata/transaction/mod.rs
- dash/src/sml/llmq_entry_verification.rs
- dash/src/taproot.rs
- dash/src/blockdata/transaction/special_transaction/provider_registration.rs
- dash/src/blockdata/transaction/special_transaction/asset_unlock/unqualified_asset_unlock.rs
- dash/src/network/message_qrinfo.rs
- dash/src/blockdata/transaction/special_transaction/quorum_commitment.rs
- dash/src/consensus/encode.rs
- dash/Cargo.toml
- dash/src/sml/masternode_list_engine/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: fuzz (hashes_cbor)
- GitHub Check: fuzz (hashes_sha256)
- GitHub Check: fuzz (hashes_sha512_256)
- GitHub Check: fuzz (dash_deserialize_amount)
- GitHub Check: fuzz (hashes_ripemd160)
- GitHub Check: fuzz (hashes_sha512)
- GitHub Check: fuzz (dash_deser_net_msg)
- GitHub Check: fuzz (dash_deserialize_address)
- GitHub Check: fuzz (hashes_sha1)
- GitHub Check: fuzz (hashes_json)
- GitHub Check: fuzz (dash_deserialize_block)
- GitHub Check: fuzz (dash_script_bytes_to_asm_fmt)
- GitHub Check: fuzz (dash_outpoint_string)
- GitHub Check: fuzz (dash_deserialize_script)
- GitHub Check: fuzz (dash_deserialize_witness)
@@ -32,20 +32,21 @@ use crate::{Script, VarInt}; | |||
/// [segwit upgrade]: <https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki> | |||
#[derive(Clone, Default, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] | |||
#[cfg_attr(feature = "bincode", derive(Encode, Decode))] | |||
#[cfg_attr(feature = "apple", ferment_macro::export)] |
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.
💡 Verification agent
🧩 Analysis chain
Attribution addition for ferment integration matches other similar changes.
The addition of the #[cfg_attr(feature = "apple", ferment_macro::export)]
attribute aligns with the overall PR objective of integrating with ferment when the "apple" feature flag is enabled.
Looking at the previous review comment, there's a concern about testing the ferment serialization of the Witness
struct. Let's verify if any tests have been added since that comment:
🏁 Script executed:
#!/bin/bash
# Search for tests that verify ferment serialization of Witness
echo "Looking for existing tests for ferment serialization of Witness"
rg -l "ferment.*Witness" --type rust
echo "Checking for test files that might contain ferment serialization tests"
rg -l "test.*ferment.*witness" --type rust -i
echo "Looking for ferment-related serialization tests"
rg -l "test.*serialize.*ferment" --type rust -i
Length of output: 529
Action Required: Add Tests for Ferment Serialization of the Witness Struct
The new attribute #[cfg_attr(feature = "apple", ferment_macro::export)]
is in line with similar changes across the codebase, which is great. However, our current search did not uncover any tests verifying the ferment serialization of the Witness
struct. To ensure that this integration behaves as expected when the "apple" feature is enabled, please add tests covering this functionality or point to where such tests exist if they’ve been added elsewhere.
- File:
dash/src/blockdata/witness.rs
(line 35)
Summary by CodeRabbit
New Features
Enhancements
bincode_derive
to support serialization.Bug Fixes