diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index dd26b9fa29c..d890078ee14 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -2,11 +2,11 @@ import path from 'path'; import semver from 'semver'; import fs from 'fs'; +import Config from '../../src/config/Config.js'; import { NETWORK_MAINNET, PACKAGE_ROOT_DIR, } from '../../src/constants.js'; -import Config from '../../src/config/Config.js'; const { version } = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_DIR, 'package.json'), 'utf8')); @@ -98,7 +98,7 @@ export default function getBaseConfigFactory(homeDir) { tenderdash: { password: 'rpcpassword', whitelist: [ - 'quoruminfo', 'quorumverify', 'quorumsign', 'masternodestatus', 'masternodelist', + 'quoruminfo', 'quorumverify', 'quorumplatformsign', 'masternodestatus', 'masternodelist', 'ping', 'getnetworkinfo', ], lowPriority: false, @@ -301,7 +301,7 @@ export default function getBaseConfigFactory(homeDir) { tenderdash: { mode: 'full', docker: { - image: 'dashpay/tenderdash:1.0.0', + image: 'dashpay/tenderdash:1.1.0-dev.1', }, p2p: { host: '0.0.0.0', diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 8f3b6c963c9..092debe3db9 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1,12 +1,12 @@ /* eslint-disable no-param-reassign */ import fs from 'fs'; -import path from 'path'; import lodash from 'lodash'; +import path from 'path'; import { NETWORK_LOCAL, - NETWORK_TESTNET, NETWORK_MAINNET, + NETWORK_TESTNET, SSL_PROVIDERS, } from '../src/constants.js'; @@ -711,6 +711,12 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) delete options.platform.featureFlags; delete options.platform.masternodeRewardShares; delete options.platform.withdrawals; + + // Update tenderdash image + options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image'); + + // Replace quorumsign with qurumplatformsign in Core RPC Tenderdash auth whitelist + options.core.rpc.users.tenderdash.whitelist = base.get('core.rpc.users.tenderdash.whitelist'); }); return configFile; }, diff --git a/packages/rs-drive-abci/src/main.rs b/packages/rs-drive-abci/src/main.rs index 7062f1db6a2..7a1d42fa41a 100644 --- a/packages/rs-drive-abci/src/main.rs +++ b/packages/rs-drive-abci/src/main.rs @@ -98,8 +98,9 @@ impl Cli { ) -> Result<(), String> { match self.command { Commands::Start => { - verify_grovedb(&config.db_path, false)?; - + if config.drive.grovedb_verify_on_startup { + verify_grovedb(&config.db_path, false)?; + } let core_rpc = DefaultCoreRPC::open( config.core.consensus_rpc.url().as_str(), config.core.consensus_rpc.username.clone(), diff --git a/packages/rs-drive/src/config.rs b/packages/rs-drive/src/config.rs index b65fc7ec8ef..3856eb0b0ac 100644 --- a/packages/rs-drive/src/config.rs +++ b/packages/rs-drive/src/config.rs @@ -9,6 +9,8 @@ use serde::{Deserialize, Serialize}; pub const DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED: bool = false; /// Boolean if GroveDB has_raw in enabled by default pub const DEFAULT_GROVE_HAS_RAW_ENABLED: bool = true; +/// Boolean if verification of GroveDB should be run on startup +pub const DEFAULT_VERIFY_GROVE_ON_STARTUP: bool = false; /// The default default query limit pub const DEFAULT_QUERY_LIMIT: u16 = 100; /// The default max query limit @@ -31,6 +33,13 @@ pub struct DriveConfig { #[cfg_attr(feature = "serde", serde(default = "default_has_raw_enabled"))] pub has_raw_enabled: bool, + /// Boolean if GroveDB verification should happen on startup + #[cfg_attr( + feature = "serde", + serde(default = "default_grove_verify_on_startup_enabled") + )] + pub grovedb_verify_on_startup: bool, + /// The default returned count if no limit is set #[cfg_attr( feature = "serde", @@ -146,6 +155,10 @@ fn default_has_raw_enabled() -> bool { DEFAULT_GROVE_HAS_RAW_ENABLED } +fn default_grove_verify_on_startup_enabled() -> bool { + DEFAULT_VERIFY_GROVE_ON_STARTUP +} + fn default_default_query_limit() -> u16 { DEFAULT_QUERY_LIMIT } @@ -173,6 +186,7 @@ impl Default for DriveConfig { batching_consistency_verification: DEFAULT_GROVE_BATCHING_CONSISTENCY_VERIFICATION_ENABLED, has_raw_enabled: DEFAULT_GROVE_HAS_RAW_ENABLED, + grovedb_verify_on_startup: DEFAULT_VERIFY_GROVE_ON_STARTUP, default_query_limit: DEFAULT_QUERY_LIMIT, epochs_per_era: DEFAULT_EPOCHS_PER_ERA, max_query_limit: DEFAULT_MAX_QUERY_LIMIT, 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 1091507a3b7..1110b448445 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 @@ -44,27 +44,30 @@ impl Drive { /// - The layer might potentially have max elements. /// - Each item in this layer has a size of 36, which represents the size of an outpoint. /// - /// # Notes - /// - /// The todo comment suggests that there may be inaccuracies in the current function logic. Ensure to verify - /// the correctness of the provided logic and assumptions before relying on this function in production. pub(crate) fn add_estimation_costs_for_adding_asset_lock_v0( estimated_costs_only_with_layer_info: &mut HashMap, ) { - //todo: verify (this is wrong) + // DataContract_Documents 64 + // / \ + // Identities 32 Balances 96 + // / \ / \ + // Token_Balances 16 Pools 48 WithdrawalTransactions 80 Votes 112 + // / \ / / / \ + // NUPKH->I 8 UPKH->I 24 PreFundedSpecializedBalances 40 -> SpentAssetLockTransactions 72 <- Misc 104 Versions 120 + // we have constructed the top layer so contract/documents tree are at the top - // since balance will be on layer 2, updating will mean we will update 1 sum tree - // and 1 normal tree, hence we should give an equal weight to both + // since SpentAssetLockTransactions will be on layer 3, updating will mean we will update 1 sum tree + // and 2 normal tree, hence we should give an equal weight to both estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { is_sum_tree: false, - estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( - 1, + 12, // 32 + 1 + 1 / 3 SomeSumTrees { sum_trees_weight: 1, - non_sum_trees_weight: 1, + non_sum_trees_weight: 2, }, None, ), 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 a442ca21d62..2d8a9d33bcc 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 @@ -10,6 +10,14 @@ use crate::drive::system::misc_path_vec; use grovedb::EstimatedSumTrees::SomeSumTrees; use std::collections::HashMap; +// DataContract_Documents 64 +// / \ +// Identities 32 Balances 96 +// / \ / \ +// Token_Balances 16 Pools 48 WithdrawalTransactions 80 Votes 112 +// / \ / / / \ +// NUPKH->I 8 UPKH->I 24 PreFundedSpecializedBalances 40 SpentAssetLockTransactions 72 -> Misc 104 <- Versions 120 + impl Drive { /// Adds estimation costs for total system credits update. /// @@ -19,34 +27,32 @@ impl Drive { pub(super) fn add_estimation_costs_for_total_system_credits_update_v0( estimated_costs_only_with_layer_info: &mut HashMap, ) { - //todo: verify (this is wrong) // we have constructed the top layer so contract/documents tree are at the top - // since balance will be on layer 2, updating will mean we will update 1 sum tree - // and 1 normal tree, hence we should give an equal weight to both + // since balance will be on layer 3, updating will mean we will update 1 sum tree + // and 2 normal trees, hence we should give an equal weight to both estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_path([]), EstimatedLayerInformation { is_sum_tree: false, - estimated_layer_count: EstimatedLevel(1, false), + estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( - 1, + 12, // about 32 + 1 + 1 / 3 SomeSumTrees { sum_trees_weight: 1, - non_sum_trees_weight: 1, + non_sum_trees_weight: 2, }, None, ), }, ); - //todo : verify this // we then need to insert the contract layer estimated_costs_only_with_layer_info.insert( KeyInfoPath::from_known_owned_path(misc_path_vec()), EstimatedLayerInformation { - is_sum_tree: true, - estimated_layer_count: ApproximateElements(0), - estimated_layer_sizes: AllItems(1, 64, None), + is_sum_tree: false, + estimated_layer_count: ApproximateElements(1), + estimated_layer_sizes: AllItems(1, 8, None), }, ); }