From 8dee692cc3adc2f5c1aac1c7f715b46b4220c149 Mon Sep 17 00:00:00 2001 From: linning Date: Tue, 10 Dec 2024 19:32:55 +0800 Subject: [PATCH 1/2] Update the consensus chain ED to 10_000_000_000_000 * SHANNON and the domain chain ED to 1_000_000_000_000 * SHANNON Signed-off-by: linning --- crates/subspace-runtime/src/lib.rs | 4 ++-- domains/primitives/runtime/src/lib.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index 7ba9312dff..76382a21ab 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -322,9 +322,9 @@ parameter_types! { // Price per byte = Min Number of validators * Storage duration (years) * Storage cost per year // Account data size (80 bytes) // Min Number of redundant validators (100) - For a stable and redundant blockchain we need at least a certain number of full nodes/collators. - // Storage duration (20 years) - It is theoretically unlimited, accounts will stay around while the chain is alive. + // Storage duration (1 year) - It is theoretically unlimited, accounts will stay around while the chain is alive. // Storage cost per year of (12 * 1e-9 * 0.1 ) - SSD storage on cloud hosting costs about 0.1 USD per Gb per month - pub const ExistentialDeposit: Balance = 200_000_000_000_000 * SHANNON; + pub const ExistentialDeposit: Balance = 10_000_000_000_000 * SHANNON; } #[derive( diff --git a/domains/primitives/runtime/src/lib.rs b/domains/primitives/runtime/src/lib.rs index e91b79cfe3..e8989b499f 100644 --- a/domains/primitives/runtime/src/lib.rs +++ b/domains/primitives/runtime/src/lib.rs @@ -93,8 +93,13 @@ pub fn maximum_block_length() -> BlockLength { BlockLength::max_with_normal_ratio(MAX_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO) } -/// The existential deposit. Same with the one on primary chain. -pub const EXISTENTIAL_DEPOSIT: Balance = 500 * SHANNON; +/// Computed as ED = Account data size * Price per byte, where +/// Price per byte = Min Number of validators * Storage duration (years) * Storage cost per year +/// Account data size (80 bytes) +/// Min Number of redundant validators (10) - For a stable and redundant blockchain we need at least a certain number of full nodes/collators. +/// Storage duration (1 year) - It is theoretically unlimited, accounts will stay around while the chain is alive. +/// Storage cost per year of (12 * 1e-9 * 0.1 ) - SSD storage on cloud hosting costs about 0.1 USD per Gb per month +pub const EXISTENTIAL_DEPOSIT: Balance = 1_000_000_000_000 * SHANNON; /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is /// used to limit the maximal weight of a single extrinsic. From b8a53628aa25ad42663f4e40cb89a779e3964bf3 Mon Sep 17 00:00:00 2001 From: linning Date: Tue, 10 Dec 2024 19:40:10 +0800 Subject: [PATCH 2/2] Update the test consensus runtime ED Signed-off-by: linning --- test/subspace-test-client/src/chain_spec.rs | 5 ++--- test/subspace-test-runtime/src/lib.rs | 12 ++---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/test/subspace-test-client/src/chain_spec.rs b/test/subspace-test-client/src/chain_spec.rs index 8694e1a984..6e5631857a 100644 --- a/test/subspace-test-client/src/chain_spec.rs +++ b/test/subspace-test-client/src/chain_spec.rs @@ -5,11 +5,10 @@ use sp_core::{sr25519, Pair, Public}; use sp_runtime::traits::{IdentifyAccount, Verify}; use std::marker::PhantomData; use std::num::NonZeroU32; -use subspace_runtime_primitives::{AccountId, Balance, Signature}; +use subspace_runtime_primitives::{AccountId, Balance, Signature, SSC}; use subspace_test_runtime::{ AllowAuthoringBy, BalancesConfig, DomainsConfig, EnableRewardsAt, HistorySeedingConfig, - RewardsConfig, RuntimeGenesisConfig, SubspaceConfig, SudoConfig, SystemConfig, SSC, - WASM_BINARY, + RewardsConfig, RuntimeGenesisConfig, SubspaceConfig, SudoConfig, SystemConfig, WASM_BINARY, }; /// Generate a crypto pair from seed. diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index 383e0e9d17..b1bf2008d3 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -100,7 +100,7 @@ use subspace_core_primitives::solutions::SolutionRange; use subspace_core_primitives::{hashes, PublicKey, Randomness, SlotNumber, U256}; use subspace_runtime_primitives::{ AccountId, Balance, BlockNumber, FindBlockRewardAddress, Hash, HoldIdentifier, Moment, Nonce, - Signature, MIN_REPLICATION_FACTOR, + Signature, MIN_REPLICATION_FACTOR, SHANNON, SSC, }; sp_runtime::impl_opaque_keys! { @@ -130,13 +130,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { system_version: 2, }; -/// The smallest unit of the token is called Shannon. -pub const SHANNON: Balance = 1; -/// Subspace Credits have 18 decimal places. -pub const DECIMAL_PLACES: u8 = 18; -/// One Subspace Credit. -pub const SSC: Balance = (10 * SHANNON).pow(DECIMAL_PLACES as u32); - // TODO: Many of below constants should probably be updatable but currently they are not /// Expected block time in milliseconds. @@ -364,8 +357,7 @@ impl pallet_balances::Config for Runtime { /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; type DustRemoval = (); - // TODO: Correct value - type ExistentialDeposit = ConstU128<{ 500 * SHANNON }>; + type ExistentialDeposit = ConstU128<{ 10_000_000_000_000 * SHANNON }>; type AccountStore = System; type WeightInfo = pallet_balances::weights::SubstrateWeight; type FreezeIdentifier = ();