diff --git a/packages/rs-dpp/src/fee/default_costs/mod.rs b/packages/rs-dpp/src/fee/default_costs/mod.rs index 6875935e23..5a7ff91abc 100644 --- a/packages/rs-dpp/src/fee/default_costs/mod.rs +++ b/packages/rs-dpp/src/fee/default_costs/mod.rs @@ -32,11 +32,11 @@ //! Fee costs for Known Platform operations //! -use std::collections::BTreeMap; use crate::block::epoch::{Epoch, EpochIndex}; use crate::fee::Credits; use platform_version::version::fee::FeeVersion; use platform_version::version::PlatformVersion; +use std::collections::BTreeMap; pub mod constants; @@ -104,10 +104,12 @@ impl KnownCostItem { .fetch_single_identity_key_processing_cost } KnownCostItem::Blake3 => { - fee_version.hashing.blake3_base + fee_version.hashing.blake3_per_block * size.unwrap_or(0) as u64 + fee_version.hashing.blake3_base + + fee_version.hashing.blake3_per_block * size.unwrap_or(0) as u64 } KnownCostItem::SingleSHA256 => { - fee_version.hashing.single_sha256_base + fee_version.hashing.sha256_per_block * size.unwrap_or(0) as u64 + fee_version.hashing.single_sha256_base + + fee_version.hashing.sha256_per_block * size.unwrap_or(0) as u64 } KnownCostItem::VerifySignatureEcdsaSecp256k1 => { fee_version.signature.verify_signature_ecdsa_secp256k1 diff --git a/packages/rs-dpp/src/fee/fee_result/refunds.rs b/packages/rs-dpp/src/fee/fee_result/refunds.rs index b4e3ab5048..7a24ced289 100644 --- a/packages/rs-dpp/src/fee/fee_result/refunds.rs +++ b/packages/rs-dpp/src/fee/fee_result/refunds.rs @@ -4,8 +4,8 @@ //! use crate::block::epoch::{Epoch, EpochIndex}; -use crate::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use crate::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; +use crate::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use crate::fee::epoch::distribution::calculate_storage_fee_refund_amount_and_leftovers; use crate::fee::epoch::{BytesPerEpoch, CreditsPerEpoch}; use crate::fee::Credits; diff --git a/packages/rs-dpp/src/lib.rs b/packages/rs-dpp/src/lib.rs index 58ff59ff40..e0318774ce 100644 --- a/packages/rs-dpp/src/lib.rs +++ b/packages/rs-dpp/src/lib.rs @@ -57,7 +57,7 @@ pub use async_trait; pub use bls::*; pub mod prelude { - use crate::block::epoch::EpochIndex; + pub use crate::data_contract::DataContract; #[cfg(feature = "extended-document")] pub use crate::document::ExtendedDocument; 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 6ebd3054ed..67330b5539 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,16 +14,16 @@ 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::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, }; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use dpp::util::hash::hash_single; +use dpp::validation::ConsensusValidationResult; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; +use std::time::Instant; #[derive(Debug)] struct StateTransitionAwareError<'t> { 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 ec5d8c197e..942d632f58 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::fee::default_costs::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 51af1c4d57..555bcbe96f 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::fee::default_costs::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-proof-verifier/src/proof.rs b/packages/rs-drive-proof-verifier/src/proof.rs index 21574a6e2e..63d76226da 100644 --- a/packages/rs-drive-proof-verifier/src/proof.rs +++ b/packages/rs-drive-proof-verifier/src/proof.rs @@ -2,6 +2,8 @@ use crate::from_request::TryFromRequest; use crate::provider::DataContractProvider; use crate::{types, types::*, ContextProvider, Error}; use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; +use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; +use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; use dapi_grpc::platform::v0::get_protocol_version_upgrade_vote_status_request::{ self, GetProtocolVersionUpgradeVoteStatusRequestV0, @@ -24,13 +26,17 @@ use dapi_grpc::platform::{ VersionedGrpcResponse, }; use dpp::block::block_info::BlockInfo; +use dpp::block::block_info::BlockInfo; use dpp::block::epoch::{EpochIndex, MAX_EPOCH}; use dpp::block::extended_epoch_info::ExtendedEpochInfo; use dpp::dashcore::hashes::Hash; use dpp::dashcore::ProTxHash; use dpp::document::{Document, DocumentV0Getters}; use dpp::identity::identities_contract_keys::IdentitiesContractKeys; +use dpp::identity::identities_contract_keys::IdentitiesContractKeys; +use dpp::identity::Purpose; use dpp::identity::Purpose; +use dpp::platform_value; use dpp::platform_value::{self}; use dpp::prelude::{DataContract, Identifier, Identity}; use dpp::serialization::PlatformDeserializable; @@ -41,12 +47,6 @@ use dpp::voting::votes::Vote; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyKindRequestType, KeyRequestType, PurposeU8, SecurityLevelU8, }; -use dapi_grpc::platform::v0::get_identities_contract_keys_request::GetIdentitiesContractKeysRequestV0; -use dapi_grpc::platform::v0::get_path_elements_request::GetPathElementsRequestV0; -use dpp::block::block_info::BlockInfo; -use dpp::identity::identities_contract_keys::IdentitiesContractKeys; -use dpp::identity::Purpose; -use dpp::platform_value; use drive::drive::Drive; use drive::error::proof::ProofError; use drive::query::contested_resource_votes_given_by_identity_query::ContestedResourceVotesGivenByIdentityQuery; 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 8c9c7cea30..c4a00b0457 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 @@ -7,9 +7,9 @@ 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 grovedb::TransactionArg; 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 9d2b2977cf..acf9ebf3cb 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 std::collections::HashMap; use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use std::collections::HashMap; 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 135fa3a6fb..7f39ab6bf8 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::fee::default_costs::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 9a9d780e44..017a3d7993 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::fee::default_costs::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/document/delete/delete_document_for_contract/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract/mod.rs index 7ca62bbd4d..9aa5ecc8a6 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 @@ -10,9 +10,9 @@ use dpp::fee::fee_result::FeeResult; use dpp::version::PlatformVersion; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::identifier::Identifier; 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 85dc0d4c7b..d15faeebb2 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 @@ -5,12 +5,12 @@ use dpp::block::block_info::BlockInfo; use dpp::data_contract::DataContract; use dpp::fee::fee_result::FeeResult; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::identifier::Identifier; 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 42093efd90..7d13b03033 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 @@ -2,9 +2,9 @@ mod v0; use grovedb::TransactionArg; +use crate::drive::Drive; use dpp::block::block_info::BlockInfo; use dpp::fee::default_costs::CachedEpochIndexFeeVersions; -use crate::drive::Drive; use crate::error::drive::DriveError; 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 0dc596f3bc..08e82357de 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 @@ -4,10 +4,10 @@ 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; +use dpp::block::block_info::BlockInfo; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use crate::error::Error; use crate::fee::op::LowLevelDriveOperation; diff --git a/packages/rs-drive/src/drive/document/delete/mod.rs b/packages/rs-drive/src/drive/document/delete/mod.rs index 0fc54c52b2..a270a6d462 100644 --- a/packages/rs-drive/src/drive/document/delete/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/mod.rs @@ -71,8 +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::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::tests::json_document::{json_document_to_contract, json_document_to_document}; use crate::tests::helpers::setup::setup_drive_with_initial_state_structure; @@ -829,7 +829,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); // We added 1559 bytes assert_eq!(added_bytes, 1559); @@ -867,7 +867,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); assert!(added_bytes > refund_equivalent_bytes); @@ -931,7 +931,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); // We added 1558 bytes assert_eq!(added_bytes, 1559); 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 920c97615d..f589456b3e 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::fee::default_costs::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 a3659aacfb..e1c52bf315 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::fee::default_costs::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 20bf9edf20..ac60dd9b84 100644 --- a/packages/rs-drive/src/drive/document/insert/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/mod.rs @@ -91,8 +91,8 @@ 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::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::fee_result::FeeResult; use dpp::tests::json_document::json_document_to_document; use dpp::version::PlatformVersion; @@ -475,7 +475,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); assert_eq!(1305, added_bytes); assert_eq!(144859600, processing_fee); // TODO: Readjust this test when FeeHashingVersion blake3_base, sha256_ripe_md160_base, blake3_per_block values are finalised diff --git a/packages/rs-drive/src/drive/document/update/mod.rs b/packages/rs-drive/src/drive/document/update/mod.rs index acada22ccc..37850288ba 100644 --- a/packages/rs-drive/src/drive/document/update/mod.rs +++ b/packages/rs-drive/src/drive/document/update/mod.rs @@ -89,8 +89,8 @@ mod tests { }; use dpp::document::specialized_document_factory::SpecializedDocumentFactory; use dpp::document::{Document, DocumentV0Getters, DocumentV0Setters}; - use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::default_costs::KnownCostItem::StorageDiskUsageCreditPerByte; + use dpp::fee::default_costs::{CachedEpochIndexFeeVersions, EpochCosts}; use dpp::fee::fee_result::FeeResult; use dpp::platform_value; use dpp::tests::json_document::json_document_to_document; @@ -941,7 +941,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); let expected_added_bytes = if using_history { //Explanation for 1237 @@ -1110,7 +1110,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); assert!(expected_added_bytes > refund_equivalent_bytes); @@ -1131,7 +1131,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); assert_eq!(original_bytes, expected_added_bytes); @@ -1153,7 +1153,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); let expected_added_bytes = if using_history { 313 } else { 1 }; @@ -1226,7 +1226,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); let expected_added_bytes = if using_history { 1238 } else { 962 }; assert_eq!(original_bytes, expected_added_bytes); @@ -1253,7 +1253,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); assert!(expected_added_bytes > refund_equivalent_bytes); @@ -1274,7 +1274,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); assert_eq!(original_bytes, expected_added_bytes); @@ -1296,7 +1296,7 @@ mod tests { / Epoch::new(0).unwrap().cost_for_known_cost_item( &EPOCH_CHANGE_FEE_VERSION_TEST, StorageDiskUsageCreditPerByte, - None + None, ); let removed_credits = update_fees 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 f0d16e627a..e8d8810c74 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::fee::default_costs::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 ec3cc6c052..1e1389151a 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 @@ -8,13 +8,13 @@ use dpp::block::block_info::BlockInfo; use dpp::data_contract::document_type::DocumentTypeRef; use dpp::data_contract::DataContract; use dpp::document::Document; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; 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 e9b3603e3a..93a9141560 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::fee::default_costs::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 1c23467cf0..3467dab072 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 @@ -10,13 +10,13 @@ use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::document::serialization_traits::DocumentPlatformConversionMethodsV0; use dpp::document::Document; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; 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 85366ddd45..b531cb2beb 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::fee::default_costs::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 83167354e8..55b9bb1894 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::fee::default_costs::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 2981970c6d..cd4cb51657 100644 --- a/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs +++ b/packages/rs-drive/src/drive/fee/calculate_fee/mod.rs @@ -3,10 +3,10 @@ use crate::error::drive::DriveError; use crate::error::Error; use crate::fee::op::{BaseOp, LowLevelDriveOperation}; use dpp::block::epoch::Epoch; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::FeeResult; 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 f36970380c..508729fcfe 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 enum_map::EnumMap; use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use enum_map::EnumMap; use platform_version::version::fee::FeeVersion; impl Drive { 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 bd642a7e00..5c551a2741 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::fee::default_costs::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 76cf34f9ca..9740837f1d 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::fee::default_costs::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 86bd6d16c0..200fb75735 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 @@ -13,8 +13,8 @@ use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use std::collections::HashMap; 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 ab3e5552d6..1427d07d25 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 @@ -13,8 +13,8 @@ use dpp::prelude::Revision; use dpp::version::PlatformVersion; use grovedb::{EstimatedLayerInformation, TransactionArg}; -use std::collections::HashMap; use dpp::fee::default_costs::CachedEpochIndexFeeVersions; +use std::collections::HashMap; 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 abefc105c6..a90ffe7192 100644 --- a/packages/rs-drive/src/fee/op.rs +++ b/packages/rs-drive/src/fee/op.rs @@ -22,10 +22,10 @@ use crate::fee::op::LowLevelDriveOperation::{ CalculatedCostOperation, FunctionOperation, GroveOperation, PreCalculatedFeeResult, }; use dpp::block::epoch::Epoch; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::fee::fee_result::refunds::FeeRefunds; use dpp::fee::fee_result::FeeResult; use dpp::fee::Credits; -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 88b0dc183d..5fd6be2396 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -67,15 +67,15 @@ use dpp::document::serialization_traits::{ DocumentCborMethodsV0, DocumentPlatformConversionMethodsV0, DocumentPlatformValueMethodsV0, }; use dpp::document::{DocumentV0Getters, DocumentV0Setters}; +use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::identity::TimestampMillis; use dpp::platform_value; #[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; +use once_cell::sync::Lazy; use dpp::version::PlatformVersion; diff --git a/packages/rs-platform-version/src/version/fee/mod.rs b/packages/rs-platform-version/src/version/fee/mod.rs index 509699b4a7..aa83c46416 100644 --- a/packages/rs-platform-version/src/version/fee/mod.rs +++ b/packages/rs-platform-version/src/version/fee/mod.rs @@ -4,8 +4,8 @@ use crate::version::fee::processing::FeeProcessingVersion; use crate::version::fee::signature::FeeSignatureVersion; use crate::version::fee::state_transition_min_fees::StateTransitionMinFees; use crate::version::fee::storage::FeeStorageVersion; -use bincode::{Decode, Encode}; use crate::version::fee::vote_resolution_fund_fees::VoteResolutionFundFees; +use bincode::{Decode, Encode}; mod data_contract; mod hashing; @@ -27,9 +27,9 @@ pub struct FeeVersion { pub vote_resolution_fund_fees: VoteResolutionFundFees, } - #[cfg(test)] mod tests { + use super::FeeVersion; use crate::version::fee::data_contract::FeeDataContractValidationVersion; use crate::version::fee::hashing::FeeHashingVersion; use crate::version::fee::processing::FeeProcessingVersion; @@ -37,7 +37,6 @@ mod tests { use crate::version::fee::state_transition_min_fees::StateTransitionMinFees; use crate::version::fee::storage::FeeStorageVersion; use crate::version::fee::vote_resolution_fund_fees::VoteResolutionFundFees; - use super::FeeVersion; #[test] // If this test failed, then a new field was added in FeeVersion. And the corresponding eq needs to be updated as well @@ -64,7 +63,7 @@ mod tests { sha256_per_block: 4, blake3_per_block: 5, }, - processing:FeeProcessingVersion { + processing: FeeProcessingVersion { fetch_identity_balance_processing_cost: 1, fetch_identity_revision_processing_cost: 2, fetch_identity_balance_and_revision_processing_cost: 3, @@ -120,7 +119,7 @@ mod tests { sha256_per_block: 4, blake3_per_block: 5, }, - processing:FeeProcessingVersion { + processing: FeeProcessingVersion { fetch_identity_balance_processing_cost: 1, fetch_identity_revision_processing_cost: 2, fetch_identity_balance_and_revision_processing_cost: 3, @@ -158,4 +157,3 @@ mod tests { assert_eq!(version1, version2, "FeeVersion equality test failed. If a field was added or removed, update the Eq implementation."); } } - 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 c363855f8d..ba594961d4 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 @@ -1,5 +1,4 @@ use bincode::{Decode, Encode}; -use crate::version::fee::storage::FeeStorageVersion; pub mod v1; #[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)]