mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +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
@@ -678,7 +678,7 @@ pub(crate) mod tests {
|
||||
(
|
||||
nonce,
|
||||
MessageDetails {
|
||||
dispatch_weight: 1,
|
||||
dispatch_weight: Weight::from_ref_time(1),
|
||||
size: 1,
|
||||
reward: 1,
|
||||
dispatch_fee_payment: DispatchFeePayment::AtSourceChain,
|
||||
@@ -879,9 +879,11 @@ pub(crate) mod tests {
|
||||
total_dispatch_weight: Weight,
|
||||
total_size: u32,
|
||||
) -> Result<TestSourceChainBalance, TestError> {
|
||||
Ok(BASE_MESSAGE_DELIVERY_TRANSACTION_COST * (nonces.end() - nonces.start() + 1) +
|
||||
Ok((Weight::from_ref_time(BASE_MESSAGE_DELIVERY_TRANSACTION_COST) *
|
||||
(nonces.end() - nonces.start() + 1) +
|
||||
total_dispatch_weight +
|
||||
total_size as TestSourceChainBalance)
|
||||
Weight::from_ref_time(total_size as u64))
|
||||
.ref_time())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -916,7 +918,7 @@ pub(crate) mod tests {
|
||||
max_unrewarded_relayer_entries_at_target: 4,
|
||||
max_unconfirmed_nonces_at_target: 4,
|
||||
max_messages_in_single_batch: 4,
|
||||
max_messages_weight_in_single_batch: 4,
|
||||
max_messages_weight_in_single_batch: Weight::from_ref_time(4),
|
||||
max_messages_size_in_single_batch: 4,
|
||||
relay_strategy: AltruisticStrategy,
|
||||
},
|
||||
|
||||
@@ -295,7 +295,7 @@ impl<P: MessageLane, Strategy: RelayStrategy, SC, TC> MessageDeliveryStrategy<P,
|
||||
.source_queue()
|
||||
.iter()
|
||||
.flat_map(|(_, range)| range.values().map(|details| details.dispatch_weight))
|
||||
.fold(0, |total, weight| total.saturating_add(weight))
|
||||
.fold(Weight::from_ref_time(0), |total, weight| total.saturating_add(weight))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,11 +578,11 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
const DEFAULT_DISPATCH_WEIGHT: Weight = 1;
|
||||
const DEFAULT_DISPATCH_WEIGHT: Weight = Weight::from_ref_time(1);
|
||||
const DEFAULT_SIZE: u32 = 1;
|
||||
const DEFAULT_REWARD: TestSourceChainBalance = CONFIRMATION_TRANSACTION_COST +
|
||||
BASE_MESSAGE_DELIVERY_TRANSACTION_COST +
|
||||
DEFAULT_DISPATCH_WEIGHT +
|
||||
DEFAULT_DISPATCH_WEIGHT.ref_time() +
|
||||
(DEFAULT_SIZE as TestSourceChainBalance);
|
||||
|
||||
type TestRaceState = RaceState<TestSourceHeaderId, TestTargetHeaderId, TestMessagesProof>;
|
||||
@@ -629,7 +629,7 @@ mod tests {
|
||||
max_unrewarded_relayer_entries_at_target: 4,
|
||||
max_unconfirmed_nonces_at_target: 4,
|
||||
max_messages_in_single_batch: 4,
|
||||
max_messages_weight_in_single_batch: 4,
|
||||
max_messages_weight_in_single_batch: Weight::from_ref_time(4),
|
||||
max_messages_size_in_single_batch: 4,
|
||||
latest_confirmed_nonces_at_source: vec![(header_id(1), 19)].into_iter().collect(),
|
||||
lane_source_client: TestSourceClient::default(),
|
||||
@@ -667,10 +667,10 @@ mod tests {
|
||||
(race_state, race_strategy)
|
||||
}
|
||||
|
||||
fn proof_parameters(state_required: bool, weight: Weight) -> MessageProofParameters {
|
||||
fn proof_parameters(state_required: bool, weight: u32) -> MessageProofParameters {
|
||||
MessageProofParameters {
|
||||
outbound_state_proof_required: state_required,
|
||||
dispatch_weight: weight,
|
||||
dispatch_weight: Weight::from_ref_time(weight as u64),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ mod tests {
|
||||
(
|
||||
idx,
|
||||
MessageDetails {
|
||||
dispatch_weight: idx,
|
||||
dispatch_weight: Weight::from_ref_time(idx),
|
||||
size: idx as _,
|
||||
reward: idx as _,
|
||||
dispatch_fee_payment: DispatchFeePayment::AtSourceChain,
|
||||
@@ -813,7 +813,7 @@ mod tests {
|
||||
let (state, mut strategy) = prepare_strategy();
|
||||
|
||||
// not all queued messages may fit in the batch, because batch has max weight
|
||||
strategy.max_messages_weight_in_single_batch = 3;
|
||||
strategy.max_messages_weight_in_single_batch = Weight::from_ref_time(3);
|
||||
assert_eq!(
|
||||
strategy.select_nonces_to_deliver(state).await,
|
||||
Some(((20..=22), proof_parameters(false, 3)))
|
||||
@@ -827,7 +827,8 @@ mod tests {
|
||||
|
||||
// first message doesn't fit in the batch, because it has weight (10) that overflows max
|
||||
// weight (4)
|
||||
strategy.strategy.source_queue_mut()[0].1.get_mut(&20).unwrap().dispatch_weight = 10;
|
||||
strategy.strategy.source_queue_mut()[0].1.get_mut(&20).unwrap().dispatch_weight =
|
||||
Weight::from_ref_time(10);
|
||||
assert_eq!(
|
||||
strategy.select_nonces_to_deliver(state).await,
|
||||
Some(((20..=20), proof_parameters(false, 10)))
|
||||
@@ -1023,7 +1024,7 @@ mod tests {
|
||||
let nonces = source_nonces(
|
||||
24..=24,
|
||||
19,
|
||||
DEFAULT_REWARD - DEFAULT_DISPATCH_WEIGHT,
|
||||
DEFAULT_REWARD - DEFAULT_DISPATCH_WEIGHT.ref_time(),
|
||||
dispatch_fee_payment,
|
||||
);
|
||||
strategy.strategy.source_nonces_updated(header_id(2), nonces);
|
||||
@@ -1031,7 +1032,7 @@ mod tests {
|
||||
strategy.max_unrewarded_relayer_entries_at_target = 100;
|
||||
strategy.max_unconfirmed_nonces_at_target = 100;
|
||||
strategy.max_messages_in_single_batch = 100;
|
||||
strategy.max_messages_weight_in_single_batch = 100;
|
||||
strategy.max_messages_weight_in_single_batch = Weight::from_ref_time(100);
|
||||
strategy.max_messages_size_in_single_batch = 100;
|
||||
strategy.relay_strategy = MixStrategy::new(RelayerMode::Rational);
|
||||
|
||||
@@ -1070,7 +1071,7 @@ mod tests {
|
||||
strategy.max_unrewarded_relayer_entries_at_target = 100;
|
||||
strategy.max_unconfirmed_nonces_at_target = 100;
|
||||
strategy.max_messages_in_single_batch = 5;
|
||||
strategy.max_messages_weight_in_single_batch = 100;
|
||||
strategy.max_messages_weight_in_single_batch = Weight::from_ref_time(100);
|
||||
strategy.max_messages_size_in_single_batch = 100;
|
||||
state.best_finalized_source_header_id_at_best_target = Some(header_id(2));
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ impl<Strategy: RelayStrategy> EnforcementStrategy<Strategy> {
|
||||
let mut hard_selected_count = 0;
|
||||
let mut soft_selected_count = 0;
|
||||
|
||||
let mut selected_weight: Weight = 0;
|
||||
let mut selected_weight = Weight::from_ref_time(0);
|
||||
let mut selected_count: MessageNonce = 0;
|
||||
|
||||
let hard_selected_begin_nonce =
|
||||
@@ -77,12 +77,12 @@ impl<Strategy: RelayStrategy> EnforcementStrategy<Strategy> {
|
||||
|
||||
hard_selected_begin_nonce,
|
||||
selected_prepaid_nonces: 0,
|
||||
selected_unpaid_weight: 0,
|
||||
selected_unpaid_weight: Weight::from_ref_time(0),
|
||||
|
||||
index: 0,
|
||||
nonce: 0,
|
||||
details: MessageDetails {
|
||||
dispatch_weight: 0,
|
||||
dispatch_weight: Weight::from_ref_time(0),
|
||||
size: 0,
|
||||
reward: P::SourceChainBalance::zero(),
|
||||
dispatch_fee_payment: DispatchFeePayment::AtSourceChain,
|
||||
@@ -105,9 +105,10 @@ impl<Strategy: RelayStrategy> EnforcementStrategy<Strategy> {
|
||||
// transaction will be rejected by the target runtime, but at least we have tried.
|
||||
|
||||
// limit messages in the batch by weight
|
||||
let new_selected_weight = match selected_weight.checked_add(details.dispatch_weight) {
|
||||
let new_selected_weight = match selected_weight.checked_add(&details.dispatch_weight) {
|
||||
Some(new_selected_weight)
|
||||
if new_selected_weight <= reference.max_messages_weight_in_single_batch =>
|
||||
if new_selected_weight.ref_time() <=
|
||||
reference.max_messages_weight_in_single_batch.ref_time() =>
|
||||
new_selected_weight,
|
||||
new_selected_weight if selected_count == 0 => {
|
||||
log::warn!(
|
||||
|
||||
Reference in New Issue
Block a user