From 91f8952d5481912b94b4cf9fdda97e65d2bff7a1 Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Fri, 12 Jul 2024 15:47:56 +0300 Subject: [PATCH] suggestions --- packages/rs-dpp/src/fee/default_costs/mod.rs | 6 ++++-- packages/rs-dpp/src/fee/fee_result/refunds.rs | 3 +-- packages/rs-dpp/src/lib.rs | 4 ---- .../process_block_fees/mod.rs | 2 +- .../process_block_fees/v0/mod.rs | 2 +- .../execute_event/mod.rs | 2 +- .../execute_event/v0/mod.rs | 2 +- .../process_raw_state_transitions/v0/mod.rs | 3 +-- .../validate_fees_of_event/mod.rs | 3 ++- .../validate_fees_of_event/v0/mod.rs | 3 ++- .../src/platform_types/platform_state/mod.rs | 2 +- .../src/platform_types/platform_state/v0/mod.rs | 2 +- .../drive_methods/apply_drive_operations/mod.rs | 3 +-- .../apply_drive_operations/v0/mod.rs | 2 +- .../contract/update/update_contract/mod.rs | 2 +- .../contract/update/update_contract/v0/mod.rs | 2 +- .../epochs/get_epochs_infos/v0/mod.rs | 2 +- .../get_epochs_protocol_versions/v0/mod.rs | 2 +- .../epochs/prove_epochs_infos/v0/mod.rs | 2 +- .../delete/delete_document_for_contract/mod.rs | 2 +- .../delete_document_for_contract/v0/mod.rs | 2 +- .../delete_document_for_contract_id/mod.rs | 3 +-- .../delete_document_for_contract_id/v0/mod.rs | 3 +-- .../rs-drive/src/drive/document/delete/mod.rs | 3 +-- .../insert/add_document_for_contract/mod.rs | 2 +- .../insert/add_document_for_contract/v0/mod.rs | 2 +- .../rs-drive/src/drive/document/insert/mod.rs | 5 +---- .../rs-drive/src/drive/document/update/mod.rs | 3 +-- .../update/update_document_for_contract/mod.rs | 2 +- .../update_document_for_contract/v0/mod.rs | 2 +- .../update_document_for_contract_id/mod.rs | 2 +- .../update_document_for_contract_id/v0/mod.rs | 2 +- .../mod.rs | 2 +- .../v0/mod.rs | 2 +- .../rs-drive/src/drive/fee/calculate_fee/mod.rs | 2 +- .../src/drive/fee/calculate_fee/v0/mod.rs | 2 +- .../src/drive/identity/key/fetch/mod.rs | 1 - .../methods/remove_from_identity_balance/mod.rs | 2 +- .../remove_from_identity_balance/v0/mod.rs | 2 +- .../methods/update_identity_revision/mod.rs | 3 ++- .../methods/update_identity_revision/v0/mod.rs | 3 ++- packages/rs-drive/src/fee/op.rs | 2 +- packages/rs-drive/tests/query_tests.rs | 3 +-- packages/rs-drive/tests/query_tests_history.rs | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- .../src/version/fee/data_contract/mod.rs | 17 +---------------- .../src/version/fee/hashing/mod.rs | 11 +---------- .../rs-platform-version/src/version/fee/mod.rs | 13 +------------ .../src/version/fee/processing/mod.rs | 17 +---------------- .../src/version/fee/signature/mod.rs | 12 +----------- .../fee/state_transition_min_fees/mod.rs | 13 +------------ .../src/version/fee/storage/mod.rs | 12 +----------- .../fee/vote_resolution_fund_fees/mod.rs | 10 +--------- 53 files changed, 58 insertions(+), 157 deletions(-) diff --git a/packages/rs-dpp/src/fee/default_costs/mod.rs b/packages/rs-dpp/src/fee/default_costs/mod.rs index 07b423467a..c6c2ecc651 100644 --- a/packages/rs-dpp/src/fee/default_costs/mod.rs +++ b/packages/rs-dpp/src/fee/default_costs/mod.rs @@ -32,14 +32,16 @@ //! Fee costs for Known Platform operations //! -use crate::block::epoch::Epoch; +use std::collections::BTreeMap; +use crate::block::epoch::{Epoch, EpochIndex}; use crate::fee::Credits; -use crate::prelude::CachedEpochIndexFeeVersions; use platform_version::version::fee::FeeVersion; use platform_version::version::PlatformVersion; pub mod constants; +pub type CachedEpochIndexFeeVersions = BTreeMap; + /// A Known Cost Item is an item that changes costs depending on the Epoch #[derive(Eq, PartialEq, Copy, Clone, Hash)] pub enum KnownCostItem { diff --git a/packages/rs-dpp/src/fee/fee_result/refunds.rs b/packages/rs-dpp/src/fee/fee_result/refunds.rs index 20d09f324d..750bd368c3 100644 --- a/packages/rs-dpp/src/fee/fee_result/refunds.rs +++ b/packages/rs-dpp/src/fee/fee_result/refunds.rs @@ -4,7 +4,7 @@ //! use crate::block::epoch::{Epoch, EpochIndex}; -use crate::fee::default_costs::EpochCosts; +use crate::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use crate::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; use crate::fee::epoch::distribution::calculate_storage_fee_refund_amount_and_leftovers; use crate::fee::epoch::{BytesPerEpoch, CreditsPerEpoch}; @@ -12,7 +12,6 @@ use crate::fee::Credits; use crate::ProtocolError; use bincode::{Decode, Encode}; -use crate::prelude::CachedEpochIndexFeeVersions; use platform_value::Identifier; use serde::{Deserialize, Serialize}; use std::collections::btree_map::Iter; diff --git a/packages/rs-dpp/src/lib.rs b/packages/rs-dpp/src/lib.rs index 91f9ef6199..58ff59ff40 100644 --- a/packages/rs-dpp/src/lib.rs +++ b/packages/rs-dpp/src/lib.rs @@ -68,8 +68,6 @@ pub mod prelude { pub use crate::identity::IdentityPublicKey; #[cfg(feature = "validation")] pub use crate::validation::ConsensusValidationResult; - use platform_version::version::fee::FeeVersion; - use std::collections::BTreeMap; pub type BlockHeight = u64; @@ -83,8 +81,6 @@ pub mod prelude { /// UserFeeIncrease is the additional percentage of the processing fee. /// A 1 here means we pay 1% more in processing fees. A 100 means we pay 100% more. pub type UserFeeIncrease = u16; - - pub type CachedEpochIndexFeeVersions = BTreeMap; } pub use bincode; diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs index 8c1318da2c..ac29ae5cdf 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/mod.rs @@ -1,6 +1,6 @@ mod v0; -use dpp::prelude::CachedEpochIndexFeeVersions; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs index 986460807e..01581e4e25 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_fee_processing/process_block_fees/v0/mod.rs @@ -36,7 +36,7 @@ use std::option::Option::None; use dpp::block::epoch::Epoch; -use dpp::prelude::CachedEpochIndexFeeVersions; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use drive::drive::batch::DriveOperation; use drive::drive::Drive; diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs index 539e1882a7..e2aa2dab96 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/mod.rs @@ -9,7 +9,7 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::consensus::ConsensusError; -use dpp::prelude::CachedEpochIndexFeeVersions; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs index 39560de69c..26afe3f245 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/execute_event/v0/mod.rs @@ -11,8 +11,8 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::consensus::ConsensusError; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use drive::drive::identity::update::apply_balance_change_outcome::ApplyBalanceChangeOutcomeV0Methods; use drive::grovedb::Transaction; diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs index b12fc6a4c3..6ebd3054ed 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs @@ -14,11 +14,10 @@ use crate::execution::types::state_transition_container::v0::{ use crate::execution::validation::state_transition::processor::process_state_transition; use crate::metrics::state_transition_execution_histogram; use crate::platform_types::event_execution_result::EventExecutionResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::util::hash::hash_single; use dpp::validation::ConsensusValidationResult; use std::time::Instant; - +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::state_transitions_processing_result::{ StateTransitionExecutionResult, StateTransitionsProcessingResult, diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs index fcac3af275..b3dff47371 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/mod.rs @@ -7,8 +7,9 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::{CachedEpochIndexFeeVersions, ConsensusValidationResult}; +use dpp::prelude::ConsensusValidationResult; use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; diff --git a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs index 3cfb5e17a1..04e8f0f503 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/validate_fees_of_event/v0/mod.rs @@ -7,9 +7,10 @@ use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::consensus::state::identity::IdentityInsufficientBalanceError; use dpp::consensus::state::state_error::StateError; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::{CachedEpochIndexFeeVersions, ConsensusValidationResult}; +use dpp::prelude::ConsensusValidationResult; use dpp::version::PlatformVersion; use drive::grovedb::TransactionArg; diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index aca71d30d9..ec5d8c197e 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -24,9 +24,9 @@ use crate::config::PlatformConfig; use crate::error::execution::ExecutionError; use crate::platform_types::signature_verification_quorum_set::SignatureVerificationQuorumSet; use dpp::block::block_info::BlockInfo; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::util::hash::hash_double; use std::collections::BTreeMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; /// Platform state #[derive(Clone, Debug, From)] diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index 57deee8770..51af1c4d57 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -23,10 +23,10 @@ use crate::config::PlatformConfig; use crate::platform_types::signature_verification_quorum_set::{ SignatureVerificationQuorumSet, SignatureVerificationQuorumSetForSaving, }; -use dpp::prelude::CachedEpochIndexFeeVersions; use itertools::Itertools; use std::collections::BTreeMap; use std::fmt::{Debug, Formatter}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; /// Platform state #[derive(Clone)] diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs index c20a6cec8e..8c9c7cea30 100644 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs +++ b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/mod.rs @@ -8,9 +8,8 @@ use crate::error::{drive::DriveError, Error}; use dpp::block::block_info::BlockInfo; use grovedb::TransactionArg; - +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs index 9d9d5b191f..9d2b2977cf 100644 --- a/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/batch/drive_op_batch/drive_methods/apply_drive_operations/v0/mod.rs @@ -16,8 +16,8 @@ use grovedb::batch::KeyInfoPath; use crate::drive::batch::drive_op_batch::finalize_task::{ DriveOperationFinalizationTasks, DriveOperationFinalizeTask, }; -use dpp::prelude::CachedEpochIndexFeeVersions; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Applies a list of high level DriveOperations to the drive, and calculates the fee for them. diff --git a/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs b/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs index d3cfd7e949..135fa3a6fb 100644 --- a/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs +++ b/packages/rs-drive/src/drive/contract/update/update_contract/mod.rs @@ -8,11 +8,11 @@ use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a data contract. diff --git a/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs b/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs index 3730afa748..9a9d780e44 100644 --- a/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/update/update_contract/v0/mod.rs @@ -16,11 +16,11 @@ use dpp::fee::fee_result::FeeResult; use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::serialization::PlatformSerializableWithPlatformVersion; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; use std::collections::{HashMap, HashSet}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a data contract. diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs index ee67b16a43..d9d4eb4ef5 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_infos/v0/mod.rs @@ -28,7 +28,7 @@ impl Drive { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch. With 40 epochs/year, this value is way safe atm. + // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch and 16383 is large enough. if count > 16383 { return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( "get_epochs_infos_v0 count too high {}", diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs index 56b32f7518..420924fe8d 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/get_epochs_protocol_versions/v0/mod.rs @@ -24,7 +24,7 @@ impl Drive { platform_version: &PlatformVersion, ) -> Result, Error> { if let Some(count) = count { - // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch. With 40 epochs/year, this value is way safe atm. + // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch and 16383 is large enough. if count > 16383 { return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( "get_epochs_protocol_versions_v0 count too high {}", diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs index 08928672f1..9fa275c9ee 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/prove_epochs_infos/v0/mod.rs @@ -25,7 +25,7 @@ impl Drive { transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result, Error> { - // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch. With 40 epochs/year, this value is way safe atm. + // TODO: We should avoid magic numbers. For now we are good since count refers to the number of epochs to fetch and 16383 is large enough. if count > 16383 { return Err(Error::Query(QuerySyntaxError::InvalidLimit(format!( "get_epochs_infos_v0 count too high {}", diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs index edcf3fd6e4..7ca62bbd4d 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs @@ -11,8 +11,8 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; use dpp::identifier::Identifier; -use dpp::prelude::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Deletes a document and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs index 40fd87af58..85dc0d4c7b 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/v0/mod.rs @@ -6,11 +6,11 @@ use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Deletes a document and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs index 52adcde583..42093efd90 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/mod.rs @@ -3,7 +3,7 @@ mod v0; use grovedb::TransactionArg; use dpp::block::block_info::BlockInfo; - +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -12,7 +12,6 @@ use crate::error::Error; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; impl Drive { diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs index 6197f1aef3..0dc596f3bc 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_id/v0/mod.rs @@ -5,7 +5,7 @@ use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; use dpp::block::block_info::BlockInfo; - +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use crate::drive::Drive; use crate::error::document::DocumentError; @@ -14,7 +14,6 @@ use crate::fee::op::LowLevelDriveOperation; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; impl Drive { diff --git a/packages/rs-drive/src/drive/document/delete/mod.rs b/packages/rs-drive/src/drive/document/delete/mod.rs index 5a4a70c3be..10d5326d35 100644 --- a/packages/rs-drive/src/drive/document/delete/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/mod.rs @@ -71,9 +71,8 @@ mod tests { use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::Document; - use dpp::fee::default_costs::EpochCosts; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; - use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::tests::json_document::{json_document_to_contract, json_document_to_document}; use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs index c5fb03d9d7..920c97615d 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/mod.rs @@ -9,9 +9,9 @@ use crate::error::Error; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::TransactionArg; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Adds a document to a contract. diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs index 863f582200..a3659aacfb 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract/v0/mod.rs @@ -6,9 +6,9 @@ use crate::fee::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::TransactionArg; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Adds a document to a contract. diff --git a/packages/rs-drive/src/drive/document/insert/mod.rs b/packages/rs-drive/src/drive/document/insert/mod.rs index 3833d10cc3..94da680939 100644 --- a/packages/rs-drive/src/drive/document/insert/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/mod.rs @@ -91,12 +91,9 @@ mod tests { use crate::drive::object_size_info::DocumentInfo::DocumentRefInfo; use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; - use dpp::fee::default_costs::EpochCosts; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; use dpp::fee::fee_result::FeeResult; - use dpp::prelude::CachedEpochIndexFeeVersions; - use dpp::platform_value::{platform_value, BinaryData, Identifier}; - use dpp::tests::fixtures::get_dpns_data_contract_fixture; use dpp::tests::json_document::json_document_to_document; use dpp::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/update/mod.rs b/packages/rs-drive/src/drive/document/update/mod.rs index c24d684c36..e9235abe60 100644 --- a/packages/rs-drive/src/drive/document/update/mod.rs +++ b/packages/rs-drive/src/drive/document/update/mod.rs @@ -89,11 +89,10 @@ mod tests { }; use dpp::document::specialized_document_factory::SpecializedDocumentFactory; use dpp::document::{Document, DocumentV0Getters, DocumentV0Setters}; - use dpp::fee::default_costs::EpochCosts; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; use dpp::fee::fee_result::FeeResult; use dpp::platform_value; - use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::tests::json_document::json_document_to_document; use once_cell::sync::Lazy; use platform_version::version::PlatformVersion; diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs index 85cfb58114..f0d16e627a 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract/mod.rs @@ -14,9 +14,9 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; -use dpp::prelude::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; use std::borrow::Cow; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a document and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs index 7fde64cd74..ec3cc6c052 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract/v0/mod.rs @@ -9,12 +9,12 @@ use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; use dpp::document::Document; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::borrow::Cow; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a document and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs index 900f2ad037..e9b3603e3a 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/mod.rs @@ -12,9 +12,9 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; -use dpp::prelude::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; use std::borrow::Cow; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a serialized document given a contract id and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs index 453700d863..1c23467cf0 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_for_contract_id/v0/mod.rs @@ -11,12 +11,12 @@ use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::Document; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::borrow::Cow; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a serialized document given a contract id and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs index d3c77b04b3..85366ddd45 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/mod.rs @@ -13,9 +13,9 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; -use dpp::prelude::CachedEpochIndexFeeVersions; use grovedb::TransactionArg; use std::borrow::Cow; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a document and returns the associated fee. diff --git a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs index 55acefd99a..83167354e8 100644 --- a/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/update_document_with_serialization_for_contract/v0/mod.rs @@ -10,12 +10,12 @@ use dpp::data_contract::DataContract; use dpp::document::Document; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::borrow::Cow; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates a document and returns the associated fee. diff --git a/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs b/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs index e69fed52e3..2981970c6d 100644 --- a/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs +++ b/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs @@ -4,9 +4,9 @@ use crate::error::Error; use crate::fee::op::{BaseOp, LowLevelDriveOperation}; use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use enum_map::EnumMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; mod v0; diff --git a/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs b/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs index 07a0507a06..f36970380c 100644 --- a/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs +++ b/packages/rs-drive/src/drive/fee/calculate_fee/v0/mod.rs @@ -5,8 +5,8 @@ use crate::fee::op::{BaseOp, LowLevelDriveOperation}; use dpp::block::epoch::Epoch; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::CachedEpochIndexFeeVersions; use enum_map::EnumMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use platform_version::version::fee::FeeVersion; impl Drive { diff --git a/packages/rs-drive/src/drive/identity/key/fetch/mod.rs b/packages/rs-drive/src/drive/identity/key/fetch/mod.rs index 23207b3661..b734ed0efa 100644 --- a/packages/rs-drive/src/drive/identity/key/fetch/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/fetch/mod.rs @@ -650,7 +650,6 @@ impl IdentityKeysRequest { #[cfg(feature = "server")] /// Gets the processing cost of an identity keys request pub fn processing_cost(&self, platform_version: &PlatformVersion) -> Result { - // Good match &self.request_type { AllKeys => Err(Error::Fee(FeeError::OperationNotAllowed( "You can not get costs for requesting all keys", diff --git a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs index 7ec811be95..bd642a7e00 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/mod.rs @@ -8,11 +8,11 @@ use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// The operations for removing a certain amount of credits from an identity's balance. This function is version controlled. diff --git a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs index 291bb6d397..76cf34f9ca 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/remove_from_identity_balance/v0/mod.rs @@ -8,11 +8,11 @@ use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; -use dpp::prelude::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Balances are stored in the balance tree under the identity's id diff --git a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs index d264b88940..86bd6d16c0 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/mod.rs @@ -7,13 +7,14 @@ use crate::fee::op::LowLevelDriveOperation; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::{CachedEpochIndexFeeVersions, Revision}; +use dpp::prelude::Revision; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { /// Updates the revision for a specific identity. This function is version controlled. diff --git a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs index b06141634a..ab3e5552d6 100644 --- a/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/update/methods/update_identity_revision/v0/mod.rs @@ -8,12 +8,13 @@ use grovedb::batch::KeyInfoPath; use dpp::fee::fee_result::FeeResult; -use dpp::prelude::{CachedEpochIndexFeeVersions, Revision}; +use dpp::prelude::Revision; use dpp::version::PlatformVersion; use grovedb::{EstimatedLayerInformation, TransactionArg}; use std::collections::HashMap; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; impl Drive { //todo: this should probably not exist diff --git a/packages/rs-drive/src/fee/op.rs b/packages/rs-drive/src/fee/op.rs index 0896cb4f0d..abefc105c6 100644 --- a/packages/rs-drive/src/fee/op.rs +++ b/packages/rs-drive/src/fee/op.rs @@ -25,7 +25,7 @@ use dpp::block::epoch::Epoch; use dpp::fee::fee_result::refunds::FeeRefunds; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; -use dpp::prelude::CachedEpochIndexFeeVersions; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use platform_version::version::fee::FeeVersion; /// Base ops diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index ba43a47379..88b0dc183d 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -69,11 +69,10 @@ use dpp::document::serialization_traits::{ use dpp::document::{DocumentV0Getters, DocumentV0Setters}; use dpp::identity::TimestampMillis; use dpp::platform_value; -use dpp::prelude::CachedEpochIndexFeeVersions; #[cfg(feature = "server")] use dpp::prelude::DataContract; use once_cell::sync::Lazy; - +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::tests::json_document::json_document_to_contract; #[cfg(feature = "server")] use dpp::util::cbor_serializer; diff --git a/packages/rs-drive/tests/query_tests_history.rs b/packages/rs-drive/tests/query_tests_history.rs index 6efdc20f04..3747237028 100644 --- a/packages/rs-drive/tests/query_tests_history.rs +++ b/packages/rs-drive/tests/query_tests_history.rs @@ -83,7 +83,7 @@ use dpp::document::serialization_traits::{ DocumentCborMethodsV0, DocumentPlatformConversionMethodsV0, }; use dpp::document::DocumentV0Getters; -use dpp::prelude::CachedEpochIndexFeeVersions; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::tests::json_document::json_document_to_contract; use dpp::version::PlatformVersion; use drive::drive::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 5470c990a6..9b8c66d48b 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" [dependencies] thiserror = { version = "1.0.59" } -bincode = { version = "2.0.0-rc.3", features = ["serde"] } +bincode = { version = "2.0.0-rc.3"} versioned-feature-core = { git = "https://github.com/dashpay/versioned-feature-core", version = "1.0.0" } grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "8ada131a1079c763e83d2b11ab1f6abbd5d82e06"} diff --git a/packages/rs-platform-version/src/version/fee/data_contract/mod.rs b/packages/rs-platform-version/src/version/fee/data_contract/mod.rs index 548deb929f..88894894f5 100644 --- a/packages/rs-platform-version/src/version/fee/data_contract/mod.rs +++ b/packages/rs-platform-version/src/version/fee/data_contract/mod.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct FeeDataContractValidationVersion { pub document_type_base_fee: u64, pub document_type_size_fee: u64, @@ -13,21 +13,6 @@ pub struct FeeDataContractValidationVersion { pub document_type_unique_index_per_property_fee: u64, } -impl PartialEq for FeeDataContractValidationVersion { - fn eq(&self, other: &Self) -> bool { - self.document_type_base_fee == other.document_type_base_fee - && self.document_type_size_fee == other.document_type_size_fee - && self.document_type_per_property_fee == other.document_type_per_property_fee - && self.document_type_base_non_unique_index_fee - == other.document_type_base_non_unique_index_fee - && self.document_type_non_unique_index_per_property_fee - == other.document_type_non_unique_index_per_property_fee - && self.document_type_base_unique_index_fee == other.document_type_base_unique_index_fee - && self.document_type_unique_index_per_property_fee - == other.document_type_unique_index_per_property_fee - } -} - #[cfg(test)] mod tests { use super::FeeDataContractValidationVersion; diff --git a/packages/rs-platform-version/src/version/fee/hashing/mod.rs b/packages/rs-platform-version/src/version/fee/hashing/mod.rs index a5ec109ef8..2d40315601 100644 --- a/packages/rs-platform-version/src/version/fee/hashing/mod.rs +++ b/packages/rs-platform-version/src/version/fee/hashing/mod.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct FeeHashingVersion { pub blake3_base: u64, pub blake3_per_block: u64, @@ -10,15 +10,6 @@ pub struct FeeHashingVersion { pub sha256_ripe_md160_base: u64, pub single_sha256_base: u64, } -impl PartialEq for FeeHashingVersion { - fn eq(&self, other: &Self) -> bool { - self.blake3_base == other.blake3_base - && self.blake3_per_block == other.blake3_per_block - && self.sha256_per_block == other.sha256_per_block - && self.sha256_ripe_md160_base == other.sha256_ripe_md160_base - && self.single_sha256_base == other.single_sha256_base - } -} #[cfg(test)] mod tests { diff --git a/packages/rs-platform-version/src/version/fee/mod.rs b/packages/rs-platform-version/src/version/fee/mod.rs index a86fb2fe95..509699b4a7 100644 --- a/packages/rs-platform-version/src/version/fee/mod.rs +++ b/packages/rs-platform-version/src/version/fee/mod.rs @@ -16,7 +16,7 @@ pub mod storage; pub mod v1; pub mod vote_resolution_fund_fees; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct FeeVersion { pub storage: FeeStorageVersion, pub signature: FeeSignatureVersion, @@ -27,17 +27,6 @@ pub struct FeeVersion { pub vote_resolution_fund_fees: VoteResolutionFundFees, } -impl PartialEq for FeeVersion { - fn eq(&self, other: &Self) -> bool { - self.storage == other.storage - && self.signature == other.signature - && self.hashing == other.hashing - && self.processing == other.processing - && self.data_contract == other.data_contract - && self.state_transition_min_fees == other.state_transition_min_fees - } -} - #[cfg(test)] mod tests { diff --git a/packages/rs-platform-version/src/version/fee/processing/mod.rs b/packages/rs-platform-version/src/version/fee/processing/mod.rs index f08d888ea0..0427cd0916 100644 --- a/packages/rs-platform-version/src/version/fee/processing/mod.rs +++ b/packages/rs-platform-version/src/version/fee/processing/mod.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct FeeProcessingVersion { pub fetch_identity_balance_processing_cost: u64, pub fetch_identity_revision_processing_cost: u64, @@ -13,21 +13,6 @@ pub struct FeeProcessingVersion { pub validate_key_structure: u64, } -impl PartialEq for FeeProcessingVersion { - fn eq(&self, other: &Self) -> bool { - self.fetch_identity_balance_processing_cost == other.fetch_identity_balance_processing_cost - && self.fetch_identity_revision_processing_cost - == other.fetch_identity_revision_processing_cost - && self.fetch_identity_balance_and_revision_processing_cost - == other.fetch_identity_balance_and_revision_processing_cost - && self.fetch_identity_cost_per_look_up_key_by_id - == other.fetch_identity_cost_per_look_up_key_by_id - && self.fetch_single_identity_key_processing_cost - == other.fetch_single_identity_key_processing_cost - && self.validate_key_structure == other.validate_key_structure - } -} - #[cfg(test)] mod tests { use super::FeeProcessingVersion; diff --git a/packages/rs-platform-version/src/version/fee/signature/mod.rs b/packages/rs-platform-version/src/version/fee/signature/mod.rs index 06a872dad0..6a667bd574 100644 --- a/packages/rs-platform-version/src/version/fee/signature/mod.rs +++ b/packages/rs-platform-version/src/version/fee/signature/mod.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct FeeSignatureVersion { pub verify_signature_ecdsa_secp256k1: u64, pub verify_signature_bls12_381: u64, @@ -11,16 +11,6 @@ pub struct FeeSignatureVersion { pub verify_signature_eddsa25519_hash160: u64, } -impl PartialEq for FeeSignatureVersion { - fn eq(&self, other: &Self) -> bool { - self.verify_signature_ecdsa_secp256k1 == other.verify_signature_ecdsa_secp256k1 - && self.verify_signature_bls12_381 == other.verify_signature_bls12_381 - && self.verify_signature_ecdsa_hash160 == other.verify_signature_ecdsa_hash160 - && self.verify_signature_bip13_script_hash == other.verify_signature_bip13_script_hash - && self.verify_signature_eddsa25519_hash160 == other.verify_signature_eddsa25519_hash160 - } -} - #[cfg(test)] mod tests { use super::FeeSignatureVersion; diff --git a/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs b/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs index ee8a16a2b0..2b099d7143 100644 --- a/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs +++ b/packages/rs-platform-version/src/version/fee/state_transition_min_fees/mod.rs @@ -1,7 +1,7 @@ use bincode::{Decode, Encode}; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct StateTransitionMinFees { pub credit_transfer: u64, pub credit_withdrawal: u64, @@ -12,17 +12,6 @@ pub struct StateTransitionMinFees { pub masternode_vote: u64, } -impl PartialEq for StateTransitionMinFees { - fn eq(&self, other: &Self) -> bool { - self.credit_transfer == other.credit_transfer - && self.credit_withdrawal == other.credit_withdrawal - && self.identity_update == other.identity_update - && self.document_batch_sub_transition == other.document_batch_sub_transition - && self.contract_create == other.contract_create - && self.contract_update == other.contract_update - } -} - #[cfg(test)] mod tests { use super::StateTransitionMinFees; diff --git a/packages/rs-platform-version/src/version/fee/storage/mod.rs b/packages/rs-platform-version/src/version/fee/storage/mod.rs index 5ba6a1cc90..f6121321ba 100644 --- a/packages/rs-platform-version/src/version/fee/storage/mod.rs +++ b/packages/rs-platform-version/src/version/fee/storage/mod.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct FeeStorageVersion { pub storage_disk_usage_credit_per_byte: u64, pub storage_processing_credit_per_byte: u64, @@ -11,16 +11,6 @@ pub struct FeeStorageVersion { pub storage_seek_cost: u64, } -impl PartialEq for FeeStorageVersion { - fn eq(&self, other: &Self) -> bool { - self.storage_disk_usage_credit_per_byte == other.storage_disk_usage_credit_per_byte - && self.storage_processing_credit_per_byte == other.storage_processing_credit_per_byte - && self.storage_load_credit_per_byte == other.storage_load_credit_per_byte - && self.non_storage_load_credit_per_byte == other.non_storage_load_credit_per_byte - && self.storage_seek_cost == other.storage_seek_cost - } -} - #[cfg(test)] mod tests { use super::FeeStorageVersion; diff --git a/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs b/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs index 0aff7208f9..c363855f8d 100644 --- a/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs +++ b/packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs @@ -2,7 +2,7 @@ use bincode::{Decode, Encode}; use crate::version::fee::storage::FeeStorageVersion; pub mod v1; -#[derive(Clone, Debug, Encode, Decode, Default)] +#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)] pub struct VoteResolutionFundFees { /// This is the amount that will be deducted from an identity and used to pay for voting pub contested_document_vote_resolution_fund_required_amount: u64, @@ -12,14 +12,6 @@ pub struct VoteResolutionFundFees { pub contested_document_single_vote_cost: u64, } -impl PartialEq for VoteResolutionFundFees { - fn eq(&self, other: &Self) -> bool { - self.contested_document_vote_resolution_fund_required_amount == other.contested_document_vote_resolution_fund_required_amount - && self.contested_document_vote_resolution_unlock_fund_required_amount == other.contested_document_vote_resolution_unlock_fund_required_amount - && self.contested_document_single_vote_cost == other.contested_document_single_vote_cost - } -} - #[cfg(test)] mod tests { use super::VoteResolutionFundFees;