mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 14:11:09 +00:00
Fix phragmen election to wasm (#3898)
* Fix phragmen-election compile to wasm * Fix chain_spec stuff * Fix panic with no term duration
This commit is contained in:
@@ -235,11 +235,11 @@ pub fn testnet_genesis(
|
||||
members: vec![],
|
||||
phantom: Default::default(),
|
||||
}),
|
||||
elections: Some(ElectionsConfig {
|
||||
members: vec![],
|
||||
presentation_duration: 1 * DAYS,
|
||||
elections_phragmen: Some(ElectionsConfig {
|
||||
members: endowed_accounts.iter().take(2).cloned().collect(),
|
||||
term_duration: 28 * DAYS,
|
||||
desired_seats: 0,
|
||||
desired_members: 4,
|
||||
desired_runners_up: 1,
|
||||
}),
|
||||
contracts: Some(ContractsConfig {
|
||||
current_schedule: contracts::Schedule {
|
||||
|
||||
@@ -60,9 +60,6 @@ pub type DigestItem = generic::DigestItem<Hash>;
|
||||
/// Header type.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
/// Block type.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type Block = generic::Block<Header, OpaqueExtrinsic>;
|
||||
/// Block ID.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
|
||||
/// Opaque, encoded, unchecked extrinsic.
|
||||
pub type UncheckedExtrinsic = OpaqueExtrinsic;
|
||||
|
||||
@@ -33,7 +33,7 @@ collective = { package = "srml-collective", path = "../../srml/collective", defa
|
||||
contracts = { package = "srml-contracts", path = "../../srml/contracts", default-features = false }
|
||||
contracts-rpc-runtime-api = { package = "srml-contracts-rpc-runtime-api", path = "../../srml/contracts/rpc/runtime-api/", default-features = false }
|
||||
democracy = { package = "srml-democracy", path = "../../srml/democracy", default-features = false }
|
||||
elections = { package = "srml-elections", path = "../../srml/elections", default-features = false }
|
||||
elections-phragmen = { package = "srml-elections-phragmen", path = "../../srml/elections-phragmen", default-features = false }
|
||||
executive = { package = "srml-executive", path = "../../srml/executive", default-features = false }
|
||||
finality-tracker = { package = "srml-finality-tracker", path = "../../srml/finality-tracker", default-features = false }
|
||||
grandpa = { package = "srml-grandpa", path = "../../srml/grandpa", default-features = false }
|
||||
@@ -72,7 +72,7 @@ std = [
|
||||
"contracts/std",
|
||||
"contracts-rpc-runtime-api/std",
|
||||
"democracy/std",
|
||||
"elections/std",
|
||||
"elections-phragmen/std",
|
||||
"executive/std",
|
||||
"finality-tracker/std",
|
||||
"grandpa/std",
|
||||
|
||||
@@ -45,7 +45,6 @@ use sr_primitives::traits::{
|
||||
self, BlakeTwo256, Block as BlockT, NumberFor, StaticLookup, SaturatedConversion,
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
use elections::VoteIndex;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use version::NativeVersion;
|
||||
use primitives::OpaqueMetadata;
|
||||
@@ -84,8 +83,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
// and set impl_version to equal spec_version. If only runtime
|
||||
// implementation changes and behavior does not, then leave spec_version as
|
||||
// is and increment impl_version.
|
||||
spec_version: 181,
|
||||
impl_version: 183,
|
||||
spec_version: 182,
|
||||
impl_version: 182,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
};
|
||||
|
||||
@@ -324,33 +323,18 @@ impl collective::Trait<CouncilCollective> for Runtime {
|
||||
parameter_types! {
|
||||
pub const CandidacyBond: Balance = 10 * DOLLARS;
|
||||
pub const VotingBond: Balance = 1 * DOLLARS;
|
||||
pub const VotingFee: Balance = 2 * DOLLARS;
|
||||
pub const MinimumVotingLock: Balance = 1 * DOLLARS;
|
||||
pub const PresentSlashPerVoter: Balance = 1 * CENTS;
|
||||
pub const CarryCount: u32 = 6;
|
||||
// one additional vote should go by before an inactive voter can be reaped.
|
||||
pub const InactiveGracePeriod: VoteIndex = 1;
|
||||
pub const ElectionsVotingPeriod: BlockNumber = 2 * DAYS;
|
||||
pub const DecayRatio: u32 = 0;
|
||||
}
|
||||
|
||||
impl elections::Trait for Runtime {
|
||||
impl elections_phragmen::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type BadPresentation = ();
|
||||
type BadReaper = ();
|
||||
type BadVoterIndex = ();
|
||||
type LoserCandidate = ();
|
||||
type ChangeMembers = Council;
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
type CandidacyBond = CandidacyBond;
|
||||
type VotingBond = VotingBond;
|
||||
type VotingFee = VotingFee;
|
||||
type MinimumVotingLock = MinimumVotingLock;
|
||||
type PresentSlashPerVoter = PresentSlashPerVoter;
|
||||
type CarryCount = CarryCount;
|
||||
type InactiveGracePeriod = InactiveGracePeriod;
|
||||
type VotingPeriod = ElectionsVotingPeriod;
|
||||
type DecayRatio = DecayRatio;
|
||||
type LoserCandidate = ();
|
||||
type BadReport = ();
|
||||
type KickedMember = ();
|
||||
type ChangeMembers = Council;
|
||||
}
|
||||
|
||||
type TechnicalCollective = collective::Instance2;
|
||||
@@ -518,7 +502,7 @@ construct_runtime!(
|
||||
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
||||
Council: collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||
TechnicalCommittee: collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||
Elections: elections::{Module, Call, Storage, Event<T>, Config<T>},
|
||||
Elections: elections_phragmen::{Module, Call, Storage, Event<T>, Config<T>},
|
||||
TechnicalMembership: membership::<Instance1>::{Module, Call, Storage, Event<T>, Config<T>},
|
||||
FinalityTracker: finality_tracker::{Module, Call, Inherent},
|
||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||
|
||||
@@ -94,7 +94,7 @@ pub fn config(support_changes_trie: bool, code: Option<&[u8]>) -> GenesisConfig
|
||||
collective_Instance1: Some(Default::default()),
|
||||
collective_Instance2: Some(Default::default()),
|
||||
membership_Instance1: Some(Default::default()),
|
||||
elections: Some(Default::default()),
|
||||
elections_phragmen: Some(Default::default()),
|
||||
sudo: Some(Default::default()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user