mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 10:11:08 +00:00
verify ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT constant value (#731)
This commit is contained in:
committed by
Bastian Köcher
parent
82739314a8
commit
89b0f7beda
@@ -643,7 +643,8 @@ mod tests {
|
|||||||
type Weights = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
type Weights = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
||||||
|
|
||||||
pallet_message_lane::ensure_weights_are_correct::<Weights>(
|
pallet_message_lane::ensure_weights_are_correct::<Weights>(
|
||||||
bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_TX_WEIGHT,
|
bp_millau::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,
|
||||||
|
bp_millau::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT,
|
||||||
bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ impl MessageBridge for WithRialtoMessageBridge {
|
|||||||
message_payload_len.saturating_add(bp_millau::EXTRA_STORAGE_PROOF_SIZE as _),
|
message_payload_len.saturating_add(bp_millau::EXTRA_STORAGE_PROOF_SIZE as _),
|
||||||
extra_bytes_in_payload
|
extra_bytes_in_payload
|
||||||
.saturating_mul(bp_rialto::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
|
.saturating_mul(bp_rialto::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
|
||||||
.saturating_add(bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_TX_WEIGHT),
|
.saturating_add(bp_rialto::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1072,7 +1072,8 @@ mod tests {
|
|||||||
type Weights = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
type Weights = pallet_message_lane::weights::RialtoWeight<Runtime>;
|
||||||
|
|
||||||
pallet_message_lane::ensure_weights_are_correct::<Weights>(
|
pallet_message_lane::ensure_weights_are_correct::<Weights>(
|
||||||
bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_TX_WEIGHT,
|
bp_rialto::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT,
|
||||||
|
bp_rialto::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT,
|
||||||
bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ impl MessageBridge for WithMillauMessageBridge {
|
|||||||
message_payload_len.saturating_add(bp_rialto::EXTRA_STORAGE_PROOF_SIZE as _),
|
message_payload_len.saturating_add(bp_rialto::EXTRA_STORAGE_PROOF_SIZE as _),
|
||||||
extra_bytes_in_payload
|
extra_bytes_in_payload
|
||||||
.saturating_mul(bp_millau::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
|
.saturating_mul(bp_millau::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
|
||||||
.saturating_add(bp_millau::MAX_SINGLE_MESSAGE_DELIVERY_TX_WEIGHT),
|
.saturating_add(bp_millau::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ const SIGNED_EXTENSIONS_SIZE: u32 = 1024;
|
|||||||
|
|
||||||
/// Ensure that weights from `WeightInfoExt` implementation are looking correct.
|
/// Ensure that weights from `WeightInfoExt` implementation are looking correct.
|
||||||
pub fn ensure_weights_are_correct<W: WeightInfoExt>(
|
pub fn ensure_weights_are_correct<W: WeightInfoExt>(
|
||||||
expected_single_regular_message_delivery_tx_weight: Weight,
|
expected_default_message_delivery_tx_weight: Weight,
|
||||||
|
expected_additional_byte_delivery_weight: Weight,
|
||||||
expected_messages_delivery_confirmation_tx_weight: Weight,
|
expected_messages_delivery_confirmation_tx_weight: Weight,
|
||||||
) {
|
) {
|
||||||
// verify `send_message` weight components
|
// verify `send_message` weight components
|
||||||
@@ -51,10 +52,19 @@ pub fn ensure_weights_are_correct<W: WeightInfoExt>(
|
|||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
actual_single_regular_message_delivery_tx_weight <= expected_single_regular_message_delivery_tx_weight,
|
actual_single_regular_message_delivery_tx_weight <= expected_default_message_delivery_tx_weight,
|
||||||
"Single message delivery transaction weight {} is larger than expected weight {}",
|
"Default message delivery transaction weight {} is larger than expected weight {}",
|
||||||
actual_single_regular_message_delivery_tx_weight,
|
actual_single_regular_message_delivery_tx_weight,
|
||||||
expected_single_regular_message_delivery_tx_weight,
|
expected_default_message_delivery_tx_weight,
|
||||||
|
);
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
"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
|
// verify `receive_messages_delivery_proof` weight components
|
||||||
|
|||||||
@@ -69,15 +69,19 @@ pub const MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE: MessageNonce = 1024;
|
|||||||
/// Maximal number of unconfirmed messages at inbound lane.
|
/// Maximal number of unconfirmed messages at inbound lane.
|
||||||
pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 1024;
|
pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 1024;
|
||||||
|
|
||||||
/// Maximal weight of single regular message delivery transaction on Millau chain.
|
/// Weight of single regular message delivery transaction on Millau chain.
|
||||||
///
|
///
|
||||||
/// This value is a result of `pallet_message_lane::Module::receive_messages_proof` weight formula computation
|
/// This value is a result of `pallet_message_lane::Module::receive_messages_proof_weight()` call
|
||||||
/// for the case when single message is delivered. The result then must be rounded up to account possible future
|
/// for the case when single message of `pallet_message_lane::EXPECTED_DEFAULT_MESSAGE_LENGTH` bytes is delivered.
|
||||||
/// runtime upgrades.
|
/// The message must have dispatch weight set to zero. The result then must be rounded up to account
|
||||||
pub const MAX_SINGLE_MESSAGE_DELIVERY_TX_WEIGHT: Weight = 1_000_000_000;
|
/// possible future runtime upgrades.
|
||||||
|
pub const DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT: Weight = 1_000_000_000;
|
||||||
|
|
||||||
/// Increase of delivery transaction weight on Millau chain with every additional message byte.
|
/// Increase of delivery transaction weight on Millau chain with every additional message byte.
|
||||||
pub const ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT: Weight = 3_000;
|
///
|
||||||
|
/// This value is a result of `pallet_message_lane::WeightInfoExt::storage_proof_size_overhead(1)` call. The
|
||||||
|
/// result then must be rounded up to account possible future runtime upgrades.
|
||||||
|
pub const ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT: Weight = 25_000;
|
||||||
|
|
||||||
/// Maximal weight of single message delivery confirmation transaction on Millau chain.
|
/// Maximal weight of single message delivery confirmation transaction on Millau chain.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -60,15 +60,19 @@ pub const MAX_UNREWARDED_RELAYER_ENTRIES_AT_INBOUND_LANE: MessageNonce = 128;
|
|||||||
/// Maximal number of unconfirmed messages at inbound lane.
|
/// Maximal number of unconfirmed messages at inbound lane.
|
||||||
pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 128;
|
pub const MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE: MessageNonce = 128;
|
||||||
|
|
||||||
/// Maximal weight of single regular message delivery transaction on Rialto chain.
|
/// Weight of single regular message delivery transaction on Rialto chain.
|
||||||
///
|
///
|
||||||
/// This value is a result of `pallet_message_lane::Module::receive_messages_proof` weight formula computation
|
/// This value is a result of `pallet_message_lane::Module::receive_messages_proof_weight()` call
|
||||||
/// for the case when single message is delivered. The result then must be rounded up to account possible future
|
/// for the case when single message of `pallet_message_lane::EXPECTED_DEFAULT_MESSAGE_LENGTH` bytes is delivered.
|
||||||
/// runtime upgrades.
|
/// The message must have dispatch weight set to zero. The result then must be rounded up to account
|
||||||
pub const MAX_SINGLE_MESSAGE_DELIVERY_TX_WEIGHT: Weight = 1_000_000_000;
|
/// possible future runtime upgrades.
|
||||||
|
pub const DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT: Weight = 1_000_000_000;
|
||||||
|
|
||||||
/// Increase of delivery transaction weight on Rialto chain with every additional message byte.
|
/// Increase of delivery transaction weight on Rialto chain with every additional message byte.
|
||||||
pub const ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT: Weight = 3_000;
|
///
|
||||||
|
/// This value is a result of `pallet_message_lane::WeightInfoExt::storage_proof_size_overhead(1)` call. The
|
||||||
|
/// result then must be rounded up to account possible future runtime upgrades.
|
||||||
|
pub const ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT: Weight = 25_000;
|
||||||
|
|
||||||
/// Maximal weight of single message delivery confirmation transaction on Rialto chain.
|
/// Maximal weight of single message delivery confirmation transaction on Rialto chain.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user