diff --git a/modules/messages/src/weights_ext.rs b/modules/messages/src/weights_ext.rs index b763ca69024e..b2133f06460c 100644 --- a/modules/messages/src/weights_ext.rs +++ b/modules/messages/src/weights_ext.rs @@ -45,6 +45,20 @@ pub fn ensure_weights_are_correct() { // verify `receive_messages_delivery_proof` weight components assert_ne!(W::receive_messages_delivery_proof_overhead(), 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. diff --git a/relays/lib-substrate-relay/Cargo.toml b/relays/lib-substrate-relay/Cargo.toml index 933c9f859a0e..96fe9356fa0f 100644 --- a/relays/lib-substrate-relay/Cargo.toml +++ b/relays/lib-substrate-relay/Cargo.toml @@ -48,8 +48,8 @@ sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } [dev-dependencies] -bp-millau = { path = "../../primitives/chain-millau" } bp-rialto = { path = "../../primitives/chain-rialto" } +bp-rialto-parachain = { path = "../../primitives/chain-rialto-parachain" } bp-rococo = { path = "../../primitives/chain-rococo" } bp-wococo = { path = "../../primitives/chain-wococo" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/relays/lib-substrate-relay/src/messages_lane.rs b/relays/lib-substrate-relay/src/messages_lane.rs index 16fb1301ea04..1a4f65ff51e1 100644 --- a/relays/lib-substrate-relay/src/messages_lane.rs +++ b/relays/lib-substrate-relay/src/messages_lane.rs @@ -487,10 +487,14 @@ mod tests { pallet_bridge_messages::weights::BridgeWeight; #[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) = select_delivery_transaction_limits::( - bp_millau::Millau::max_extrinsic_weight(), + bp_rialto_parachain::RialtoParachain::max_extrinsic_weight(), bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, ); assert_eq!( @@ -500,13 +504,7 @@ mod tests { // i.e. weight reserved for messages dispatch allows dispatch of non-trivial messages. // // Any significant change in this values should attract additional attention. - // - // 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) - ), + (1024, Weight::from_parts(866_600_106_667, 2_271_915)), ); } }