From 7d7f05fffd479ff193cecd82420c3d19058865a6 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Sep 2025 17:05:04 +0700 Subject: [PATCH 1/6] clippy fixes --- packages/rs-dapi-client/src/dump.rs | 2 +- .../distribution_function/mod.rs | 8 +++-- .../class_methods/try_from_schema/v0/mod.rs | 2 ++ .../class_methods/try_from_schema/v1/mod.rs | 2 ++ .../document_type/methods/mod.rs | 14 ++++---- .../src/data_contract/document_type/mod.rs | 1 + .../document_type/property/mod.rs | 6 ++-- .../src/errors/consensus/basic/basic_error.rs | 1 + .../src/errors/consensus/consensus_error.rs | 1 + packages/rs-dpp/src/errors/protocol_error.rs | 1 + packages/rs-dpp/src/fee/fee_result/refunds.rs | 5 +-- .../identity/identity_public_key/random.rs | 32 +++++++++---------- .../state_transition/asset_lock_proof/mod.rs | 5 +-- packages/rs-dpp/src/lib.rs | 1 + packages/rs-dpp/src/state_transition/mod.rs | 8 ++--- .../methods/v0/mod.rs | 2 +- .../identity_create_transition/v0/mod.rs | 4 +-- .../v0/v0_methods.rs | 4 +-- .../check_for_desired_protocol_upgrade/mod.rs | 4 +-- .../mod.rs | 2 +- packages/rs-drive-abci/src/lib.rs | 2 ++ packages/rs-drive-proof-verifier/src/lib.rs | 1 + packages/rs-drive-proof-verifier/src/proof.rs | 4 +-- packages/strategy-tests/src/lib.rs | 1 + packages/strategy-tests/src/operations.rs | 1 + packages/wasm-dpp/src/identity/identity.rs | 4 +-- packages/wasm-drive-verify/src/lib.rs | 4 ++- 27 files changed, 68 insertions(+), 54 deletions(-) diff --git a/packages/rs-dapi-client/src/dump.rs b/packages/rs-dapi-client/src/dump.rs index a1e23d1ff2..b4dd5b3557 100644 --- a/packages/rs-dapi-client/src/dump.rs +++ b/packages/rs-dapi-client/src/dump.rs @@ -105,7 +105,7 @@ impl DumpData { // Return request type (T) name without module prefix fn request_type() -> String { let req_type = std::any::type_name::(); - req_type.split(':').last().unwrap_or(req_type).to_string() + req_type.rsplit(':').next().unwrap_or(req_type).to_string() } /// Generate unique filename for this dump. /// diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs b/packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs index b53b48018e..432adc7b6c 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs @@ -119,10 +119,10 @@ pub enum DistributionFunction { /// - `step_count`: The number of periods between each step. /// - `decrease_per_interval_numerator` and `decrease_per_interval_denominator`: Define the reduction factor per step. /// - `start_decreasing_offset`: Optional start period offset (e.g., start block or time). If not provided, the contract creation start is used. - /// If this is provided before this number we give out the distribution start amount every interval. + /// If this is provided before this number we give out the distribution start amount every interval. /// - `max_interval_count`: The maximum amount of intervals there can be. Can be up to 1024. - /// !!!Very important!!! -> This will default to 128 is default if not set. - /// This means that after 128 cycles we will be distributing trailing_distribution_interval_amount per interval. + /// !!!Very important!!! -> This will default to 128 is default if not set. + /// This means that after 128 cycles we will be distributing trailing_distribution_interval_amount per interval. /// - `distribution_start_amount`: The initial token emission. /// - `trailing_distribution_interval_amount`: The token emission after all decreasing intervals. /// - `min_value`: Optional minimum emission value. @@ -524,6 +524,7 @@ pub enum DistributionFunction { /// f(x) = 10000 * ln(5000 / x) /// ``` /// - Values: a = 10000 n = 5000 m = 1 o = 0 b = 0 d = 0 + /// ```text /// y /// ↑ /// 10000 |* @@ -538,6 +539,7 @@ pub enum DistributionFunction { /// 1000 | * /// 0 +-------------------*----------→ x /// 0 2000 4000 6000 8000 + /// ``` /// /// - The emission **starts high** and **gradually decreases**, ensuring early adopters receive /// more tokens while later participants still get rewards. diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs index 7915f66584..09bc5492e6 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs @@ -61,6 +61,8 @@ impl DocumentTypeV0 { // TODO: Split into multiple functions #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] + #[allow(clippy::ptr_arg)] + #[allow(clippy::unnecessary_operation)] pub(super) fn try_from_schema( data_contract_id: Identifier, name: &str, diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs index 4d96e90163..1c8f3912bf 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs @@ -77,6 +77,8 @@ impl DocumentTypeV1 { // TODO: Split into multiple functions #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] + #[allow(clippy::ptr_arg)] + #[allow(clippy::unnecessary_operation)] pub(super) fn try_from_schema( data_contract_id: Identifier, name: &str, diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs index 7d3282e6ff..ff2ffa93e2 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs @@ -212,15 +212,15 @@ pub trait DocumentTypeV0Methods: DocumentTypeV0Getters + DocumentTypeV0MethodsVe /// - `id`: An identifier for the document. Unique within the context of the document's type. /// - `owner_id`: The identifier of the entity that will own this document. /// - `block_height`: The block height at which this document is considered to have been created. - /// While this value is recorded in the document, it is ignored when the document is broadcasted - /// to the network. This is because the actual block height at the time of broadcast may differ. - /// This parameter is included to fulfill schema requirements that specify a block height; you may - /// use the current block height, a placeholder value of 0, or any other value as necessary. + /// While this value is recorded in the document, it is ignored when the document is broadcasted + /// to the network. This is because the actual block height at the time of broadcast may differ. + /// This parameter is included to fulfill schema requirements that specify a block height; you may + /// use the current block height, a placeholder value of 0, or any other value as necessary. /// - `core_block_height`: Similar to `block_height`, this represents the core network's block height - /// at the document's creation time. It is handled the same way as `block_height` regarding broadcast - /// and schema requirements. + /// at the document's creation time. It is handled the same way as `block_height` regarding broadcast + /// and schema requirements. /// - `properties`: A collection of properties for the document, structured as a `BTreeMap`. - /// These must be pre-validated to match the document's schema definitions. + /// These must be pre-validated to match the document's schema definitions. /// - `platform_version`: A reference to the current version of the platform for which the document is created. /// /// # Returns: diff --git a/packages/rs-dpp/src/data_contract/document_type/mod.rs b/packages/rs-dpp/src/data_contract/document_type/mod.rs index a4fcdb0999..aadb6eedbf 100644 --- a/packages/rs-dpp/src/data_contract/document_type/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/mod.rs @@ -88,6 +88,7 @@ pub enum DocumentTypeMutRef<'a> { V1(&'a mut DocumentTypeV1), } +#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone, PartialEq, From)] pub enum DocumentType { V0(DocumentTypeV0), diff --git a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs index 5eed565047..d295ee7b38 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs @@ -306,7 +306,7 @@ impl DocumentPropertyType { let min_size = self.min_size()?; let max_size = self.max_size()?; if platform_version.protocol_version > 8 { - Some(((min_size as u32 + max_size as u32 + 1) / 2) as u16) + Some(((min_size as u32 + max_size as u32).div_ceil(2)) as u16) } else { Some(min_size.wrapping_add(max_size).wrapping_add(1) / 2) } @@ -342,7 +342,9 @@ impl DocumentPropertyType { return Ok(None); }; if platform_version.protocol_version > 8 { - Ok(Some(((min_size as u32 + max_size as u32 + 1) / 2) as u16)) + Ok(Some( + ((min_size as u32 + max_size as u32).div_ceil(2)) as u16, + )) } else { Ok(Some(min_size.wrapping_add(max_size).wrapping_add(1) / 2)) } diff --git a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs index 456da8d451..09857b5dde 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs @@ -103,6 +103,7 @@ use crate::consensus::basic::{ use crate::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError; use crate::data_contract::errors::DataContractError; +#[allow(clippy::large_enum_variant)] #[derive( Error, Debug, PlatformSerialize, PlatformDeserialize, Encode, Decode, PartialEq, Clone, )] diff --git a/packages/rs-dpp/src/errors/consensus/consensus_error.rs b/packages/rs-dpp/src/errors/consensus/consensus_error.rs index 72d41d4aa3..008a8592b4 100644 --- a/packages/rs-dpp/src/errors/consensus/consensus_error.rs +++ b/packages/rs-dpp/src/errors/consensus/consensus_error.rs @@ -27,6 +27,7 @@ use crate::errors::consensus::basic::BasicError; )] #[platform_serialize(limit = 2000)] #[error(transparent)] +#[allow(clippy::large_enum_variant)] pub enum ConsensusError { /* diff --git a/packages/rs-dpp/src/errors/protocol_error.rs b/packages/rs-dpp/src/errors/protocol_error.rs index 5c20a90ca4..dc5530f66b 100644 --- a/packages/rs-dpp/src/errors/protocol_error.rs +++ b/packages/rs-dpp/src/errors/protocol_error.rs @@ -42,6 +42,7 @@ use crate::version::FeatureVersion; use platform_value::{Error as ValueError, Value}; use platform_version::error::PlatformVersionError; +#[allow(clippy::large_enum_variant)] #[derive(Error, Debug)] pub enum ProtocolError { #[error("Identifier Error: {0}")] diff --git a/packages/rs-dpp/src/fee/fee_result/refunds.rs b/packages/rs-dpp/src/fee/fee_result/refunds.rs index a9e93499f8..65c453dab3 100644 --- a/packages/rs-dpp/src/fee/fee_result/refunds.rs +++ b/packages/rs-dpp/src/fee/fee_result/refunds.rs @@ -158,10 +158,7 @@ impl FeeRefunds { ) -> Option { let credits_per_epoch = self.get(identity_id.as_bytes())?; - let credits = credits_per_epoch - .iter() - .map(|(_epoch_index, credits)| credits) - .sum(); + let credits = credits_per_epoch.values().sum(); Some(credits) } diff --git a/packages/rs-dpp/src/identity/identity_public_key/random.rs b/packages/rs-dpp/src/identity/identity_public_key/random.rs index 6582a3567b..f7882356fc 100644 --- a/packages/rs-dpp/src/identity/identity_public_key/random.rs +++ b/packages/rs-dpp/src/identity/identity_public_key/random.rs @@ -75,13 +75,13 @@ impl IdentityPublicKey { /// * `id`: The `KeyID` for the generated key. /// * `rng`: A mutable reference to a random number generator of type `StdRng`. /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used - /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. /// * `platform_version`: The platform version which determines the structure of the identity key. /// /// # Returns /// /// * `Result`: If successful, returns an instance of `Self`. - /// In case of an error, it returns a `ProtocolError`. + /// In case of an error, it returns a `ProtocolError`. /// /// # Errors /// @@ -121,13 +121,13 @@ impl IdentityPublicKey { /// * `id`: The `KeyID` for the generated key. /// * `seed`: A seed that will create a random number generator `StdRng`. /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used - /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. /// * `platform_version`: The platform version which determines the structure of the identity key. /// /// # Returns /// /// * `Result<(Self, Vec), ProtocolError>`: If successful, returns an instance of `Self` and the private key as `Vec`. - /// In case of an error, it returns a `ProtocolError`. + /// In case of an error, it returns a `ProtocolError`. /// /// # Errors /// @@ -158,13 +158,13 @@ impl IdentityPublicKey { /// * `id`: The `KeyID` for the generated key. /// * `rng`: A mutable reference to a random number generator of type `StdRng`. /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used - /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. /// * `platform_version`: The platform version which determines the structure of the identity key. /// /// # Returns /// /// * `Result<(Self, Vec), ProtocolError>`: If successful, returns an instance of `Self` and the private key as `Vec`. - /// In case of an error, it returns a `ProtocolError`. + /// In case of an error, it returns a `ProtocolError`. /// /// # Errors /// @@ -205,13 +205,13 @@ impl IdentityPublicKey { /// * `id`: The `KeyID` for the generated key. /// * `rng`: A mutable reference to a random number generator of type `StdRng`. /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used - /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. /// * `platform_version`: The platform version which determines the structure of the identity key. /// /// # Returns /// /// * `Result`: If successful, returns an instance of `Self`. - /// In case of an error, it returns a `ProtocolError`. + /// In case of an error, it returns a `ProtocolError`. /// /// # Errors /// @@ -251,13 +251,13 @@ impl IdentityPublicKey { /// * `id`: The `KeyID` for the generated key. /// * `rng`: A mutable reference to a random number generator of type `StdRng`. /// * `used_key_matrix`: An optional tuple that contains the count of keys that have already been used - /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. + /// and a mutable reference to a matrix (or vector) that tracks which keys have been used. /// * `platform_version`: The platform version which determines the structure of the identity key. /// /// # Returns /// /// * `Result`: If successful, returns an instance of `Self`. - /// In case of an error, it returns a `ProtocolError`. + /// In case of an error, it returns a `ProtocolError`. /// /// # Errors /// @@ -311,7 +311,7 @@ impl IdentityPublicKey { /// # Returns /// /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, - /// and the second element is the corresponding private key. + /// and the second element is the corresponding private key. /// pub fn random_ecdsa_master_authentication_key_with_rng( id: KeyID, @@ -377,7 +377,7 @@ impl IdentityPublicKey { /// # Returns /// /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, - /// and the second element is the corresponding private key. + /// and the second element is the corresponding private key. /// pub fn random_ecdsa_master_authentication_key( id: KeyID, @@ -404,7 +404,7 @@ impl IdentityPublicKey { /// # Returns /// /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, - /// and the second element is the corresponding private key. + /// and the second element is the corresponding private key. /// pub fn random_ecdsa_critical_level_authentication_key( id: KeyID, @@ -435,7 +435,7 @@ impl IdentityPublicKey { /// # Returns /// /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, - /// and the second element is the corresponding private key. + /// and the second element is the corresponding private key. /// pub fn random_ecdsa_critical_level_authentication_key_with_rng( id: KeyID, @@ -622,7 +622,7 @@ impl IdentityPublicKey { /// # Returns /// /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, - /// and the second element is the corresponding private key. + /// and the second element is the corresponding private key. /// pub fn random_ecdsa_high_level_authentication_key( id: KeyID, @@ -649,7 +649,7 @@ impl IdentityPublicKey { /// # Returns /// /// * `(Self, Vec)`: A tuple where the first element is an instance of the `IdentityPublicKey` struct, - /// and the second element is the corresponding private key. + /// and the second element is the corresponding private key. /// pub fn random_ecdsa_high_level_authentication_key_with_rng( id: KeyID, diff --git a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs index 389736ec64..3fb44f89cb 100644 --- a/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs +++ b/packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs @@ -169,10 +169,7 @@ impl AssetLockProof { match proof_type_res { Ok(proof_type_int) => { let proof_type = AssetLockProofType::try_from(proof_type_int); - match proof_type { - Ok(pt) => Some(pt), - Err(_) => None, - } + proof_type.ok() } Err(_) => None, } diff --git a/packages/rs-dpp/src/lib.rs b/packages/rs-dpp/src/lib.rs index 072e3db448..a80d38b85b 100644 --- a/packages/rs-dpp/src/lib.rs +++ b/packages/rs-dpp/src/lib.rs @@ -3,6 +3,7 @@ #![forbid(unsafe_code)] //#![deny(missing_docs)] #![allow(dead_code)] +#![allow(clippy::result_large_err)] extern crate core; diff --git a/packages/rs-dpp/src/state_transition/mod.rs b/packages/rs-dpp/src/state_transition/mod.rs index de8e0b4ec9..f0f4ba907c 100644 --- a/packages/rs-dpp/src/state_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/mod.rs @@ -295,7 +295,7 @@ pub struct StateTransitionSigningOptions { impl StateTransition { pub fn deserialize_from_bytes_in_version( bytes: &[u8], - platform_version: &PlatformVersion, + _platform_version: &PlatformVersion, ) -> Result { let state_transition = StateTransition::deserialize_from_bytes(bytes)?; #[cfg(all(feature = "state-transitions", feature = "validation"))] @@ -304,8 +304,8 @@ impl StateTransition { // Tests are done with very high protocol ranges, while we could put this behind a feature, // that would probably be overkill. - if active_version_range.contains(&platform_version.protocol_version) - || platform_version.protocol_version > 268435456 + if active_version_range.contains(&_platform_version.protocol_version) + || _platform_version.protocol_version > 268435456 { Ok(state_transition) } else { @@ -313,7 +313,7 @@ impl StateTransition { StateTransitionIsNotActiveError { state_transition_type: state_transition.name(), active_version_range, - current_protocol_version: platform_version.protocol_version, + current_protocol_version: _platform_version.protocol_version, }, )) } diff --git a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs index e7987c4fbe..cbe493b0ec 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/contract/data_contract_create_transition/methods/v0/mod.rs @@ -20,7 +20,7 @@ pub trait DataContractCreateTransitionMethodsV0 { /// * `signer` - A reference to an object implementing the `Signer` trait. /// * `platform_version` - The current platform version that should be used. /// * `feature_version` - You can set the feature version to a different version than the default for the current - /// protocol version. + /// protocol version. /// /// # Returns /// diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs index dec9e0efa0..02db627394 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/mod.rs @@ -98,8 +98,8 @@ impl IdentityCreateTransitionV0 { let public_keys = identity .public_keys() - .iter() - .map(|(_, public_key)| public_key.into()) + .values() + .map(|public_key| public_key.into()) .collect::>(); identity_create_transition.set_public_keys(public_keys); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs index baf2d0cb40..b771ff497a 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_create_transition/v0/v0_methods.rs @@ -49,8 +49,8 @@ impl IdentityCreateTransitionMethodsV0 for IdentityCreateTransitionV0 { }; let public_keys = identity .public_keys() - .iter() - .map(|(_, public_key)| public_key.clone().into()) + .values() + .map(|public_key| public_key.clone().into()) .collect(); identity_create_transition.set_public_keys(public_keys); diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs index be12d1989d..49b14661e7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/mod.rs @@ -18,8 +18,8 @@ impl Platform { /// # Returns /// /// * `Result, Error>` - Returns the new protocol version if an upgrade was needed, - /// or None if no upgrade is required. - /// In case of an error, the corresponding Error is returned. + /// or None if no upgrade is required. + /// In case of an error, the corresponding Error is returned. /// /// # Errors /// diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs index 6d5cade8e6..fc2f95ec2a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/update_broadcasted_withdrawal_statuses/mod.rs @@ -28,7 +28,7 @@ where /// # Returns /// /// * `Result<(), Error>` - Returns an Ok(()) if the statuses are successfully updated. - /// Otherwise, it returns an Error. + /// Otherwise, it returns an Error. /// /// # Errors /// diff --git a/packages/rs-drive-abci/src/lib.rs b/packages/rs-drive-abci/src/lib.rs index f9a51dcd1b..a81b24d0ef 100644 --- a/packages/rs-drive-abci/src/lib.rs +++ b/packages/rs-drive-abci/src/lib.rs @@ -9,6 +9,8 @@ // Coding conventions #![forbid(unsafe_code)] #![deny(missing_docs)] +#![allow(clippy::result_large_err)] +#![allow(clippy::large_enum_variant)] /// ABCI module pub mod abci; diff --git a/packages/rs-drive-proof-verifier/src/lib.rs b/packages/rs-drive-proof-verifier/src/lib.rs index adc1fbdbd6..5790b842a9 100644 --- a/packages/rs-drive-proof-verifier/src/lib.rs +++ b/packages/rs-drive-proof-verifier/src/lib.rs @@ -1,5 +1,6 @@ //! Proof verification library for Dash Drive #![warn(missing_docs)] +#![allow(clippy::result_large_err)] /// Errors that can occur during proof verification pub mod error; diff --git a/packages/rs-drive-proof-verifier/src/proof.rs b/packages/rs-drive-proof-verifier/src/proof.rs index b6ddd7caf0..307634a266 100644 --- a/packages/rs-drive-proof-verifier/src/proof.rs +++ b/packages/rs-drive-proof-verifier/src/proof.rs @@ -93,7 +93,7 @@ pub trait FromProof { /// /// * `Ok(Some(object, metadata))` when the requested object was found in the proof. /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence. - /// For collections, returns Ok(None) if none of the requested objects were found. + /// For collections, returns Ok(None) if none of the requested objects were found. /// * `Err(Error)` when either the provided data is invalid or proof validation failed. fn maybe_from_proof<'a, I: Into, O: Into>( request: I, @@ -123,7 +123,7 @@ pub trait FromProof { /// /// * `Ok(Some((object, metadata)))` when the requested object was found in the proof. /// * `Ok(None)` when the requested object was not found in the proof; this can be interpreted as proof of non-existence. - /// For collections, returns Ok(None) if none of the requested objects were found. + /// For collections, returns Ok(None) if none of the requested objects were found. /// * `Err(Error)` when either the provided data is invalid or proof validation failed. fn maybe_from_proof_with_metadata<'a, I: Into, O: Into>( request: I, diff --git a/packages/strategy-tests/src/lib.rs b/packages/strategy-tests/src/lib.rs index 32c2dc9754..ec28474d48 100644 --- a/packages/strategy-tests/src/lib.rs +++ b/packages/strategy-tests/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::result_large_err)] //! This library facilitates the creation and execution of comprehensive testing strategies for Dash Platform, leveraging the `Strategy` struct as its core. //! It is designed to simulate a wide range of blockchain activities, offering detailed control over the generation of state transitions, contract interactions, and identity management across blocks. //! diff --git a/packages/strategy-tests/src/operations.rs b/packages/strategy-tests/src/operations.rs index 51f4e55853..cf3201e845 100644 --- a/packages/strategy-tests/src/operations.rs +++ b/packages/strategy-tests/src/operations.rs @@ -617,6 +617,7 @@ pub enum OperationType { Token(TokenOp), } +#[allow(clippy::large_enum_variant)] #[derive(Clone, Debug, Encode, Decode)] enum OperationTypeInSerializationFormat { Document(Vec), diff --git a/packages/wasm-dpp/src/identity/identity.rs b/packages/wasm-dpp/src/identity/identity.rs index de94d11d11..1db256f0f0 100644 --- a/packages/wasm-dpp/src/identity/identity.rs +++ b/packages/wasm-dpp/src/identity/identity.rs @@ -88,8 +88,8 @@ impl IdentityWasm { pub fn get_public_keys(&self) -> Vec { self.inner .public_keys() - .iter() - .map(|(_, k)| k.to_owned()) + .values() + .cloned() .map(IdentityPublicKeyWasm::from) .map(JsValue::from) .collect() diff --git a/packages/wasm-drive-verify/src/lib.rs b/packages/wasm-drive-verify/src/lib.rs index c68e22da41..f5e115f1f6 100644 --- a/packages/wasm-drive-verify/src/lib.rs +++ b/packages/wasm-drive-verify/src/lib.rs @@ -1,4 +1,6 @@ #![cfg_attr(not(target_arch = "wasm32"), allow(dead_code))] +#![allow(clippy::type_complexity)] +#![allow(clippy::too_many_arguments)] //! # wasm-drive-verify //! @@ -103,7 +105,7 @@ pub mod transition_verification { pub use crate::state_transition::*; } -use wasm_bindgen::prelude::*; +// no prelude imports needed here; attribute uses full path #[cfg(all(target_arch = "wasm32", not(test)))] #[wasm_bindgen(start)] From 4d0061bf52f7c70b970776ddc8ac52a4fee4f9a7 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Sep 2025 17:08:29 +0700 Subject: [PATCH 2/6] clippy fixes --- packages/rs-dpp/src/system_data_contracts.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/rs-dpp/src/system_data_contracts.rs b/packages/rs-dpp/src/system_data_contracts.rs index 13ed6cd214..c27dcbf0cb 100644 --- a/packages/rs-dpp/src/system_data_contracts.rs +++ b/packages/rs-dpp/src/system_data_contracts.rs @@ -160,35 +160,35 @@ mod tests { assert_ne!(contract_1, contract_2); let v1_ser: DataContractInSerializationFormat = contract_1 .clone() - .try_into_platform_versioned(&PlatformVersion::get(1).unwrap()) + .try_into_platform_versioned(PlatformVersion::get(1).unwrap()) .expect("expected to serialize"); let v2_ser: DataContractInSerializationFormat = contract_2 .clone() - .try_into_platform_versioned(&PlatformVersion::get(1).unwrap()) + .try_into_platform_versioned(PlatformVersion::get(1).unwrap()) .expect("expected to serialize"); assert_eq!(v1_ser, v2_ser); let v1_bytes = contract_1 - .serialize_to_bytes_with_platform_version(&PlatformVersion::get(1).unwrap()) + .serialize_to_bytes_with_platform_version(PlatformVersion::get(1).unwrap()) .expect("expected to serialize"); let v8_bytes = contract_1 - .serialize_to_bytes_with_platform_version(&PlatformVersion::get(8).unwrap()) + .serialize_to_bytes_with_platform_version(PlatformVersion::get(8).unwrap()) .expect("expected to serialize"); let v9_bytes = contract_1 - .serialize_to_bytes_with_platform_version(&PlatformVersion::get(9).unwrap()) + .serialize_to_bytes_with_platform_version(PlatformVersion::get(9).unwrap()) .expect("expected to serialize"); assert_eq!(v1_bytes.len(), 1747); assert_eq!(v8_bytes.len(), 1747); assert_eq!(v9_bytes.len(), 1757); // this will still use a config v0 without sized_integer_types let v1_bytes = contract_2 - .serialize_to_bytes_with_platform_version(&PlatformVersion::get(8).unwrap()) + .serialize_to_bytes_with_platform_version(PlatformVersion::get(8).unwrap()) .expect("expected to serialize"); let v8_bytes = contract_2 - .serialize_to_bytes_with_platform_version(&PlatformVersion::get(8).unwrap()) + .serialize_to_bytes_with_platform_version(PlatformVersion::get(8).unwrap()) .expect("expected to serialize"); let v9_bytes = contract_2 - .serialize_to_bytes_with_platform_version(&PlatformVersion::get(9).unwrap()) + .serialize_to_bytes_with_platform_version(PlatformVersion::get(9).unwrap()) .expect("expected to serialize"); assert_eq!(v1_bytes.len(), 1747); assert_eq!(v8_bytes.len(), 1747); From bffd61095b7b76376fa6fbcaddb8e9ffd7e7b249 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Sep 2025 17:15:53 +0700 Subject: [PATCH 3/6] fixes --- .../rs-dpp/src/data_contract/extra/drive_api_tests.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs b/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs index 67ab7eb856..289c3e9529 100644 --- a/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs +++ b/packages/rs-dpp/src/data_contract/extra/drive_api_tests.rs @@ -40,7 +40,6 @@ mod test { &[("$ownerId", "asc"), ("$updatedAt", "asc")], ), ], - ..Default::default() }, ExpectedDocumentsData { document_name: "contactInfo", @@ -49,7 +48,6 @@ mod test { ("index1", true, &[("$ownerId", "asc")]), ("index2", false, &[("$ownerId", "asc"), ("lastName", "asc")]), ], - ..Default::default() }, ExpectedDocumentsData { document_name: "contactRequest", @@ -150,25 +148,25 @@ mod test { assert!(!contract.config().readonly()); // the contract shouldn't be readonly assert!(!contract.config.documents_keep_history_contract_default()); assert_eq!(contract.document_types.len(), 3); - assert!(contract.document_types.get("profile").is_some()); + assert!(contract.document_types.contains_key("profile")); assert!(contract .document_types .get("profile") .unwrap() .documents_mutable()); - assert!(contract.document_types.get("contactInfo").is_some()); + assert!(contract.document_types.contains_key("contactInfo")); assert!(contract .document_types .get("contactInfo") .unwrap() .documents_mutable()); - assert!(contract.document_types.get("contactRequest").is_some()); + assert!(contract.document_types.contains_key("contactRequest")); assert!(!contract .document_types .get("contactRequest") .unwrap() .documents_mutable()); - assert!(contract.document_types.get("non_existent_key").is_none()); + assert!(!contract.document_types.contains_key("non_existent_key")); let contact_info_indices = &contract .document_types From c6360de83b02bcf5fbe59249f24807f6f54a8819 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Sep 2025 17:44:29 +0700 Subject: [PATCH 4/6] cleanup --- .../v0/mod.rs | 2 +- .../class_methods/try_from_schema/mod.rs | 2 +- .../class_methods/try_from_schema/v0/mod.rs | 24 ++++++++----------- .../class_methods/try_from_schema/v1/mod.rs | 20 +++++++--------- packages/rs-dpp/src/state_transition/mod.rs | 9 +++---- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs index a1b8f94c83..9a187a750d 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/create_document_types_from_document_schemas/v0/mod.rs @@ -18,7 +18,7 @@ impl DocumentType { token_configurations: &BTreeMap, data_contact_config: &DataContractConfig, full_validation: bool, - validation_operations: &mut Vec, + validation_operations: &mut impl Extend, platform_version: &PlatformVersion, ) -> Result, ProtocolError> { let mut contract_document_types: BTreeMap = BTreeMap::new(); diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs index 943c1d2642..33e63576f9 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs @@ -46,7 +46,7 @@ impl DocumentType { token_configurations: &BTreeMap, data_contact_config: &DataContractConfig, full_validation: bool, - validation_operations: &mut Vec, + validation_operations: &mut impl Extend, platform_version: &PlatformVersion, ) -> Result { match platform_version diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs index 09bc5492e6..5d3dbfeba0 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v0/mod.rs @@ -61,8 +61,6 @@ impl DocumentTypeV0 { // TODO: Split into multiple functions #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] - #[allow(clippy::ptr_arg)] - #[allow(clippy::unnecessary_operation)] pub(super) fn try_from_schema( data_contract_id: Identifier, name: &str, @@ -70,7 +68,7 @@ impl DocumentTypeV0 { schema_defs: Option<&BTreeMap>, data_contact_config: &DataContractConfig, full_validation: bool, // we don't need to validate if loaded from state - validation_operations: &mut Vec, + validation_operations: &mut impl Extend, platform_version: &PlatformVersion, ) -> Result { // Create a full root JSON Schema from shorten contract document type schema @@ -84,9 +82,7 @@ impl DocumentTypeV0 { if full_validation { // TODO we are silently dropping this error when we shouldn't be // but returning this error causes tests to fail; investigate more. - ProtocolError::CorruptedCodeExecution( - "validation is not enabled but is being called on try_from_schema".to_string(), - ); + "validation is not enabled but is being called on try_from_schema".to_string(); } #[cfg(feature = "validation")] @@ -114,18 +110,18 @@ impl DocumentTypeV0 { let schema_size = result.into_data()?.size; - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), - ); + )); return Err(ProtocolError::ConsensusError(Box::new(error))); } let schema_size = result.into_data()?.size; - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), - ); + )); // Make sure JSON Schema is compilable let root_json_schema = root_schema.try_to_validating_json().map_err(|e| { @@ -202,11 +198,11 @@ impl DocumentTypeV0 { #[cfg(feature = "validation")] if full_validation { - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation( property_values.values().len() as u64, ), - ); + )); // We should validate that the positions are continuous for (pos, value) in property_values.values().enumerate() { @@ -304,12 +300,12 @@ impl DocumentTypeV0 { #[cfg(feature = "validation")] if full_validation { - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaIndexValidation( index.properties.len() as u64, index.unique, ), - ); + )); // Unique indices produces significant load on the system during state validation // so we need to limit their number to prevent of spikes and DoS attacks diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs index 1c8f3912bf..7c0fb1a26b 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs @@ -77,8 +77,6 @@ impl DocumentTypeV1 { // TODO: Split into multiple functions #[allow(unused_variables)] #[allow(clippy::too_many_arguments)] - #[allow(clippy::ptr_arg)] - #[allow(clippy::unnecessary_operation)] pub(super) fn try_from_schema( data_contract_id: Identifier, name: &str, @@ -87,7 +85,7 @@ impl DocumentTypeV1 { token_configurations: &BTreeMap, data_contact_config: &DataContractConfig, full_validation: bool, // we don't need to validate if loaded from state - validation_operations: &mut Vec, + validation_operations: &mut impl Extend, platform_version: &PlatformVersion, ) -> Result { // Create a full root JSON Schema from shorten contract document type schema @@ -101,9 +99,7 @@ impl DocumentTypeV1 { if full_validation { // TODO we are silently dropping this error when we shouldn't be // but returning this error causes tests to fail; investigate more. - ProtocolError::CorruptedCodeExecution( - "validation is not enabled but is being called on try_from_schema".to_string(), - ); + "validation is not enabled but is being called on try_from_schema".to_string(); } #[cfg(feature = "validation")] @@ -131,18 +127,18 @@ impl DocumentTypeV1 { let schema_size = result.into_data()?.size; - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), - ); + )); return Err(ProtocolError::ConsensusError(Box::new(error))); } let schema_size = result.into_data()?.size; - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaValidationForSize(schema_size), - ); + )); // Make sure JSON Schema is compilable let root_json_schema = root_schema.try_to_validating_json().map_err(|e| { @@ -321,12 +317,12 @@ impl DocumentTypeV1 { #[cfg(feature = "validation")] if full_validation { - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaIndexValidation( index.properties.len() as u64, index.unique, ), - ); + )); // Unique indices produces significant load on the system during state validation // so we need to limit their number to prevent of spikes and DoS attacks diff --git a/packages/rs-dpp/src/state_transition/mod.rs b/packages/rs-dpp/src/state_transition/mod.rs index f0f4ba907c..260a511c26 100644 --- a/packages/rs-dpp/src/state_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/mod.rs @@ -293,9 +293,10 @@ pub struct StateTransitionSigningOptions { } impl StateTransition { + #[allow(unused_variables)] pub fn deserialize_from_bytes_in_version( bytes: &[u8], - _platform_version: &PlatformVersion, + platform_version: &PlatformVersion, ) -> Result { let state_transition = StateTransition::deserialize_from_bytes(bytes)?; #[cfg(all(feature = "state-transitions", feature = "validation"))] @@ -304,8 +305,8 @@ impl StateTransition { // Tests are done with very high protocol ranges, while we could put this behind a feature, // that would probably be overkill. - if active_version_range.contains(&_platform_version.protocol_version) - || _platform_version.protocol_version > 268435456 + if active_version_range.contains(&platform_version.protocol_version) + || platform_version.protocol_version > 268435456 { Ok(state_transition) } else { @@ -313,7 +314,7 @@ impl StateTransition { StateTransitionIsNotActiveError { state_transition_type: state_transition.name(), active_version_range, - current_protocol_version: _platform_version.protocol_version, + current_protocol_version: platform_version.protocol_version, }, )) } From 4e68e29d1da0dc7c4514191460c02c8c32b16bfa Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Sep 2025 17:55:23 +0700 Subject: [PATCH 5/6] more fixes --- .../class_methods/try_from_schema/v1/mod.rs | 4 ++-- .../tests/strategy_tests/token_tests.rs | 14 +------------- .../rs-platform-wallet/examples/basic_usage.rs | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs index 7c0fb1a26b..af1cc65423 100644 --- a/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v1/mod.rs @@ -215,11 +215,11 @@ impl DocumentTypeV1 { #[cfg(feature = "validation")] if full_validation { - validation_operations.push( + validation_operations.extend(std::iter::once( ProtocolValidationOperation::DocumentTypeSchemaPropertyValidation( property_values.values().len() as u64, ), - ); + )); // We should validate that the positions are continuous for (pos, value) in property_values.values().enumerate() { diff --git a/packages/rs-drive-abci/tests/strategy_tests/token_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/token_tests.rs index a0878081ef..a67876d2a2 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/token_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/token_tests.rs @@ -470,18 +470,7 @@ mod tests { let block_count = 60; - let ChainExecutionOutcome { - abci_app, - proposers, - validator_quorums: quorums, - current_validator_quorum_hash: current_quorum_hash, - current_proposer_versions, - end_time_ms, - identity_nonce_counter, - identity_contract_nonce_counter, - instant_lock_quorums, - .. - } = run_chain_for_strategy( + let ChainExecutionOutcome { abci_app, .. } = run_chain_for_strategy( &mut platform, block_count, // block count is 30 strategy.clone(), @@ -791,7 +780,6 @@ mod tests { let state = platform.state.load(); { - let counter = platform.drive.cache.protocol_versions_counter.read(); platform .drive .fetch_versions_with_counter(None, &platform_version.drive) diff --git a/packages/rs-platform-wallet/examples/basic_usage.rs b/packages/rs-platform-wallet/examples/basic_usage.rs index 3dda05fd52..7cc87dccac 100644 --- a/packages/rs-platform-wallet/examples/basic_usage.rs +++ b/packages/rs-platform-wallet/examples/basic_usage.rs @@ -6,7 +6,7 @@ use platform_wallet::{PlatformWalletError, PlatformWalletInfo}; fn main() -> Result<(), PlatformWalletError> { // Create a platform wallet let wallet_id = [1u8; 32]; - let mut platform_wallet = PlatformWalletInfo::new(wallet_id, "My Platform Wallet".to_string()); + let platform_wallet = PlatformWalletInfo::new(wallet_id, "My Platform Wallet".to_string()); println!("Created wallet: {:?}", platform_wallet.name()); From a8dbe683e0bdbe0900dd5b7dac40867d7d2baecf Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Sep 2025 18:15:27 +0700 Subject: [PATCH 6/6] more work --- .../update_state_masternode_list/v0/mod.rs | 4 ++-- .../rs-drive-abci/src/execution/types/block_fees/v0/mod.rs | 3 +++ .../rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs | 2 ++ .../rs-drive-abci/src/platform_types/validator_set/v0/mod.rs | 2 ++ packages/wasm-drive-verify/src/lib.rs | 4 +++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs index 515988d8cf..034b8e4e7a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs @@ -25,7 +25,7 @@ where /// /// * `pro_tx_hash` - A reference to the ProTxHash of the masternode to be removed. /// * `validator_sets` - A mutable reference to an IndexMap containing QuorumHash as key - /// and ValidatorSet as value. + /// and ValidatorSet as value. /// fn remove_masternode_in_validator_sets( pro_tx_hash: &ProTxHash, @@ -50,7 +50,7 @@ where /// * `pro_tx_hash` - The `ProTxHash` of the masternode to be updated /// * `dmn_state_diff` - The `DMNStateDiff` containing the updated masternode information /// * `validator_sets` - A mutable reference to the `IndexMap` - /// representing the validator sets with the quorum hash as the key + /// representing the validator sets with the quorum hash as the key fn update_masternode_in_validator_sets( pro_tx_hash: &ProTxHash, dmn_state_diff: &DMNStateDiff, diff --git a/packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs index d7f1cd0f31..6d7bd227dc 100644 --- a/packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_fees/v0/mod.rs @@ -14,6 +14,7 @@ pub struct BlockFeesV0 { pub refunds_per_epoch: CreditsPerEpoch, } +#[allow(dead_code)] pub trait BlockFeesV0Methods { /// Create block fee result from fees fn from_fees(storage_fee: u64, processing_fee: u64) -> Self; @@ -30,6 +31,7 @@ impl BlockFeesV0Methods for BlockFeesV0 { } /// `BlockFeesV0Getters` trait provides getter methods for `BlockFeesV0`. +#[allow(dead_code)] pub trait BlockFeesV0Getters { /// Returns the processing fee. fn processing_fee(&self) -> u64; @@ -48,6 +50,7 @@ pub trait BlockFeesV0Getters { } /// `BlockFeesV0Setters` trait provides setter methods for `BlockFeesV0`. +#[allow(dead_code)] pub trait BlockFeesV0Setters { /// Sets the processing fee. fn set_processing_fee(&mut self, fee: u64); diff --git a/packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs index a28ce22f0d..f74ad53498 100644 --- a/packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/unpaid_epoch/v0/mod.rs @@ -46,6 +46,7 @@ impl UnpaidEpochV0Methods for UnpaidEpochV0 { } /// Trait that defines getter methods for `UnpaidEpochV0` +#[allow(dead_code)] pub trait UnpaidEpochV0Getters { /// Get the index of the current epoch fn epoch_index(&self) -> EpochIndex; @@ -70,6 +71,7 @@ pub trait UnpaidEpochV0Getters { } /// Trait that defines setter methods for `UnpaidEpochV0` +#[allow(dead_code)] pub trait UnpaidEpochV0Setters { /// Set the index of the current epoch fn set_epoch_index(&mut self, epoch_index: EpochIndex); diff --git a/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs index 70addf0da8..6a882c1a7d 100644 --- a/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs @@ -15,11 +15,13 @@ use tenderdash_abci::proto::abci::ValidatorSetUpdate; use tenderdash_abci::proto::crypto::public_key::Sum::Bls12381; use tenderdash_abci::proto::{abci, crypto}; +#[allow(dead_code)] pub(crate) trait ValidatorSetMethodsV0 { #[allow(unused)] fn update_difference(&self, rhs: &ValidatorSetV0) -> Result; fn to_update(&self) -> ValidatorSetUpdate; + #[allow(dead_code)] fn to_update_owned(self) -> ValidatorSetUpdate; /// Try to create a quorum from info from the Masternode list (given with state), /// and for information return for quorum members diff --git a/packages/wasm-drive-verify/src/lib.rs b/packages/wasm-drive-verify/src/lib.rs index f5e115f1f6..1eea3817ba 100644 --- a/packages/wasm-drive-verify/src/lib.rs +++ b/packages/wasm-drive-verify/src/lib.rs @@ -105,7 +105,9 @@ pub mod transition_verification { pub use crate::state_transition::*; } -// no prelude imports needed here; attribute uses full path +// Bring the wasm_bindgen attribute macro into scope for the start function +#[cfg(all(target_arch = "wasm32", not(test)))] +use wasm_bindgen::prelude::wasm_bindgen; #[cfg(all(target_arch = "wasm32", not(test)))] #[wasm_bindgen(start)]