More standard staking miner deposits (#3621)

This commit is contained in:
Kian Paimani
2021-08-11 23:08:16 +02:00
committed by GitHub
parent 4e89b6adde
commit ecf71233c3
3 changed files with 31 additions and 16 deletions
+16 -5
View File
@@ -345,11 +345,8 @@ parameter_types! {
// signed config
pub const SignedMaxSubmissions: u32 = 16;
pub const SignedDepositBase: Balance = deposit(1, 0);
// A typical solution occupies within an order of magnitude of 50kb.
// 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);
pub const SignedDepositBase: Balance = deposit(2, 0);
pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
// Each good submission will get 1/10 KSM as reward
pub SignedRewardBase: Balance = UNITS / 10;
// fallback: emergency phase.
@@ -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);
}
}