From f9c46a20a8a40e4206f2bad331da678dfca5c70e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 22 Aug 2026 19:40:32 +0700 Subject: [PATCH 1/3] feat(drive)!: raise the daily withdrawal limit to 4000 Dash Platform pooled at most 2000 Dash of withdrawals per 24h (daily_withdrawal_limit v1, PV8, matching Core v22's LimitAmountV22). Core doubled its credit-pool unlock limit to 4000 Dash (LimitAmountV24, DIP-0165, dashpay/dash#6662) behind its DEPLOYMENT_V24 hard fork; this mirrors that on Platform, gated on PV14. - rs-dpp: daily_withdrawal_limit v2 returns a flat 4000 Dash; dispatcher wired. - rs-platform-version: DPP_METHOD_VERSIONS_V3 (daily_withdrawal_limit: 2), used by PV14 only. PV13 and earlier keep V2. - Dispatcher-level test: PV13 -> 2000 Dash, PV14 -> 4000 Dash. Core's V24 deployment is still NEVER_ACTIVE on mainnet and testnet as of Core v23.1.8, so PV14 must not activate on a network before Core's V24 fork does. Co-Authored-By: Claude Fable 5 --- .../withdrawal/daily_withdrawal_limit/mod.rs | 30 +++++++++++++++++++ .../daily_withdrawal_limit/v2/mod.rs | 9 ++++++ .../dpp_versions/dpp_method_versions/mod.rs | 1 + .../dpp_versions/dpp_method_versions/v3.rs | 8 +++++ .../rs-platform-version/src/version/v14.rs | 18 +++++++---- 5 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs create mode 100644 packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs index 997bd422621..9fe5bf2ad3e 100644 --- a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs +++ b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs @@ -5,6 +5,7 @@ use platform_version::version::PlatformVersion; mod v0; mod v1; +mod v2; pub fn daily_withdrawal_limit( total_credits_in_platform: Credits, @@ -13,8 +14,37 @@ pub fn daily_withdrawal_limit( match platform_version.dpp.methods.daily_withdrawal_limit { 0 => Ok(daily_withdrawal_limit_v0(total_credits_in_platform)), 1 => Ok(v1::daily_withdrawal_limit_v1()), + 2 => Ok(v2::daily_withdrawal_limit_v2()), v => Err(ProtocolError::UnknownVersionError(format!( "Unknown daily_withdrawal_limit version {v}" ))), } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::dash_to_credits; + + #[test] + fn should_double_flat_daily_withdrawal_limit_at_protocol_version_14() { + let v13 = PlatformVersion::get(13).expect("expected protocol version 13"); + let v14 = PlatformVersion::get(14).expect("expected protocol version 14"); + + // Both flat limits are independent of the credits held in Platform. + for total_credits in [ + dash_to_credits!(50), + dash_to_credits!(5000), + dash_to_credits!(1000000), + ] { + assert_eq!( + daily_withdrawal_limit(total_credits, v13).expect("expected v13 limit"), + dash_to_credits!(2000) + ); + assert_eq!( + daily_withdrawal_limit(total_credits, v14).expect("expected v14 limit"), + dash_to_credits!(4000) + ); + } + } +} diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs new file mode 100644 index 00000000000..8590225d9b0 --- /dev/null +++ b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs @@ -0,0 +1,9 @@ +use crate::fee::Credits; + +/// Set constant withdrawal daily limit to 4000 Dash +/// that corresponds to the limit in Core v24 (`LimitAmountV24`, activated by +/// Core's `DEPLOYMENT_V24` hard fork; DIP-0165). +pub const fn daily_withdrawal_limit_v2() -> Credits { + // 4000 Dash + 400_000_000_000_000 +} diff --git a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs index 14f4dc66c00..3c654283a53 100644 --- a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs +++ b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs @@ -2,6 +2,7 @@ use versioned_feature_core::FeatureVersion; pub mod v1; pub mod v2; +pub mod v3; #[derive(Clone, Debug, Default)] pub struct DPPMethodVersions { diff --git a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs new file mode 100644 index 00000000000..41ed3d4eb78 --- /dev/null +++ b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs @@ -0,0 +1,8 @@ +use crate::version::dpp_versions::dpp_method_versions::DPPMethodVersions; +pub const DPP_METHOD_VERSIONS_V3: DPPMethodVersions = DPPMethodVersions { + epoch_core_reward_credits_for_distribution: 0, + daily_withdrawal_limit: 2, + deduct_fee_from_outputs_or_remaining_balance_of_inputs: 0, + compute_minimum_shielded_fee: 0, + shielded_extra_sighash_data: 0, +}; diff --git a/packages/rs-platform-version/src/version/v14.rs b/packages/rs-platform-version/src/version/v14.rs index cfa1f2a0efc..da25f34f975 100644 --- a/packages/rs-platform-version/src/version/v14.rs +++ b/packages/rs-platform-version/src/version/v14.rs @@ -5,7 +5,7 @@ use crate::version::dpp_versions::dpp_costs_versions::v1::DPP_COSTS_VERSIONS_V1; use crate::version::dpp_versions::dpp_document_versions::v3::DOCUMENT_VERSIONS_V3; use crate::version::dpp_versions::dpp_factory_versions::v1::DPP_FACTORY_VERSIONS_V1; use crate::version::dpp_versions::dpp_identity_versions::v1::IDENTITY_VERSIONS_V1; -use crate::version::dpp_versions::dpp_method_versions::v2::DPP_METHOD_VERSIONS_V2; +use crate::version::dpp_versions::dpp_method_versions::v3::DPP_METHOD_VERSIONS_V3; use crate::version::dpp_versions::dpp_state_transition_conversion_versions::v2::STATE_TRANSITION_CONVERSION_VERSIONS_V2; use crate::version::dpp_versions::dpp_state_transition_method_versions::v1::STATE_TRANSITION_METHOD_VERSIONS_V1; use crate::version::dpp_versions::dpp_state_transition_serialization_versions::v2::STATE_TRANSITION_SERIALIZATION_VERSIONS_V2; @@ -30,7 +30,7 @@ use crate::version::ProtocolVersion; pub const PROTOCOL_VERSION_14: ProtocolVersion = 14; -/// v14 hosts three consensus changes: +/// v14 hosts four consensus changes: /// /// 1. **Contract-level ranked aggregates** (this branch): an index can /// declare that its groups are rankable by an aggregate, so a query like @@ -66,6 +66,13 @@ pub const PROTOCOL_VERSION_14: ProtocolVersion = 14; /// the contest was created on — which halts the chain when that poll /// ends — or open a contest for a document that is not a contested /// resource at all. +/// 4. **Daily withdrawal limit 2000 → 4000 Dash**: `DPP_METHOD_VERSIONS_V3` +/// bumps `daily_withdrawal_limit` 1 → 2, doubling the amount of credits +/// Platform pools into asset unlock transactions per 24 hours. This +/// mirrors Core's doubled credit-pool unlock limit (`LimitAmountV24`, +/// DIP-0165, dashpay/dash#6662), which Core gates on its own +/// `DEPLOYMENT_V24` hard fork — v14 must not activate on a network before +/// that fork does, or Core rejects the excess unlocks. /// /// The first two are orthogonal by construction: the ranked upgrade decides the /// *property-name* tree type, the demotion decides the *value* tree type @@ -75,8 +82,9 @@ pub const PROTOCOL_VERSION_14: ProtocolVersion = 14; /// shared-prefix shapes. /// /// Until a contract uses the ranked grammar, the only v14 behavior changes -/// are the shared-prefix fix, the contested-index cross-check and the -/// index-reorder schema-compatibility fix; everything else matches v13: +/// are the shared-prefix fix, the contested-index cross-check, the +/// index-reorder schema-compatibility fix and the doubled daily withdrawal +/// limit; everything else matches v13: /// /// * `CONTRACT_VERSIONS_V6` points `document_type_schema` at the v3 document /// meta-schema, which hosts the ranked index keywords @@ -145,7 +153,7 @@ pub const PLATFORM_V14: PlatformVersion = PlatformVersion { voting_versions: VOTING_VERSION_V2, token_versions: TOKEN_VERSIONS_V2, asset_lock_versions: DPP_ASSET_LOCK_VERSIONS_V1, - methods: DPP_METHOD_VERSIONS_V2, + methods: DPP_METHOD_VERSIONS_V3, // changed: daily_withdrawal_limit v2 — 4000 Dash per day, matching Core's LimitAmountV24 factory_versions: DPP_FACTORY_VERSIONS_V1, }, system_data_contracts: SYSTEM_DATA_CONTRACT_VERSIONS_V3, // changed: DashPay v2 adds profile payment address fields (DIP-33) From e51f136728de60dcd66fd92f2bdc4b265d982c82 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 22 Aug 2026 20:01:42 +0700 Subject: [PATCH 2/3] docs(drive): v14 daily withdrawal limit does not depend on Core's V24 fork Pre-V24 Core caps unlocks at LimitAmountV22 per block (no window) and checks the amount only at block level, so Platform's 4000 Dash/day is fully minable before DEPLOYMENT_V24 activates; V24's 4000-per-576-blocks window then matches. Co-Authored-By: Claude Fable 5 --- packages/rs-platform-version/src/version/v14.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/rs-platform-version/src/version/v14.rs b/packages/rs-platform-version/src/version/v14.rs index da25f34f975..58dc3fe44fd 100644 --- a/packages/rs-platform-version/src/version/v14.rs +++ b/packages/rs-platform-version/src/version/v14.rs @@ -71,8 +71,13 @@ pub const PROTOCOL_VERSION_14: ProtocolVersion = 14; /// Platform pools into asset unlock transactions per 24 hours. This /// mirrors Core's doubled credit-pool unlock limit (`LimitAmountV24`, /// DIP-0165, dashpay/dash#6662), which Core gates on its own -/// `DEPLOYMENT_V24` hard fork — v14 must not activate on a network before -/// that fork does, or Core rejects the excess unlocks. +/// `DEPLOYMENT_V24` hard fork. v14 does not have to wait for that fork: +/// pre-V24 Core caps unlocks at `LimitAmountV22` (2000 Dash) per *block* +/// (no sliding window — the window only arrives with V24), and its mempool +/// does not check the amount at all, so a day's 4000 Dash is still fully +/// minable; unlocks above 2000 in one Core block simply wait for the next +/// one. After V24, Core enforces 4000 Dash per 576-block window, which +/// matches this limit. /// /// The first two are orthogonal by construction: the ranked upgrade decides the /// *property-name* tree type, the demotion decides the *value* tree type From e75fb3f0077bf340443ef890d2e886dfb97b775d Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 22 Aug 2026 20:57:44 +0700 Subject: [PATCH 3/3] refactor(drive): carry the daily withdrawal limit in system limits Move the flat daily withdrawal limit into SystemLimits::daily_withdrawal_limit (next to the other withdrawal limits) instead of a new daily_withdrawal_limit method version: SYSTEM_LIMITS_V1..V3 keep 2000 Dash, new SYSTEM_LIMITS_V4 (PV14) carries 4000 Dash, and method v1 reads the table. Co-Authored-By: Claude Fable 5 --- .../withdrawal/daily_withdrawal_limit/mod.rs | 4 +-- .../daily_withdrawal_limit/v1/mod.rs | 11 +++--- .../daily_withdrawal_limit/v2/mod.rs | 9 ----- .../dpp_versions/dpp_method_versions/mod.rs | 1 - .../dpp_versions/dpp_method_versions/v3.rs | 8 ----- .../src/version/mocks/v2_test.rs | 1 + .../src/version/system_limits/mod.rs | 7 ++++ .../src/version/system_limits/v1.rs | 3 +- .../src/version/system_limits/v2.rs | 5 +-- .../src/version/system_limits/v3.rs | 7 ++-- .../src/version/system_limits/v4.rs | 34 +++++++++++++++++++ .../rs-platform-version/src/version/v14.rs | 15 ++++---- 12 files changed, 66 insertions(+), 39 deletions(-) delete mode 100644 packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs delete mode 100644 packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs create mode 100644 packages/rs-platform-version/src/version/system_limits/v4.rs diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs index 9fe5bf2ad3e..3f964db0e41 100644 --- a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs +++ b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs @@ -5,7 +5,6 @@ use platform_version::version::PlatformVersion; mod v0; mod v1; -mod v2; pub fn daily_withdrawal_limit( total_credits_in_platform: Credits, @@ -13,8 +12,7 @@ pub fn daily_withdrawal_limit( ) -> Result { match platform_version.dpp.methods.daily_withdrawal_limit { 0 => Ok(daily_withdrawal_limit_v0(total_credits_in_platform)), - 1 => Ok(v1::daily_withdrawal_limit_v1()), - 2 => Ok(v2::daily_withdrawal_limit_v2()), + 1 => Ok(v1::daily_withdrawal_limit_v1(platform_version)), v => Err(ProtocolError::UnknownVersionError(format!( "Unknown daily_withdrawal_limit version {v}" ))), diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs index 56112338a6d..5f2e4537573 100644 --- a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs +++ b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs @@ -1,8 +1,9 @@ use crate::fee::Credits; +use platform_version::version::PlatformVersion; -/// Set constant withdrawal daily limit to 2000 Dash -/// that corresponds to the limit in Core v22. -pub const fn daily_withdrawal_limit_v1() -> Credits { - // 2000 Dash - 200_000_000_000_000 +/// Flat daily withdrawal limit, read from the protocol version's system limits +/// (`SystemLimits::daily_withdrawal_limit`): 2000 Dash up to protocol version 13 +/// (the limit in Core v22), 4000 Dash from protocol version 14 (Core v24). +pub fn daily_withdrawal_limit_v1(platform_version: &PlatformVersion) -> Credits { + platform_version.system_limits.daily_withdrawal_limit } diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs deleted file mode 100644 index 8590225d9b0..00000000000 --- a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v2/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -use crate::fee::Credits; - -/// Set constant withdrawal daily limit to 4000 Dash -/// that corresponds to the limit in Core v24 (`LimitAmountV24`, activated by -/// Core's `DEPLOYMENT_V24` hard fork; DIP-0165). -pub const fn daily_withdrawal_limit_v2() -> Credits { - // 4000 Dash - 400_000_000_000_000 -} diff --git a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs index 3c654283a53..14f4dc66c00 100644 --- a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs +++ b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs @@ -2,7 +2,6 @@ use versioned_feature_core::FeatureVersion; pub mod v1; pub mod v2; -pub mod v3; #[derive(Clone, Debug, Default)] pub struct DPPMethodVersions { diff --git a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs deleted file mode 100644 index 41ed3d4eb78..00000000000 --- a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v3.rs +++ /dev/null @@ -1,8 +0,0 @@ -use crate::version::dpp_versions::dpp_method_versions::DPPMethodVersions; -pub const DPP_METHOD_VERSIONS_V3: DPPMethodVersions = DPPMethodVersions { - epoch_core_reward_credits_for_distribution: 0, - daily_withdrawal_limit: 2, - deduct_fee_from_outputs_or_remaining_balance_of_inputs: 0, - compute_minimum_shielded_fee: 0, - shielded_extra_sighash_data: 0, -}; diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 4286f9fb97d..5e8cce5f0d1 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -509,6 +509,7 @@ pub const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { withdrawal_transactions_per_block_limit: 4, retry_signing_expired_withdrawal_documents_per_block_limit: 1, max_withdrawal_amount: 50_000_000_000_000, + daily_withdrawal_limit: 200_000_000_000_000, //2000 Dash min_withdrawal_amount: 190_000, max_contract_group_size: 256, max_token_redemption_cycles: 128, diff --git a/packages/rs-platform-version/src/version/system_limits/mod.rs b/packages/rs-platform-version/src/version/system_limits/mod.rs index 5ceb6fceaf9..87ce1718742 100644 --- a/packages/rs-platform-version/src/version/system_limits/mod.rs +++ b/packages/rs-platform-version/src/version/system_limits/mod.rs @@ -1,6 +1,7 @@ pub mod v1; pub mod v2; pub mod v3; +pub mod v4; #[derive(Clone, Debug, Default)] pub struct SystemLimits { @@ -57,6 +58,12 @@ pub struct SystemLimits { pub withdrawal_transactions_per_block_limit: u16, pub retry_signing_expired_withdrawal_documents_per_block_limit: u16, pub max_withdrawal_amount: u64, + /// Flat cap (in credits) on the total amount Platform pools into asset unlock transactions + /// per 24 hours. Read by `daily_withdrawal_limit` method version 1 (protocol version 8 and + /// later); method version 0 (protocol versions 1–7) derived the limit from the total credits + /// in Platform instead and ignores this field. Versioned: see `daily_withdrawal_limit` in + /// each `SYSTEM_LIMITS_V*`. + pub daily_withdrawal_limit: u64, /// Minimum net amount (in credits) a withdrawal may send to Core, shared by the /// transparent (identity + address) and shielded withdrawal paths. The dust floor that /// keeps Core from rejecting the resulting `TxOut`. Versioned: see `min_withdrawal_amount` diff --git a/packages/rs-platform-version/src/version/system_limits/v1.rs b/packages/rs-platform-version/src/version/system_limits/v1.rs index f36f5dd05f8..39516e2f0f8 100644 --- a/packages/rs-platform-version/src/version/system_limits/v1.rs +++ b/packages/rs-platform-version/src/version/system_limits/v1.rs @@ -26,7 +26,8 @@ pub const SYSTEM_LIMITS_V1: SystemLimits = SystemLimits { max_transitions_in_documents_batch: 1, withdrawal_transactions_per_block_limit: 4, retry_signing_expired_withdrawal_documents_per_block_limit: 1, - max_withdrawal_amount: 50_000_000_000_000, //500 Dash + max_withdrawal_amount: 50_000_000_000_000, //500 Dash + daily_withdrawal_limit: 200_000_000_000_000, //2000 Dash (Core v22 limit; unused before protocol version 8) // = dpp MIN_WITHDRAWAL_AMOUNT: ASSET_UNLOCK_TX_SIZE(190) * MIN_CORE_FEE_PER_BYTE(1) // * CREDITS_PER_DUFF(1000) = 190_000 credits = 190 duffs. min_withdrawal_amount: 190_000, diff --git a/packages/rs-platform-version/src/version/system_limits/v2.rs b/packages/rs-platform-version/src/version/system_limits/v2.rs index 1fcb2205aa0..3c1b74aa944 100644 --- a/packages/rs-platform-version/src/version/system_limits/v2.rs +++ b/packages/rs-platform-version/src/version/system_limits/v2.rs @@ -16,8 +16,9 @@ pub const SYSTEM_LIMITS_V2: SystemLimits = SystemLimits { max_transitions_in_documents_batch: 1, withdrawal_transactions_per_block_limit: 4, retry_signing_expired_withdrawal_documents_per_block_limit: 1, - max_withdrawal_amount: 50_000_000_000_000, //500 Dash - min_withdrawal_amount: 1_000_000, //1000 duffs (raised from 190 in v12) + max_withdrawal_amount: 50_000_000_000_000, //500 Dash + daily_withdrawal_limit: 200_000_000_000_000, //2000 Dash (Core v22 limit) + min_withdrawal_amount: 1_000_000, //1000 duffs (raised from 190 in v12) max_contract_group_size: 256, max_token_redemption_cycles: 128, // NOTE: the Halo 2 proof grows with the action count (~2,273 B/action on diff --git a/packages/rs-platform-version/src/version/system_limits/v3.rs b/packages/rs-platform-version/src/version/system_limits/v3.rs index 99472f10562..7002be075e8 100644 --- a/packages/rs-platform-version/src/version/system_limits/v3.rs +++ b/packages/rs-platform-version/src/version/system_limits/v3.rs @@ -1,6 +1,6 @@ use crate::version::system_limits::SystemLimits; -/// System limits for protocol version 13 and above. +/// System limits for protocol version 13. /// /// Identical to [`super::v2::SYSTEM_LIMITS_V2`] except that `max_document_value_depth` is set: /// document property values are bounded to 256 nested containers, enforced by the wire decoder @@ -18,8 +18,9 @@ pub const SYSTEM_LIMITS_V3: SystemLimits = SystemLimits { max_transitions_in_documents_batch: 1, withdrawal_transactions_per_block_limit: 4, retry_signing_expired_withdrawal_documents_per_block_limit: 1, - max_withdrawal_amount: 50_000_000_000_000, //500 Dash - min_withdrawal_amount: 1_000_000, //1000 duffs (raised from 190 in v12) + max_withdrawal_amount: 50_000_000_000_000, //500 Dash + daily_withdrawal_limit: 200_000_000_000_000, //2000 Dash (Core v22 limit) + min_withdrawal_amount: 1_000_000, //1000 duffs (raised from 190 in v12) max_contract_group_size: 256, max_token_redemption_cycles: 128, // NOTE: the Halo 2 proof grows with the action count (~2,273 B/action on diff --git a/packages/rs-platform-version/src/version/system_limits/v4.rs b/packages/rs-platform-version/src/version/system_limits/v4.rs new file mode 100644 index 00000000000..485753e458c --- /dev/null +++ b/packages/rs-platform-version/src/version/system_limits/v4.rs @@ -0,0 +1,34 @@ +use crate::version::system_limits::SystemLimits; + +/// System limits for protocol version 14 and above. +/// +/// Identical to [`super::v3::SYSTEM_LIMITS_V3`] except that `daily_withdrawal_limit` is raised +/// from 2000 Dash to 4000 Dash, matching Core's doubled credit-pool unlock limit +/// (`LimitAmountV24`, DIP-0165, dashpay/dash#6662). v13 is already live on networks with the +/// 2000 Dash limit, so the change gates here. +pub const SYSTEM_LIMITS_V4: SystemLimits = SystemLimits { + estimated_contract_max_serialized_size: 16384, + max_field_value_size: 5120, //5 KiB + // Use the protocol's existing data-contract schema-depth ceiling as the conservative + // instance budget, bounding pre-schema work well above known document requirements. + max_document_value_depth: Some(256), + max_state_transition_size: 20480, //20 KiB + // Load-bearing for state correctness, not just for throughput — see + // SystemLimits::max_transitions_in_documents_batch and SYSTEM_LIMITS_V1. + max_transitions_in_documents_batch: 1, + withdrawal_transactions_per_block_limit: 4, + retry_signing_expired_withdrawal_documents_per_block_limit: 1, + max_withdrawal_amount: 50_000_000_000_000, //500 Dash + daily_withdrawal_limit: 400_000_000_000_000, //4000 Dash (Core v24 limit; raised from 2000 in v14) + min_withdrawal_amount: 1_000_000, //1000 duffs (raised from 190 in v12) + max_contract_group_size: 256, + max_token_redemption_cycles: 128, + // NOTE: the Halo 2 proof grows with the action count (~2,273 B/action on + // top of the 408 B serialized action), so a transition's on-wire size is + // ~2,681 B per action + ~2,930 B fixed (measured: 2 actions → 8,294 B, + // 6 → 19,018 B). The effective per-transition action bound under the + // 20 KiB `max_state_transition_size` is therefore 6, NOT this cap — 16 + // only becomes reachable if the size limit is raised. Pinned by dpp's + // `seed_pool_batch_fits_max_state_transition_size` signing test. + max_shielded_transition_actions: 16, +}; diff --git a/packages/rs-platform-version/src/version/v14.rs b/packages/rs-platform-version/src/version/v14.rs index 58dc3fe44fd..84f2bd3d306 100644 --- a/packages/rs-platform-version/src/version/v14.rs +++ b/packages/rs-platform-version/src/version/v14.rs @@ -5,7 +5,7 @@ use crate::version::dpp_versions::dpp_costs_versions::v1::DPP_COSTS_VERSIONS_V1; use crate::version::dpp_versions::dpp_document_versions::v3::DOCUMENT_VERSIONS_V3; use crate::version::dpp_versions::dpp_factory_versions::v1::DPP_FACTORY_VERSIONS_V1; use crate::version::dpp_versions::dpp_identity_versions::v1::IDENTITY_VERSIONS_V1; -use crate::version::dpp_versions::dpp_method_versions::v3::DPP_METHOD_VERSIONS_V3; +use crate::version::dpp_versions::dpp_method_versions::v2::DPP_METHOD_VERSIONS_V2; use crate::version::dpp_versions::dpp_state_transition_conversion_versions::v2::STATE_TRANSITION_CONVERSION_VERSIONS_V2; use crate::version::dpp_versions::dpp_state_transition_method_versions::v1::STATE_TRANSITION_METHOD_VERSIONS_V1; use crate::version::dpp_versions::dpp_state_transition_serialization_versions::v2::STATE_TRANSITION_SERIALIZATION_VERSIONS_V2; @@ -25,7 +25,7 @@ use crate::version::drive_versions::v9::DRIVE_VERSION_V9; use crate::version::fee::v2::FEE_VERSION2; use crate::version::protocol_version::PlatformVersion; use crate::version::system_data_contract_versions::v3::SYSTEM_DATA_CONTRACT_VERSIONS_V3; -use crate::version::system_limits::v3::SYSTEM_LIMITS_V3; +use crate::version::system_limits::v4::SYSTEM_LIMITS_V4; use crate::version::ProtocolVersion; pub const PROTOCOL_VERSION_14: ProtocolVersion = 14; @@ -66,9 +66,10 @@ pub const PROTOCOL_VERSION_14: ProtocolVersion = 14; /// the contest was created on — which halts the chain when that poll /// ends — or open a contest for a document that is not a contested /// resource at all. -/// 4. **Daily withdrawal limit 2000 → 4000 Dash**: `DPP_METHOD_VERSIONS_V3` -/// bumps `daily_withdrawal_limit` 1 → 2, doubling the amount of credits -/// Platform pools into asset unlock transactions per 24 hours. This +/// 4. **Daily withdrawal limit 2000 → 4000 Dash**: `SYSTEM_LIMITS_V4` raises +/// `daily_withdrawal_limit`, doubling the amount of credits Platform pools +/// into asset unlock transactions per 24 hours (the `daily_withdrawal_limit` +/// method stays at v1, which reads that system limit). This /// mirrors Core's doubled credit-pool unlock limit (`LimitAmountV24`, /// DIP-0165, dashpay/dash#6662), which Core gates on its own /// `DEPLOYMENT_V24` hard fork. v14 does not have to wait for that fork: @@ -158,12 +159,12 @@ pub const PLATFORM_V14: PlatformVersion = PlatformVersion { voting_versions: VOTING_VERSION_V2, token_versions: TOKEN_VERSIONS_V2, asset_lock_versions: DPP_ASSET_LOCK_VERSIONS_V1, - methods: DPP_METHOD_VERSIONS_V3, // changed: daily_withdrawal_limit v2 — 4000 Dash per day, matching Core's LimitAmountV24 + methods: DPP_METHOD_VERSIONS_V2, factory_versions: DPP_FACTORY_VERSIONS_V1, }, system_data_contracts: SYSTEM_DATA_CONTRACT_VERSIONS_V3, // changed: DashPay v2 adds profile payment address fields (DIP-33) fee_version: FEE_VERSION2, - system_limits: SYSTEM_LIMITS_V3, + system_limits: SYSTEM_LIMITS_V4, // changed: daily_withdrawal_limit 2000 → 4000 Dash, matching Core's LimitAmountV24 consensus: ConsensusVersions { tenderdash_consensus_version: 1, },