remove lower limit of message weight (#727)

This commit is contained in:
Svyatoslav Nikolsky
2021-02-15 15:11:17 +03:00
committed by Bastian Köcher
parent c4b931ba29
commit 32342bf6e5
2 changed files with 12 additions and 14 deletions
@@ -95,17 +95,16 @@ impl MessageBridge for WithRialtoMessageBridge {
bp_rialto::max_extrinsic_size() bp_rialto::max_extrinsic_size()
} }
fn weight_limits_of_message_on_bridged_chain(message_payload: &[u8]) -> RangeInclusive<Weight> { fn weight_limits_of_message_on_bridged_chain(_message_payload: &[u8]) -> RangeInclusive<Weight> {
// we don't want to relay too large messages + keep reserve for future upgrades // we don't want to relay too large messages + keep reserve for future upgrades
let upper_limit = messages::target::maximal_incoming_message_dispatch_weight(bp_rialto::max_extrinsic_weight()); let upper_limit = messages::target::maximal_incoming_message_dispatch_weight(bp_rialto::max_extrinsic_weight());
// given Rialto chain parameters (`TransactionByteFee`, `WeightToFee`, `FeeMultiplierUpdate`), // we're charging for payload bytes in `WithRialtoMessageBridge::weight_of_delivery_transaction` function
// the minimal weight of the message may be computed as message.length() //
let lower_limit = u32::try_from(message_payload.len()) // this bridge may be used to deliver all kind of messages, so we're not making any assumptions about
.map(Into::into) // minimal dispatch weight here
.unwrap_or(Weight::MAX);
lower_limit..=upper_limit 0..=upper_limit
} }
fn weight_of_delivery_transaction(message_payload: &[u8]) -> Weight { fn weight_of_delivery_transaction(message_payload: &[u8]) -> Weight {
@@ -95,17 +95,16 @@ impl MessageBridge for WithMillauMessageBridge {
bp_millau::max_extrinsic_size() bp_millau::max_extrinsic_size()
} }
fn weight_limits_of_message_on_bridged_chain(message_payload: &[u8]) -> RangeInclusive<Weight> { fn weight_limits_of_message_on_bridged_chain(_message_payload: &[u8]) -> RangeInclusive<Weight> {
// we don't want to relay too large messages + keep reserve for future upgrades // we don't want to relay too large messages + keep reserve for future upgrades
let upper_limit = messages::target::maximal_incoming_message_dispatch_weight(bp_millau::max_extrinsic_weight()); let upper_limit = messages::target::maximal_incoming_message_dispatch_weight(bp_millau::max_extrinsic_weight());
// given Millau chain parameters (`TransactionByteFee`, `WeightToFee`, `FeeMultiplierUpdate`), // we're charging for payload bytes in `WithMillauMessageBridge::weight_of_delivery_transaction` function
// the minimal weight of the message may be computed as message.length() //
let lower_limit = u32::try_from(message_payload.len()) // this bridge may be used to deliver all kind of messages, so we're not making any assumptions about
.map(Into::into) // minimal dispatch weight here
.unwrap_or(Weight::MAX);
lower_limit..=upper_limit 0..=upper_limit
} }
fn weight_of_delivery_transaction(message_payload: &[u8]) -> Weight { fn weight_of_delivery_transaction(message_payload: &[u8]) -> Weight {