mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +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:
@@ -25,6 +25,7 @@ use sp_runtime::{
|
||||
traits::{
|
||||
Hash as HashT, BlakeTwo256, Saturating, One, Zero, Dispatchable,
|
||||
AccountIdConversion, BadOrigin, Convert, SignedExtension, AppVerify,
|
||||
DispatchInfoOf,
|
||||
},
|
||||
transaction_validity::{TransactionValidityError, ValidTransaction, TransactionValidity},
|
||||
};
|
||||
@@ -35,7 +36,7 @@ use sp_staking::{
|
||||
use frame_support::{
|
||||
traits::KeyOwnerProofSystem,
|
||||
dispatch::{IsSubType},
|
||||
weights::{DispatchInfo, SimpleDispatchInfo, Weight, WeighData},
|
||||
weights::{SimpleDispatchInfo, Weight, WeighData},
|
||||
};
|
||||
use primitives::{
|
||||
Balance,
|
||||
@@ -1456,7 +1457,6 @@ impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> wh
|
||||
type Call = <T as system::Trait>::Call;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
type DispatchInfo = DispatchInfo;
|
||||
|
||||
fn additional_signed(&self)
|
||||
-> sp_std::result::Result<Self::AdditionalSigned, TransactionValidityError>
|
||||
@@ -1468,7 +1468,7 @@ impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> wh
|
||||
&self,
|
||||
_who: &Self::AccountId,
|
||||
call: &Self::Call,
|
||||
_info: DispatchInfo,
|
||||
_info: &DispatchInfoOf<Self::Call>,
|
||||
_len: usize,
|
||||
) -> TransactionValidity {
|
||||
let r = ValidTransaction::default();
|
||||
@@ -1538,6 +1538,7 @@ mod tests {
|
||||
use frame_support::{
|
||||
impl_outer_origin, impl_outer_dispatch, assert_ok, assert_err, parameter_types,
|
||||
traits::{OnInitialize, OnFinalize},
|
||||
weights::DispatchInfo,
|
||||
};
|
||||
use crate::parachains;
|
||||
use crate::registrar;
|
||||
@@ -1699,6 +1700,7 @@ mod tests {
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
||||
pub const ElectionLookahead: BlockNumber = 0;
|
||||
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
|
||||
}
|
||||
|
||||
pub struct CurrencyToVoteHandler;
|
||||
@@ -1730,6 +1732,7 @@ mod tests {
|
||||
type ElectionLookahead = ElectionLookahead;
|
||||
type Call = Call;
|
||||
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
|
||||
type UnsignedPriority = StakingUnsignedPriority;
|
||||
}
|
||||
|
||||
impl attestations::Trait for Test {
|
||||
@@ -1900,7 +1903,7 @@ mod tests {
|
||||
let call = Call::Parachains(inner.clone());
|
||||
|
||||
ValidateDoubleVoteReports::<Test>(sp_std::marker::PhantomData)
|
||||
.validate(&0, &call, DispatchInfo::default(), 0)?;
|
||||
.validate(&0, &call, &DispatchInfo::default(), 0)?;
|
||||
|
||||
Ok(inner)
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ use codec::{Encode, Decode};
|
||||
|
||||
use sp_runtime::{
|
||||
transaction_validity::{TransactionValidityError, ValidTransaction, TransactionValidity},
|
||||
traits::{Hash as HashT, SignedExtension}
|
||||
traits::{Hash as HashT, SignedExtension, DispatchInfoOf},
|
||||
};
|
||||
|
||||
use frame_support::{
|
||||
decl_storage, decl_module, decl_event, decl_error, ensure,
|
||||
dispatch::{DispatchResult, IsSubType}, traits::{Get, Currency, ReservableCurrency},
|
||||
weights::{SimpleDispatchInfo, DispatchInfo, Weight, WeighData},
|
||||
weights::{SimpleDispatchInfo, Weight, WeighData},
|
||||
};
|
||||
use system::{self, ensure_root, ensure_signed};
|
||||
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 AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
type DispatchInfo = DispatchInfo;
|
||||
|
||||
fn additional_signed(&self)
|
||||
-> sp_std::result::Result<Self::AdditionalSigned, TransactionValidityError>
|
||||
@@ -600,7 +599,7 @@ impl<T: Trait + Send + Sync> SignedExtension for LimitParathreadCommits<T> where
|
||||
&self,
|
||||
_who: &Self::AccountId,
|
||||
call: &Self::Call,
|
||||
_info: DispatchInfo,
|
||||
_info: &DispatchInfoOf<Self::Call>,
|
||||
_len: usize,
|
||||
) -> TransactionValidity {
|
||||
let mut r = ValidTransaction::default();
|
||||
@@ -673,6 +672,7 @@ mod tests {
|
||||
use frame_support::{
|
||||
traits::{KeyOwnerProofSystem, OnInitialize, OnFinalize},
|
||||
impl_outer_origin, impl_outer_dispatch, assert_ok, parameter_types, assert_noop,
|
||||
weights::DispatchInfo,
|
||||
};
|
||||
use keyring::Sr25519Keyring;
|
||||
|
||||
@@ -803,6 +803,7 @@ mod tests {
|
||||
pub const ValidationUpgradeDelay: BlockNumber = 2;
|
||||
pub const SlashPeriod: BlockNumber = 50;
|
||||
pub const ElectionLookahead: BlockNumber = 0;
|
||||
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
|
||||
}
|
||||
|
||||
impl staking::Trait for Test {
|
||||
@@ -824,6 +825,7 @@ mod tests {
|
||||
type ElectionLookahead = ElectionLookahead;
|
||||
type Call = Call;
|
||||
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
|
||||
type UnsignedPriority = StakingUnsignedPriority;
|
||||
}
|
||||
|
||||
impl timestamp::Trait for Test {
|
||||
@@ -969,7 +971,7 @@ mod tests {
|
||||
let inner_call = super::Call::select_parathread(id, col.clone(), hdh);
|
||||
let call = Call::Registrar(inner_call);
|
||||
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)));
|
||||
}
|
||||
|
||||
@@ -1416,7 +1418,7 @@ mod tests {
|
||||
let bad_para_id = user_id(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 info = DispatchInfo::default();
|
||||
let info = &DispatchInfo::default();
|
||||
|
||||
// Allow for threads
|
||||
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 inner = super::Call::select_parathread(para_id, collator_id, head_hash);
|
||||
let call = Call::Registrar(inner);
|
||||
let info = DispatchInfo::default();
|
||||
let info = &DispatchInfo::default();
|
||||
|
||||
// First 3 transactions win a slot
|
||||
if x < 3 {
|
||||
|
||||
Reference in New Issue
Block a user