pub trait MinerConfig {
type AccountId: Ord + Clone + Codec + Debug;
type Solution: Codec + Default + PartialEq + Eq + Clone + Debug + Ord + NposSolution + TypeInfo;
type MaxVotesPerVoter;
type MaxLength: Get<u32>;
type MaxWeight: Get<Weight>;
type MaxWinners: Get<u32>;
// Required method
fn solution_weight(
voters: u32,
targets: u32,
active_voters: u32,
degree: u32
) -> Weight;
}
Expand description
Configurations for a miner that comes with this pallet.
Required Associated Types§
sourcetype Solution: Codec + Default + PartialEq + Eq + Clone + Debug + Ord + NposSolution + TypeInfo
type Solution: Codec + Default + PartialEq + Eq + Clone + Debug + Ord + NposSolution + TypeInfo
The solution that the miner is mining.
sourcetype MaxVotesPerVoter
type MaxVotesPerVoter
Maximum number of votes per voter in the snapshots.
sourcetype MaxLength: Get<u32>
type MaxLength: Get<u32>
Maximum length of the solution that the miner is allowed to generate.
Solutions are trimmed to respect this.
sourcetype MaxWeight: Get<Weight>
type MaxWeight: Get<Weight>
Maximum weight of the solution that the miner is allowed to generate.
Solutions are trimmed to respect this.
The weight is computed using solution_weight
.
sourcetype MaxWinners: Get<u32>
type MaxWinners: Get<u32>
The maximum number of winners that can be elected.
Required Methods§
sourcefn solution_weight(
voters: u32,
targets: u32,
active_voters: u32,
degree: u32
) -> Weight
fn solution_weight( voters: u32, targets: u32, active_voters: u32, degree: u32 ) -> Weight
Something that can compute the weight of a solution.
This weight estimate is then used to trim the solution, based on MinerConfig::MaxWeight
.