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

Commit

Permalink
Revert "demo calculating an appropriate fee for the signed reward"
Browse files Browse the repository at this point in the history
This reverts commit b19f7e1.
  • Loading branch information
coriolinus committed Jun 23, 2021
1 parent b19f7e1 commit 07e9101
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 73 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "ma
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

pallet-beefy = { git = "https://github.com/paritytech/grandpa-bridge-gadget", branch = "master", default-features = false }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

Expand Down Expand Up @@ -91,7 +91,6 @@ std = [
"pallet-vesting/std",
"pallet-transaction-payment/std",
"pallet-treasury/std",
"pallet-election-provider-multi-phase/std",
"slot-range-helper/std",
"sp-runtime/std",
"sp-session/std",
Expand Down
61 changes: 0 additions & 61 deletions runtime/common/src/elections.rs

This file was deleted.

24 changes: 21 additions & 3 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -30,7 +30,6 @@ pub mod paras_registrar;
pub mod slot_range;
pub mod traits;
pub mod xcm_sender;
pub mod elections;

#[cfg(test)]
mod mock;
Expand All @@ -55,7 +54,6 @@ pub use pallet_staking::StakerStatus;
pub use sp_runtime::BuildStorage;
pub use pallet_timestamp::Call as TimestampCall;
pub use pallet_balances::Call as BalancesCall;
pub use elections::{OffchainSolutionLengthLimit, OffchainSolutionWeightLimit};

/// Implementations of some helper traits passed into runtime modules as associated types.
pub use impls::ToAuthor;
Expand Down Expand Up @@ -110,6 +108,26 @@ parameter_types! {
.build_or_panic();
}

parameter_types! {
/// A limit for off-chain phragmen unsigned solution submission.
///
/// We want to keep it as high as possible, but can't risk having it reject,
/// so we always subtract the base block execution weight.
pub OffchainSolutionWeightLimit: Weight = BlockWeights::get()
.get(DispatchClass::Normal)
.max_extrinsic
.expect("Normal extrinsics have weight limit configured by default; qed")
.saturating_sub(BlockExecutionWeight::get());

/// A limit for off-chain phragmen unsigned solution length.
///
/// We allow up to 90% of the block's size to be consumed by the solution.
pub OffchainSolutionLengthLimit: u32 = Perbill::from_rational(90_u32, 100) *
*BlockLength::get()
.max
.get(DispatchClass::Normal);
}

/// Parameterized slow adjusting fee updated based on
/// https://w3f-research.readthedocs.io/en/latest/polkadot/Token%20Economics.html#-2.-slow-adjusting-mechanism
pub type SlowAdjustingFeeUpdate<R> = TargetedFeeAdjustment<
Expand Down
7 changes: 1 addition & 6 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use runtime_common::{
impls::ToAuthor,
BlockHashCount, BlockWeights, BlockLength, RocksDbWeight,
OffchainSolutionWeightLimit, OffchainSolutionLengthLimit,
elections::fee_for_weight,
};

use runtime_parachains::origin as parachains_origin;
Expand Down Expand Up @@ -344,11 +343,7 @@ parameter_types! {
// A typical solution occupies 20kb. This formula is currently adjusted such that a typical
// solution will spend approximately equal amounts on the base and per-byte deposits.
pub const SignedDepositByte: Balance = deposit(1, 0) / (20 * 1024 * 1024);
pub const SignedRewardBase: Balance = fee_for_weight::<
Runtime,
crate::constants::fee::WeightToFee,
crate::weights::pallet_election_provider_multi_phase::WeightInfo<Runtime>,
>(Perbill::from_perthousand(3500));
pub const SignedRewardBase: Balance = 1 * CENTS;

// fallback: emergency phase.
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
Expand Down

0 comments on commit 07e9101

Please sign in to comment.