mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 13:21:01 +00:00
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:
committed by
Bastian Köcher
parent
9e1847d12a
commit
a3dc2d2748
@@ -32,7 +32,7 @@ use bridge_runtime_common::messages::{
|
||||
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
|
||||
};
|
||||
use codec::Encode;
|
||||
use frame_support::weights::{GetDispatchInfo, Weight};
|
||||
use frame_support::{dispatch::GetDispatchInfo, weights::Weight};
|
||||
use messages_relay::{message_lane::MessageLane, relay_strategy::RelayStrategy};
|
||||
use pallet_bridge_messages::{Call as BridgeMessagesCall, Config as BridgeMessagesConfig};
|
||||
use relay_substrate_client::{
|
||||
@@ -461,17 +461,23 @@ pub fn select_delivery_transaction_limits<W: pallet_bridge_messages::WeightInfoE
|
||||
let delivery_tx_base_weight = W::receive_messages_proof_overhead() +
|
||||
W::receive_messages_proof_outbound_lane_state_overhead();
|
||||
let delivery_tx_weight_rest = weight_for_delivery_tx - delivery_tx_base_weight;
|
||||
let max_number_of_messages = std::cmp::min(
|
||||
delivery_tx_weight_rest / W::receive_messages_proof_messages_overhead(1),
|
||||
max_unconfirmed_messages_at_inbound_lane,
|
||||
);
|
||||
|
||||
let max_number_of_messages = if delivery_tx_weight_rest.ref_time() /
|
||||
W::receive_messages_proof_messages_overhead(1).ref_time() <
|
||||
max_unconfirmed_messages_at_inbound_lane
|
||||
{
|
||||
delivery_tx_weight_rest.ref_time() /
|
||||
W::receive_messages_proof_messages_overhead(1).ref_time()
|
||||
} else {
|
||||
max_unconfirmed_messages_at_inbound_lane
|
||||
};
|
||||
|
||||
assert!(
|
||||
max_number_of_messages > 0,
|
||||
"Relay should fit at least one message in every delivery transaction",
|
||||
);
|
||||
assert!(
|
||||
weight_for_messages_dispatch >= max_extrinsic_weight / 2,
|
||||
weight_for_messages_dispatch.ref_time() >= max_extrinsic_weight.ref_time() / 2,
|
||||
"Relay shall be able to deliver messages with dispatch weight = max_extrinsic_weight / 2",
|
||||
);
|
||||
|
||||
@@ -500,7 +506,9 @@ 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.
|
||||
(1024, 216_609_134_667),
|
||||
//
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1543 - remove `set_proof_size`
|
||||
(1024, Weight::from_ref_time(216_609_134_667).set_proof_size(217)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ mod tests {
|
||||
.into_iter()
|
||||
.map(|nonce| bp_messages::OutboundMessageDetails {
|
||||
nonce,
|
||||
dispatch_weight: 0,
|
||||
dispatch_weight: Weight::from_ref_time(0),
|
||||
size: 0,
|
||||
delivery_and_dispatch_fee: 0,
|
||||
dispatch_fee_payment: DispatchFeePayment::AtSourceChain,
|
||||
@@ -730,7 +730,7 @@ mod tests {
|
||||
for (idx, _) in payload_sizes.iter().enumerate() {
|
||||
out_msgs_details.push(OutboundMessageDetails::<BalanceOf<Rialto>> {
|
||||
nonce: idx as MessageNonce,
|
||||
dispatch_weight: 0,
|
||||
dispatch_weight: Weight::from_ref_time(0),
|
||||
size: 0,
|
||||
delivery_and_dispatch_fee: 0,
|
||||
dispatch_fee_payment: DispatchFeePayment::AtTargetChain,
|
||||
|
||||
@@ -347,7 +347,7 @@ where
|
||||
// chain. This requires more knowledge of the Target chain, but seems there's no better way
|
||||
// to solve this now.
|
||||
let expected_refund_in_target_tokens = if total_prepaid_nonces != 0 {
|
||||
const WEIGHT_DIFFERENCE: Weight = 100;
|
||||
const WEIGHT_DIFFERENCE: Weight = Weight::from_ref_time(100);
|
||||
|
||||
let (spec_version, transaction_version) =
|
||||
self.target_client.simple_runtime_version().await?;
|
||||
@@ -533,7 +533,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn prepare_dummy_messages_proof_works() {
|
||||
const DISPATCH_WEIGHT: Weight = 1_000_000;
|
||||
const DISPATCH_WEIGHT: Weight = Weight::from_ref_time(1_000_000);
|
||||
const SIZE: u32 = 1_000;
|
||||
let dummy_proof = prepare_dummy_messages_proof::<Rococo>(1..=10, DISPATCH_WEIGHT, SIZE);
|
||||
assert_eq!(dummy_proof.0, DISPATCH_WEIGHT);
|
||||
@@ -563,21 +563,24 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn compute_fee_multiplier_returns_sane_results() {
|
||||
let multiplier: FixedU128 = bp_rialto::WeightToFee::weight_to_fee(&1).into();
|
||||
let multiplier: FixedU128 =
|
||||
bp_rialto::WeightToFee::weight_to_fee(&Weight::from_ref_time(1)).into();
|
||||
|
||||
let smaller_weight = 1_000_000;
|
||||
let smaller_adjusted_weight_fee =
|
||||
multiplier.saturating_mul_int(WeightToFeeOf::<Rialto>::weight_to_fee(&smaller_weight));
|
||||
let smaller_adjusted_weight_fee = multiplier.saturating_mul_int(
|
||||
WeightToFeeOf::<Rialto>::weight_to_fee(&Weight::from_ref_time(smaller_weight)),
|
||||
);
|
||||
|
||||
let larger_weight = smaller_weight + 200_000;
|
||||
let larger_adjusted_weight_fee =
|
||||
multiplier.saturating_mul_int(WeightToFeeOf::<Rialto>::weight_to_fee(&larger_weight));
|
||||
let larger_adjusted_weight_fee = multiplier.saturating_mul_int(
|
||||
WeightToFeeOf::<Rialto>::weight_to_fee(&Weight::from_ref_time(larger_weight)),
|
||||
);
|
||||
assert_eq!(
|
||||
compute_fee_multiplier::<Rialto>(
|
||||
smaller_adjusted_weight_fee,
|
||||
smaller_weight,
|
||||
Weight::from_ref_time(smaller_weight),
|
||||
larger_adjusted_weight_fee,
|
||||
larger_weight,
|
||||
Weight::from_ref_time(larger_weight),
|
||||
),
|
||||
multiplier,
|
||||
);
|
||||
@@ -589,7 +592,9 @@ mod tests {
|
||||
compute_prepaid_messages_refund::<Rialto>(
|
||||
10,
|
||||
FixedU128::saturating_from_rational(110, 100),
|
||||
) > (10 * Rialto::PAY_INBOUND_DISPATCH_FEE_WEIGHT_AT_CHAIN).into()
|
||||
) > Rialto::PAY_INBOUND_DISPATCH_FEE_WEIGHT_AT_CHAIN
|
||||
.saturating_mul(10u64)
|
||||
.ref_time() as _
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user