Skip to content

Commit

Permalink
Reduce staking miner reward (companion substrate/pull/9395) (#3465)
Browse files Browse the repository at this point in the history
* Reduce staking miner reward

* Add EOF

* Fix stuff

* remove import

* Add tyoe

* remove redundant stuff

* update Substrate

Co-authored-by: kianenigma <[email protected]>
Co-authored-by: parity-processbot <>
  • Loading branch information
emostov and kianenigma authored Jul 23, 2021
1 parent dca9d22 commit 5f2a179
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
17 changes: 5 additions & 12 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -347,7 +347,6 @@ impl pallet_session::historical::Config for Runtime {
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}

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;
Expand All @@ -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::<Runtime>(
// give 20% threshold.
sp_runtime::FixedU128::saturating_from_rational(12, 10),
// maximum weight possible.
weights::pallet_election_provider_multi_phase::WeightInfo::<Runtime>::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;
Expand All @@ -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;
Expand Down
16 changes: 4 additions & 12 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use runtime_common::{
impls::DealWithFees,
BlockHashCount, RocksDbWeight, BlockWeights, BlockLength,
OffchainSolutionWeightLimit, OffchainSolutionLengthLimit,
elections::fee_for_submit_call,
ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder,
};

Expand All @@ -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::{
Expand Down Expand Up @@ -327,7 +326,6 @@ impl pallet_session::historical::Config for Runtime {
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}

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;
Expand All @@ -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::<Runtime>(
// give 20% threshold.
sp_runtime::FixedU128::saturating_from_rational(12, 10),
// maximum weight possible.
weights::pallet_election_provider_multi_phase::WeightInfo::<Runtime>::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;
Expand All @@ -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;
Expand Down

0 comments on commit 5f2a179

Please sign in to comment.