mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 06:21:11 +00:00
* Companion PR to #5560 * Set priorities. * Update substrate. * Fix tests. * Update Substrate * Companion of SignedExtension refactor (#5540) Co-authored-by: Tomasz Drwięga <tomasz@parity.io> Co-authored-by: Alexander Theißen <alexander.theissen@parity.io>
This commit is contained in:
Generated
+233
-327
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ use sp_consensus::block_import::{BlockImport, ImportResult};
|
|||||||
use sp_consensus::Error as ConsensusError;
|
use sp_consensus::Error as ConsensusError;
|
||||||
use sp_consensus::{BlockOrigin, BlockImportParams, BlockCheckParams, JustificationImport};
|
use sp_consensus::{BlockOrigin, BlockImportParams, BlockCheckParams, JustificationImport};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use sc_network::{NetworkWorker, NetworkStateInfo, NetworkService, ReportHandle, config::ProtocolId};
|
use sc_network::{NetworkWorker, NetworkService, ReportHandle, config::ProtocolId};
|
||||||
use sc_network::config::{NetworkConfiguration, TransportConfig, BoxFinalityProofRequestBuilder};
|
use sc_network::config::{NetworkConfiguration, TransportConfig, BoxFinalityProofRequestBuilder};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
@@ -157,7 +157,7 @@ pub struct Peer<D> {
|
|||||||
|
|
||||||
impl<D> Peer<D> {
|
impl<D> Peer<D> {
|
||||||
/// Get this peer ID.
|
/// Get this peer ID.
|
||||||
pub fn id(&self) -> PeerId {
|
pub fn id(&self) -> &PeerId {
|
||||||
self.network.service().local_peer_id()
|
self.network.service().local_peer_id()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,7 +597,7 @@ pub trait TestNetFactory: Sized {
|
|||||||
|
|
||||||
self.mut_peers(|peers| {
|
self.mut_peers(|peers| {
|
||||||
for peer in peers.iter_mut() {
|
for peer in peers.iter_mut() {
|
||||||
peer.network.add_known_address(network.service().local_peer_id(), listen_addr.clone());
|
peer.network.add_known_address(network.service().local_peer_id().clone(), listen_addr.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let imported_blocks_stream = Box::pin(client.import_notification_stream().fuse());
|
let imported_blocks_stream = Box::pin(client.import_notification_stream().fuse());
|
||||||
@@ -672,7 +672,7 @@ pub trait TestNetFactory: Sized {
|
|||||||
|
|
||||||
self.mut_peers(|peers| {
|
self.mut_peers(|peers| {
|
||||||
for peer in peers.iter_mut() {
|
for peer in peers.iter_mut() {
|
||||||
peer.network.add_known_address(network.service().local_peer_id(), listen_addr.clone());
|
peer.network.add_known_address(network.service().local_peer_id().clone(), listen_addr.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let imported_blocks_stream = Box::pin(client.import_notification_stream().fuse());
|
let imported_blocks_stream = Box::pin(client.import_notification_stream().fuse());
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ use sp_runtime::{
|
|||||||
traits::{
|
traits::{
|
||||||
Hash as HashT, BlakeTwo256, Saturating, One, Zero, Dispatchable,
|
Hash as HashT, BlakeTwo256, Saturating, One, Zero, Dispatchable,
|
||||||
AccountIdConversion, BadOrigin, Convert, SignedExtension, AppVerify,
|
AccountIdConversion, BadOrigin, Convert, SignedExtension, AppVerify,
|
||||||
|
DispatchInfoOf,
|
||||||
},
|
},
|
||||||
transaction_validity::{TransactionValidityError, ValidTransaction, TransactionValidity},
|
transaction_validity::{TransactionValidityError, ValidTransaction, TransactionValidity},
|
||||||
};
|
};
|
||||||
@@ -35,7 +36,7 @@ use sp_staking::{
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
traits::KeyOwnerProofSystem,
|
traits::KeyOwnerProofSystem,
|
||||||
dispatch::{IsSubType},
|
dispatch::{IsSubType},
|
||||||
weights::{DispatchInfo, SimpleDispatchInfo, Weight, WeighData},
|
weights::{SimpleDispatchInfo, Weight, WeighData},
|
||||||
};
|
};
|
||||||
use primitives::{
|
use primitives::{
|
||||||
Balance,
|
Balance,
|
||||||
@@ -1456,7 +1457,6 @@ impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> wh
|
|||||||
type Call = <T as system::Trait>::Call;
|
type Call = <T as system::Trait>::Call;
|
||||||
type AdditionalSigned = ();
|
type AdditionalSigned = ();
|
||||||
type Pre = ();
|
type Pre = ();
|
||||||
type DispatchInfo = DispatchInfo;
|
|
||||||
|
|
||||||
fn additional_signed(&self)
|
fn additional_signed(&self)
|
||||||
-> sp_std::result::Result<Self::AdditionalSigned, TransactionValidityError>
|
-> sp_std::result::Result<Self::AdditionalSigned, TransactionValidityError>
|
||||||
@@ -1468,7 +1468,7 @@ impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> wh
|
|||||||
&self,
|
&self,
|
||||||
_who: &Self::AccountId,
|
_who: &Self::AccountId,
|
||||||
call: &Self::Call,
|
call: &Self::Call,
|
||||||
_info: DispatchInfo,
|
_info: &DispatchInfoOf<Self::Call>,
|
||||||
_len: usize,
|
_len: usize,
|
||||||
) -> TransactionValidity {
|
) -> TransactionValidity {
|
||||||
let r = ValidTransaction::default();
|
let r = ValidTransaction::default();
|
||||||
@@ -1538,6 +1538,7 @@ mod tests {
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
impl_outer_origin, impl_outer_dispatch, assert_ok, assert_err, parameter_types,
|
impl_outer_origin, impl_outer_dispatch, assert_ok, assert_err, parameter_types,
|
||||||
traits::{OnInitialize, OnFinalize},
|
traits::{OnInitialize, OnFinalize},
|
||||||
|
weights::DispatchInfo,
|
||||||
};
|
};
|
||||||
use crate::parachains;
|
use crate::parachains;
|
||||||
use crate::registrar;
|
use crate::registrar;
|
||||||
@@ -1699,6 +1700,7 @@ mod tests {
|
|||||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||||
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
||||||
pub const ElectionLookahead: BlockNumber = 0;
|
pub const ElectionLookahead: BlockNumber = 0;
|
||||||
|
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CurrencyToVoteHandler;
|
pub struct CurrencyToVoteHandler;
|
||||||
@@ -1730,6 +1732,7 @@ mod tests {
|
|||||||
type ElectionLookahead = ElectionLookahead;
|
type ElectionLookahead = ElectionLookahead;
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
|
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
|
||||||
|
type UnsignedPriority = StakingUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl attestations::Trait for Test {
|
impl attestations::Trait for Test {
|
||||||
@@ -1900,7 +1903,7 @@ mod tests {
|
|||||||
let call = Call::Parachains(inner.clone());
|
let call = Call::Parachains(inner.clone());
|
||||||
|
|
||||||
ValidateDoubleVoteReports::<Test>(sp_std::marker::PhantomData)
|
ValidateDoubleVoteReports::<Test>(sp_std::marker::PhantomData)
|
||||||
.validate(&0, &call, DispatchInfo::default(), 0)?;
|
.validate(&0, &call, &DispatchInfo::default(), 0)?;
|
||||||
|
|
||||||
Ok(inner)
|
Ok(inner)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ use codec::{Encode, Decode};
|
|||||||
|
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
transaction_validity::{TransactionValidityError, ValidTransaction, TransactionValidity},
|
transaction_validity::{TransactionValidityError, ValidTransaction, TransactionValidity},
|
||||||
traits::{Hash as HashT, SignedExtension}
|
traits::{Hash as HashT, SignedExtension, DispatchInfoOf},
|
||||||
};
|
};
|
||||||
|
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
decl_storage, decl_module, decl_event, decl_error, ensure,
|
decl_storage, decl_module, decl_event, decl_error, ensure,
|
||||||
dispatch::{DispatchResult, IsSubType}, traits::{Get, Currency, ReservableCurrency},
|
dispatch::{DispatchResult, IsSubType}, traits::{Get, Currency, ReservableCurrency},
|
||||||
weights::{SimpleDispatchInfo, DispatchInfo, Weight, WeighData},
|
weights::{SimpleDispatchInfo, Weight, WeighData},
|
||||||
};
|
};
|
||||||
use system::{self, ensure_root, ensure_signed};
|
use system::{self, ensure_root, ensure_signed};
|
||||||
use primitives::parachain::{
|
use primitives::parachain::{
|
||||||
@@ -588,7 +588,6 @@ impl<T: Trait + Send + Sync> SignedExtension for LimitParathreadCommits<T> where
|
|||||||
type Call = <T as system::Trait>::Call;
|
type Call = <T as system::Trait>::Call;
|
||||||
type AdditionalSigned = ();
|
type AdditionalSigned = ();
|
||||||
type Pre = ();
|
type Pre = ();
|
||||||
type DispatchInfo = DispatchInfo;
|
|
||||||
|
|
||||||
fn additional_signed(&self)
|
fn additional_signed(&self)
|
||||||
-> sp_std::result::Result<Self::AdditionalSigned, TransactionValidityError>
|
-> sp_std::result::Result<Self::AdditionalSigned, TransactionValidityError>
|
||||||
@@ -600,7 +599,7 @@ impl<T: Trait + Send + Sync> SignedExtension for LimitParathreadCommits<T> where
|
|||||||
&self,
|
&self,
|
||||||
_who: &Self::AccountId,
|
_who: &Self::AccountId,
|
||||||
call: &Self::Call,
|
call: &Self::Call,
|
||||||
_info: DispatchInfo,
|
_info: &DispatchInfoOf<Self::Call>,
|
||||||
_len: usize,
|
_len: usize,
|
||||||
) -> TransactionValidity {
|
) -> TransactionValidity {
|
||||||
let mut r = ValidTransaction::default();
|
let mut r = ValidTransaction::default();
|
||||||
@@ -673,6 +672,7 @@ mod tests {
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
traits::{KeyOwnerProofSystem, OnInitialize, OnFinalize},
|
traits::{KeyOwnerProofSystem, OnInitialize, OnFinalize},
|
||||||
impl_outer_origin, impl_outer_dispatch, assert_ok, parameter_types, assert_noop,
|
impl_outer_origin, impl_outer_dispatch, assert_ok, parameter_types, assert_noop,
|
||||||
|
weights::DispatchInfo,
|
||||||
};
|
};
|
||||||
use keyring::Sr25519Keyring;
|
use keyring::Sr25519Keyring;
|
||||||
|
|
||||||
@@ -803,6 +803,7 @@ mod tests {
|
|||||||
pub const ValidationUpgradeDelay: BlockNumber = 2;
|
pub const ValidationUpgradeDelay: BlockNumber = 2;
|
||||||
pub const SlashPeriod: BlockNumber = 50;
|
pub const SlashPeriod: BlockNumber = 50;
|
||||||
pub const ElectionLookahead: BlockNumber = 0;
|
pub const ElectionLookahead: BlockNumber = 0;
|
||||||
|
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl staking::Trait for Test {
|
impl staking::Trait for Test {
|
||||||
@@ -824,6 +825,7 @@ mod tests {
|
|||||||
type ElectionLookahead = ElectionLookahead;
|
type ElectionLookahead = ElectionLookahead;
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
|
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
|
||||||
|
type UnsignedPriority = StakingUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl timestamp::Trait for Test {
|
impl timestamp::Trait for Test {
|
||||||
@@ -969,7 +971,7 @@ mod tests {
|
|||||||
let inner_call = super::Call::select_parathread(id, col.clone(), hdh);
|
let inner_call = super::Call::select_parathread(id, col.clone(), hdh);
|
||||||
let call = Call::Registrar(inner_call);
|
let call = Call::Registrar(inner_call);
|
||||||
let origin = 4u64;
|
let origin = 4u64;
|
||||||
assert!(tx.validate(&origin, &call, Default::default(), 0).is_ok());
|
assert!(tx.validate(&origin, &call, &Default::default(), 0).is_ok());
|
||||||
assert_ok!(call.dispatch(Origin::signed(origin)));
|
assert_ok!(call.dispatch(Origin::signed(origin)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1416,7 +1418,7 @@ mod tests {
|
|||||||
let bad_para_id = user_id(1);
|
let bad_para_id = user_id(1);
|
||||||
let bad_head_hash = <Test as system::Trait>::Hashing::hash(&vec![1, 2, 1]);
|
let bad_head_hash = <Test as system::Trait>::Hashing::hash(&vec![1, 2, 1]);
|
||||||
let good_head_hash = <Test as system::Trait>::Hashing::hash(&vec![1, 1, 1]);
|
let good_head_hash = <Test as system::Trait>::Hashing::hash(&vec![1, 1, 1]);
|
||||||
let info = DispatchInfo::default();
|
let info = &DispatchInfo::default();
|
||||||
|
|
||||||
// Allow for threads
|
// Allow for threads
|
||||||
assert_ok!(Registrar::set_thread_count(Origin::ROOT, 10));
|
assert_ok!(Registrar::set_thread_count(Origin::ROOT, 10));
|
||||||
@@ -1481,7 +1483,7 @@ mod tests {
|
|||||||
let head_hash = <Test as system::Trait>::Hashing::hash(&vec![x; 3]);
|
let head_hash = <Test as system::Trait>::Hashing::hash(&vec![x; 3]);
|
||||||
let inner = super::Call::select_parathread(para_id, collator_id, head_hash);
|
let inner = super::Call::select_parathread(para_id, collator_id, head_hash);
|
||||||
let call = Call::Registrar(inner);
|
let call = Call::Registrar(inner);
|
||||||
let info = DispatchInfo::default();
|
let info = &DispatchInfo::default();
|
||||||
|
|
||||||
// First 3 transactions win a slot
|
// First 3 transactions win a slot
|
||||||
if x < 3 {
|
if x < 3 {
|
||||||
|
|||||||
@@ -36,10 +36,13 @@ use sp_runtime::{
|
|||||||
create_runtime_str, generic, impl_opaque_keys,
|
create_runtime_str, generic, impl_opaque_keys,
|
||||||
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, RuntimeDebug,
|
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, RuntimeDebug,
|
||||||
transaction_validity::{
|
transaction_validity::{
|
||||||
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource,
|
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource, TransactionPriority,
|
||||||
},
|
},
|
||||||
curve::PiecewiseLinear,
|
curve::PiecewiseLinear,
|
||||||
traits::{BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto, IdentityLookup},
|
traits::{
|
||||||
|
BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto, IdentityLookup,
|
||||||
|
DispatchInfoOf,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
use sp_runtime::RuntimeString;
|
use sp_runtime::RuntimeString;
|
||||||
@@ -51,7 +54,6 @@ use sp_core::OpaqueMetadata;
|
|||||||
use sp_staking::SessionIndex;
|
use sp_staking::SessionIndex;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
parameter_types, construct_runtime, traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
parameter_types, construct_runtime, traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
||||||
weights::DispatchInfo,
|
|
||||||
};
|
};
|
||||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
@@ -104,11 +106,16 @@ impl SignedExtension for RestrictFunctionality {
|
|||||||
type Call = Call;
|
type Call = Call;
|
||||||
type AdditionalSigned = ();
|
type AdditionalSigned = ();
|
||||||
type Pre = ();
|
type Pre = ();
|
||||||
type DispatchInfo = DispatchInfo;
|
|
||||||
|
|
||||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||||
|
|
||||||
fn validate(&self, _: &Self::AccountId, call: &Self::Call, _: DispatchInfo, _: usize)
|
fn validate(
|
||||||
|
&self,
|
||||||
|
_: &Self::AccountId,
|
||||||
|
call: &Self::Call,
|
||||||
|
_: &DispatchInfoOf<Self::Call>,
|
||||||
|
_: usize
|
||||||
|
)
|
||||||
-> TransactionValidity
|
-> TransactionValidity
|
||||||
{
|
{
|
||||||
match call {
|
match call {
|
||||||
@@ -313,6 +320,7 @@ impl staking::Trait for Runtime {
|
|||||||
type ElectionLookahead = ElectionLookahead;
|
type ElectionLookahead = ElectionLookahead;
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type SubmitTransaction = TransactionSubmitter<(), Runtime, UncheckedExtrinsic>;
|
type SubmitTransaction = TransactionSubmitter<(), Runtime, UncheckedExtrinsic>;
|
||||||
|
type UnsignedPriority = StakingUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -462,6 +470,11 @@ parameter_types! {
|
|||||||
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
|
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
|
||||||
|
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
|
||||||
|
}
|
||||||
|
|
||||||
impl im_online::Trait for Runtime {
|
impl im_online::Trait for Runtime {
|
||||||
type AuthorityId = ImOnlineId;
|
type AuthorityId = ImOnlineId;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
@@ -469,6 +482,7 @@ impl im_online::Trait for Runtime {
|
|||||||
type SubmitTransaction = SubmitTransaction;
|
type SubmitTransaction = SubmitTransaction;
|
||||||
type ReportUnresponsiveness = Offences;
|
type ReportUnresponsiveness = Offences;
|
||||||
type SessionDuration = SessionDuration;
|
type SessionDuration = SessionDuration;
|
||||||
|
type UnsignedPriority = StakingUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl grandpa::Trait for Runtime {
|
impl grandpa::Trait for Runtime {
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ use sp_runtime::{
|
|||||||
create_runtime_str, generic, impl_opaque_keys,
|
create_runtime_str, generic, impl_opaque_keys,
|
||||||
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, RuntimeDebug,
|
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, RuntimeDebug,
|
||||||
transaction_validity::{
|
transaction_validity::{
|
||||||
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource,
|
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource, TransactionPriority,
|
||||||
},
|
},
|
||||||
curve::PiecewiseLinear,
|
curve::PiecewiseLinear,
|
||||||
traits::{
|
traits::{
|
||||||
BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto,
|
BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto,
|
||||||
IdentityLookup
|
IdentityLookup, DispatchInfoOf,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
@@ -55,7 +55,6 @@ use sp_core::OpaqueMetadata;
|
|||||||
use sp_staking::SessionIndex;
|
use sp_staking::SessionIndex;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
parameter_types, construct_runtime, traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
parameter_types, construct_runtime, traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
||||||
weights::DispatchInfo,
|
|
||||||
};
|
};
|
||||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||||
@@ -112,11 +111,16 @@ impl SignedExtension for OnlyStakingAndClaims {
|
|||||||
type Call = Call;
|
type Call = Call;
|
||||||
type AdditionalSigned = ();
|
type AdditionalSigned = ();
|
||||||
type Pre = ();
|
type Pre = ();
|
||||||
type DispatchInfo = DispatchInfo;
|
|
||||||
|
|
||||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||||
|
|
||||||
fn validate(&self, _: &Self::AccountId, call: &Self::Call, _: DispatchInfo, _: usize)
|
fn validate(
|
||||||
|
&self, _:
|
||||||
|
&Self::AccountId,
|
||||||
|
call: &Self::Call,
|
||||||
|
_: &DispatchInfoOf<Self::Call>,
|
||||||
|
_: usize
|
||||||
|
)
|
||||||
-> TransactionValidity
|
-> TransactionValidity
|
||||||
{
|
{
|
||||||
match call {
|
match call {
|
||||||
@@ -320,6 +324,7 @@ impl staking::Trait for Runtime {
|
|||||||
type ElectionLookahead = ElectionLookahead;
|
type ElectionLookahead = ElectionLookahead;
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type SubmitTransaction = TransactionSubmitter<(), Runtime, UncheckedExtrinsic>;
|
type SubmitTransaction = TransactionSubmitter<(), Runtime, UncheckedExtrinsic>;
|
||||||
|
type UnsignedPriority = StakingUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -470,6 +475,11 @@ parameter_types! {
|
|||||||
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
|
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
|
||||||
|
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
|
||||||
|
}
|
||||||
|
|
||||||
impl im_online::Trait for Runtime {
|
impl im_online::Trait for Runtime {
|
||||||
type AuthorityId = ImOnlineId;
|
type AuthorityId = ImOnlineId;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
@@ -477,6 +487,7 @@ impl im_online::Trait for Runtime {
|
|||||||
type SubmitTransaction = SubmitTransaction;
|
type SubmitTransaction = SubmitTransaction;
|
||||||
type SessionDuration = SessionDuration;
|
type SessionDuration = SessionDuration;
|
||||||
type ReportUnresponsiveness = Offences;
|
type ReportUnresponsiveness = Offences;
|
||||||
|
type UnsignedPriority = ImOnlineUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl grandpa::Trait for Runtime {
|
impl grandpa::Trait for Runtime {
|
||||||
|
|||||||
@@ -36,10 +36,13 @@ use sp_runtime::{
|
|||||||
create_runtime_str, generic, impl_opaque_keys,
|
create_runtime_str, generic, impl_opaque_keys,
|
||||||
ApplyExtrinsicResult, Perbill, RuntimeDebug, KeyTypeId,
|
ApplyExtrinsicResult, Perbill, RuntimeDebug, KeyTypeId,
|
||||||
transaction_validity::{
|
transaction_validity::{
|
||||||
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource,
|
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource, TransactionPriority,
|
||||||
},
|
},
|
||||||
curve::PiecewiseLinear,
|
curve::PiecewiseLinear,
|
||||||
traits::{BlakeTwo256, Block as BlockT, StaticLookup, SignedExtension, OpaqueKeys, ConvertInto},
|
traits::{
|
||||||
|
BlakeTwo256, Block as BlockT, StaticLookup, SignedExtension, OpaqueKeys, ConvertInto,
|
||||||
|
DispatchInfoOf,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use version::RuntimeVersion;
|
use version::RuntimeVersion;
|
||||||
use grandpa::{AuthorityId as GrandpaId, fg_primitives};
|
use grandpa::{AuthorityId as GrandpaId, fg_primitives};
|
||||||
@@ -50,7 +53,6 @@ use sp_staking::SessionIndex;
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
parameter_types, construct_runtime,
|
parameter_types, construct_runtime,
|
||||||
traits::{KeyOwnerProofSystem, Randomness},
|
traits::{KeyOwnerProofSystem, Randomness},
|
||||||
weights::DispatchInfo,
|
|
||||||
};
|
};
|
||||||
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
||||||
use session::historical as session_historical;
|
use session::historical as session_historical;
|
||||||
@@ -100,11 +102,16 @@ impl SignedExtension for RestrictFunctionality {
|
|||||||
type Call = Call;
|
type Call = Call;
|
||||||
type AdditionalSigned = ();
|
type AdditionalSigned = ();
|
||||||
type Pre = ();
|
type Pre = ();
|
||||||
type DispatchInfo = DispatchInfo;
|
|
||||||
|
|
||||||
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
|
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||||
|
|
||||||
fn validate(&self, _: &Self::AccountId, call: &Self::Call, _: DispatchInfo, _: usize)
|
fn validate(
|
||||||
|
&self,
|
||||||
|
_: &Self::AccountId,
|
||||||
|
call: &Self::Call,
|
||||||
|
_: &DispatchInfoOf<Self::Call>,
|
||||||
|
_: usize
|
||||||
|
)
|
||||||
-> TransactionValidity
|
-> TransactionValidity
|
||||||
{
|
{
|
||||||
match call {
|
match call {
|
||||||
@@ -269,6 +276,7 @@ parameter_types! {
|
|||||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||||
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
||||||
pub const ElectionLookahead: BlockNumber = 0;
|
pub const ElectionLookahead: BlockNumber = 0;
|
||||||
|
pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl staking::Trait for Runtime {
|
impl staking::Trait for Runtime {
|
||||||
@@ -291,6 +299,7 @@ impl staking::Trait for Runtime {
|
|||||||
type ElectionLookahead = ElectionLookahead;
|
type ElectionLookahead = ElectionLookahead;
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Runtime, Extrinsic>;
|
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Runtime, Extrinsic>;
|
||||||
|
type UnsignedPriority = StakingUnsignedPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl grandpa::Trait for Runtime {
|
impl grandpa::Trait for Runtime {
|
||||||
|
|||||||
Reference in New Issue
Block a user