From 5f2a179e328f3415ad49b9d7662d4d8720417031 Mon Sep 17 00:00:00 2001 From: Zeke Mostov <32168567+emostov@users.noreply.github.com> Date: Fri, 23 Jul 2021 02:58:29 -0700 Subject: [PATCH] Reduce staking miner reward (companion `substrate/pull/9395`) (#3465) * Reduce staking miner reward * Add EOF * Fix stuff * remove import * Add tyoe * remove redundant stuff * update Substrate Co-authored-by: kianenigma Co-authored-by: parity-processbot <> --- relay/kusama/src/lib.rs | 17 +++++------------ relay/polkadot/src/lib.rs | 16 ++++------------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index e427686f20..f16c1da145 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -35,7 +35,7 @@ use runtime_common::{ claims, paras_registrar, xcm_sender, slots, auctions, crowdloan, SlowAdjustingFeeUpdate, CurrencyToVote, impls::DealWithFees, BlockHashCount, RocksDbWeight, BlockWeights, BlockLength, - OffchainSolutionWeightLimit, OffchainSolutionLengthLimit, elections::fee_for_submit_call, + OffchainSolutionWeightLimit, OffchainSolutionLengthLimit, ToAuthor, }; @@ -66,7 +66,7 @@ use xcm_executor::XcmExecutor; use sp_arithmetic::Perquintill; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, ApplyExtrinsicResult, KeyTypeId, Percent, - Permill, Perbill, FixedPointNumber, + Permill, Perbill, transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority}, traits::{ BlakeTwo256, Block as BlockT, OpaqueKeys, ConvertInto, AccountIdLookup, @@ -347,7 +347,6 @@ impl pallet_session::historical::Config for Runtime { type FullIdentificationOf = pallet_staking::ExposureOf; } -use pallet_election_provider_multi_phase::WeightInfo; parameter_types! { // phase durations. 1/4 of the last session for each. pub const SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4; @@ -360,15 +359,8 @@ parameter_types! { // 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 SignedRewardBase: Balance = fee_for_submit_call::( - // give 20% threshold. - sp_runtime::FixedU128::saturating_from_rational(12, 10), - // maximum weight possible. - weights::pallet_election_provider_multi_phase::WeightInfo::::submit(SignedMaxSubmissions::get()), - // assume a solution of 100kb length. - 100 * 1024 - ); - + // Each good submission will get 1/10 KSM as reward + pub SignedRewardBase: Balance = UNITS / 10; // fallback: emergency phase. pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy = pallet_election_provider_multi_phase::FallbackStrategy::Nothing; @@ -391,6 +383,7 @@ sp_npos_elections::generate_solution_type!( impl pallet_election_provider_multi_phase::Config for Runtime { type Event = Event; type Currency = Balances; + type EstimateCallFee = TransactionPayment; type UnsignedPhase = UnsignedPhase; type SignedMaxSubmissions = SignedMaxSubmissions; type SignedRewardBase = SignedRewardBase; diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 96c11958f5..213e54c806 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -26,7 +26,6 @@ use runtime_common::{ impls::DealWithFees, BlockHashCount, RocksDbWeight, BlockWeights, BlockLength, OffchainSolutionWeightLimit, OffchainSolutionLengthLimit, - elections::fee_for_submit_call, ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder, }; @@ -41,7 +40,7 @@ use primitives::v1::{ ValidatorIndex, InboundDownwardMessage, InboundHrmpMessage, SessionInfo, }; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, ApplyExtrinsicResult, FixedPointNumber, + create_runtime_str, generic, impl_opaque_keys, ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, curve::PiecewiseLinear, transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority}, traits::{ @@ -327,7 +326,6 @@ impl pallet_session::historical::Config for Runtime { type FullIdentificationOf = pallet_staking::ExposureOf; } -use pallet_election_provider_multi_phase::WeightInfo; parameter_types! { // phase durations. 1/4 of the last session for each. pub const SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4; @@ -340,15 +338,8 @@ parameter_types! { // 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 SignedRewardBase: Balance = fee_for_submit_call::( - // give 20% threshold. - sp_runtime::FixedU128::saturating_from_rational(12, 10), - // maximum weight possible. - weights::pallet_election_provider_multi_phase::WeightInfo::::submit(SignedMaxSubmissions::get()), - // assume a solution of 200kb length. - 200 * 1024 - ); - + // Each good submission will get 1 DOT as reward + pub SignedRewardBase: Balance = 1 * UNITS; // fallback: emergency phase. pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy = pallet_election_provider_multi_phase::FallbackStrategy::Nothing; @@ -371,6 +362,7 @@ sp_npos_elections::generate_solution_type!( impl pallet_election_provider_multi_phase::Config for Runtime { type Event = Event; type Currency = Balances; + type EstimateCallFee = TransactionPayment; type SignedPhase = SignedPhase; type UnsignedPhase = UnsignedPhase; type SignedMaxSubmissions = SignedMaxSubmissions;