Unverified Commit 686e3180 authored by Kian Paimani's avatar Kian Paimani Committed by GitHub
Browse files

More standard staking miner deposits (#3621)

parent f0063c27
Pipeline #152395 passed with stages
in 47 minutes and 29 seconds
...@@ -345,11 +345,8 @@ parameter_types! { ...@@ -345,11 +345,8 @@ parameter_types! {
// signed config // signed config
pub const SignedMaxSubmissions: u32 = 16; pub const SignedMaxSubmissions: u32 = 16;
pub const SignedDepositBase: Balance = deposit(1, 0); pub const SignedDepositBase: Balance = deposit(2, 0);
// A typical solution occupies within an order of magnitude of 50kb. pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
// This formula is currently adjusted such that a typical solution will spend an amount equal
// to the base deposit for every 50 kb.
pub const SignedDepositByte: Balance = deposit(1, 0) / (50 * 1024);
// Each good submission will get 1/10 KSM as reward // Each good submission will get 1/10 KSM as reward
pub SignedRewardBase: Balance = UNITS / 10; pub SignedRewardBase: Balance = UNITS / 10;
// fallback: emergency phase. // fallback: emergency phase.
...@@ -1921,3 +1918,17 @@ sp_api::impl_runtime_apis! { ...@@ -1921,3 +1918,17 @@ sp_api::impl_runtime_apis! {
} }
} }
} }
#[cfg(test)]
mod tests_fess {
use super::*;
use sp_runtime::assert_eq_error_rate;
#[test]
fn signed_deposit_is_sensible() {
// ensure this number does not change, or that it is checked after each change.
// a 1 MB solution should need around 0.16 KSM deposit
let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024);
assert_eq_error_rate!(deposit, UNITS * 16 / 100, UNITS / 100);
}
}
...@@ -350,11 +350,10 @@ parameter_types! { ...@@ -350,11 +350,10 @@ parameter_types! {
// signed config // signed config
pub const SignedMaxSubmissions: u32 = 16; pub const SignedMaxSubmissions: u32 = 16;
pub const SignedDepositBase: Balance = deposit(1, 0); // 40 DOTs fixed deposit..
// A typical solution occupies within an order of magnitude of 50kb. pub const SignedDepositBase: Balance = deposit(2, 0);
// This formula is currently adjusted such that a typical solution will spend an amount equal // 0.01 DOT per KB of solution data.
// to the base deposit for every 50 kb. pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
pub const SignedDepositByte: Balance = deposit(1, 0) / (50 * 1024);
// Each good submission will get 1 DOT as reward // Each good submission will get 1 DOT as reward
pub SignedRewardBase: Balance = 1 * UNITS; pub SignedRewardBase: Balance = 1 * UNITS;
// fallback: emergency phase. // fallback: emergency phase.
...@@ -1549,7 +1548,7 @@ mod test_fees { ...@@ -1549,7 +1548,7 @@ mod test_fees {
use pallet_transaction_payment::Multiplier; use pallet_transaction_payment::Multiplier;
use parity_scale_codec::Encode; use parity_scale_codec::Encode;
use separator::Separatable; use separator::Separatable;
use sp_runtime::FixedPointNumber; use sp_runtime::{assert_eq_error_rate, FixedPointNumber};
#[test] #[test]
fn payout_weight_portion() { fn payout_weight_portion() {
...@@ -1674,6 +1673,14 @@ mod test_fees { ...@@ -1674,6 +1673,14 @@ mod test_fees {
println!("can support {} nominators to yield a weight of {}", active, weight_with(active)); println!("can support {} nominators to yield a weight of {}", active, weight_with(active));
assert!(active > target_voters, "we need to reevaluate the weight of the election system"); assert!(active > target_voters, "we need to reevaluate the weight of the election system");
} }
#[test]
fn signed_deposit_is_sensible() {
// ensure this number does not change, or that it is checked after each change.
// a 1 MB solution should take (40 + 10) DOTs of deposit.
let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024);
assert_eq_error_rate!(deposit, 50 * DOLLARS, DOLLARS);
}
} }
#[cfg(test)] #[cfg(test)]
......
...@@ -331,11 +331,8 @@ parameter_types! { ...@@ -331,11 +331,8 @@ parameter_types! {
// signed config // signed config
pub const SignedMaxSubmissions: u32 = 128; pub const SignedMaxSubmissions: u32 = 128;
pub const SignedDepositBase: Balance = deposit(1, 0); pub const SignedDepositBase: Balance = deposit(2, 0);
// A typical solution occupies within an order of magnitude of 50kb. pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
// This formula is currently adjusted such that a typical solution will spend an amount equal
// to the base deposit for every 50 kb.
pub const SignedDepositByte: Balance = deposit(1, 0) / (50 * 1024);
// Each good submission will get 1 WND as reward // Each good submission will get 1 WND as reward
pub SignedRewardBase: Balance = 1 * UNITS; pub SignedRewardBase: Balance = 1 * UNITS;
// fallback: emergency phase. // fallback: emergency phase.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment