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

Companion for Decouple Staking and Election - Part 3: Signed Phase #2793

Merged
merged 20 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
36502dc
Companion for Decouple Staking and Election - Part 3: Signed Phase
coriolinus Apr 1, 2021
1e509e9
Merge remote-tracking branch 'origin/master' into prgn-companion-for-…
coriolinus May 26, 2021
9638fcf
Merge remote-tracking branch 'origin/master' into prgn-companion-for-…
coriolinus May 27, 2021
0fc8c64
remove some config types
coriolinus May 31, 2021
a7ded3d
Merge remote-tracking branch 'origin/master' into prgn-companion-for-…
coriolinus Jun 18, 2021
5a972b2
Merge remote-tracking branch 'origin/master' into prgn-companion-for-…
coriolinus Jun 23, 2021
3c51221
allow up to 5 signed submissions on polkadot and kusama
coriolinus Jun 23, 2021
9538b7e
signed phase is equal induration to unsigned phase
coriolinus Jun 23, 2021
3da0659
use chain defaults for base and per-byte deposits; >= 16 SignedMaxSub…
coriolinus Jun 23, 2021
0f380ae
use a small but non-trivial solution reward
coriolinus Jun 23, 2021
fd9e8c6
reduce signed deposit per byte fee
coriolinus Jun 23, 2021
a0372e3
reduce signed reward, adjust polkadot expected soln size
coriolinus Jun 23, 2021
e1f3a06
copy submit benchmark from substrate
coriolinus Jun 23, 2021
b19f7e1
demo calculating an appropriate fee for the signed reward
coriolinus Jun 23, 2021
ff228bc
SignedRewardBase is 1.5x the fee to submit a signed solution
coriolinus Jun 24, 2021
f97eca3
Merge remote-tracking branch 'origin/master' into prgn-companion-for-…
coriolinus Jun 24, 2021
f5b6dd5
all chains use deposit byte of base per 50k
coriolinus Jun 25, 2021
99a16f3
Merge remote-tracking branch 'origin/master' into prgn-companion-for-…
Jun 28, 2021
7084efc
update Substrate
Jun 28, 2021
8cf97b6
cargo update -p pallet-election-provider-multi-phase
coriolinus Jun 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ parameter_types! {
pub const SignedPhase: u32 = 0;
pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;

// signed config
pub const SignedMaxSubmissions: u32 = 0;
coriolinus marked this conversation as resolved.
Show resolved Hide resolved
pub const SignedRewardBase: Balance = 100 * CENTS;
pub const SignedDepositBase: Balance = 100 * CENTS;
pub const SignedDepositByte: Balance = 1 * CENTS;

// fallback: run election on-chain.
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
pallet_election_provider_multi_phase::FallbackStrategy::Nothing;
Expand All @@ -377,6 +383,14 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event;
type Currency = Balances;
type UnsignedPhase = UnsignedPhase;
type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedRewardBase = SignedRewardBase;
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight = Self::MinerMaxWeight;
type SlashHandler = (); // burn slashes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, could use more thought. My initial values here are all placeholders.

type RewardHandler = (); // nothing to do upon rewards
type SignedPhase = SignedPhase;
type SolutionImprovementThreshold = SolutionImprovementThreshold;
type MinerMaxIterations = MinerMaxIterations;
Expand Down
17 changes: 17 additions & 0 deletions runtime/kusama/src/weights/pallet_election_provider_multi_phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
fn submit(c: u32, ) -> Weight {
(84_430_000 as Weight)
// Standard Error: 146_000
.saturating_add((2_758_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 23_000
Expand All @@ -92,4 +99,14 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add((4_130_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
}
fn finalize_signed_phase_accept_solution() -> Weight {
(47_783_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn finalize_signed_phase_reject_solution() -> Weight {
(21_277_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
14 changes: 14 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ parameter_types! {
pub const SignedPhase: u32 = 0;
pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;

// signed config
pub const SignedMaxSubmissions: u32 = 0;
coriolinus marked this conversation as resolved.
Show resolved Hide resolved
pub const SignedRewardBase: Balance = 1 * DOLLARS;
coriolinus marked this conversation as resolved.
Show resolved Hide resolved
pub const SignedDepositBase: Balance = 1 * DOLLARS;
pub const SignedDepositByte: Balance = 1 * CENTS;

// fallback: run election on-chain.
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
pallet_election_provider_multi_phase::FallbackStrategy::Nothing;
Expand All @@ -358,6 +364,14 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type Currency = Balances;
type SignedPhase = SignedPhase;
type UnsignedPhase = UnsignedPhase;
type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedRewardBase = SignedRewardBase;
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight = Self::MinerMaxWeight;
type SlashHandler = (); // burn slashes
type RewardHandler = (); // nothing to do upon rewards
type SolutionImprovementThreshold = SolutionImprovementThreshold;
type MinerMaxIterations = MinerMaxIterations;
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,18 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add((3_405_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
}
fn finalize_signed_phase_accept_solution() -> Weight {
(47_783_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn finalize_signed_phase_reject_solution() -> Weight {
(21_277_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn submit(_: u32) -> Weight {
// needs a real benchmarking to get a real value here
0
}
}
18 changes: 16 additions & 2 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,16 @@ impl pallet_session::historical::Config for Runtime {
}

parameter_types! {
// no signed phase for now, just unsigned.
pub const SignedPhase: u32 = 0;
// phase durations. 1/4 of the last session for each.
pub const SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;

// signed config
pub const SignedMaxSubmissions: u32 = 128;
pub const SignedRewardBase: Balance = 100 * CENTS;
pub const SignedDepositBase: Balance = 100 * CENTS;
pub const SignedDepositByte: Balance = 1 * CENTS;

// fallback: run election on-chain.
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
pallet_election_provider_multi_phase::FallbackStrategy::Nothing;
Expand All @@ -364,6 +370,14 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type Currency = Balances;
type SignedPhase = SignedPhase;
type UnsignedPhase = UnsignedPhase;
type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedRewardBase = SignedRewardBase;
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight = Self::MinerMaxWeight;
type SlashHandler = (); // burn slashes
type RewardHandler = (); // nothing to do upon rewards
type SolutionImprovementThreshold = SolutionImprovementThreshold;
type MinerMaxIterations = MinerMaxIterations;
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,18 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add((3_700_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
}
fn finalize_signed_phase_accept_solution() -> Weight {
(47_783_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn finalize_signed_phase_reject_solution() -> Weight {
(21_277_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn submit(_: u32) -> Weight {
// need a real benchmark to get a value here
0
}
}