diff --git a/Cargo.lock b/Cargo.lock index e3ec8a698e1..c5f11ebd4ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2141,8 +2141,7 @@ dependencies = [ [[package]] name = "grovedb" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d91e8f87926c834c7338d0c69a48816c043e0cddf0062a8a567483db2fb1e24" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "axum", "bincode", @@ -2176,8 +2175,7 @@ dependencies = [ [[package]] name = "grovedb-costs" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360f7c8d3b20beafcbf3cde8754bbcfd201ae2a30ec7594a4b9678fd2fa3c7a8" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "integer-encoding", "intmap", @@ -2187,8 +2185,7 @@ dependencies = [ [[package]] name = "grovedb-epoch-based-storage-flags" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acec1b6962d99d7b079c0fd1532cd3a2c83a3d659ffd9fcf02edda4599334bb4" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "grovedb-costs", "hex", @@ -2200,8 +2197,7 @@ dependencies = [ [[package]] name = "grovedb-merk" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72057865f239fdd24f92eaa8668acc0d618da168f330546577a62eda1701210e" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "bincode", "blake3", @@ -2226,14 +2222,12 @@ dependencies = [ [[package]] name = "grovedb-path" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d96cc6106e5ca88e548d66f130b877b664da78be226dfdba555fc210f8508f4" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" [[package]] name = "grovedb-storage" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c9b59bc9fa7123b8485f87f88a886dd109e7aff5f34a29a3812cb64eb897ff" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "blake3", "grovedb-costs", @@ -2252,8 +2246,7 @@ dependencies = [ [[package]] name = "grovedb-version" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4be0c1a1ef97068fe93212e7b6f349e0b44a9fc90063c8c28e110cfb8c2fcb2" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "thiserror", "versioned-feature-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2262,8 +2255,7 @@ dependencies = [ [[package]] name = "grovedb-visualize" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5865f4335eb99644512a7d80d6b1698ba1099a8268fdfd3ffb1a3a32dcb4af28" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "hex", "itertools 0.12.1", @@ -2272,8 +2264,7 @@ dependencies = [ [[package]] name = "grovedbg-types" version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921b9a29facf9d3f0de667cd1da083a34695ede9e7bfacd74bb5bd29f8f7c178" +source = "git+https://github.com/dashpay/grovedb?rev=2417f7a72900cd3dca943ad52c979bc8abfdaa20#2417f7a72900cd3dca943ad52c979bc8abfdaa20" dependencies = [ "serde", "serde_with 3.9.0", 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 1050a4c2285..69b497eeeae 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 @@ -88,6 +88,7 @@ mod tests { false, false, false, + false, &mut vec![], PlatformVersion::latest(), ); diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/methods/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/methods/mod.rs index 8decb15b361..f690b7edc2e 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/methods/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/methods/mod.rs @@ -738,6 +738,7 @@ impl DocumentsBatchTransitionMethodsV1 for BatchTransition { } } + #[cfg(feature = "state-transition-signing")] fn new_token_destroy_frozen_funds_transition( token_id: Identifier, owner_id: Identifier, @@ -798,6 +799,7 @@ impl DocumentsBatchTransitionMethodsV1 for BatchTransition { } } + #[cfg(feature = "state-transition-signing")] fn new_token_emergency_action_transition( token_id: Identifier, owner_id: Identifier, diff --git a/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/v1/v0_methods.rs b/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/v1/v0_methods.rs index d9d266fe10d..b1e12f82f6f 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/v1/v0_methods.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/v1/v0_methods.rs @@ -749,6 +749,7 @@ impl DocumentsBatchTransitionMethodsV1 for BatchTransitionV1 { Ok(state_transition) } + #[cfg(feature = "state-transition-signing")] fn new_token_destroy_frozen_funds_transition( token_id: Identifier, owner_id: Identifier, @@ -820,6 +821,7 @@ impl DocumentsBatchTransitionMethodsV1 for BatchTransitionV1 { Ok(state_transition) } + #[cfg(feature = "state-transition-signing")] fn new_token_emergency_action_transition( token_id: Identifier, owner_id: Identifier, diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/cleanup_expired_locks_of_withdrawal_amounts/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/cleanup_expired_locks_of_withdrawal_amounts/v0/mod.rs index 74315a1d6c7..0c4ab33a051 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/cleanup_expired_locks_of_withdrawal_amounts/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/cleanup_expired_locks_of_withdrawal_amounts/v0/mod.rs @@ -6,7 +6,7 @@ use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; use drive::drive::identity::withdrawals::paths::get_withdrawal_transactions_sum_tree_path_vec; -use drive::grovedb::{PathQuery, QueryItem, Transaction}; +use drive::grovedb::{MaybeTree, PathQuery, QueryItem, Transaction}; use drive::util::grove_operations::BatchDeleteApplyType; impl Platform @@ -49,7 +49,7 @@ where true, // we know that we are not deleting a subtree BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, Some(transaction), &mut batch_operations, diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index 9dbbd3a1ed8..9a4dc5ae8c4 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -1427,7 +1427,7 @@ impl NetworkStrategy { contract, token_id, token_pos, - action: TokenEvent::Mint(amount, note), + action: TokenEvent::Mint(amount, recipient, note), }) if current_identities.len() > 1 => { let random_index = rng.gen_range(0..current_identities.len()); let random_identity_id = current_identities[random_index].id(); 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 d253aef1462..4c5aae85f02 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/token_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/token_tests.rs @@ -79,7 +79,7 @@ mod tests { contract: contract.clone(), token_id, token_pos: 0, - action: TokenEvent::Mint(1000, None), + action: TokenEvent::Mint(1000, identity2.id(), None), }; let strategy = NetworkStrategy { @@ -206,7 +206,7 @@ mod tests { contract: contract.clone(), token_id, token_pos: 0, - action: TokenEvent::Mint(1000, None), + action: TokenEvent::Mint(1000, identity2.id(), None), }; let strategy = NetworkStrategy { diff --git a/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs b/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs index 007b1b5e930..49ee1e5c22f 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/verify_state_transitions.rs @@ -15,9 +15,7 @@ use dpp::version::PlatformVersion; use drive::drive::identity::key::fetch::IdentityKeysRequest; use drive::drive::Drive; use drive::query::{SingleDocumentDriveQuery, SingleDocumentDriveQueryContestedStatus}; -use drive::state_transition_action::batch::batched_transition::document_transition::{ - BatchedTransitionAction, DocumentTransitionAction, -}; +use drive::state_transition_action::batch::batched_transition::document_transition::DocumentTransitionAction; use drive::state_transition_action::StateTransitionAction; use drive_abci::execution::validation::state_transition::transformer::StateTransitionActionTransformerV0; use drive_abci::platform_types::platform::PlatformRef; @@ -29,6 +27,7 @@ use dpp::voting::votes::Vote; use drive::drive::votes::resolved::vote_polls::ResolvedVotePoll; use drive::drive::votes::resolved::votes::resolved_resource_vote::accessors::v0::ResolvedResourceVoteGettersV0; use drive::drive::votes::resolved::votes::ResolvedVote; +use drive::state_transition_action::batch::batched_transition::BatchedTransitionAction; use drive::state_transition_action::batch::batched_transition::document_transition::document_base_transition_action::DocumentBaseTransitionActionAccessorsV0; use drive::state_transition_action::batch::batched_transition::document_transition::document_create_transition_action::{DocumentCreateTransitionActionAccessorsV0, DocumentFromCreateTransitionAction}; use drive::state_transition_action::batch::batched_transition::document_transition::document_purchase_transition_action::DocumentPurchaseTransitionActionAccessorsV0; diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 50a337f27ae..cd76d01dce3 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -52,12 +52,12 @@ enum-map = { version = "2.0.3", optional = true } intmap = { version = "2.0.0", features = ["serde"], optional = true } chrono = { version = "0.4.35", optional = true } itertools = { version = "0.13", optional = true } -grovedb = { version = "2.1.0", optional = true, default-features = false } -grovedb-costs = { version = "2.1.0", optional = true } -grovedb-path = { version = "2.1.0" } -grovedb-storage = { version = "2.1.0", optional = true } -grovedb-version = { version = "2.1.0" } -grovedb-epoch-based-storage-flags = { version = "2.1.0" } +grovedb = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20", optional = true, default-features = false } +grovedb-costs = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20", optional = true } +grovedb-path = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20" } +grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20", optional = true } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20" } +grovedb-epoch-based-storage-flags = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20" } [dev-dependencies] criterion = "0.5" diff --git a/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs index 1110b448445..3973d252e8d 100644 --- a/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::asset_lock::asset_lock_storage_path; use grovedb::EstimatedSumTrees::SomeSumTrees; @@ -61,7 +61,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 12, // 32 + 1 + 1 / 3 @@ -77,7 +77,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(asset_lock_storage_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( 36, //The size of an outpoint diff --git a/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs index eb929eda17f..c85e0dc84d3 100644 --- a/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/fetch_asset_lock_outpoint_info/v0/mod.rs @@ -13,7 +13,7 @@ use dpp::asset_lock::reduced_asset_lock_value::AssetLockValue; use dpp::asset_lock::StoredAssetLockInfo; use dpp::platform_value::Bytes36; use dpp::serialization::PlatformDeserializable; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Checks if a given `outpoint` is present as an asset lock in the transaction. @@ -68,7 +68,7 @@ impl Drive { StatefulDirectQuery } else { StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(36), } }; diff --git a/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs b/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs index a7b41957bfc..8a7289995e2 100644 --- a/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/apply/apply_contract_with_serialization/v0/mod.rs @@ -18,7 +18,7 @@ use dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersion use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::borrow::Cow; use std::collections::HashMap; @@ -99,7 +99,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, // we can ignore flags as this is just an approximation // and it's doubtful that contracts will always be inserted at max size query_target: QueryTargetValue( diff --git a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs index ba04d65bc61..c1acab18020 100644 --- a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs @@ -16,9 +16,9 @@ use crate::util::type_constants::{DEFAULT_FLOAT_SIZE, DEFAULT_FLOAT_SIZE_U8}; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -61,7 +61,7 @@ impl Drive { ), ), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -80,7 +80,7 @@ impl Drive { document_type_name.as_str(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(0, true), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -103,7 +103,7 @@ impl Drive { contract.id_ref().as_bytes(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(AVERAGE_NUMBER_OF_UPDATES as u32), estimated_layer_sizes: Mix { subtrees_size: None, diff --git a/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs b/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs index 8844fe39bcc..837d1fcbcc9 100644 --- a/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/add_contract_to_storage/v0/mod.rs @@ -19,7 +19,7 @@ use dpp::version::drive_versions::DriveVersion; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::KeyInfoPath; use grovedb::reference_path::ReferencePathType::SiblingReference; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -64,8 +64,8 @@ impl Drive { } else { let apply_type = if estimated_costs_only_with_layer_info.is_some() { BatchInsertTreeApplyType::StatelessBatchInsertTree { - is_sum_tree: false, - in_tree_using_sums: false, + tree_type: TreeType::NormalTree, + in_tree_type: TreeType::NormalTree, flags_len: storage_flags .as_ref() .map(|flags| flags.to_element_flags().len()) 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 ddec35b2bae..22ce029f82c 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 @@ -19,7 +19,7 @@ use dpp::serialization::PlatformSerializableWithPlatformVersion; use dpp::fee::default_costs::CachedEpochIndexFeeVersions; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::{HashMap, HashSet}; impl Drive { @@ -300,8 +300,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: element_flags .as_ref() .map(|e| e.len() as u32) diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs b/packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs index 81248a8e5a6..ebc0d9ed5ae 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/operations_factory.rs @@ -20,7 +20,7 @@ use dpp::fee::Credits; use dpp::util::deserializer::ProtocolVersion; use dpp::version::PlatformVersion; use grovedb::batch::QualifiedGroveDbOp; -use grovedb::{Element, TransactionArg}; +use grovedb::{Element, TransactionArg, TreeType}; /// Operations on Epochs pub trait EpochOperations { @@ -288,7 +288,11 @@ impl EpochOperations for Epoch { /// Returns a groveDB op which deletes the epoch proposers tree. fn delete_proposers_tree_operation(&self) -> QualifiedGroveDbOp { - QualifiedGroveDbOp::delete_tree_op(self.get_path_vec(), KEY_PROPOSERS.to_vec(), false) + QualifiedGroveDbOp::delete_tree_op( + self.get_path_vec(), + KEY_PROPOSERS.to_vec(), + TreeType::NormalTree, + ) } /// Adds a groveDB op to the batch which deletes the given epoch proposers from the proposers tree. diff --git a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs index cec20f624ae..3f13cfcc6bb 100644 --- a/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/delete_document_for_contract_operations/v0/mod.rs @@ -1,6 +1,6 @@ use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use dpp::data_contract::document_type::DocumentTypeRef; @@ -83,7 +83,7 @@ impl Drive { &platform_version.drive, )?; DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue( document_type.estimated_size(platform_version)? as u32 ), diff --git a/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs index 2f2863cd4ac..ce3ca4d6e5b 100644 --- a/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs @@ -1,8 +1,8 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllItems; +use grovedb::{EstimatedLayerInformation, TreeType}; use dpp::data_contract::document_type::DocumentTypeRef; @@ -67,7 +67,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs index b3ea51c398a..07d0b4f5642 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_document_from_primary_storage/v0/mod.rs @@ -1,6 +1,6 @@ use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, MaybeTree, TransactionArg, TreeType}; use dpp::data_contract::document_type::DocumentTypeRef; @@ -38,14 +38,14 @@ impl Drive { ) -> Result<(), Error> { let apply_type = if estimated_costs_only_with_layer_info.is_some() { StatelessBatchDelete { - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, estimated_key_size: DEFAULT_HASH_SIZE_U32, estimated_value_size: document_type.estimated_size(platform_version)? as u32, } } else { // we know we are not deleting a subtree StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), } }; self.batch_delete( diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs index 6ad033a0f41..a7e531ebb1c 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -2,7 +2,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::AllSubtrees; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use dpp::data_contract::document_type::IndexLevel; @@ -51,7 +51,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -116,7 +116,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs index 332e9214519..65f48016dd9 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs @@ -2,7 +2,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::AllSubtrees; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use grovedb::EstimatedSumTrees::NoSumTrees; use std::collections::HashMap; @@ -69,7 +69,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -119,7 +119,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs index 0ee9619ac03..171af548196 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs @@ -3,7 +3,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; use grovedb::EstimatedLayerSizes::{AllReference, AllSubtrees}; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, MaybeTree, TransactionArg, TreeType}; use dpp::data_contract::document_type::IndexLevelTypeInfo; use dpp::data_contract::document_type::IndexType::{ContestedResourceIndex, NonUniqueIndex}; @@ -64,7 +64,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( key_info_path.clone(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -83,7 +83,7 @@ impl Drive { ), &key_info_path, // we know we are not deleting a tree - Some((false, false)), + Some(MaybeTree::NotTree), estimated_costs_only_with_layer_info, platform_version, )?; @@ -112,7 +112,7 @@ impl Drive { ), &key_info_path, // we know we are not deleting a tree - Some((false, false)), + Some(MaybeTree::NotTree), estimated_costs_only_with_layer_info, platform_version, )?; diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs index 3de9414bc08..2bcaf9ccbc4 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs @@ -11,8 +11,8 @@ use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllItems; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use std::collections::HashMap; @@ -77,7 +77,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs index a43d53d1bfc..9b5bb29ebde 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs @@ -15,9 +15,9 @@ use dpp::document::DocumentV0Getters; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees, Mix}; use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::util::type_constants::{ DEFAULT_FLOAT_SIZE, DEFAULT_FLOAT_SIZE_U8, DEFAULT_HASH_SIZE_U8, @@ -84,7 +84,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -108,7 +108,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(document_id_in_primary_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(AVERAGE_NUMBER_OF_UPDATES as u32), estimated_layer_sizes: Mix { subtrees_size: None, @@ -137,7 +137,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs index 4d8a852d845..d31bad5cf55 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/mod.rs @@ -1,6 +1,6 @@ mod v0; -use crate::util::grove_operations::{BatchDeleteUpTreeApplyType, IsSubTree, IsSumSubTree}; +use crate::util::grove_operations::BatchDeleteUpTreeApplyType; use crate::drive::Drive; @@ -10,7 +10,7 @@ use crate::error::drive::DriveError; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, EstimatedLayerSizes}; +use grovedb::{EstimatedLayerInformation, EstimatedLayerSizes, MaybeTree}; use std::collections::HashMap; @@ -39,7 +39,7 @@ impl Drive { pub(crate) fn stateless_delete_of_non_tree_for_costs( element_estimated_sizes: EstimatedLayerSizes, key_info_path: &KeyInfoPath, - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + is_known_to_be_subtree_with_sum: Option, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, diff --git a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs index 7d70f79819e..504daac2d10 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/stateless_delete_of_non_tree_for_costs/v0/mod.rs @@ -1,6 +1,6 @@ use crate::drive::constants::CONTRACT_DOCUMENTS_PATH_HEIGHT; -use crate::util::grove_operations::{BatchDeleteUpTreeApplyType, IsSubTree, IsSumSubTree}; +use crate::util::grove_operations::BatchDeleteUpTreeApplyType; use crate::drive::Drive; use crate::error::fee::FeeError; @@ -8,7 +8,7 @@ use crate::error::Error; use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, EstimatedLayerSizes}; +use grovedb::{EstimatedLayerInformation, EstimatedLayerSizes, MaybeTree}; use intmap::IntMap; use itertools::Itertools; use std::collections::HashMap; @@ -41,7 +41,7 @@ impl Drive { pub(super) fn stateless_delete_of_non_tree_for_costs_v0( element_estimated_sizes: EstimatedLayerSizes, key_info_path: &KeyInfoPath, - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + is_known_to_be_subtree_with_sum: Option, estimated_costs_only_with_layer_info: &mut Option< HashMap, >, diff --git a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs index 1faf95a1dc2..f072477da87 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_for_contract_operations/v0/mod.rs @@ -12,7 +12,7 @@ use dpp::data_contract::document_type::methods::DocumentTypeV0Methods; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -41,7 +41,7 @@ impl Drive { StatefulDirectQuery } else { StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue( document_and_contract_info .document_type diff --git a/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs index f0ecde6e3ee..c26d1b944cc 100644 --- a/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_document_to_primary_storage/v0/mod.rs @@ -5,7 +5,7 @@ use grovedb::batch::key_info::KeyInfo::KnownKey; use grovedb::batch::KeyInfoPath; use grovedb::reference_path::ReferencePathType::SiblingReference; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; use std::option::Option::None; @@ -125,8 +125,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), @@ -425,7 +425,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, target: QueryTargetValue(document_type.estimated_size(platform_version)? as u32), } }; diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs index 2725cc80b1c..6b4932e1865 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -14,7 +14,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::AllSubtrees; use grovedb::EstimatedSumTrees::NoSumTrees; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -62,7 +62,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -77,8 +77,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), @@ -136,7 +136,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs index c21146a1832..320a4625af5 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs @@ -20,7 +20,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::AllSubtrees; use grovedb::EstimatedSumTrees::NoSumTrees; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -70,7 +70,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -85,8 +85,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), @@ -146,7 +146,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs index 00d3f872cd4..c84ab415615 100644 --- a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs @@ -23,7 +23,7 @@ use grovedb::batch::key_info::KeyInfo; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; use grovedb::EstimatedLayerSizes::AllReference; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -61,8 +61,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), @@ -94,7 +94,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllReference( DEFAULT_HASH_SIZE_U8, @@ -194,7 +194,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, target: QueryTargetValue( document_reference_size(document_and_contract_info.document_type) + storage_flags diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs index 5df447b5ef5..5a18464be37 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_document_to_primary_storage/v0/mod.rs @@ -1,7 +1,7 @@ use grovedb::batch::key_info::KeyInfo; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; @@ -203,7 +203,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, target: QueryTargetValue(document_type.estimated_size(platform_version)? as u32), } }; diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs index 1881419fdd2..43433cb6e70 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs @@ -23,7 +23,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::AllSubtrees; use grovedb::EstimatedSumTrees::NoSumTrees; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -74,8 +74,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), @@ -123,7 +123,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, @@ -187,7 +187,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(16), // very seldom would more than 16 people want the resource estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs index a989dd3997b..a1ecffebb30 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -60,7 +60,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -76,7 +76,7 @@ impl Drive { } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { in_tree_using_sums: false, - is_sum_tree: false, + tree_type: TreeType::NormalTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), @@ -134,7 +134,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs index 3bc068d4f11..4370b1811d3 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs @@ -21,7 +21,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::{AllItems, Mix}; use grovedb::EstimatedSumTrees::AllSumTrees; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -53,7 +53,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: Mix { // The votes don't have storage flags @@ -144,7 +144,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( votes_path_key_info.clone().convert_to_key_info_path()?, EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, None), }, @@ -155,8 +155,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: true, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::SumTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs index bb036014bd5..a23851323de 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs @@ -12,7 +12,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; use grovedb::EstimatedLayerSizes::{AllItems, Mix}; use grovedb::EstimatedSumTrees::AllSumTrees; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -43,7 +43,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(1), estimated_layer_sizes: Mix { // The votes don't have storage flags @@ -71,7 +71,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( votes_path_key_info.clone().convert_to_key_info_path()?, EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, None), }, @@ -82,8 +82,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: true, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::SumTree, flags_len: storage_flags .map(|s| s.serialized_size()) .unwrap_or_default(), diff --git a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs index 0c92a15651f..eb982b4f3c3 100644 --- a/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/update/internal/update_document_for_contract_operations/v0/mod.rs @@ -34,7 +34,7 @@ use dpp::version::PlatformVersion; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::key_info::KeyInfo::KnownKey; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, MaybeTree, TransactionArg}; use std::borrow::Cow; use std::collections::{HashMap, HashSet}; @@ -380,7 +380,7 @@ impl Drive { document.id().as_slice(), Some(CONTRACT_DOCUMENTS_PATH_HEIGHT), BatchDeleteUpTreeApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, previous_batch_operations, @@ -394,7 +394,7 @@ impl Drive { &[0], Some(CONTRACT_DOCUMENTS_PATH_HEIGHT), BatchDeleteUpTreeApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, previous_batch_operations, diff --git a/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs b/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs index c1faf370de5..1133447945b 100644 --- a/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs @@ -8,9 +8,9 @@ use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use dpp::data_contract::GroupContractPosition; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::EstimatedLevel; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees, Mix}; use grovedb::EstimatedSumTrees::{AllSumTrees, NoSumTrees, SomeSumTrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -79,7 +79,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 1, @@ -96,7 +96,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(group_root_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(10, false), // We estimate that on average we need to update 10 nodes estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -105,7 +105,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(group_contract_path(contract_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(2, NoSumTrees, None), }, @@ -117,7 +117,7 @@ impl Drive { &group_contract_position.to_be_bytes(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -129,7 +129,7 @@ impl Drive { &group_contract_position.to_be_bytes(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(10, false), estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -143,7 +143,7 @@ impl Drive { action_id.as_slice(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: Mix { subtrees_size: Some((1, AllSumTrees, None, 1)), @@ -160,7 +160,7 @@ impl Drive { action_id.as_slice(), )), EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllItems(8, 1, None), }, diff --git a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_has_signer/v0/mod.rs b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_has_signer/v0/mod.rs index ef6963b4d3b..c4503fe3286 100644 --- a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_has_signer/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_has_signer/v0/mod.rs @@ -9,7 +9,7 @@ use dpp::data_contract::GroupContractPosition; use dpp::fee::fee_result::FeeResult; use dpp::identifier::Identifier; use dpp::version::PlatformVersion; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// v0 implementation of fetching the signers' power for a given action ID within a group contract. @@ -144,7 +144,7 @@ impl Drive { // no estimated_costs_only_with_layer_info, means we want to apply to state let direct_query_type = if estimate_costs_only { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: true, + in_tree_type: TreeType::SumTree, query_target: QueryTargetValue(8), } } else { diff --git a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info/v0/mod.rs b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info/v0/mod.rs index f17a4674e99..d01751e4749 100644 --- a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info/v0/mod.rs @@ -12,7 +12,7 @@ use dpp::identifier::Identifier; use dpp::serialization::PlatformDeserializable; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; impl Drive { pub(super) fn fetch_action_id_info_v0( @@ -70,7 +70,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs index 95483153889..46f88becaa0 100644 --- a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_info_keep_serialized/v0/mod.rs @@ -10,7 +10,7 @@ use dpp::data_contract::GroupContractPosition; use dpp::identifier::Identifier; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; impl Drive { /// v0 implementation of fetching the signers' power for a given action ID within a group contract. @@ -113,7 +113,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs index af88918a8fa..d61af2bc7da 100644 --- a/packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/fetch/fetch_action_id_signers_power/v0/mod.rs @@ -8,7 +8,7 @@ use dpp::data_contract::group::GroupSumPower; use dpp::data_contract::GroupContractPosition; use dpp::identifier::Identifier; use dpp::version::PlatformVersion; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// v0 implementation of fetching the signers' power for a given action ID within a group contract. @@ -109,7 +109,7 @@ impl Drive { // no estimated_costs_only_with_layer_info, means we want to apply to state let direct_query_type = if estimate_costs_only { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(8), } } else { diff --git a/packages/rs-drive/src/drive/group/insert/add_group_action/v0/mod.rs b/packages/rs-drive/src/drive/group/insert/add_group_action/v0/mod.rs index 8273acfa7f2..a0d8ce1dd97 100644 --- a/packages/rs-drive/src/drive/group/insert/add_group_action/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/insert/add_group_action/v0/mod.rs @@ -18,7 +18,7 @@ use dpp::serialization::PlatformSerializable; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::element::SumValue; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use grovedb_epoch_based_storage_flags::StorageFlags; use std::collections::HashMap; @@ -141,8 +141,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: 0, } }; @@ -208,7 +208,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: true, + in_tree_type: TreeType::SumTree, target: QueryTarget::QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/group/insert/add_new_groups/v0/mod.rs b/packages/rs-drive/src/drive/group/insert/add_new_groups/v0/mod.rs index 9e489c31c2a..bde785e07c0 100644 --- a/packages/rs-drive/src/drive/group/insert/add_new_groups/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/insert/add_new_groups/v0/mod.rs @@ -15,7 +15,7 @@ use dpp::identifier::Identifier; use dpp::serialization::PlatformSerializable; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::{BTreeMap, HashMap}; impl Drive { @@ -101,8 +101,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: 0, } }; diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs index 14a8e3e05ee..bfbf1c2f4f9 100644 --- a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/fetch_identity_contract_nonce/v0/mod.rs @@ -12,7 +12,7 @@ use dpp::prelude::IdentityNonce; use crate::drive::identity::contract_info::ContractInfoStructure::IdentityContractNonceKey; use dpp::version::PlatformVersion; use grovedb::Element::Item; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Fetches the Identity's contract revision from the backing store @@ -51,7 +51,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(1), } }; diff --git a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs index aaa805ca542..be3b7075665 100644 --- a/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/contract_info/identity_contract_nonce/merge_identity_contract_nonce/v0/mod.rs @@ -11,7 +11,7 @@ use crate::util::object_size_info::{PathKeyElementInfo, PathKeyInfo}; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; use dpp::block::block_info::BlockInfo; use dpp::fee::fee_result::FeeResult; @@ -98,8 +98,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: 0, } }; diff --git a/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs b/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs index 745bd2daffa..a2177bd0697 100644 --- a/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/contract_info/keys/add_potential_contract_info_for_contract_bounded_key/v0/mod.rs @@ -24,7 +24,7 @@ use dpp::identity::{IdentityPublicKey, Purpose}; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; use grovedb::reference_path::ReferencePathType::{SiblingReference, UpstreamRootHeightReference}; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use grovedb_costs::OperationCost; use integer_encoding::VarInt; use std::collections::HashMap; @@ -95,8 +95,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: 0, } }; @@ -233,7 +233,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, target: QueryTargetValue(reference_type_path.serialized_size() as u32), } }; @@ -419,7 +419,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, target: QueryTargetValue(reference.serialized_size() as u32), } }; diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs index 28d254ead1a..529b56477f6 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllItems; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::identity_query_keys_security_level_tree_path_vec; @@ -45,7 +45,7 @@ impl Drive { )), //todo: revisit EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(4), //we can estimate that each security level will only have 4 keys //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllItems(1, KEY_REFERENCE_SIZE, None), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs index fd7be5dcdb2..59696e6aac5 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::balances::balance_path_vec; @@ -56,7 +56,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees( 1, @@ -73,7 +73,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(balance_path_vec()), EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs index 79a3a2c57b6..77a184dab7d 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs @@ -3,9 +3,9 @@ use crate::drive::{identity_tree_path, Drive}; use crate::util::type_constants::DEFAULT_HASH_SIZE_U8; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -19,7 +19,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -29,7 +29,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -46,7 +46,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: Mix { subtrees_size: Some((1, NoSumTrees, None, 2)), // weight of 2 because 1 for keys and 1 for data contract info @@ -59,7 +59,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_contract_info_root_path_vec(identity_id)), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs index 9fc0347ab8a..563dedebf6a 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs @@ -2,9 +2,9 @@ use crate::drive::identity::identity_contract_info_group_path_vec; use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::Mix; use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -20,7 +20,7 @@ impl Drive { group_id, )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: Mix { subtrees_size: Some((1, NoSumTrees, None, 1)), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs index 2a2d2405d79..195a04d3c7c 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllReference; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::estimation_costs::KEY_REFERENCE_SIZE; use crate::drive::identity::identity_contract_info_group_path_key_purpose_vec; @@ -25,7 +25,7 @@ impl Drive { key_purpose, )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(5), estimated_layer_sizes: AllReference(1, KEY_REFERENCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs index efa3892a36c..069fc57bcb8 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs @@ -2,9 +2,9 @@ use crate::drive::identity::identity_contract_info_group_keys_path_vec; use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllSubtrees; use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -20,7 +20,7 @@ impl Drive { group_id, )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs index 3721c5cad3b..ac776f1ab24 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::{identity_tree_path, Drive}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::{identity_key_tree_path_vec, identity_path_vec}; @@ -58,7 +58,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -68,7 +68,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -78,7 +78,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -89,7 +89,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_key_tree_path_vec(identity_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(50), //we can estimate that an identity will have amount 50 keys //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllItems(1, 42, Some(3)), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs index 34a7a6d214a..c4102f56b77 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::{identity_tree_path, Drive}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::identity_path_vec; @@ -36,7 +36,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -53,7 +53,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(2, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: Mix { diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs index 68d4852ad3e..6951d86eda7 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllReference, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::identity_query_keys_purpose_tree_path_vec; @@ -68,7 +68,7 @@ impl Drive { purpose, )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count, // there are //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs index ca2672fa5a2..7d312f98fd6 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::identity_query_keys_tree_path_vec; @@ -34,7 +34,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_query_keys_tree_path_vec(identity_id)), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(4), //we can estimate that an identity will have amount 50 keys //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs index bbd73f99edf..0f129654927 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::{identity_tree_path, Drive}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::identity_path_vec; @@ -40,7 +40,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -50,7 +50,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -67,7 +67,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: Mix { diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs index f5fe620cc68..659ffc26169 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::{identity_tree_path, Drive}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllSubtrees, Mix}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::identity::identity_path_vec; @@ -40,7 +40,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -50,7 +50,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -67,7 +67,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: Mix { diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs index 2c5c98f7dbe..31c0eb6b9cf 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_balance/v0/mod.rs @@ -12,7 +12,7 @@ use dpp::fee::Credits; use dpp::version::PlatformVersion; use grovedb::Element::SumItem; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Fetches the Identity's balance from the backing store @@ -77,7 +77,7 @@ impl Drive { } else { // 8 is the size of a i64 used in sum trees DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: true, + in_tree_type: TreeType::SumTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs index ba32dca8740..8bc4ccb63ba 100644 --- a/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/balance/fetch_identity_negative_balance/v0/mod.rs @@ -9,7 +9,7 @@ use dpp::fee::Credits; use dpp::version::PlatformVersion; use grovedb::Element::Item; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Fetches the Identity's negative balance operations from the backing store. @@ -26,7 +26,7 @@ impl Drive { } else { // 8 is the size of a encoded u64 DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: true, + in_tree_type: TreeType::SumTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs index 14a7c3f705e..8aa7fbe80d6 100644 --- a/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/nonce/fetch_identity_nonce/v0/mod.rs @@ -12,7 +12,7 @@ use dpp::prelude::IdentityNonce; use dpp::version::PlatformVersion; use grovedb::Element::Item; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Fetches the Identity's nonce from the backing store @@ -48,7 +48,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(1), } }; diff --git a/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs index bc58f655241..5257b2f4323 100644 --- a/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/revision/fetch_identity_revision/v0/mod.rs @@ -12,7 +12,7 @@ use dpp::prelude::Revision; use dpp::version::PlatformVersion; use grovedb::Element::Item; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Fetches the Identity's revision from the backing store @@ -48,7 +48,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(1), } }; diff --git a/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs b/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs index 64f7dd35021..83146f7a86c 100644 --- a/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/insert/add_new_identity/v0/mod.rs @@ -19,7 +19,7 @@ use dpp::identity::identity_public_key::accessors::v0::{ }; use dpp::version::PlatformVersion; use grovedb::batch::KeyInfoPath; -use grovedb::{EstimatedLayerInformation, TransactionArg}; +use grovedb::{EstimatedLayerInformation, TransactionArg, TreeType}; use itertools::Itertools; use std::collections::{BTreeSet, HashMap}; @@ -122,8 +122,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags.serialized_size(), } }; diff --git a/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs index 8ae39f8b345..91fd7fbe21a 100644 --- a/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert/insert_key_searchable_references/v0/mod.rs @@ -16,7 +16,7 @@ use dpp::identity::{IdentityPublicKey, Purpose, SecurityLevel}; use dpp::version::drive_versions::DriveVersion; use grovedb::batch::KeyInfoPath; use grovedb::reference_path::ReferencePathType; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -79,8 +79,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: SINGLE_EPOCH_FLAGS_SIZE, } }; diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs index 355d05f34ba..a24e1eea04a 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs @@ -7,9 +7,9 @@ use crate::drive::{ use crate::util::type_constants::{DEFAULT_HASH_160_SIZE_U8, DEFAULT_HASH_SIZE_U8}; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; use grovedb::EstimatedSumTrees::NoSumTrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -24,7 +24,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(non_unique_key_hashes_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_160_SIZE_U8, NoSumTrees, None), }, @@ -36,7 +36,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(non_unique_key_hashes_sub_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(ESTIMATED_NON_UNIQUE_KEY_DUPLICATES), estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, 0, None), }, diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs index 80a35c46def..db8a337fa48 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs @@ -5,7 +5,7 @@ use grovedb::EstimatedLayerCount::PotentiallyAtMaxElements; use grovedb::EstimatedLayerSizes::AllItems; use crate::util::type_constants::{DEFAULT_HASH_160_SIZE_U8, DEFAULT_HASH_SIZE_U32}; -use grovedb::EstimatedLayerInformation; +use grovedb::{EstimatedLayerInformation, TreeType}; use std::collections::HashMap; impl Drive { @@ -18,7 +18,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(unique_key_hashes_path), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_160_SIZE_U8, diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs index 3400c9e6a43..64cdef76917 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::constants::AVERAGE_BALANCE_SIZE; use crate::drive::prefunded_specialized_balances::{ @@ -28,7 +28,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // We are on the 3rd level estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( @@ -45,7 +45,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(prefunded_specialized_balances_path()), EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, AllSumTrees, None), }, @@ -54,7 +54,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(prefunded_specialized_balances_for_voting_path_vec()), EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs index 54c2fd9690f..134a05f582f 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/fetch/single_balance/v0/mod.rs @@ -11,7 +11,7 @@ use dpp::fee::Credits; use crate::drive::prefunded_specialized_balances::prefunded_specialized_balances_for_voting_path; use dpp::version::PlatformVersion; use grovedb::Element::SumItem; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { /// Fetches the Prefunded specialized balance from the backing store @@ -76,7 +76,7 @@ impl Drive { } else { // 8 is the size of a i64 used in sum trees DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: true, + in_tree_type: TreeType::SumTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs b/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs index 6db3de7a093..871e5d7bceb 100644 --- a/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs +++ b/packages/rs-drive/src/drive/protocol_upgrade/remove_validators_proposed_app_versions/v0/mod.rs @@ -14,7 +14,7 @@ use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; use dpp::util::deserializer::ProtocolVersion; use dpp::version::drive_versions::DriveVersion; -use grovedb::{Element, TransactionArg}; +use grovedb::{Element, MaybeTree, TransactionArg}; use integer_encoding::VarInt; impl Drive { @@ -121,7 +121,7 @@ impl Drive { (&path).into(), validator_pro_tx_hash.as_slice(), StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, drive_operations, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs index 2257bfae60b..3b3969df79c 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs @@ -6,8 +6,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::votes::paths::{ vote_contested_resource_active_polls_contract_document_tree_path, @@ -58,7 +58,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(2, false), //voting is on level 2 // We have balances in the middle which is a sum tree estimated_layer_sizes: AllSubtrees( @@ -76,7 +76,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_root_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // contested resource tree is a key of "c" so it should be on the top layer of the merk estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -87,7 +87,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_contested_resource_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // active poll "p", with "e" and "i" first so it should be on the second layer of the merk estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -98,7 +98,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_contested_resource_active_polls_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -111,7 +111,7 @@ impl Drive { contract.id_ref().as_bytes(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(document_type_count), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, @@ -130,7 +130,7 @@ impl Drive { ), ), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -148,7 +148,7 @@ impl Drive { ), ), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(1024), //Just a guess estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs index 83f8c8dbc50..0559137ade7 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::votes::paths::{ vote_contested_resource_active_polls_contract_tree_path, @@ -49,7 +49,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(2, false), //voting is on level 2 // We have balances in the middle which is a sum tree estimated_layer_sizes: AllSubtrees( @@ -67,7 +67,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_root_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // contested resource tree is a key of "c" so it should be on the top layer of the merk estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -78,7 +78,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_contested_resource_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // active poll "p", with "e" and "i" first so it should be on the second layer of the merk estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -89,7 +89,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_contested_resource_active_polls_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -102,7 +102,7 @@ impl Drive { contract.id_ref().as_bytes(), )), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(document_type_count), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs index 8bae767c7b2..0e6e4630378 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs @@ -5,8 +5,8 @@ use crate::util::storage_flags::StorageFlags; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::contract::paths::all_contracts_global_root_path; @@ -43,7 +43,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -53,7 +53,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(all_contracts_global_root_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs index e9376cc3850..443349d04ad 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs @@ -6,8 +6,8 @@ use crate::util::storage_flags::StorageFlags; use dpp::data_contract::DataContract; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::AllSubtrees; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::contract::paths::contract_root_path; use crate::error::Error; @@ -62,7 +62,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(contract_root_path(contract.id_ref().as_bytes())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, storage_flags), }, @@ -71,7 +71,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(contract_documents_path(contract.id_ref().as_bytes())), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(document_type_count), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, diff --git a/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs b/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs index 2d8a9d33bcc..98aaed604c0 100644 --- a/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs +++ b/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{ApproximateElements, EstimatedLevel}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::system::misc_path_vec; @@ -33,7 +33,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 12, // about 32 + 1 + 1 / 3 @@ -50,7 +50,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(misc_path_vec()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: ApproximateElements(1), estimated_layer_sizes: AllItems(1, 8, None), }, diff --git a/packages/rs-drive/src/drive/tokens/balance/fetch_identity_token_balance/v0/mod.rs b/packages/rs-drive/src/drive/tokens/balance/fetch_identity_token_balance/v0/mod.rs index 5adbb9f513c..3a77e56f6c7 100644 --- a/packages/rs-drive/src/drive/tokens/balance/fetch_identity_token_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/balance/fetch_identity_token_balance/v0/mod.rs @@ -8,7 +8,7 @@ use crate::util::grove_operations::QueryTarget::QueryTargetValue; use dpp::balances::credits::TokenAmount; use dpp::version::PlatformVersion; use grovedb::Element::SumItem; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { pub(super) fn fetch_identity_token_balance_v0( @@ -42,7 +42,7 @@ impl Drive { } else { // 8 is the size of an i64 used in sum trees DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: true, + in_tree_type: TreeType::SumTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs index 1386c7979cd..2400e5de715 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs @@ -4,8 +4,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::{EstimatedLevel, PotentiallyAtMaxElements}; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::tokens::{ token_balances_path, token_identity_infos_path, token_path, tokens_root_path, @@ -65,7 +65,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -75,7 +75,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(tokens_root_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(10, false), // We estimate that on average we need to update 10 nodes estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -85,7 +85,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(token_path(&token_id)), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees( 1, @@ -101,7 +101,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(token_path(&token_id)), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, AllSumTrees, None), }, @@ -113,7 +113,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(token_identity_infos_path(&token_id)), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, @@ -128,7 +128,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(token_balances_path(&token_id)), EstimatedLayerInformation { - is_sum_tree: true, + tree_type: TreeType::SumTree, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs index e8f61934d07..dca4ebe18e0 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs @@ -2,8 +2,8 @@ use crate::drive::Drive; use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::EstimatedLevel; -use grovedb::EstimatedLayerInformation; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; +use grovedb::{EstimatedLayerInformation, TreeType}; use crate::drive::balances::total_tokens_root_supply_path; use crate::drive::system::misc_path; @@ -61,7 +61,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(3, false), // 17 because we have 2 layers at 32 and two layers at 2 estimated_layer_sizes: AllSubtrees( @@ -79,7 +79,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(misc_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -89,7 +89,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(total_tokens_root_supply_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, estimated_layer_count: EstimatedLevel(10, false), estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U64_SIZE_U32, None), }, diff --git a/packages/rs-drive/src/drive/tokens/freeze/v0/mod.rs b/packages/rs-drive/src/drive/tokens/freeze/v0/mod.rs index 8b1210d7e07..3df4bb38f1d 100644 --- a/packages/rs-drive/src/drive/tokens/freeze/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/freeze/v0/mod.rs @@ -11,7 +11,7 @@ use dpp::serialization::{PlatformDeserializable, PlatformSerializable}; use dpp::tokens::info::v0::IdentityTokenInfoV0Accessors; use dpp::tokens::info::IdentityTokenInfo; use dpp::version::PlatformVersion; -use grovedb::{batch::KeyInfoPath, Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{batch::KeyInfoPath, Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -101,7 +101,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/tokens/info/fetch_identity_token_info/v0/mod.rs b/packages/rs-drive/src/drive/tokens/info/fetch_identity_token_info/v0/mod.rs index 102811581f5..31b139e84ac 100644 --- a/packages/rs-drive/src/drive/tokens/info/fetch_identity_token_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/info/fetch_identity_token_info/v0/mod.rs @@ -9,7 +9,7 @@ use dpp::serialization::PlatformDeserializable; use dpp::tokens::info::IdentityTokenInfo; use dpp::version::PlatformVersion; use grovedb::Element::Item; -use grovedb::TransactionArg; +use grovedb::{TransactionArg, TreeType}; impl Drive { pub(super) fn fetch_identity_token_info_v0( @@ -42,7 +42,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/tokens/system/create_token_trees/v0/mod.rs b/packages/rs-drive/src/drive/tokens/system/create_token_trees/v0/mod.rs index c1ff9cc4d57..e60f48dfbdd 100644 --- a/packages/rs-drive/src/drive/tokens/system/create_token_trees/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/system/create_token_trees/v0/mod.rs @@ -15,7 +15,7 @@ use dpp::fee::fee_result::FeeResult; use dpp::serialization::PlatformSerializable; use dpp::tokens::status::TokenStatus; use grovedb::batch::KeyInfoPath; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use platform_version::version::PlatformVersion; use std::collections::HashMap; @@ -120,8 +120,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: 0, } }; @@ -130,7 +130,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, target: QueryTarget::QueryTargetValue(8), } }; @@ -139,8 +139,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: true, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::SumTree, flags_len: 0, } }; diff --git a/packages/rs-drive/src/drive/tokens/unfreeze/v0/mod.rs b/packages/rs-drive/src/drive/tokens/unfreeze/v0/mod.rs index da0524e1ce1..ab09dd3f73a 100644 --- a/packages/rs-drive/src/drive/tokens/unfreeze/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/unfreeze/v0/mod.rs @@ -11,7 +11,7 @@ use dpp::serialization::{PlatformDeserializable, PlatformSerializable}; use dpp::tokens::info::v0::IdentityTokenInfoV0Accessors; use dpp::tokens::info::IdentityTokenInfo; use dpp::version::PlatformVersion; -use grovedb::{batch::KeyInfoPath, Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{batch::KeyInfoPath, Element, EstimatedLayerInformation, TransactionArg, TreeType}; use std::collections::HashMap; impl Drive { @@ -101,7 +101,7 @@ impl Drive { DirectQueryType::StatefulDirectQuery } else { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, query_target: QueryTargetValue(8), } }; diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs index 81b3d0fab7b..2f2346d88b6 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_all_votes_given_by_identities/v0/mod.rs @@ -15,7 +15,7 @@ use dpp::dashcore::Network; use dpp::prelude::{BlockHeight, Identifier}; use dpp::version::PlatformVersion; use grovedb::query_result_type::QueryResultType::QueryPathKeyElementTrioResultType; -use grovedb::{PathQuery, Query, SizedQuery, TransactionArg}; +use grovedb::{MaybeTree, PathQuery, Query, SizedQuery, TransactionArg}; impl Drive { /// We remove votes for an identity when that identity is somehow disabled. Currently there is @@ -70,7 +70,7 @@ impl Drive { vote_path_ref.as_slice().into(), vote_id.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, &mut deletion_batch, @@ -106,7 +106,7 @@ impl Drive { absolute_path_ref.as_slice().into(), identifier_bytes.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, &mut deletion_batch, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs index 5e9127abf65..3598e7b0617 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v0/mod.rs @@ -8,7 +8,7 @@ use crate::util::grove_operations::BatchDeleteApplyType; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -33,7 +33,7 @@ impl Drive { path.as_slice().into(), resource_vote_choice.to_key().as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v1/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v1/mod.rs index 7440aaadce6..4a2542b3906 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_contenders_operations/v1/mod.rs @@ -10,7 +10,7 @@ use crate::util::grove_operations::BatchDeleteApplyType; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -35,7 +35,7 @@ impl Drive { path.as_slice().into(), resource_vote_choice.to_key().as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, @@ -47,7 +47,7 @@ impl Drive { path.as_slice().into(), &RESOURCE_ABSTAIN_VOTE_TREE_KEY_U8_32, BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, @@ -58,7 +58,7 @@ impl Drive { path.as_slice().into(), &RESOURCE_LOCK_VOTE_TREE_KEY_U8_32, BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs index cb25558a382..c417c36cfb4 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v0/mod.rs @@ -9,7 +9,7 @@ use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use grovedb::query_result_type::QueryResultType; -use grovedb::{PathQuery, TransactionArg}; +use grovedb::{MaybeTree, PathQuery, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; use std::ops::RangeFull; @@ -54,7 +54,7 @@ impl Drive { documents_storage_path.as_slice().into(), document_key.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, @@ -72,7 +72,7 @@ impl Drive { contender_path.as_slice().into(), vec![0].as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v1/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v1/mod.rs index f6722670348..b21d9584fab 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_documents_operations/v1/mod.rs @@ -11,7 +11,7 @@ use dpp::document::DocumentV0Getters; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -70,7 +70,7 @@ impl Drive { documents_storage_path.as_slice().into(), document_key.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, @@ -89,7 +89,7 @@ impl Drive { contender_path.as_slice().into(), vec![0].as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs index 1f2a36d353f..4a0e7c0a4be 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v0/mod.rs @@ -8,7 +8,7 @@ use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use grovedb::batch::KeyInfoPath; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -34,7 +34,7 @@ impl Drive { // VotePoll Info 1 VotePoll Info 2 VotePoll Info 3 let delete_apply_type = BatchDeleteUpTreeApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }; for (vote_poll, end_date, _) in vote_polls { diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v1/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v1/mod.rs index b47e5feb605..ef35e8a2db9 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_end_date_query_operations/v1/mod.rs @@ -12,7 +12,7 @@ use crate::util::grove_operations::BatchDeleteApplyType; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -38,7 +38,7 @@ impl Drive { // VotePoll Info 1 VotePoll Info 2 VotePoll Info 3 let delete_apply_type = BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }; let mut by_end_date: BTreeMap> = BTreeMap::new(); diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_info_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_info_operations/v0/mod.rs index 141fd3c766e..0f30733b0a9 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_info_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_info_operations/v0/mod.rs @@ -7,7 +7,7 @@ use crate::util::grove_operations::BatchDeleteApplyType; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -29,7 +29,7 @@ impl Drive { path.as_slice().into(), &RESOURCE_STORED_INFO_KEY_U8_32, BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_top_level_index_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_top_level_index_operations/v0/mod.rs index 13d3832592c..d1a3583bf08 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_top_level_index_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_top_level_index_operations/v0/mod.rs @@ -7,7 +7,7 @@ use crate::util::grove_operations::BatchDeleteApplyType; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -30,7 +30,7 @@ impl Drive { path.as_slice().into(), last_index_path.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs index 4bd8edcff97..44ee761e560 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_contested_resource_vote_poll_votes_operations/v0/mod.rs @@ -7,7 +7,7 @@ use crate::util::grove_operations::BatchDeleteApplyType; use dpp::identifier::Identifier; use dpp::identity::TimestampMillis; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; use std::collections::BTreeMap; @@ -36,7 +36,7 @@ impl Drive { path.as_slice().into(), vote.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, @@ -51,7 +51,7 @@ impl Drive { path.as_slice().into(), vec![VOTING_STORAGE_TREE_KEY].as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs b/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs index bc8b4679853..1802e9ab242 100644 --- a/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/cleanup/remove_specific_votes_given_by_identity/v0/mod.rs @@ -6,7 +6,7 @@ use crate::fees::op::LowLevelDriveOperation; use crate::util::grove_operations::BatchDeleteApplyType; use dpp::prelude::Identifier; use dpp::version::PlatformVersion; -use grovedb::TransactionArg; +use grovedb::{MaybeTree, TransactionArg}; impl Drive { /// We remove votes for an identity when that identity is somehow disabled. Currently there is @@ -29,7 +29,7 @@ impl Drive { vote_path_ref.as_slice().into(), vote_identifier_to_remove.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, batch_operations, diff --git a/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs index c7b284b845c..fa3782218f6 100644 --- a/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/insert/contested_resource/individual_vote/register_contested_resource_identity_vote/v0/mod.rs @@ -16,7 +16,7 @@ use dpp::fee::fee_result::FeeResult; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use dpp::{bincode, ProtocolError}; use grovedb::reference_path::ReferencePathType; -use grovedb::{Element, TransactionArg}; +use grovedb::{Element, MaybeTree, TransactionArg}; use platform_version::version::PlatformVersion; impl Drive { @@ -104,7 +104,7 @@ impl Drive { previous_voting_path.as_slice().into(), voter_pro_tx_hash.as_slice(), BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, true)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, &mut drive_operations, diff --git a/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs index 1c5fb593e9c..696b0841882 100644 --- a/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs @@ -22,7 +22,7 @@ use grovedb::batch::KeyInfoPath; use grovedb::EstimatedLayerCount::ApproximateElements; use grovedb::EstimatedLayerSizes::{AllItems, AllSubtrees}; use grovedb::EstimatedSumTrees::NoSumTrees; -use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg, TreeType}; use platform_version::version::PlatformVersion; use std::collections::HashMap; @@ -51,7 +51,7 @@ impl Drive { estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path(vote_end_date_queries_tree_path()), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // We can estimate that there is at least a vote concluding every block, and we put blocks at 6 seconds. estimated_layer_count: ApproximateElements(201_600), estimated_layer_sizes: AllSubtrees( @@ -67,7 +67,7 @@ impl Drive { vote_contested_resource_end_date_queries_at_time_tree_path_vec(end_date), ), EstimatedLayerInformation { - is_sum_tree: false, + tree_type: TreeType::NormalTree, // We can estimate that there is 2 votes ending per block. estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllItems( @@ -100,8 +100,8 @@ impl Drive { BatchInsertTreeApplyType::StatefulBatchInsertTree } else { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums: false, - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, + tree_type: TreeType::NormalTree, flags_len: storage_flags .as_ref() .map(|s| s.serialized_size()) @@ -133,7 +133,7 @@ impl Drive { BatchInsertApplyType::StatefulBatchInsert } else { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums: false, + in_tree_type: TreeType::NormalTree, // todo: figure out a default serialized size to make this faster target: QueryTargetValue( item.serialized_size(&platform_version.drive.grove_version)? as u32, diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/token.rs b/packages/rs-drive/src/util/batch/drive_op_batch/token.rs index 77fda94d41d..ad08114540e 100644 --- a/packages/rs-drive/src/util/batch/drive_op_batch/token.rs +++ b/packages/rs-drive/src/util/batch/drive_op_batch/token.rs @@ -6,7 +6,6 @@ use dpp::balances::credits::TokenAmount; use dpp::block::block_info::BlockInfo; use dpp::identifier::Identifier; use dpp::prelude::IdentityNonce; -use dpp::tokens::emergency_action::TokenEmergencyAction; use dpp::tokens::status::TokenStatus; use dpp::tokens::token_event::TokenEvent; use grovedb::batch::KeyInfoPath; diff --git a/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs b/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs index 26bf6617a78..8146f534d71 100644 --- a/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs +++ b/packages/rs-drive/src/util/batch/drive_op_batch/withdrawals.rs @@ -18,7 +18,7 @@ use dpp::fee::{Credits, SignedCredits}; use dpp::prelude::TimestampMillis; use dpp::version::PlatformVersion; use dpp::withdrawal::{WithdrawalTransactionIndex, WithdrawalTransactionIndexAndBytes}; -use grovedb::{batch::KeyInfoPath, EstimatedLayerInformation, TransactionArg}; +use grovedb::{batch::KeyInfoPath, EstimatedLayerInformation, MaybeTree, TransactionArg}; use grovedb::{Element, PathQuery, SizedQuery}; /// Operations for Withdrawals @@ -164,7 +164,7 @@ impl DriveLowLevelOperationConverter for WithdrawalOperationType { true, // we know that we are not deleting a subtree BatchMoveApplyType::StatefulBatchMove { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, &mut drive_operations, @@ -205,7 +205,7 @@ impl DriveLowLevelOperationConverter for WithdrawalOperationType { true, // we know that we are not deleting a subtree BatchMoveApplyType::StatefulBatchMove { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, &mut drive_operations, @@ -244,7 +244,7 @@ impl DriveLowLevelOperationConverter for WithdrawalOperationType { true, // we know that we are not deleting a subtree BatchDeleteApplyType::StatefulBatchDelete { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }, transaction, &mut drive_operations, diff --git a/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs b/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs index 68bac3502d1..ecf25027e2f 100644 --- a/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs +++ b/packages/rs-drive/src/util/batch/grovedb_op_batch/mod.rs @@ -13,7 +13,7 @@ use dpp::prelude::Identifier; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::{GroveDbOpConsistencyResults, GroveOp, KeyInfoPath, QualifiedGroveDbOp}; use grovedb::operations::proof::util::hex_to_ascii; -use grovedb::Element; +use grovedb::{Element, TreeType}; use std::borrow::Cow; use std::fmt; @@ -360,7 +360,7 @@ pub trait GroveDbOpBatchV0Methods { fn add_delete(&mut self, path: Vec>, key: Vec); /// Adds a `Delete` tree operation to a list of GroveDB ops. - fn add_delete_tree(&mut self, path: Vec>, key: Vec, is_sum_tree: bool); + fn add_delete_tree(&mut self, path: Vec>, key: Vec, tree_type: TreeType); /// Adds an `Insert` operation with an element to a list of GroveDB ops. fn add_insert(&mut self, path: Vec>, key: Vec, element: Element); @@ -512,9 +512,9 @@ impl GroveDbOpBatchV0Methods for GroveDbOpBatch { } /// Adds a `Delete` tree operation to a list of GroveDB ops. - fn add_delete_tree(&mut self, path: Vec>, key: Vec, is_sum_tree: bool) { + fn add_delete_tree(&mut self, path: Vec>, key: Vec, tree_type: TreeType) { self.operations - .push(QualifiedGroveDbOp::delete_tree_op(path, key, is_sum_tree)) + .push(QualifiedGroveDbOp::delete_tree_op(path, key, tree_type)) } /// Adds an `Insert` operation with an element to a list of GroveDB ops. diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs index 25a083ced3c..bc774456306 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs @@ -32,7 +32,7 @@ impl Drive { }; let delete_operation = match apply_type { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_key_size, estimated_value_size, } => GroveDb::average_case_delete_operation_for_delete::( diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs index a530776986d..6e5b6179010 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs @@ -87,7 +87,7 @@ impl Drive { }; let delete_operation = match apply_type { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_key_size, estimated_value_size, } => GroveDb::average_case_delete_operation_for_delete::( @@ -136,7 +136,7 @@ mod tests { util::grove_operations::BatchDeleteApplyType, }; use assert_matches::assert_matches; - use grovedb::SizedQuery; + use grovedb::{SizedQuery, TreeType}; use grovedb_path::SubtreePath; use platform_version::version::PlatformVersion; @@ -533,7 +533,7 @@ mod tests { // Set up the stateless apply type with estimated sizes let apply_type = BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree: false, + in_tree_type: TreeType::NormalTree, estimated_key_size: key.len() as u32, estimated_value_size: element .serialized_size(&platform_version.drive.grove_version) diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs index 4f2c30664c7..3aa69889483 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_empty_tree_if_not_exists/v0/mod.rs @@ -58,7 +58,7 @@ impl Drive { } else if let GroveOperation(grove_op) = previous_drive_operation { if grove_op.key == key && grove_op.path == path - && matches!(grove_op.op, GroveOp::DeleteTree) + && matches!(grove_op.op, GroveOp::DeleteTree(_)) { found = true; existing_operations.remove(i); @@ -133,7 +133,7 @@ impl Drive { } else if let GroveOperation(grove_op) = previous_drive_operation { if grove_op.key == key && grove_op.path == path - && matches!(grove_op.op, GroveOp::DeleteTree) + && matches!(grove_op.op, GroveOp::DeleteTree(_)) { found = true; existing_operations.remove(i); @@ -206,7 +206,7 @@ impl Drive { } else if let GroveOperation(grove_op) = previous_drive_operation { if grove_op.key == key && grove_op.path == path - && matches!(grove_op.op, GroveOp::DeleteTree) + && matches!(grove_op.op, GroveOp::DeleteTree(_)) { found = true; existing_operations.remove(i); @@ -279,7 +279,7 @@ impl Drive { } else if let GroveOperation(grove_op) = previous_drive_operation { if grove_op.key == key && grove_op.path == path - && matches!(grove_op.op, GroveOp::DeleteTree) + && matches!(grove_op.op, GroveOp::DeleteTree(_)) { found = true; existing_operations.remove(i); diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs index de5431d8f1f..f464fc3c18d 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_changed_value/v0/mod.rs @@ -99,7 +99,8 @@ impl Drive { PathKeyElementSize((key_info_path, key_info, element)) => { match apply_type { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. + in_tree_type: in_tree_using_sums, + .. } => { // we can estimate that the element was the same size drive_operations.push(CalculatedCostOperation( diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs index 8fc5c16c5b4..cdf15dc489f 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists/v0/mod.rs @@ -87,7 +87,8 @@ impl Drive { PathKeyElementSize((key_info_path, key_info, element)) => { match apply_type { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. + in_tree_type: in_tree_using_sums, + .. } => { // we can estimate that the element was the same size drive_operations.push(CalculatedCostOperation( diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/v0/mod.rs index 55f411caebc..ed3e3568800 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/v0/mod.rs @@ -129,7 +129,8 @@ impl Drive { PathKeyElementSize((key_info_path, key_info, element)) => { match apply_type { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. + in_tree_type: in_tree_using_sums, + .. } => { // Estimate if the element with the given size already exists drive_operations.push(CalculatedCostOperation( diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_if_not_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_if_not_exists/v0/mod.rs index f47ff7052cd..6785633e73e 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_if_not_exists/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_if_not_exists/v0/mod.rs @@ -182,7 +182,7 @@ impl Drive { if let Element::SumItem(new_value, _) = element { match apply_type { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. + in_tree_type, .. } => { // Estimate if the sum item with the given size already exists drive_operations.push(CalculatedCostOperation( @@ -190,7 +190,7 @@ impl Drive { &key_info_path, &key_info, element.serialized_size(&drive_version.grove_version)? as u32, - in_tree_using_sums, + in_tree_type, &drive_version.grove_version, )?, )); diff --git a/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_or_add_to_if_already_exists/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_or_add_to_if_already_exists/v0/mod.rs index 8294a6786b5..c9abd72a501 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_or_add_to_if_already_exists/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_insert_sum_item_or_add_to_if_already_exists/v0/mod.rs @@ -178,7 +178,7 @@ impl Drive { if let Element::SumItem(new_value, _) = element { match apply_type { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, .. + in_tree_type, .. } => { // Estimate if the sum item with the given size already exists drive_operations.push(CalculatedCostOperation( @@ -186,7 +186,7 @@ impl Drive { &key_info_path, &key_info, element.serialized_size(&drive_version.grove_version)? as u32, - in_tree_using_sums, + in_tree_type, &drive_version.grove_version, )?, )); diff --git a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs index f8b2b904cc5..25127f1f66b 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs @@ -89,14 +89,14 @@ impl Drive { }; let delete_operation = match apply_type { BatchMoveApplyType::StatelessBatchMove { - is_sum_tree, + in_tree_type, estimated_key_size, estimated_value_size, .. } => GroveDb::average_case_delete_operation_for_delete::( &KeyInfoPath::from_known_owned_path(path.to_vec()), &KeyInfo::KnownKey(key.to_vec()), - is_sum_tree, + in_tree_type, false, true, 0, @@ -142,7 +142,7 @@ mod tests { util::test_helpers::setup::setup_drive, }; use assert_matches::assert_matches; - use grovedb::{Element, PathQuery, Query, SizedQuery}; + use grovedb::{Element, MaybeTree, PathQuery, Query, SizedQuery}; use grovedb_path::SubtreePath; use platform_version::version::PlatformVersion; @@ -218,7 +218,7 @@ mod tests { // Set up the apply type and drive operations vector let apply_type = BatchMoveApplyType::StatefulBatchMove { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }; let mut drive_operations = Vec::new(); @@ -330,7 +330,7 @@ mod tests { // Set up the apply type and drive operations vector let apply_type = BatchMoveApplyType::StatefulBatchMove { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }; let mut drive_operations = Vec::new(); @@ -433,7 +433,7 @@ mod tests { // Set up the apply type and drive operations vector let apply_type = BatchMoveApplyType::StatefulBatchMove { - is_known_to_be_subtree_with_sum: Some((false, false)), + is_known_to_be_subtree_with_sum: Some(MaybeTree::NotTree), }; let mut drive_operations = Vec::new(); diff --git a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs index d6ef95dad2c..89902830ef6 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs @@ -45,9 +45,7 @@ impl Drive { "we should not be seeing internal grovedb operations", ))); } - Some(GroveOp::Delete { .. }) - | Some(GroveOp::DeleteTree { .. }) - | Some(GroveOp::DeleteSumTree { .. }) => false, + Some(GroveOp::Delete { .. }) | Some(GroveOp::DeleteTree { .. }) => false, _ => true, }; @@ -70,7 +68,7 @@ impl Drive { if needs_removal_from_state { let delete_operation = match apply_type { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_key_size, estimated_value_size, } => GroveDb::average_case_delete_operation_for_delete::( diff --git a/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs index 9171ff9b9a1..3baac60f013 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get/v0/mod.rs @@ -24,19 +24,19 @@ impl Drive { ) -> Result, Error> { match query_type { QueryType::StatelessQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, estimated_reference_sizes, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, ) diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_optional_sum_tree_total_value/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_optional_sum_tree_total_value/v0/mod.rs index fb117ea7a37..59fb0563445 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_optional_sum_tree_total_value/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_optional_sum_tree_total_value/v0/mod.rs @@ -25,18 +25,18 @@ impl Drive { ) -> Result, Error> { match query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { Ok(GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, )?) diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs index 4a84959eb1c..0d6778540ce 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw/v0/mod.rs @@ -24,18 +24,18 @@ impl Drive { ) -> Result, Error> { match direct_query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, ) diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_item/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_item/v0/mod.rs index 59cdb57e5ec..4f7dc34a369 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_raw_item/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_item/v0/mod.rs @@ -26,18 +26,18 @@ impl Drive { ) -> Result, Error> { match direct_query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, ) diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs index 9c8f567fa9a..90e2b2b0043 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs @@ -24,18 +24,18 @@ impl Drive { ) -> Result, Error> { match direct_query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, ) diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional_item/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional_item/v0/mod.rs index 4e17e9b0931..3ca57601fda 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional_item/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional_item/v0/mod.rs @@ -26,18 +26,18 @@ impl Drive { ) -> Result>, Error> { match direct_query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, ) diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs index 65bd03f3e30..f163c9ac51b 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_sum_tree_total_value/v0/mod.rs @@ -25,18 +25,18 @@ impl Drive { ) -> Result { match query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_size, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_size, tree_type) => { Ok(GroveDb::average_case_for_get_tree( &key_info_path, &key_info, flags_size, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, )?) diff --git a/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs index 5b15c0a73c1..f6b57a7c6f6 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_has_raw/v0/mod.rs @@ -25,18 +25,18 @@ impl Drive { ) -> Result { let CostContext { value, cost } = match query_type { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => { let key_info_path = KeyInfoPath::from_known_owned_path(path.to_vec()); let key_info = KeyInfo::KnownKey(key.to_vec()); let cost = match query_target { - QueryTarget::QueryTargetTree(flags_len, is_sum_tree) => { + QueryTarget::QueryTargetTree(flags_len, tree_type) => { GroveDb::average_case_for_has_raw_tree( &key_info_path, &key_info, flags_len, - is_sum_tree, + tree_type, in_tree_using_sums, &drive_version.grove_version, )? diff --git a/packages/rs-drive/src/util/grove_operations/mod.rs b/packages/rs-drive/src/util/grove_operations/mod.rs index ee07d5c1ff4..87818cdc13a 100644 --- a/packages/rs-drive/src/util/grove_operations/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/mod.rs @@ -144,7 +144,7 @@ pub mod grove_get_raw_optional_item; use grovedb_costs::CostContext; -use grovedb::EstimatedLayerInformation; +use grovedb::{EstimatedLayerInformation, MaybeTree, TreeType}; use crate::error::Error; use crate::fees::op::LowLevelDriveOperation; @@ -192,7 +192,7 @@ pub enum BatchDeleteApplyType { /// Stateless batch delete StatelessBatchDelete { /// Are we deleting in a sum tree - is_sum_tree: bool, + in_tree_type: TreeType, /// What is the estimated key size estimated_key_size: u32, /// What is the estimated value size @@ -201,7 +201,7 @@ pub enum BatchDeleteApplyType { /// Stateful batch delete StatefulBatchDelete { /// Are we known to be in a subtree and does this subtree have sums - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + is_known_to_be_subtree_with_sum: Option, }, } @@ -211,9 +211,9 @@ pub enum BatchMoveApplyType { /// Stateless batch move StatelessBatchMove { /// Are we moving from inside a sum tree - in_tree_using_sums: bool, + in_tree_type: TreeType, /// Are we moving a sum tree - is_sum_tree: bool, + tree_type: TreeType, /// What is the estimated key size estimated_key_size: u32, /// What is the estimated value size @@ -224,7 +224,7 @@ pub enum BatchMoveApplyType { /// Stateful batch move StatefulBatchMove { /// Are we known to be in a subtree and does this subtree have sums - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + is_known_to_be_subtree_with_sum: Option, }, } @@ -239,7 +239,7 @@ pub enum BatchDeleteUpTreeApplyType { /// Stateful batch delete StatefulBatchDelete { /// Are we known to be in a subtree and does this subtree have sums - is_known_to_be_subtree_with_sum: Option<(IsSubTree, IsSumSubTree)>, + is_known_to_be_subtree_with_sum: Option, }, } @@ -250,9 +250,9 @@ pub enum BatchInsertTreeApplyType { /// Stateless batch insert tree StatelessBatchInsertTree { /// Does this tree use sums? - in_tree_using_sums: bool, + in_tree_type: TreeType, /// Are we inserting in a sum tree - is_sum_tree: bool, + tree_type: TreeType, /// The flags length flags_len: FlagsLen, }, @@ -272,12 +272,12 @@ impl BatchInsertTreeApplyType { pub(crate) fn to_direct_query_type(self) -> DirectQueryType { match self { BatchInsertTreeApplyType::StatelessBatchInsertTree { - in_tree_using_sums, - is_sum_tree, + in_tree_type, + tree_type, flags_len, } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, - query_target: QueryTarget::QueryTargetTree(flags_len, is_sum_tree), + in_tree_type, + query_target: QueryTarget::QueryTargetTree(flags_len, tree_type), }, BatchInsertTreeApplyType::StatefulBatchInsertTree => { DirectQueryType::StatefulDirectQuery @@ -291,7 +291,7 @@ pub enum BatchInsertApplyType { /// Stateless batch insert StatelessBatchInsert { /// Does this tree use sums? - in_tree_using_sums: bool, + in_tree_type: TreeType, /// the type of Target (Tree or Value) target: QueryTarget, }, @@ -310,10 +310,10 @@ impl BatchInsertApplyType { pub(crate) fn to_direct_query_type(&self) -> DirectQueryType { match self { BatchInsertApplyType::StatelessBatchInsert { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, target, } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: *in_tree_using_sums, + in_tree_type: *in_tree_using_sums, query_target: *target, }, BatchInsertApplyType::StatefulBatchInsert => DirectQueryType::StatefulDirectQuery, @@ -329,7 +329,7 @@ pub type FlagsLen = u32; /// Query target pub enum QueryTarget { /// tree - QueryTargetTree(FlagsLen, IsSumTree), + QueryTargetTree(FlagsLen, TreeType), /// value QueryTargetValue(u32), } @@ -338,9 +338,8 @@ impl QueryTarget { /// Length pub(crate) fn len(&self) -> u32 { match self { - QueryTarget::QueryTargetTree(flags_len, is_sum_tree) => { - let len = if *is_sum_tree { 11 } else { 3 }; - *flags_len + len + QueryTarget::QueryTargetTree(flags_len, tree_type) => { + *flags_len + tree_type.inner_node_type().cost() + 3 } QueryTarget::QueryTargetValue(len) => *len, } @@ -354,7 +353,7 @@ pub enum DirectQueryType { /// Stateless direct query StatelessDirectQuery { /// Does this tree use sums? - in_tree_using_sums: bool, + in_tree_type: TreeType, /// the type of Target (Tree or Value) query_target: QueryTarget, }, @@ -366,10 +365,10 @@ impl From for QueryType { fn from(value: DirectQueryType) -> Self { match value { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type, query_target, } => QueryType::StatelessQuery { - in_tree_using_sums, + in_tree_type, query_target, estimated_reference_sizes: vec![], }, @@ -410,10 +409,10 @@ impl DirectQueryType { pub(crate) fn add_reference_sizes(self, reference_sizes: Vec) -> QueryType { match self { DirectQueryType::StatelessDirectQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, } => QueryType::StatelessQuery { - in_tree_using_sums, + in_tree_type: in_tree_using_sums, query_target, estimated_reference_sizes: reference_sizes, }, @@ -428,7 +427,7 @@ pub enum QueryType { /// Stateless query StatelessQuery { /// Does this tree use sums? - in_tree_using_sums: bool, + in_tree_type: TreeType, /// the type of Target (Tree or Value) query_target: QueryTarget, /// The estimated sizes of references @@ -442,11 +441,11 @@ impl From for QueryType { fn from(value: BatchDeleteApplyType) -> Self { match value { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_value_size, .. } => QueryType::StatelessQuery { - in_tree_using_sums: is_sum_tree, + in_tree_type: is_sum_tree, query_target: QueryTarget::QueryTargetValue(estimated_value_size), estimated_reference_sizes: vec![], }, @@ -459,11 +458,11 @@ impl From<&BatchDeleteApplyType> for QueryType { fn from(value: &BatchDeleteApplyType) -> Self { match value { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_value_size, .. } => QueryType::StatelessQuery { - in_tree_using_sums: *is_sum_tree, + in_tree_type: *is_sum_tree, query_target: QueryTarget::QueryTargetValue(*estimated_value_size), estimated_reference_sizes: vec![], }, @@ -476,11 +475,11 @@ impl From for DirectQueryType { fn from(value: BatchDeleteApplyType) -> Self { match value { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_value_size, .. } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: is_sum_tree, + in_tree_type: is_sum_tree, query_target: QueryTarget::QueryTargetValue(estimated_value_size), }, BatchDeleteApplyType::StatefulBatchDelete { .. } => { @@ -494,11 +493,11 @@ impl From<&BatchDeleteApplyType> for DirectQueryType { fn from(value: &BatchDeleteApplyType) -> Self { match value { BatchDeleteApplyType::StatelessBatchDelete { - is_sum_tree, + in_tree_type: is_sum_tree, estimated_value_size, .. } => DirectQueryType::StatelessDirectQuery { - in_tree_using_sums: *is_sum_tree, + in_tree_type: *is_sum_tree, query_target: QueryTarget::QueryTargetValue(*estimated_value_size), }, BatchDeleteApplyType::StatefulBatchDelete { .. } => { diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index 8e4503817d4..1b2eb985936 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -222,7 +222,7 @@ pub fn setup_family_tests( "tests/supporting_files/contract/family/family-contract.json", None, None, - None, + None::, Some(&db_transaction), Some(platform_version), ); @@ -295,7 +295,7 @@ pub fn setup_family_tests_with_nulls(count: u32, seed: u64) -> (Drive, DataContr "tests/supporting_files/contract/family/family-contract-fields-optional.json", None, None, - None, + None::, Some(&db_transaction), None, ); @@ -367,7 +367,7 @@ pub fn setup_family_tests_only_first_name_index(count: u32, seed: u64) -> (Drive "tests/supporting_files/contract/family/family-contract-only-first-name-index.json", None, None, - None, + None::, Some(&db_transaction), None, ); @@ -835,7 +835,7 @@ pub fn setup_dpns_tests_with_batches( "tests/supporting_files/contract/dpns/dpns-contract.json", None, None, - None, + None::, Some(&db_transaction), Some(platform_version), ); @@ -885,7 +885,7 @@ pub fn setup_withdrawal_tests( "tests/supporting_files/contract/withdrawals/withdrawals-contract.json", None, None, - None, + None::, Some(&db_transaction), None, ); @@ -931,7 +931,7 @@ pub fn setup_references_tests(_count: u32, _seed: u64) -> (Drive, DataContract) "tests/supporting_files/contract/references/references_with_contract_history.json", None, None, - None, + None::, Some(&db_transaction), None, ); @@ -969,7 +969,7 @@ pub fn setup_dpns_tests_label_not_required(count: u32, seed: u64) -> (Drive, Dat "tests/supporting_files/contract/dpns/dpns-contract-label-not-required.json", None, None, - None, + None::, Some(&db_transaction), None, ); @@ -1007,7 +1007,7 @@ pub fn setup_dpns_test_with_data(path: &str) -> (Drive, DataContract) { "tests/supporting_files/contract/dpns/dpns-contract.json", None, None, - None, + None::, Some(&db_transaction), None, ); diff --git a/packages/rs-drive/tests/query_tests_history.rs b/packages/rs-drive/tests/query_tests_history.rs index 6ea120b342e..c2af5d317e1 100644 --- a/packages/rs-drive/tests/query_tests_history.rs +++ b/packages/rs-drive/tests/query_tests_history.rs @@ -187,7 +187,7 @@ pub fn setup( "tests/supporting_files/contract/family/family-contract-with-history.json", None, None, - None, + None::, Some(&db_transaction), Some(platform_version), ); diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index a05504d9ecb..6103074b3e3 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" thiserror = { version = "1.0.63" } bincode = { version = "2.0.0-rc.3" } versioned-feature-core = { git = "https://github.com/dashpay/versioned-feature-core", version = "1.0.0" } -grovedb-version = { version = "2.1.0" } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev= "2417f7a72900cd3dca943ad52c979bc8abfdaa20" } once_cell = "1.19.0" [features] diff --git a/packages/wasm-dpp/src/errors/consensus/consensus_error.rs b/packages/wasm-dpp/src/errors/consensus/consensus_error.rs index 2301255352b..c3105e31870 100644 --- a/packages/wasm-dpp/src/errors/consensus/consensus_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/consensus_error.rs @@ -83,7 +83,7 @@ use dpp::consensus::state::identity::no_transfer_key_for_core_withdrawal_availab use dpp::consensus::state::identity::RecipientIdentityDoesNotExistError; use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_insufficient_error::PrefundedSpecializedBalanceInsufficientError; use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError; -use dpp::consensus::state::token::{IdentityDoesNotHaveEnoughTokenBalanceError, IdentityTokenAccountFrozenError, UnauthorizedTokenActionError}; +use dpp::consensus::state::token::{IdentityDoesNotHaveEnoughTokenBalanceError, IdentityTokenAccountNotFrozenError, IdentityTokenAccountFrozenError, UnauthorizedTokenActionError}; use dpp::consensus::state::voting::masternode_incorrect_voter_identity_id_error::MasternodeIncorrectVoterIdentityIdError; use dpp::consensus::state::voting::masternode_incorrect_voting_address_error::MasternodeIncorrectVotingAddressError; use dpp::consensus::state::voting::masternode_not_found_error::MasternodeNotFoundError; @@ -337,6 +337,9 @@ pub fn from_state_error(state_error: &StateError) -> JsValue { StateError::GroupActionAlreadySignedByIdentityError(e) => { generic_consensus_error!(GroupActionAlreadySignedByIdentityError, e).into() } + StateError::IdentityTokenAccountNotFrozenError(e) => { + generic_consensus_error!(IdentityTokenAccountNotFrozenError, e).into() + } } }