Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 13aa592

Browse files
kianenigmachevdor
authored andcommitted
More standard staking miner deposits (#3621)
1 parent 0d59b92 commit 13aa592

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

runtime/kusama/src/lib.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,8 @@ parameter_types! {
351351

352352
// signed config
353353
pub const SignedMaxSubmissions: u32 = 16;
354-
pub const SignedDepositBase: Balance = deposit(1, 0);
355-
// A typical solution occupies within an order of magnitude of 50kb.
356-
// This formula is currently adjusted such that a typical solution will spend an amount equal
357-
// to the base deposit for every 50 kb.
358-
pub const SignedDepositByte: Balance = deposit(1, 0) / (50 * 1024);
354+
pub const SignedDepositBase: Balance = deposit(2, 0);
355+
pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
359356
// Each good submission will get 1/10 KSM as reward
360357
pub SignedRewardBase: Balance = UNITS / 10;
361358
// fallback: emergency phase.
@@ -1978,3 +1975,17 @@ sp_api::impl_runtime_apis! {
19781975
}
19791976
}
19801977
}
1978+
1979+
#[cfg(test)]
1980+
mod tests_fess {
1981+
use super::*;
1982+
use sp_runtime::assert_eq_error_rate;
1983+
1984+
#[test]
1985+
fn signed_deposit_is_sensible() {
1986+
// ensure this number does not change, or that it is checked after each change.
1987+
// a 1 MB solution should need around 0.16 KSM deposit
1988+
let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024);
1989+
assert_eq_error_rate!(deposit, UNITS * 16 / 100, UNITS / 100);
1990+
}
1991+
}

runtime/polkadot/src/lib.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,10 @@ parameter_types! {
350350

351351
// signed config
352352
pub const SignedMaxSubmissions: u32 = 16;
353-
pub const SignedDepositBase: Balance = deposit(1, 0);
354-
// A typical solution occupies within an order of magnitude of 50kb.
355-
// This formula is currently adjusted such that a typical solution will spend an amount equal
356-
// to the base deposit for every 50 kb.
357-
pub const SignedDepositByte: Balance = deposit(1, 0) / (50 * 1024);
353+
// 40 DOTs fixed deposit..
354+
pub const SignedDepositBase: Balance = deposit(2, 0);
355+
// 0.01 DOT per KB of solution data.
356+
pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
358357
// Each good submission will get 1 DOT as reward
359358
pub SignedRewardBase: Balance = 1 * UNITS;
360359
// fallback: emergency phase.
@@ -1549,7 +1548,7 @@ mod test_fees {
15491548
use pallet_transaction_payment::Multiplier;
15501549
use parity_scale_codec::Encode;
15511550
use separator::Separatable;
1552-
use sp_runtime::FixedPointNumber;
1551+
use sp_runtime::{assert_eq_error_rate, FixedPointNumber};
15531552

15541553
#[test]
15551554
fn payout_weight_portion() {
@@ -1674,4 +1673,12 @@ mod test_fees {
16741673
println!("can support {} nominators to yield a weight of {}", active, weight_with(active));
16751674
assert!(active > target_voters, "we need to reevaluate the weight of the election system");
16761675
}
1676+
1677+
#[test]
1678+
fn signed_deposit_is_sensible() {
1679+
// ensure this number does not change, or that it is checked after each change.
1680+
// a 1 MB solution should take (40 + 10) DOTs of deposit.
1681+
let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024);
1682+
assert_eq_error_rate!(deposit, 50 * DOLLARS, DOLLARS);
1683+
}
16771684
}

runtime/westend/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,8 @@ parameter_types! {
336336

337337
// signed config
338338
pub const SignedMaxSubmissions: u32 = 128;
339-
pub const SignedDepositBase: Balance = deposit(1, 0);
340-
// A typical solution occupies within an order of magnitude of 50kb.
341-
// This formula is currently adjusted such that a typical solution will spend an amount equal
342-
// to the base deposit for every 50 kb.
343-
pub const SignedDepositByte: Balance = deposit(1, 0) / (50 * 1024);
339+
pub const SignedDepositBase: Balance = deposit(2, 0);
340+
pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
344341
// Each good submission will get 1 WND as reward
345342
pub SignedRewardBase: Balance = 1 * UNITS;
346343
// fallback: emergency phase.

0 commit comments

Comments
 (0)