mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
changed some tests for weights v2 (#1855)
This commit is contained in:
committed by
Bastian Köcher
parent
cd12d1438e
commit
7755c1b526
@@ -45,6 +45,20 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>() {
|
|||||||
// verify `receive_messages_delivery_proof` weight components
|
// verify `receive_messages_delivery_proof` weight components
|
||||||
assert_ne!(W::receive_messages_delivery_proof_overhead(), Weight::zero());
|
assert_ne!(W::receive_messages_delivery_proof_overhead(), Weight::zero());
|
||||||
assert_ne!(W::storage_proof_size_overhead(1), Weight::zero());
|
assert_ne!(W::storage_proof_size_overhead(1), Weight::zero());
|
||||||
|
|
||||||
|
// verify `receive_message_proof` weight
|
||||||
|
let receive_messages_proof_weight =
|
||||||
|
W::receive_messages_proof_weight(&PreComputedSize(1), 10, Weight::from_ref_time(0));
|
||||||
|
assert_ne!(receive_messages_proof_weight.ref_time(), 0);
|
||||||
|
assert_ne!(receive_messages_proof_weight.proof_size(), 0);
|
||||||
|
|
||||||
|
// verify `receive_message_proof` weight
|
||||||
|
let receive_messages_delivery_proof_weight = W::receive_messages_delivery_proof_weight(
|
||||||
|
&PreComputedSize(1),
|
||||||
|
&UnrewardedRelayersState::default(),
|
||||||
|
);
|
||||||
|
assert_ne!(receive_messages_delivery_proof_weight.ref_time(), 0);
|
||||||
|
assert_ne!(receive_messages_delivery_proof_weight.proof_size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure that we're able to receive maximal (by-size and by-weight) message from other chain.
|
/// Ensure that we're able to receive maximal (by-size and by-weight) message from other chain.
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch
|
|||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bp-millau = { path = "../../primitives/chain-millau" }
|
|
||||||
bp-rialto = { path = "../../primitives/chain-rialto" }
|
bp-rialto = { path = "../../primitives/chain-rialto" }
|
||||||
|
bp-rialto-parachain = { path = "../../primitives/chain-rialto-parachain" }
|
||||||
bp-rococo = { path = "../../primitives/chain-rococo" }
|
bp-rococo = { path = "../../primitives/chain-rococo" }
|
||||||
bp-wococo = { path = "../../primitives/chain-wococo" }
|
bp-wococo = { path = "../../primitives/chain-wococo" }
|
||||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|||||||
@@ -487,10 +487,14 @@ mod tests {
|
|||||||
pallet_bridge_messages::weights::BridgeWeight<rialto_runtime::Runtime>;
|
pallet_bridge_messages::weights::BridgeWeight<rialto_runtime::Runtime>;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn select_delivery_transaction_limits_works() {
|
fn select_delivery_transaction_limits_is_sane() {
|
||||||
|
// we want to check the `proof_size` component here too. But for Rialto and Millau
|
||||||
|
// it is set to `u64::MAX` (as for Polkadot and other relay/standalone chains).
|
||||||
|
// So let's use RialtoParachain limits here - it has `proof_size` limit as all
|
||||||
|
// Cumulus-based parachains do.
|
||||||
let (max_count, max_weight) =
|
let (max_count, max_weight) =
|
||||||
select_delivery_transaction_limits::<RialtoToMillauMessagesWeights>(
|
select_delivery_transaction_limits::<RialtoToMillauMessagesWeights>(
|
||||||
bp_millau::Millau::max_extrinsic_weight(),
|
bp_rialto_parachain::RialtoParachain::max_extrinsic_weight(),
|
||||||
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
|
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -500,13 +504,7 @@ mod tests {
|
|||||||
// i.e. weight reserved for messages dispatch allows dispatch of non-trivial messages.
|
// i.e. weight reserved for messages dispatch allows dispatch of non-trivial messages.
|
||||||
//
|
//
|
||||||
// Any significant change in this values should attract additional attention.
|
// Any significant change in this values should attract additional attention.
|
||||||
//
|
(1024, Weight::from_parts(866_600_106_667, 2_271_915)),
|
||||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1543 - the `proof_size`
|
|
||||||
// component is too large here!
|
|
||||||
(
|
|
||||||
1024,
|
|
||||||
Weight::from_ref_time(216_600_106_667).set_proof_size(7_993_589_098_607_472_367)
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user