Bump Substrate/Polkadot/Cumulus refs (aka Weights v1.5) (#1597)

* update Substrate + Polkadot + Cumulus refs

* Origin -> RuntimeOrigin

* weights v1.5

* update refs once again + `cargo test -p pallet-bridge-grandpa` works

* started work on `cargo test -p pallet-bridge-messages`

* cargo test -p pallet-bridge-relayers

* cargo test -p pallet-bridge-parachains

* cargo test -p millau-runtime

* cargo test -p bridge-runtime-common

* cargo test -p rialto-runtime

* cargo test -p rialto-parachain-runtime

* cargo test -p millau-bridge-node

* cargo test -p rialto-bridge-node

* cargo test -p rialto-parachain-collator

* cargo test -p messages-relay

* cargo test -p parachains-relay

* cargo test -p substrate-relay

* cargo test --all

* cargo check -p millau-runtime --locked --features runtime-benchmarks

* fix remaining test

* fmt

* try to allow clippy failure temporarily

* Revert "try to allow clippy failure temporarily"

This reverts commit d1b6593580f07e0dbeecb7ab0aa92cee98888ed3.

* use min_by

* Revert "use min_by"

This reverts commit 33042f49ed37e8dd0505370289e17f03bf1a56ee.

* Revert "Revert "use min_by""

This reverts commit 1d2204f0b14dc81e5650bb574dedb5fa78c7097d.

* trigger CI

* Revert "trigger CI"

This reverts commit 259d91b5606743bba9d043c69f07eac6c8700ef5.

* new day, new clippy warning

* more clippy issues
This commit is contained in:
Svyatoslav Nikolsky
2022-10-20 10:27:23 +03:00
committed by Bastian Köcher
parent 9e1847d12a
commit a3dc2d2748
66 changed files with 991 additions and 893 deletions
+24 -23
View File
@@ -43,14 +43,14 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>(
db_weight: RuntimeDbWeight,
) {
// verify `send_message` weight components
assert_ne!(W::send_message_overhead(), 0);
assert_ne!(W::send_message_size_overhead(0), 0);
assert_ne!(W::send_message_overhead(), Weight::from_ref_time(0));
assert_ne!(W::send_message_size_overhead(0), Weight::from_ref_time(0));
// verify `receive_messages_proof` weight components
assert_ne!(W::receive_messages_proof_overhead(), 0);
assert_ne!(W::receive_messages_proof_messages_overhead(1), 0);
assert_ne!(W::receive_messages_proof_outbound_lane_state_overhead(), 0);
assert_ne!(W::storage_proof_size_overhead(1), 0);
assert_ne!(W::receive_messages_proof_overhead(), Weight::from_ref_time(0));
assert_ne!(W::receive_messages_proof_messages_overhead(1), Weight::from_ref_time(0));
assert_ne!(W::receive_messages_proof_outbound_lane_state_overhead(), Weight::from_ref_time(0));
assert_ne!(W::storage_proof_size_overhead(1), Weight::from_ref_time(0));
// verify that the hardcoded value covers `receive_messages_proof` weight
let actual_single_regular_message_delivery_tx_weight = W::receive_messages_proof_weight(
@@ -58,11 +58,11 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>(
(EXPECTED_DEFAULT_MESSAGE_LENGTH + W::expected_extra_storage_proof_size()) as usize,
),
1,
0,
Weight::from_ref_time(0),
);
assert!(
actual_single_regular_message_delivery_tx_weight <=
expected_default_message_delivery_tx_weight,
actual_single_regular_message_delivery_tx_weight.ref_time() <=
expected_default_message_delivery_tx_weight.ref_time(),
"Default message delivery transaction weight {} is larger than expected weight {}",
actual_single_regular_message_delivery_tx_weight,
expected_default_message_delivery_tx_weight,
@@ -71,15 +71,16 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>(
// verify that hardcoded value covers additional byte length of `receive_messages_proof` weight
let actual_additional_byte_delivery_weight = W::storage_proof_size_overhead(1);
assert!(
actual_additional_byte_delivery_weight <= expected_additional_byte_delivery_weight,
actual_additional_byte_delivery_weight.ref_time() <=
expected_additional_byte_delivery_weight.ref_time(),
"Single additional byte delivery weight {} is larger than expected weight {}",
actual_additional_byte_delivery_weight,
expected_additional_byte_delivery_weight,
);
// verify `receive_messages_delivery_proof` weight components
assert_ne!(W::receive_messages_delivery_proof_overhead(), 0);
assert_ne!(W::storage_proof_size_overhead(1), 0);
assert_ne!(W::receive_messages_delivery_proof_overhead(), Weight::from_ref_time(0));
assert_ne!(W::storage_proof_size_overhead(1), Weight::from_ref_time(0));
// `receive_messages_delivery_proof_messages_overhead` and
// `receive_messages_delivery_proof_relayers_overhead` may return zero if rewards are not paid
@@ -96,8 +97,8 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>(
db_weight,
);
assert!(
actual_messages_delivery_confirmation_tx_weight <=
expected_messages_delivery_confirmation_tx_weight,
actual_messages_delivery_confirmation_tx_weight.ref_time() <=
expected_messages_delivery_confirmation_tx_weight.ref_time(),
"Messages delivery confirmation transaction weight {} is larger than expected weight {}",
actual_messages_delivery_confirmation_tx_weight,
expected_messages_delivery_confirmation_tx_weight,
@@ -106,7 +107,7 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>(
// verify pay-dispatch-fee overhead for inbound messages
let actual_pay_inbound_dispatch_fee_weight = W::pay_inbound_dispatch_fee_overhead();
assert!(
actual_pay_inbound_dispatch_fee_weight <= expected_pay_inbound_dispatch_fee_weight,
actual_pay_inbound_dispatch_fee_weight.ref_time() <= expected_pay_inbound_dispatch_fee_weight.ref_time(),
"Weight {} of pay-dispatch-fee overhead for inbound messages is larger than expected weight {}",
actual_pay_inbound_dispatch_fee_weight,
expected_pay_inbound_dispatch_fee_weight,
@@ -140,7 +141,7 @@ pub fn ensure_able_to_receive_message<W: WeightInfoExt>(
max_incoming_message_dispatch_weight,
);
assert!(
max_delivery_transaction_dispatch_weight <= max_extrinsic_weight,
max_delivery_transaction_dispatch_weight.ref_time() <= max_extrinsic_weight.ref_time(),
"Weight of maximal message delivery transaction + {} is larger than maximal possible transaction weight {}",
max_delivery_transaction_dispatch_weight,
max_extrinsic_weight,
@@ -179,7 +180,7 @@ pub fn ensure_able_to_receive_confirmation<W: WeightInfoExt>(
db_weight,
);
assert!(
max_confirmation_transaction_dispatch_weight <= max_extrinsic_weight,
max_confirmation_transaction_dispatch_weight.ref_time() <= max_extrinsic_weight.ref_time(),
"Weight of maximal confirmation transaction {} is larger than maximal possible transaction weight {}",
max_confirmation_transaction_dispatch_weight,
max_extrinsic_weight,
@@ -264,13 +265,13 @@ pub trait WeightInfoExt: WeightInfo {
// message
let callback_overhead = relayers_state
.total_messages
.saturating_mul(Self::single_message_callback_overhead(db_weight));
.saturating_mul(Self::single_message_callback_overhead(db_weight).ref_time());
transaction_overhead
.saturating_add(messages_overhead)
.saturating_add(relayers_overhead)
.saturating_add(proof_size_overhead)
.saturating_add(callback_overhead)
.saturating_add(Weight::from_ref_time(callback_overhead))
}
// Functions that are used by extrinsics weights formulas.
@@ -305,7 +306,7 @@ pub trait WeightInfoExt: WeightInfo {
let weight_of_single_message_and_single_tx_overhead = Self::receive_single_message_proof();
weight_of_two_messages_and_single_tx_overhead
.saturating_sub(weight_of_single_message_and_single_tx_overhead)
.saturating_mul(messages as Weight)
.saturating_mul(messages as _)
}
/// Returns weight that needs to be accounted when message delivery transaction
@@ -336,7 +337,7 @@ pub trait WeightInfoExt: WeightInfo {
let weight_of_single_message = Self::receive_delivery_proof_for_single_message();
weight_of_two_messages
.saturating_sub(weight_of_single_message)
.saturating_mul(messages as Weight)
.saturating_mul(messages as _)
}
/// Returns weight that needs to be accounted when receiving confirmations for given a number of
@@ -348,7 +349,7 @@ pub trait WeightInfoExt: WeightInfo {
Self::receive_delivery_proof_for_two_messages_by_single_relayer();
weight_of_two_messages_by_two_relayers
.saturating_sub(weight_of_two_messages_by_single_relayer)
.saturating_mul(relayers as Weight)
.saturating_mul(relayers as _)
}
/// Returns weight that needs to be accounted when storage proof of given size is received
@@ -360,7 +361,7 @@ pub trait WeightInfoExt: WeightInfo {
/// relayer must pay when it relays proof of given size (even if cost based on other parameters
/// is less than that cost).
fn storage_proof_size_overhead(proof_size: u32) -> Weight {
let proof_size_in_bytes = proof_size as Weight;
let proof_size_in_bytes = proof_size;
let byte_weight = (Self::receive_single_message_proof_16_kb() -
Self::receive_single_message_proof_1_kb()) /
(15 * 1024);