-
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: move BLS Sigs import to Rust Dash Core #2252
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,11 +90,11 @@ pub mod prelude { | |
|
||
pub use bincode; | ||
#[cfg(all(not(target_arch = "wasm32"), feature = "bls-signatures"))] | ||
pub use bls_signatures; | ||
pub use dashcore::bls_signatures; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Direct usage of Several instances of Affected Files:
🔗 Analysis chainLGTM: BLS signatures import moved to dashcore. This change aligns with the PR objective of moving the BLS Signatures import to Rust Dash Core. It centralizes the import through the dashcore crate while maintaining the existing feature flag and architecture conditions. Let's verify the usage of this new import path in the codebase: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the usage of the new BLS signatures import path
# Test: Search for uses of bls_signatures from dashcore
rg --type rust 'use (crate::)?dashcore::bls_signatures'
# Test: Search for any remaining direct uses of bls_signatures
rg --type rust 'use bls_signatures'
Length of output: 153 Script: #!/bin/bash
# Description: Comprehensive verification of bls_signatures usage in the codebase
# Test 1: Search for any occurrences of bls_signatures in the codebase
rg --type rust 'bls_signatures' --context 2
# Test 2: Ensure that all imports of bls_signatures are through dashcore
rg --type rust 'use\s+bls_signatures[^;]*;' | grep -v 'dashcore::bls_signatures'
# Test 3: Verify that there are no direct usages without the dashcore namespace
rg --type rust 'bls_signatures::' | grep -v 'dashcore::bls_signatures::'
Length of output: 30796 |
||
#[cfg(feature = "ed25519-dalek")] | ||
pub use dashcore::ed25519_dalek; | ||
#[cfg(feature = "system_contracts")] | ||
pub use data_contracts; | ||
#[cfg(feature = "ed25519-dalek")] | ||
pub use ed25519_dalek; | ||
#[cfg(feature = "jsonschema")] | ||
pub use jsonschema; | ||
pub use platform_serialization; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,7 +213,7 @@ mod tests { | |
|
||
use dpp::consensus::ConsensusError; | ||
use dpp::dashcore::secp256k1::Secp256k1; | ||
use dpp::dashcore::{key::KeyPair, signer, Network, PrivateKey}; | ||
use dpp::dashcore::{key::Keypair, signer, Network, PrivateKey}; | ||
|
||
use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; | ||
use dpp::data_contract::document_type::random_document::{ | ||
|
@@ -2659,7 +2659,7 @@ mod tests { | |
|
||
let secp = Secp256k1::new(); | ||
|
||
let new_key_pair = KeyPair::new(&secp, &mut rng); | ||
let new_key_pair = Keypair::new(&secp, &mut rng); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Refactor duplicated key pair generation code The line Also applies to: 2763-2763 |
||
|
||
let mut new_key = IdentityPublicKeyInCreationV0 { | ||
id: 2, | ||
|
@@ -2760,7 +2760,7 @@ mod tests { | |
|
||
let platform_state = platform.state.load(); | ||
|
||
let new_key_pair = KeyPair::new(&secp, &mut rng); | ||
let new_key_pair = Keypair::new(&secp, &mut rng); | ||
|
||
let new_key = IdentityPublicKeyInCreationV0 { | ||
id: 2, | ||
|
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.
Make imports of
bls_signatures
anded25519_dalek
conditional on feature flagsThe
bls_signatures
anded25519_dalek
modules are only used when the corresponding features (bls-signatures
anded25519-dalek
) are enabled. Including these imports unconditionally can lead to compilation errors when these features are not enabled. To prevent this, wrap the imports with the appropriate#[cfg(feature = "...")]
attributes.Apply this diff to conditionally import the modules:
📝 Committable suggestion