mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
* Remove unused trait implementations Signed-off-by: Serban Iorga <serban@parity.io> * Define encoded_size_hint_u32() Signed-off-by: Serban Iorga <serban@parity.io> * Define TransactionEstimationParams trait Signed-off-by: Serban Iorga <serban@parity.io> * Rework TransactionEstimation Signed-off-by: Serban Iorga <serban@parity.io> * Docs + Renamings Signed-off-by: Serban Iorga <serban@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
dc38e3d079
commit
1e0c2a6e02
@@ -24,7 +24,9 @@ use bp_messages::{
|
||||
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
|
||||
};
|
||||
use bp_runtime::{Chain, ChainId, MILLAU_CHAIN_ID, RIALTO_CHAIN_ID};
|
||||
use bridge_runtime_common::messages::{self, MessageBridge, MessageTransaction};
|
||||
use bridge_runtime_common::messages::{
|
||||
self, BasicConfirmationTransactionEstimation, MessageBridge, MessageTransaction,
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
@@ -122,6 +124,12 @@ impl messages::ChainWithMessages for Rialto {
|
||||
impl messages::ThisChainWithMessages for Rialto {
|
||||
type Origin = crate::Origin;
|
||||
type Call = crate::Call;
|
||||
type ConfirmationTransactionEstimation = BasicConfirmationTransactionEstimation<
|
||||
Self::AccountId,
|
||||
{ bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT },
|
||||
{ bp_millau::EXTRA_STORAGE_PROOF_SIZE },
|
||||
{ bp_rialto::TX_EXTRA_BYTES },
|
||||
>;
|
||||
|
||||
fn is_message_accepted(send_origin: &Self::Origin, lane: &LaneId) -> bool {
|
||||
let here_location =
|
||||
@@ -147,19 +155,6 @@ impl messages::ThisChainWithMessages for Rialto {
|
||||
MessageNonce::MAX
|
||||
}
|
||||
|
||||
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight> {
|
||||
let inbound_data_size = InboundLaneData::<bp_rialto::AccountId>::encoded_size_hint(1, 1)
|
||||
.and_then(|x| u32::try_from(x).ok())
|
||||
.unwrap_or(u32::MAX);
|
||||
|
||||
MessageTransaction {
|
||||
dispatch_weight: bp_rialto::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT,
|
||||
size: inbound_data_size
|
||||
.saturating_add(bp_millau::EXTRA_STORAGE_PROOF_SIZE)
|
||||
.saturating_add(bp_rialto::TX_EXTRA_BYTES),
|
||||
}
|
||||
}
|
||||
|
||||
fn transaction_payment(transaction: MessageTransaction<Weight>) -> bp_rialto::Balance {
|
||||
// `transaction` may represent transaction from the future, when multiplier value will
|
||||
// be larger, so let's use slightly increased value
|
||||
@@ -343,12 +338,10 @@ mod tests {
|
||||
);
|
||||
|
||||
let max_incoming_inbound_lane_data_proof_size =
|
||||
bp_messages::InboundLaneData::<()>::encoded_size_hint(
|
||||
bp_messages::InboundLaneData::<()>::encoded_size_hint_u32(
|
||||
bp_rialto::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX as _,
|
||||
bp_rialto::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX as _,
|
||||
)
|
||||
.and_then(|x| u32::try_from(x).ok())
|
||||
.unwrap_or(u32::MAX);
|
||||
);
|
||||
pallet_bridge_messages::ensure_able_to_receive_confirmation::<Weights>(
|
||||
bp_rialto::Rialto::max_extrinsic_size(),
|
||||
bp_rialto::Rialto::max_extrinsic_weight(),
|
||||
|
||||
Reference in New Issue
Block a user