Skip to content

Commit

Permalink
Calculate staking UnsignedPhase from epoch duration. (#1707)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Dossa <adam.dossa@gmail.com>
  • Loading branch information
Neopallium and adamdossa committed Aug 27, 2024
1 parent 3b793ca commit c390efe
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion pallets/runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ parameter_types! {
pub const SignedDepositBase: Balance = 0;
pub const SignedDepositByte: Balance = 0;
// Unsigned phase
pub const UnsignedPhase: u32 = 1_200;
pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000);
pub const MultiPhaseUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2 - 1u64;
// Fallback parameters
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/common/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ macro_rules! misc_pallet_impls {
// Something that can estimate the fee of a call (used when submitting a solution for the signed phase)
type EstimateCallFee = polymesh_runtime_common::impls::EstimateCallFeeMax;
// Duration of the unsigned phase
type UnsignedPhase = polymesh_runtime_common::UnsignedPhase;
type UnsignedPhase = UnsignedPhase;
#[cfg(not(feature = "runtime-benchmarks"))]
// Duration of the signed phase
type SignedPhase = polymesh_runtime_common::SignedPhase;
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 1_024;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const UnsignedPhase: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33);
// 0.05%. The higher the value, the more strict solution acceptance becomes.
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/mainnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 1_024;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const UnsignedPhase: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33);
// 0.05%. The higher the value, the more strict solution acceptance becomes.
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/testnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 1_024;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const UnsignedPhase: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33);
// 0.05%. The higher the value, the more strict solution acceptance becomes.
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/tests/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ parameter_types! {
pub const SessionsPerEra: sp_staking::SessionIndex = 3;
pub const BondingDuration: EraIndex = 7;
pub const SlashDeferDuration: EraIndex = 4;
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const UnsignedPhase: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000);
pub const MaxNominatorRewardedPerValidator: u32 = 1_024;
Expand Down

0 comments on commit c390efe

Please sign in to comment.