-
Notifications
You must be signed in to change notification settings - Fork 39
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
chore(sdk): various sdk fixes #2328
base: v2.0-dev
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces several improvements across multiple packages. In the rs-dpp package, a minor formatting adjustment was made, and new public methods and error variants were added with updated type signatures. In the rs-drive-abci package, logging was enhanced and BLS key generation was modified. The rs-drive package now includes new query modules, enriched test cases, and a new JSON schema for withdrawals. Additionally, the rs-sdk package received new error constants, a retry macro implementation for RPC calls, and removed extraneous debug logs. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant IdentityPublicKey
participant V0Implementation
Caller->>IdentityPublicKey: address(network)
IdentityPublicKey->>V0Implementation: Delegate call to V0 variant
V0Implementation-->>IdentityPublicKey: Return Address or ProtocolError
IdentityPublicKey-->>Caller: Return result
sequenceDiagram
participant Caller
participant DashCoreClient
participant RPCServer
Caller->>DashCoreClient: get_balance() call
DashCoreClient->>RPCServer: Make RPC call for balance
alt transient error occurs
RPCServer-->>DashCoreClient: Return transient error
DashCoreClient->>DashCoreClient: Retry with Fibonacci backoff
DashCoreClient->>RPCServer: Retry RPC call
end
RPCServer-->>DashCoreClient: Return successful result
DashCoreClient-->>Caller: Return balance or ContextProviderError
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (19)
🪧 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.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.
🛑 Comments failed to post (19)
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/mod.rs (1)
122-123:
⚠️ Potential issueFix incorrect documentation comment for V1 variant.
The documentation comment incorrectly states "Version 0" for the V1 variant.
Apply this fix:
- /// Version 0 of the signature verification quorums + /// Version 1 of the signature verification quorums V1(SignatureVerificationQuorumSetForSavingV1),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements./// Version 1 of the signature verification quorums V1(SignatureVerificationQuorumSetForSavingV1),
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs (2)
165-168: 🛠️ Refactor suggestion
Consider proper error handling while maintaining compression efficiency
The use of
to_compressed()
for the public key is good for efficiency. However, similar to the previous conversion, theexpect
usage could be replaced with proper error handling.Consider propagating the error while maintaining the compression:
- public_key: bls_signatures::PublicKey::from_bytes( - &quorum.public_key.0.to_compressed(), - ) - .expect("expected to convert between BLS key libraries (to chia)"), + public_key: bls_signatures::PublicKey::from_bytes( + &quorum.public_key.0.to_compressed(), + ) + .map_err(|e| format!("Failed to convert BLS key to chia: {}", e))?,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public_key: bls_signatures::PublicKey::from_bytes( &quorum.public_key.0.to_compressed(), ) .map_err(|e| format!("Failed to convert BLS key to chia: {}", e))?,
148-151: 🛠️ Refactor suggestion
Consider proper error handling for BLS key conversion
The current implementation uses
expect
which could cause runtime panics. While the conversion between BLS libraries might be considered safe, it's generally better to handle potential errors gracefully.Consider propagating the error instead:
- public_key: dpp::bls_signatures::PublicKey::try_from( - quorum.public_key.to_bytes().as_slice(), - ) - .expect("expected to convert between BLS key libraries (from chia)"), + public_key: dpp::bls_signatures::PublicKey::try_from( + quorum.public_key.to_bytes().as_slice(), + ) + .map_err(|e| format!("Failed to convert BLS key from chia: {}", e))?,Committable suggestion skipped: line range outside the PR's diff.
packages/rs-dpp/src/identity/random.rs (1)
69-70: 💡 Codebase verification
Breaking change detected - requires updates to test files
The change from
Vec<u8>
to[u8; 32]
is a breaking change that affects multiple test files. Found several impacted locations that need to be updated:
packages/strategy-tests/src/lib.rs
packages/strategy-tests/src/transitions.rs
packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs
packages/rs-drive-abci/tests/strategy_tests/strategy.rs
packages/rs-drive-abci/tests/strategy_tests/main.rs
packages/rs-dpp/src/state_transition/serialization.rs
All these files are currently using
Vec<_>
as the generic type parameter, which won't work with the new[u8; 32]
constraint.🔗 Analysis chain
Approve type constraint change for improved type safety.
The change from
Vec<u8>
to[u8; 32]
for private keys is a good improvement as it:
- Enforces exact key length at compile-time
- Provides better memory efficiency with stack allocation
- Prevents potential buffer overflow attacks
Let's verify the impact of this breaking change:
Let's verify the actual implementation to understand if this is a breaking change.
Let's try a different approach to check the implementation:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any existing implementations or usages that might be affected rg "random_identity_with_main_keys_with_private_key|random_identities_with_private_keys_with_rng" --type rustLength of output: 3723
Script:
#!/bin/bash # Check the implementation of these methods to understand if Vec<u8> is still supported ast-grep --pattern 'fn random_identity_with_main_keys_with_private_key<I>($$$)'Length of output: 81
Script:
#!/bin/bash # Check the content of the files containing these methods rg -A 10 "fn random_identity_with_main_keys_with_private_key" --type rustLength of output: 1771
packages/rs-sdk/src/core/transaction.rs (1)
72-78: 💡 Codebase verification
Based on the search results, I can see that tracing is extensively used throughout the codebase, particularly for error handling, debugging, and monitoring. The file under review is part of the transaction handling module where tracing is used consistently with different log levels (error, debug, trace) to provide observability.
Keep the tracing spans but consider adjusting log levels
The tracing spans in this code provide valuable transaction context for debugging. Instead of removing them completely:
- Keep the transaction ID span as it's crucial for correlation
- Consider changing
debug!
totrace!
level if the goal is to reduce noise- Maintain consistency with the rest of the codebase which uses structured logging
Example locations showing similar patterns:
rs-sdk/src/core/transaction.rs
: Uses tracing for error handlingrs-drive-abci/src/execution/
: Uses spans for transaction tracingrs-dapi-client/src/dapi_client.rs
: Uses trace spans for request tracking🔗 Analysis chain
Consider keeping structured logging for production debugging
While removing debug spans reduces noise during testing, completely removing transaction ID tracing might impact our ability to debug production issues. Consider:
- Keeping error-level tracing for critical paths
- Making tracing conditional using feature flags
- Using log levels appropriately (error, warn, info) instead of removing all tracing
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if other files in the codebase still use tracing rg "tracing::(debug|error|warn|info|trace)" --type rustLength of output: 37123
packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs (1)
171-176: 🛠️ Refactor suggestion
Extract duplicate signature verification logic
The signature verification logic is duplicated. Consider extracting it into a helper function to improve maintainability and ensure consistent error handling.
fn verify_signature( signature: &Signature<Bls12381G2Impl>, public_key: &PublicKey<Bls12381G2Impl>, message_digest: &[u8], ) -> bool { match signature.verify(public_key, message_digest) { Ok(_) => true, Err(e) => { tracing::debug!("Signature verification failed: {}", e); false } } }packages/rs-drive-abci/tests/strategy_tests/masternodes.rs (1)
212-220: 🛠️ Refactor suggestion
Improve error handling in private key generation
The current implementation uses
unwrap()
which could panic if the key generation or conversion fails. Consider propagating errors using the?
operator and handling them appropriately.Here's a suggested improvement:
- let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) - .expect("expected to generate a private key") - .to_bytes() - .to_vec(); - let private_key_operator = BlsPrivateKey::<Bls12381G2Impl>::from_be_bytes( - &private_key_operator_bytes.try_into().unwrap(), - ) - .unwrap(); + let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) + .map_err(|e| format!("Failed to generate private key: {}", e))? + .to_bytes() + .to_vec(); + let private_key_operator = BlsPrivateKey::<Bls12381G2Impl>::from_be_bytes( + &private_key_operator_bytes.try_into() + .map_err(|_| "Invalid private key length")? + ) + .map_err(|e| format!("Failed to create BLS private key: {}", e))?;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.let private_key_operator_bytes = bls_signatures::PrivateKey::generate_dash(rng) .map_err(|e| format!("Failed to generate private key: {}", e))? .to_bytes() .to_vec(); let private_key_operator = BlsPrivateKey::<Bls12381G2Impl>::from_be_bytes( &private_key_operator_bytes.try_into() .map_err(|_| "Invalid private key length")? ) .map_err(|e| format!("Failed to create BLS private key: {}", e))?; let pub_key_operator = private_key_operator.public_key().0.to_compressed().to_vec();
packages/rs-dpp/src/identity/identity_public_key/random.rs (1)
141-141: 💡 Codebase verification
Based on the search results, I can now make a final determination. The results show:
- Multiple test files and implementations explicitly use
Vec<_>
when calling these methods- The private keys are primarily used via
as_slice()
for signing operations- The change affects both the core rs-dpp package and its dependents (wasm-dpp, rs-drive-abci)
Breaking change needs to be reverted or handled with version compatibility
The change from
Vec<u8>
to[u8; 32]
is causing compatibility issues as evidenced by:
Multiple callers explicitly specify
Vec<_>
in their type parametersSeveral packages in the ecosystem depend on the
Vec<u8>
interfaceExisting code uses
as_slice()
for signing operations, which works withVec<u8>
packages/rs-dpp/src/identity/identity_public_key/random.rs
: Revert the return type change or implement version-based compatibility
packages/rs-drive-abci/tests/strategy_tests/*
: Update test files to handle the new type or maintain backward compatibility
packages/wasm-dpp/src/**/*
: Multiple files need updates to handle fixed-size arraysThe change should either:
- Keep
Vec<u8>
for backward compatibility- Implement a version-based approach where new versions use
[u8; 32]
- Add conversion methods to maintain compatibility with existing code
🔗 Analysis chain
Breaking change: Private key return type modified from Vec to [u8; 32]
The change from
Vec<u8>
to[u8; 32]
for private keys improves type safety by enforcing a fixed length of 32 bytes, which aligns with common cryptographic standards. However, this is a breaking change that requires careful consideration.Consider:
- Adding a version migration strategy
- Documenting this breaking change in CHANGELOG.md
- Updating all dependent code to handle fixed-size arrays
Also applies to: 179-179, 275-275, 321-321, 349-349, 387-387, 414-414, 445-445, 492-492, 521-521, 561-561, 590-590, 632-632, 659-659, 706-706, 723-723
Let me analyze the results and generate additional verification scripts to better understand the impact.
The first search shows multiple files using
Vec<u8>
for private keys, particularly in the wasm-dpp package. I want to verify how these keys are being used and if there are any direct dependencies on the vector nature of the private keys before making a final determination.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any direct usages of these methods that might be affected by the return type change # Search for direct method calls that might need updates rg -l "random_.*_key.*_with.*private_key" --type rust # Search for any stored private keys to ensure they're compatible with 32 bytes rg "private_key: Vec<u8>" --type rustLength of output: 2115
Script:
#!/bin/bash # Check if there are any direct usages of the return value from these random key generation methods rg -A 3 "random_.*_key.*_with.*private_key" --type rust # Check if there are any type conversions or transformations of private keys rg "private_key\.(?:to_vec|into|as_slice)" --type rust # Look for any test files that might be affected rg "test.*random_.*_key" --type rustLength of output: 15493
packages/rs-drive-abci/tests/strategy_tests/main.rs (1)
6-6: 💡 Codebase verification
Inconsistent usage of SecretKey vs PrivateKey found in the codebase
The verification reveals inconsistent usage of the BLS key terminology across the codebase:
- Several files still use
BlsPrivateKey
type alias forSecretKey
- Some files directly use
SecretKey
without the alias- JavaScript files in dashmate still use
privateKey
terminologyKey files needing alignment:
packages/rs-drive-abci/tests/strategy_tests/masternodes.rs
packages/rs-drive-abci/tests/strategy_tests/masternode_list_item_helpers.rs
packages/rs-drive-abci/src/mimic/test_quorum.rs
packages/dashmate/src/core/getBLSPublicKeyFromPrivateKeyHex.js
🔗 Analysis chain
LGTM! Verify the SecretKey usage across tests.
The import change from
PrivateKey
toSecretKey
is consistent with modern cryptographic terminology and aligns with the broader updates across the codebase.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all BLS-related code consistently uses SecretKey instead of PrivateKey # Test: Search for any remaining PrivateKey usages that might need updating rg -A 3 "PrivateKey.*Bls" # Test: Confirm SecretKey is used consistently rg -A 3 "SecretKey.*Bls"Length of output: 14745
packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs (1)
12-18:
⚠️ Potential issueUse
TryFrom
instead ofFrom
for fallible conversions to properly handle errorsCurrently, the implementations of the
From
trait forValidatorSet
,ValidatorSetV0
, andValidatorV0
useunwrap()
on functions that can fail (PublicKey::try_from
), which can cause panics if the conversion fails. Since these conversions can fail, it's appropriate to implement theTryFrom
trait instead, allowing for proper error handling without panicking.Here's how you might adjust the code:
- Implement the
TryFrom
trait for these types.- Adjust function signatures to return
Result<..., ...>
types.- Handle errors appropriately in the conversion logic.
Example for
ValidatorSetV0
:use std::convert::TryFrom; use dpp::core_types::validator_set::v0::ValidatorSetV0 as DppValidatorSetV0; use dpp::bls_signatures::PublicKey as DppPublicKey; use bls_signatures::PublicKey as BlsPublicKey; impl TryFrom<ValidatorSetV0> for DppValidatorSetV0 { type Error = SomeErrorType; // Define an appropriate error type fn try_from(value: ValidatorSetV0) -> Result<Self, Self::Error> { let ValidatorSetV0 { quorum_hash, quorum_index, core_height, members, threshold_public_key, } = value; let dpp_members = members .into_iter() .map(|(pro_tx_hash, validator)| { Ok((pro_tx_hash, validator.try_into()?)) }) .collect::<Result<_, _>>()?; let dpp_threshold_public_key = DppPublicKey::try_from(threshold_public_key.to_bytes().as_slice()) .map_err(|e| /* map or return the error appropriately */)?; Ok(Self { quorum_hash, quorum_index, core_height, members: dpp_members, threshold_public_key: dpp_threshold_public_key, }) } }Similarly, update the implementations for
ValidatorSet
andValidatorV0
to useTryFrom
and handle errors appropriately.Also applies to: 36-57, 80-103
packages/simple-signer/src/signer.rs (1)
85-93: 🛠️ Refactor suggestion
Use specific error types for BLS key operations
In the BLS signing logic, consider replacing
ProtocolError::Generic
with the more specificProtocolError::BlsError
. This will improve error clarity and make it easier to handle BLS-related issues.Apply the following changes to enhance error handling:
- .ok_or(ProtocolError::Generic( - "bls private key from bytes isn't correct".to_string(), - ))?; + .ok_or(ProtocolError::BlsError( + "Invalid BLS private key bytes: failed to construct SecretKey".to_string(), + ))?; ... - .map_err(|e| ProtocolError::Generic(format!("unable to sign {}", e)))?; + .map_err(|e| ProtocolError::BlsError(format!("Unable to sign data: {}", e)))?;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.let pk = bls_signatures::SecretKey::<Bls12381G2Impl>::from_be_bytes(private_key) .into_option() .ok_or(ProtocolError::BlsError( "Invalid BLS private key bytes: failed to construct SecretKey".to_string(), ))?; let signature = pk .sign(SignatureSchemes::Basic, data) .map_err(|e| ProtocolError::BlsError(format!("Unable to sign data: {}", e)))?; Ok(signature.as_raw_value().to_compressed().to_vec().into())
packages/rs-dpp/src/signing.rs (1)
66-67:
⚠️ Potential issueAvoid panics by handling errors from
from_compressed
Using
expect
onfrom_compressed
can cause a panic if the signature bytes are invalid. To ensure robustness, handle the error gracefully and return an appropriate validation result.Apply this diff to handle the potential error:
-let g2 = <Bls12381G2Impl as Pairing>::Signature::from_compressed(&signature_bytes) - .expect("G2 projective"); +let g2 = match <Bls12381G2Impl as Pairing>::Signature::from_compressed(&signature_bytes) { + Ok(g2) => g2, + Err(e) => { + return SimpleConsensusValidationResult::new_with_error( + SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), + ); + } +};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.let g2 = match <Bls12381G2Impl as Pairing>::Signature::from_compressed(&signature_bytes) { Ok(g2) => g2, Err(e) => { return SimpleConsensusValidationResult::new_with_error( SignatureError::BasicBLSError(BasicBLSError::new(e.to_string())).into(), ); } };
packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/quorums.rs (2)
159-159:
⚠️ Potential issueUse
Debug
formatting ifDisplay
is not implemented forpublic_key
The method
to_string()
requiresThresholdBlsPublicKey<Bls12381G2Impl>
to implement theDisplay
trait. IfDisplay
is not implemented, this will result in a compilation error. Consider usingDebug
formatting instead:- .field("public_key", &self.public_key.to_string()) + .field("public_key", &format!("{:?}", self.public_key))Alternatively, implement the
Display
trait forThresholdBlsPublicKey<Bls12381G2Impl>
if a custom string representation is needed.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements..field("public_key", &format!("{:?}", self.public_key))
210-216: 🛠️ Refactor suggestion
Simplify error handling when deserializing the private key
The current error handling can be made more concise and idiomatic. Since
from_be_bytes
returns anOption<SecretKey<Bls12381G2Impl>>
, you can useok_or_else
to provide the error:let private_key = bls_signatures::SecretKey::<Bls12381G2Impl>::from_be_bytes(&self.private_key) - .into_option() - .ok_or(Error::BLSError( - dpp::bls_signatures::BlsError::DeserializationError( - "Could not deserialize private key".to_string(), - ), - ))?; + .ok_or_else(|| Error::BLSError( + dpp::bls_signatures::BlsError::DeserializationError( + "Could not deserialize private key".to_string(), + ), + ))?;This refactoring makes the code more readable and follows Rust's error handling best practices.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.let private_key = bls_signatures::SecretKey::<Bls12381G2Impl>::from_be_bytes(&self.private_key) .ok_or_else(|| Error::BLSError( dpp::bls_signatures::BlsError::DeserializationError( "Could not deserialize private key".to_string(), ), ))?;
packages/rs-drive-abci/src/platform_types/commit/v0/mod.rs (1)
127-131:
⚠️ Potential issueAvoid including raw signatures in error messages to prevent potential leakage of sensitive data.
Including the raw signature in error messages may expose sensitive information. Consider removing the signature from the error message or replacing it with a hash or an identifier.
Apply this diff to modify the error message:
Err(_) => ValidationResult::new_with_error(AbciError::BadCommitSignature(format!( - "commit signature {} is wrong", - signature + "commit signature is invalid" ))),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.match signature.verify(&public_key, &hash) { Ok(_) => ValidationResult::default(), Err(_) => ValidationResult::new_with_error(AbciError::BadCommitSignature(format!( "commit signature is invalid"
packages/rs-sdk/src/core/dash_core_client.rs (2)
47-53: 🛠️ Refactor suggestion
Optimize the Fibonacci function to prevent stack overflow and improve efficiency
The recursive implementation of the Fibonacci function can cause stack overflows and is inefficient, even with a small
MAX_RETRIES
. Consider replacing it with an iterative implementation to enhance performance and reliability.Apply this diff to refactor the function:
fn fibonacci(n: u32) -> u64 { - match n { - 0 => 0, - 1 => 1, - _ => fibonacci(n - 1) + fibonacci(n - 2), - } + let mut a = 0; + let mut b = 1; + for _ in 0..n { + let temp = a; + a = b; + b = temp + b; + } + a }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.fn fibonacci(n: u32) -> u64 { let mut a = 0; let mut b = 1; for _ in 0..n { let temp = a; a = b; b = temp + b; } a }
90-90: 🛠️ Refactor suggestion
Avoid using
expect
to prevent potential panicsUsing
final_result.expect("expected a final result")
might cause a panic iffinal_result
remainsNone
. Although the logic suggests this shouldn't happen, it's safer to handle this case explicitly.You can modify the code to return an error instead of panicking:
- final_result.expect("expected a final result") + match final_result { + Some(result) => result, + None => Err(ContextProviderError::Generic("Failed to retrieve result after retries".to_string())), + }Committable suggestion skipped: line range outside the PR's diff.
packages/rs-drive-abci/src/mimic/test_quorum.rs (2)
283-283: 🛠️ Refactor suggestion
Encapsulate
public_key
access when settingquorum_public_key
Similar to the previous comment, avoid accessing the internal
.0
field. Use the public interface provided byBlsPublicKey
.Apply this diff:
- quorum_public_key: public_key.0.to_compressed().to_vec(), + quorum_public_key: public_key.to_compressed().to_vec(),This ensures encapsulation and reduces the risk of future breakages.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.quorum_public_key: public_key.to_compressed().to_vec(),
272-272: 🛠️ Refactor suggestion
Avoid direct access to internal fields of
public_key
Accessing the internal field
.0
ofpublic_key
breaks encapsulation and may lead to maintenance issues if the internal structure changes. Use a public method to obtain the compressed representation.Apply this diff to encapsulate access:
- pub_key_share: Some(public_key.0.to_compressed().to_vec()), + pub_key_share: Some(public_key.to_compressed().to_vec()),Ensure that the
to_compressed()
method is publicly accessible on theBlsPublicKey
type.Committable suggestion skipped: line range outside the PR's diff.
This reverts commit ae22fb8.
… test/testWithoutSpan
… test/testWithoutSpan
commit 6776651 Author: QuantumExplorer <quantum@dash.org> Date: Sat Mar 1 22:23:41 2025 +0700 chore: update to latest dash core 37 (#2483) commit 1501103 Merge: a7c7a0f da17fc5 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 27 14:21:41 2025 +0700 chore: merge master and resolve conflicts (#2481) commit da17fc5 Author: pshenmic <pshenmic@gmail.com> Date: Thu Feb 27 13:31:51 2025 +0700 feat(js-dash-sdk): fix tests after merge commit c7e40cb Merge: c57e8b2 f9eb069 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 27 09:35:02 2025 +0700 Merge remote-tracking branch 'origin/chore/merge-master' into chore/merge-master commit c57e8b2 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 27 09:34:40 2025 +0700 test(dpp): fix assertion with the same value commit 045b6fa Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 27 09:32:33 2025 +0700 chore(dpp): remove unnecessary type conversion commit 8160ccd Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 27 09:31:32 2025 +0700 chore: remove duplicated commented code commit f9eb069 Merge: 05d0085 a7c7a0f Author: pshenmic <pshenmic@gmail.com> Date: Wed Feb 26 20:03:00 2025 +0700 Merge branch 'v2.0-dev' into chore/merge-master commit a7c7a0f Author: pshenmic <pshenmic@gmail.com> Date: Wed Feb 26 19:52:02 2025 +0700 build: bump rust version to 1.85 (#2480) commit 05d0085 Merge: bcf1785 196976c Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Feb 26 18:03:38 2025 +0700 Merge branch 'master' into v2.0-dev commit bcf1785 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Fri Feb 21 08:43:35 2025 +0100 feat: wasm sdk build proof-of-concept (#2405) Co-authored-by: Ivan Shumkov <ivan@shumkov.ru> commit 5e32426 Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Thu Feb 20 19:22:52 2025 +0700 fix: token already paused unpaused and frozen validation (#2466) commit 374a036 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 20 17:46:57 2025 +0700 test: fix slowdown of JS SDK unit tests (#2475) commit 1fed09b Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 20 13:46:36 2025 +0700 fix(dpp): invalid feature flag usage (#2477) commit 33507bb Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Thu Feb 20 13:18:55 2025 +0700 fix: destroy frozen funds used wrong identity and proof verification (#2467) commit 91a9766 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Feb 19 16:57:32 2025 +0700 feat(sdk): return state transition execution error (#2454) commit cb915a7 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Feb 19 16:46:54 2025 +0700 test: fix token history contract tests (#2470) commit 04276d5 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Tue Feb 18 21:00:05 2025 +0700 fix: xss vulnerability in mocha (#2469) commit 196976c Author: pshenmic <pshenmic@gmail.com> Date: Fri Feb 14 18:50:08 2025 +0700 fix(sdk)!: bigint for uint64 values (#2443) commit 0bd29a6 Author: pshenmic <pshenmic@gmail.com> Date: Fri Feb 14 17:29:35 2025 +0700 feat(dpp): extra methods for state transitions in wasm (#2462) commit 1eae781 Author: pshenmic <pshenmic@gmail.com> Date: Fri Feb 14 15:29:17 2025 +0700 chore(platform): npm audit fix (#2463) commit ddf4e67 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Fri Feb 14 11:28:08 2025 +0700 test: fix `fetchProofForStateTransition` tests and warnings (#2460) commit d88ea46 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Fri Feb 14 09:52:53 2025 +0700 fix(dpp): invalid imports and tests (#2459) commit 82e4d4c Merge: 125cfe7 4becf5f Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Thu Feb 13 19:05:51 2025 +0700 fix: check if token is paused on token transfers (#2458) commit 4becf5f Author: pauldelucia <pauldelucia2@gmail.com> Date: Thu Feb 13 18:34:24 2025 +0700 add costs commit 907971d Merge: 9026669 125cfe7 Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Thu Feb 13 18:05:06 2025 +0700 Merge branch 'v2.0-dev' into feat/token-paused-validation commit 125cfe7 Merge: 91f65c6 c286ec0 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Feb 13 15:51:46 2025 +0700 Merge branch 'v2.0-dev' into v2.0-tokens-dev commit 9026669 Author: pauldelucia <pauldelucia2@gmail.com> Date: Thu Feb 13 13:41:19 2025 +0700 feat: check if token is paused on token transfers commit c286ec0 Author: pshenmic <pshenmic@gmail.com> Date: Wed Feb 12 15:41:21 2025 +0700 feat(sdk): add option to request all keys (#2445) commit 91f65c6 Merge: d6b40e6 1a1c50b Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Wed Feb 12 12:04:58 2025 +0700 fix: wrong order of parameters in UnauthorizedTokenActionError (#2456) commit 1a1c50b Author: pauldelucia <pauldelucia2@gmail.com> Date: Wed Feb 12 11:51:31 2025 +0700 fix: wrong order of parameters in UnauthorizedTokenActionError commit 26aff36 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Tue Feb 11 13:06:54 2025 +0100 build: bump Alpine version to 3.21 (#2074) commit 9daa195 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Tue Feb 11 14:38:55 2025 +0700 ci: use github-hosted arm runner for release workflow (#2452) commit 2b1c252 Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Tue Feb 4 16:40:34 2025 +0700 fix: proof result error for credit transfers in sdk (#2451) commit d6b40e6 Author: QuantumExplorer <quantum@dash.org> Date: Tue Feb 4 06:49:03 2025 +0700 feat(platform): token distribution part two (#2450) commit 93f7d44 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Jan 29 14:07:55 2025 +0700 fix(dpp): invalid feature flag instructions (#2448) commit 6d5af88 Author: QuantumExplorer <quantum@dash.org> Date: Mon Jan 27 16:59:39 2025 +0700 feat(dpp): token distribution model (#2447) commit e735313 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Mon Jan 27 14:24:26 2025 +0700 feat: add token transitions to SDK and DAPI (#2434) commit 0743be2 Author: pshenmic <pshenmic@gmail.com> Date: Sun Jan 26 22:00:40 2025 +0700 feat(dpp): extra methods for state transitions in wasm (#2401) commit f609bcf Merge: 3733f56 cbddb8d Author: Ivan Shumkov <ivan@shumkov.ru> Date: Fri Jan 24 18:16:38 2025 +0700 Merge branch 'v2.0-dev' into v2.0-tokens-dev commit cbddb8d Author: QuantumExplorer <quantum@dash.org> Date: Fri Jan 24 17:59:16 2025 +0700 chore(platform): make bls sig compatibility an optional feature (#2440) Co-authored-by: Ivan Shumkov <ivan@shumkov.ru> commit 764684b Author: Ivan Shumkov <ivan@shumkov.ru> Date: Fri Jan 24 17:57:27 2025 +0700 chore: ignore deprecated `lodash.get` (#2441) commit 3733f56 Author: QuantumExplorer <quantum@dash.org> Date: Thu Jan 23 09:16:12 2025 +0700 feat(platform)!: enhance token configuration and validation mechanisms (#2439) commit 2480ceb Author: QuantumExplorer <quantum@dash.org> Date: Wed Jan 22 16:33:13 2025 +0700 chore: dapi grpc queries (#2437) commit c9ab154 Author: QuantumExplorer <quantum@dash.org> Date: Wed Jan 22 15:50:25 2025 +0700 feat(platform)!: improved token validation and token config update transition (#2435) commit d9647cc Author: QuantumExplorer <quantum@dash.org> Date: Tue Jan 21 10:28:58 2025 +0700 feat: get proofs for tokens (#2433) commit e5964b8 Author: QuantumExplorer <quantum@dash.org> Date: Mon Jan 20 23:31:50 2025 +0700 feat: group queries (#2432) commit 0220302 Author: QuantumExplorer <quantum@dash.org> Date: Sun Jan 19 14:43:51 2025 +0700 feat(platform): proof verification for many queries and a few more queries (#2431) commit cd1527d Author: QuantumExplorer <quantum@dash.org> Date: Fri Jan 17 19:39:37 2025 +0700 fix(dpp)!: wrapping overflow issue (#2430) commit fd7ee85 Merge: d7143cc e4e156c Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Jan 16 21:45:47 2025 +0700 Merge branch 'master' into v1.9-dev commit e4e156c Author: QuantumExplorer <quantum@dash.org> Date: Thu Jan 16 18:11:57 2025 +0700 chore(release): update change log and release v1.8.0 (#2427) Co-authored-by: Ivan Shumkov <ivan@shumkov.ru> commit 55a1e03 Author: QuantumExplorer <quantum@dash.org> Date: Thu Jan 16 15:30:42 2025 +0700 feat(platform)!: token base support (#2383) commit 59bf0af Author: QuantumExplorer <quantum@dash.org> Date: Thu Jan 16 13:10:39 2025 +0700 chore(release): bump to v1.8.0-rc.2 (#2426) commit 410eb09 Author: QuantumExplorer <quantum@dash.org> Date: Thu Jan 16 06:31:26 2025 +0700 fix(drive-abci): rebroadcasting should not only take first 2 quorums too (#2425) commit 2abce8e Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Jan 15 22:51:58 2025 +0700 chore(release): update changelog and bump version to 1.8.0-rc.1 (#2423) commit ad5f604 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Jan 15 22:14:13 2025 +0700 chore: update bls library (#2424) commit c6feb5b Author: QuantumExplorer <quantum@dash.org> Date: Wed Jan 15 18:57:49 2025 +0700 feat(platform)!: distribute prefunded specialized balances after vote (#2422) Co-authored-by: Ivan Shumkov <ivan@shumkov.ru> commit 94dcbb2 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Jan 15 05:51:45 2025 +0700 chore(drive): increase withdrawal limits to 2000 Dash per day (#2287) commit 6a0aede Author: Ivan Shumkov <ivan@shumkov.ru> Date: Tue Jan 14 21:42:59 2025 +0700 chore: fix test suite configuration script (#2402) commit e94b7bb Author: QuantumExplorer <quantum@dash.org> Date: Tue Jan 14 19:23:46 2025 +0700 fix(drive-abci): document purchase on mutable document from different epoch had issue (#2420) commit 4ee57a6 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Tue Jan 14 19:12:20 2025 +0700 fix(drive): more than one key was returned when expecting only one result (#2421) commit be5cd6d Author: Ivan Shumkov <ivan@shumkov.ru> Date: Mon Jan 13 15:12:33 2025 +0700 fix(sdk): failed to deserialize consensus error (#2410) commit e07271e Author: Ivan Shumkov <ivan@shumkov.ru> Date: Mon Jan 13 14:57:08 2025 +0700 chore: resolve NPM audit warnings (#2417) commit a809df7 Author: QuantumExplorer <quantum@dash.org> Date: Sun Jan 12 09:21:48 2025 +0700 test: unify identity versioned cost coverage (#2416) commit 6d637fe Author: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Fri Dec 27 09:42:04 2024 -0500 fix: try DriveDocumentQuery from DocumentQuery start field (#2407) commit cfd9c4d Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Dec 19 18:30:06 2024 +0700 chore(release): update changelog and bump version to 1.8.0-dev.2 (#2404) commit fecda31 Merge: 37d5732 fc7d994 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Dec 19 15:33:45 2024 +0700 Merge branch 'master' into v1.8-dev commit fc7d994 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Dec 19 14:40:44 2024 +0700 chore(release): update changelog and bump version to 1.7.1 (#2403) commit adcd3b8 Author: QuantumExplorer <quantum@dash.org> Date: Thu Dec 19 09:54:07 2024 +0300 fix!: emergency hard fork to fix masternode voting (#2397) commit 37d5732 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Dec 18 22:24:37 2024 +0700 fix(dashmate): some group commands fail with mtime not found (#2400) commit 01a5b7a Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Dec 18 20:44:44 2024 +0700 refactor(dpp): using deprecated param to init wasm module (#2399) commit c5f5878 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Dec 18 18:04:14 2024 +0700 fix(dashmate): local network starting issues (#2394) commit 71c41ff Author: Ivan Shumkov <ivan@shumkov.ru> Date: Wed Dec 18 18:03:55 2024 +0700 perf(dpp): reduce JS binding size by 3x (#2396) commit 21ec393 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Wed Dec 18 10:47:58 2024 +0100 build!: update rust to 1.83 - backport #2393 to v1.7 (#2398) commit d7143cc Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Wed Dec 18 08:53:53 2024 +0100 build!: optimize for x86-64-v3 cpu microarchitecture (Haswell+) (#2374) commit d318b1c Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Tue Dec 17 14:56:15 2024 +0100 build: bump wasm-bindgen to 0.2.99 (#2395) commit 889d192 Author: Ivan Shumkov <ivan@shumkov.ru> Date: Tue Dec 17 19:25:58 2024 +0700 chore(release): update changelog and bump version to 1.8.0-dev.1 (#2391) commit 8185d21 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Tue Dec 17 10:47:53 2024 +0100 feat(sdk)!: allow setting CA cert (#1924) commit 82a6217 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Tue Dec 17 02:51:18 2024 +0100 build!: update rust to 1.83 (#2393) commit 494054a Author: QuantumExplorer <quantum@dash.org> Date: Mon Dec 16 13:47:58 2024 +0300 refactor(platform): replace bls library (#2257) Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com> commit 4c203e4 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Mon Dec 16 10:38:34 2024 +0100 test(sdk): generate test vectors using testnet (#2381) commit 0ff6b27 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Mon Dec 16 10:37:35 2024 +0100 chore: remove deprecated check_network_version.sh (#2084) commit b265bb8 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Fri Dec 13 13:25:40 2024 +0100 ci: fix artifact upload issue on release build (#2389) commit 40ae73f Author: Ivan Shumkov <ivan@shumkov.ru> Date: Fri Dec 13 17:35:40 2024 +0700 chore(release): update changelog and bump version to 1.7.0 (#2387) commit 257e3da Author: Ivan Shumkov <ivan@shumkov.ru> Date: Fri Dec 13 15:44:10 2024 +0700 chore(dashmate)!: update Core to version 22 (#2384) commit 19a4c6d Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Dec 12 18:30:14 2024 +0700 chore(dashmate): set tenderdash version to 1 (#2385) commit 0e9d4dc Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Thu Dec 12 11:39:35 2024 +0100 chore: address vulnerabilty GHSA-mwcw-c2x4-8c55 (#2382) Co-authored-by: Ivan Shumkov <ivan@shumkov.ru> commit bdae90c Author: Ivan Shumkov <ivan@shumkov.ru> Date: Thu Dec 12 13:36:04 2024 +0700 chore(dashmate): increase subsidy for devnet (#2353)
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Refactor