mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 18:11:03 +00:00
Companion for substrate#14471 (#7432)
* Companion for substrate#14471 * add missing MaxNominators constant * missing MaxNominators in test-runtime * missing MaxNominators in runtime/integration_tests * Dont use deprecated functions Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fixup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * update lockfile for {"substrate"} * Update Substrate dep Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+183
-183
File diff suppressed because it is too large
Load Diff
@@ -149,6 +149,7 @@ impl pallet_babe::Config for Test {
|
|||||||
type DisabledValidators = ();
|
type DisabledValidators = ();
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = ConstU32<0>;
|
||||||
type KeyOwnerProof = sp_core::Void;
|
type KeyOwnerProof = sp_core::Void;
|
||||||
type EquivocationReportSystem = ();
|
type EquivocationReportSystem = ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ impl pallet_babe::Config for Runtime {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
|
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -715,6 +716,7 @@ impl pallet_grandpa::Config for Runtime {
|
|||||||
|
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
||||||
|
|
||||||
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ impl pallet_babe::Config for Test {
|
|||||||
type DisabledValidators = ();
|
type DisabledValidators = ();
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = ConstU32<0>;
|
||||||
type KeyOwnerProof = sp_core::Void;
|
type KeyOwnerProof = sp_core::Void;
|
||||||
type EquivocationReportSystem = ();
|
type EquivocationReportSystem = ();
|
||||||
}
|
}
|
||||||
@@ -439,7 +440,7 @@ impl ProcessMessage for TestProcessMessage {
|
|||||||
Ok(w) => Weight::from_parts(w as u64, w as u64),
|
Ok(w) => Weight::from_parts(w as u64, w as u64),
|
||||||
Err(_) => return Err(ProcessMessageError::Corrupt), // same as the real `ProcessMessage`
|
Err(_) => return Err(ProcessMessageError::Corrupt), // same as the real `ProcessMessage`
|
||||||
};
|
};
|
||||||
if !meter.check_accrue(required) {
|
if meter.try_consume(required).is_err() {
|
||||||
return Err(ProcessMessageError::Overweight(required))
|
return Err(ProcessMessageError::Overweight(required))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ impl pallet_babe::Config for Runtime {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
|
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
|
|
||||||
type KeyOwnerProof =
|
type KeyOwnerProof =
|
||||||
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
||||||
@@ -763,6 +764,7 @@ impl pallet_grandpa::Config for Runtime {
|
|||||||
|
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
||||||
|
|
||||||
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ impl pallet_babe::Config for Runtime {
|
|||||||
type DisabledValidators = Session;
|
type DisabledValidators = Session;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = ConstU32<0>;
|
||||||
type KeyOwnerProof =
|
type KeyOwnerProof =
|
||||||
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
||||||
type EquivocationReportSystem =
|
type EquivocationReportSystem =
|
||||||
@@ -659,6 +660,7 @@ impl pallet_grandpa::Config for Runtime {
|
|||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = ConstU32<0>;
|
||||||
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
||||||
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
||||||
type EquivocationReportSystem =
|
type EquivocationReportSystem =
|
||||||
@@ -1261,6 +1263,7 @@ parameter_types! {
|
|||||||
impl pallet_beefy::Config for Runtime {
|
impl pallet_beefy::Config for Runtime {
|
||||||
type BeefyId = BeefyId;
|
type BeefyId = BeefyId;
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = ConstU32<0>;
|
||||||
type MaxSetIdSessionEntries = BeefySetIdSessionEntries;
|
type MaxSetIdSessionEntries = BeefySetIdSessionEntries;
|
||||||
type OnNewValidatorSet = MmrLeaf;
|
type OnNewValidatorSet = MmrLeaf;
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ impl pallet_babe::Config for Runtime {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
|
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
|
|
||||||
type KeyOwnerProof =
|
type KeyOwnerProof =
|
||||||
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
||||||
@@ -370,6 +371,7 @@ impl pallet_grandpa::Config for Runtime {
|
|||||||
|
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
||||||
|
|
||||||
type KeyOwnerProof = sp_core::Void;
|
type KeyOwnerProof = sp_core::Void;
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ impl pallet_babe::Config for Runtime {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
|
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
|
|
||||||
type KeyOwnerProof =
|
type KeyOwnerProof =
|
||||||
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
||||||
@@ -591,6 +592,7 @@ impl pallet_grandpa::Config for Runtime {
|
|||||||
|
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxAuthorities;
|
||||||
|
type MaxNominators = MaxNominatorRewardedPerValidator;
|
||||||
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
||||||
|
|
||||||
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ impl<
|
|||||||
.map_err(|_| ProcessMessageError::Unsupported)?;
|
.map_err(|_| ProcessMessageError::Unsupported)?;
|
||||||
let pre = XcmExecutor::prepare(message).map_err(|_| ProcessMessageError::Unsupported)?;
|
let pre = XcmExecutor::prepare(message).map_err(|_| ProcessMessageError::Unsupported)?;
|
||||||
let required = pre.weight_of();
|
let required = pre.weight_of();
|
||||||
ensure!(meter.can_accrue(required), ProcessMessageError::Overweight(required));
|
ensure!(meter.can_consume(required), ProcessMessageError::Overweight(required));
|
||||||
|
|
||||||
let (consumed, result) = match XcmExecutor::execute(origin.into(), pre, id, Weight::zero())
|
let (consumed, result) = match XcmExecutor::execute(origin.into(), pre, id, Weight::zero())
|
||||||
{
|
{
|
||||||
@@ -60,7 +60,7 @@ impl<
|
|||||||
// In the error-case we assume the worst case and consume all possible weight.
|
// In the error-case we assume the worst case and consume all possible weight.
|
||||||
Outcome::Error(_) => (required, Err(ProcessMessageError::Unsupported)),
|
Outcome::Error(_) => (required, Err(ProcessMessageError::Unsupported)),
|
||||||
};
|
};
|
||||||
meter.defensive_saturating_accrue(consumed);
|
meter.consume(consumed);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,14 +116,14 @@ mod tests {
|
|||||||
Processor::process_message(msg, ORIGIN, meter, &mut id),
|
Processor::process_message(msg, ORIGIN, meter, &mut id),
|
||||||
Overweight(1000.into())
|
Overweight(1000.into())
|
||||||
);
|
);
|
||||||
assert_eq!(meter.consumed, 0.into());
|
assert_eq!(meter.consumed(), 0.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Works with a limit of 1000.
|
// Works with a limit of 1000.
|
||||||
let meter = &mut WeightMeter::from_limit(1000.into());
|
let meter = &mut WeightMeter::from_limit(1000.into());
|
||||||
let mut id = [0; 32];
|
let mut id = [0; 32];
|
||||||
assert_ok!(Processor::process_message(msg, ORIGIN, meter, &mut id));
|
assert_ok!(Processor::process_message(msg, ORIGIN, meter, &mut id));
|
||||||
assert_eq!(meter.consumed, 1000.into());
|
assert_eq!(meter.consumed(), 1000.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user