weights v1.5: iteration 2 (#1613)

This commit is contained in:
Svyatoslav Nikolsky
2022-10-21 13:43:07 +03:00
committed by Bastian Köcher
parent 829b23c7cf
commit e97bb57564
15 changed files with 81 additions and 70 deletions
+10 -5
View File
@@ -407,7 +407,7 @@ pub mod source {
let delivery_transaction = BridgedChain::<B>::estimate_delivery_transaction(
&payload.encode(),
true,
Weight::from_ref_time(0),
Weight::zero(),
);
let delivery_transaction_fee = BridgedChain::<B>::transaction_payment(delivery_transaction);
@@ -733,7 +733,7 @@ pub mod target {
payload.weight = Some(weight);
weight
},
_ => Weight::from_ref_time(0),
_ => Weight::zero(),
}
}
@@ -762,17 +762,22 @@ pub mod target {
location,
xcm,
hash,
weight_limit.unwrap_or(Weight::from_ref_time(0)).ref_time(),
weight_limit.unwrap_or_else(Weight::zero).ref_time(),
weight_credit.ref_time(),
);
Ok(xcm_outcome)
};
let xcm_outcome = do_dispatch();
log::trace!(target: "runtime::bridge-dispatch", "Incoming message {:?} dispatched with result: {:?}", message_id, xcm_outcome);
log::trace!(
target: "runtime::bridge-dispatch",
"Incoming message {:?} dispatched with result: {:?}",
message_id,
xcm_outcome,
);
MessageDispatchResult {
dispatch_result: true,
unspent_weight: Weight::from_ref_time(0),
unspent_weight: Weight::zero(),
dispatch_fee_paid_during_dispatch: false,
}
}
@@ -39,7 +39,7 @@ where
nonce,
// dispatch message weight is always zero at the source chain, since we're paying for
// dispatch at the target chain
dispatch_weight: frame_support::weights::Weight::from_ref_time(0),
dispatch_weight: frame_support::weights::Weight::zero(),
size: message_data.payload.len() as _,
delivery_and_dispatch_fee: message_data.fee,
// we're delivering XCM messages here, so fee is always paid at the target chain
@@ -94,7 +94,7 @@ where
nonces_start: *params.message_nonces.start(),
nonces_end: *params.message_nonces.end(),
},
Weight::from_ref_time(0),
Weight::zero(),
)
}
@@ -125,7 +125,7 @@ mod tests {
pallet_bridge_messages::Call::<Runtime, ()>::receive_messages_proof {
relayer_id_at_bridged_chain: [0u8; 32].into(),
messages_count: (nonces_end - nonces_start + 1) as u32,
dispatch_weight: frame_support::weights::Weight::from_ref_time(0),
dispatch_weight: frame_support::weights::Weight::zero(),
proof: FromBridgedChainMessagesProof {
bridged_header_hash: Default::default(),
storage_proof: vec![],