Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong committed Sep 30, 2022
1 parent 66d07fc commit 44532aa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 94 deletions.
47 changes: 0 additions & 47 deletions runtime/crab-parachain/src/bridges_message/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,6 @@ impl ThisChainWithMessages for CrabParachain {
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
MessageNonce::MAX
}

fn transaction_payment(transaction: MessageTransaction<Weight>) -> Balance {
// in our testnets, both per-byte fee and weight-to-fee are 1:1
messages::transaction_payment(
RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
1,
FixedU128::zero(),
|weight| weight as _,
transaction,
)
}
}

#[derive(Clone, Copy, RuntimeDebug)]
Expand All @@ -132,42 +121,6 @@ impl BridgedChainWithMessages for Crab {
target::maximal_incoming_message_dispatch_weight(bp_crab::Crab::max_extrinsic_weight());
0..=upper_limit
}

fn estimate_delivery_transaction(
message_payload: &[u8],
include_pay_dispatch_fee_cost: bool,
message_dispatch_weight: Weight,
) -> MessageTransaction<Weight> {
let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX);
let extra_bytes_in_payload = Weight::from(message_payload_len)
.saturating_sub(EXPECTED_DEFAULT_MESSAGE_LENGTH.into());

MessageTransaction {
dispatch_weight: extra_bytes_in_payload
.saturating_mul(bp_crab::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
.saturating_add(bp_crab::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT)
.saturating_add(message_dispatch_weight)
.saturating_sub(if include_pay_dispatch_fee_cost {
0
} else {
bp_crab::PAY_INBOUND_DISPATCH_FEE_WEIGHT
}),
size: message_payload_len
.saturating_add(bp_crab::EXTRA_STORAGE_PROOF_SIZE)
.saturating_add(bp_crab::TX_EXTRA_BYTES),
}
}

fn transaction_payment(transaction: MessageTransaction<Weight>) -> Self::Balance {
// in our testnets, both per-byte fee and weight-to-fee are 1:1
messages::transaction_payment(
bp_crab::RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
1,
FixedU128::zero(),
|weight| weight as _,
transaction,
)
}
}
impl TargetHeaderChain<ToCrabMessagePayload, <Self as ChainWithMessages>::AccountId> for Crab {
type Error = &'static str;
Expand Down
47 changes: 0 additions & 47 deletions runtime/pangolin-parachain/src/bridges_message/pangolin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,6 @@ impl ThisChainWithMessages for PangolinParachain {
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
MessageNonce::MAX
}

fn transaction_payment(transaction: MessageTransaction<Weight>) -> Balance {
// in our testnets, both per-byte fee and weight-to-fee are 1:1
messages::transaction_payment(
RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
1,
FixedU128::zero(),
|weight| weight as _,
transaction,
)
}
}

#[derive(Clone, Copy, RuntimeDebug)]
Expand All @@ -133,42 +122,6 @@ impl BridgedChainWithMessages for Pangolin {
);
0..=upper_limit
}

fn estimate_delivery_transaction(
message_payload: &[u8],
include_pay_dispatch_fee_cost: bool,
message_dispatch_weight: Weight,
) -> MessageTransaction<Weight> {
let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX);
let extra_bytes_in_payload = Weight::from(message_payload_len)
.saturating_sub(EXPECTED_DEFAULT_MESSAGE_LENGTH.into());

MessageTransaction {
dispatch_weight: extra_bytes_in_payload
.saturating_mul(bp_pangolin::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT)
.saturating_add(bp_pangolin::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT)
.saturating_add(message_dispatch_weight)
.saturating_sub(if include_pay_dispatch_fee_cost {
0
} else {
bp_pangolin::PAY_INBOUND_DISPATCH_FEE_WEIGHT
}),
size: message_payload_len
.saturating_add(bp_pangolin::EXTRA_STORAGE_PROOF_SIZE)
.saturating_add(bp_pangolin::TX_EXTRA_BYTES),
}
}

fn transaction_payment(transaction: MessageTransaction<Weight>) -> Self::Balance {
// in our testnets, both per-byte fee and weight-to-fee are 1:1
messages::transaction_payment(
bp_pangolin::RuntimeBlockWeights::get().get(DispatchClass::Normal).base_extrinsic,
1,
FixedU128::zero(),
|weight| weight as _,
transaction,
)
}
}
impl TargetHeaderChain<ToPangolinMessagePayload, <Self as ChainWithMessages>::AccountId>
for Pangolin
Expand Down

0 comments on commit 44532aa

Please sign in to comment.