mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 17:31:03 +00:00
Parachains double vote handler initial implementation. (#840)
* Parachains double vote handler initial implementation. * Make tests test the actual slashing. * Implement SignedExtension validation of double vote reports. * Fixes build after merge * Review fixes * Adds historical session proofs * Review fixes. * Bump runtime spec_version * Get the session number from the proof * Check that proof matches session * Change signature type on DoubleVoteReport * Adds docs and removes blank lines * Removes leftover code * Fix build * Fix build after a merge * Apply suggestions from code review Co-Authored-By: Robert Habermeier <rphmeier@gmail.com> * Prune ParentToSessionIndex * Remove a clone and a warning Co-authored-by: Robert Habermeier <rphmeier@gmail.com> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -34,7 +34,7 @@ use runtime_common::{attestations, claims, parachains, registrar, slots,
|
||||
};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
ApplyExtrinsicResult, Percent, Permill, Perbill, RuntimeDebug,
|
||||
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, RuntimeDebug,
|
||||
transaction_validity::{TransactionValidity, InvalidTransaction, TransactionValidityError},
|
||||
curve::PiecewiseLinear,
|
||||
traits::{BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto, IdentityLookup},
|
||||
@@ -48,13 +48,14 @@ use version::NativeVersion;
|
||||
use sp_core::OpaqueMetadata;
|
||||
use sp_staking::SessionIndex;
|
||||
use frame_support::{
|
||||
parameter_types, construct_runtime, traits::{SplitTwoWays, Randomness},
|
||||
parameter_types, construct_runtime, traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
||||
weights::DispatchInfo,
|
||||
};
|
||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||
use system::offchain::TransactionSubmitter;
|
||||
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
||||
use session::{historical as session_historical};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use staking::StakerStatus;
|
||||
@@ -491,6 +492,10 @@ impl parachains::Trait for Runtime {
|
||||
type Registrar = Registrar;
|
||||
type MaxCodeSize = MaxCodeSize;
|
||||
type MaxHeadDataSize = MaxHeadDataSize;
|
||||
type Proof = session::historical::Proof;
|
||||
type KeyOwnerProofSystem = session::historical::Module<Self>;
|
||||
type IdentificationTuple = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::IdentificationTuple;
|
||||
type ReportOffence = Offences;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -648,6 +653,7 @@ construct_runtime! {
|
||||
Authorship: authorship::{Module, Call, Storage},
|
||||
Staking: staking::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
Offences: offences::{Module, Call, Storage, Event},
|
||||
Historical: session_historical::{Module},
|
||||
Session: session::{Module, Call, Storage, Event, Config<T>},
|
||||
FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent},
|
||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||
@@ -708,7 +714,8 @@ pub type SignedExtra = (
|
||||
system::CheckNonce<Runtime>,
|
||||
system::CheckWeight<Runtime>,
|
||||
transaction_payment::ChargeTransactionPayment::<Runtime>,
|
||||
registrar::LimitParathreadCommits<Runtime>
|
||||
registrar::LimitParathreadCommits<Runtime>,
|
||||
parachains::ValidateDoubleVoteReports<Runtime>,
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
|
||||
Reference in New Issue
Block a user