Skip to content

Commit

Permalink
Fixed (partial) FAIL-CI @svyatonik / FAIL-CI @bkontur
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Jun 14, 2024
1 parent c85bc45 commit 5e61ece
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 63 deletions.
2 changes: 1 addition & 1 deletion relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ impl parachains_hrmp::Config for Runtime {
type Currency = Balances;
type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Self>;
type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem;
type VersionWrapper = XcmPallet; // FAIL-CI @bkontur please check here and in Kusama
type VersionWrapper = XcmPallet;
}

impl parachains_paras_inherent::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ frame_support::parameter_types! {
pub const BridgeHubKusamaBaseXcmFeeInKsms: u128 = 590_387_000;

/// Transaction fee that is paid at the Kusama BridgeHub for delivering single inbound message.
/// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`)
pub const BridgeHubKusamaBaseDeliveryFeeInKsms: u128 = 56_374_989_788;
/// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`)
pub const BridgeHubKusamaBaseDeliveryFeeInKsms: u128 = 3_140_383_954;

/// Transaction fee that is paid at the Kusama BridgeHub for delivering single outbound message confirmation.
/// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`)
pub const BridgeHubKusamaBaseConfirmationFeeInKsms: u128 = 53_808_755_240;
/// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_standalone_message_confirmation_transaction` + `33%`)
pub const BridgeHubKusamaBaseConfirmationFeeInKsms: u128 = 574_149_406;
}

/// Compute the total estimated fee that needs to be paid in KSMs by the sender when sending
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ impl pallet_bridge_grandpa::Config<BridgeGrandpaPolkadotInstance> for Runtime {
type WeightInfo = weights::pallet_bridge_grandpa::WeightInfo<Runtime>;
}

// FAIL-CI @svyatonik please check this.
impl pallet_bridge_grandpa::WeightInfoExt for weights::pallet_bridge_grandpa::WeightInfo<Runtime> {
fn submit_finality_proof_overhead_from_runtime() -> Weight {
todo!()
}
}

/// Add parachain bridge pallet to track Polkadot BridgeHub parachain.
pub type BridgeParachainPolkadotInstance = pallet_bridge_parachains::Instance1;
impl pallet_bridge_parachains::Config<BridgeParachainPolkadotInstance> for Runtime {
Expand Down
14 changes: 7 additions & 7 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Get},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
};
Expand Down Expand Up @@ -751,11 +751,10 @@ impl_runtime_apis! {
BridgePolkadotGrandpa::best_finalized()
}

fn free_headers_interval() -> Option<bp_polkadot_bulletin::BlockNumber> {
todo!() // FAIL-CI @svyatonik
/*<Runtime as pallet_bridge_grandpa::Config<
bridge_common_config::BridgeGrandpaRococoBulletinInstance
>>::FreeHeadersInterval::get()*/
fn free_headers_interval() -> Option<bp_polkadot::BlockNumber> {
<Runtime as pallet_bridge_grandpa::Config<
bridge_to_polkadot_config::BridgeGrandpaPolkadotInstance
>>::FreeHeadersInterval::get()
}

fn synced_headers_grandpa_info(
Expand All @@ -772,7 +771,8 @@ impl_runtime_apis! {
}

fn free_headers_interval() -> Option<bp_bridge_hub_polkadot::BlockNumber> {
None // FAIL-CI @svyatonik
// "free interval" is not currently used for parachains
None
}
}

Expand Down
21 changes: 17 additions & 4 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ fn construct_and_apply_extrinsic(
r.unwrap()
}

fn construct_and_estimate_extrinsic_fee(batch: pallet_utility::Call<Runtime>) -> Balance {
let batch_call = RuntimeCall::Utility(batch);
let batch_info = batch_call.get_dispatch_info();
let xt = construct_extrinsic(Alice, batch_call);
TransactionPayment::compute_fee(xt.encoded_size() as _, &batch_info, 0)
fn construct_and_estimate_extrinsic_fee(call: RuntimeCall) -> Balance {
let info = call.get_dispatch_info();
let xt = construct_extrinsic(Alice, call);
TransactionPayment::compute_fee(xt.encoded_size() as _, &info, 0)
}

fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime> {
Expand Down Expand Up @@ -327,12 +326,12 @@ pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
}

#[test]
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
pub fn can_calculate_fee_for_standalone_message_delivery_transaction() {
bridge_hub_test_utils::check_sane_fees_values(
"bp_bridge_hub_kusama::BridgeHubKusamaBaseDeliveryFeeInKsms",
bp_bridge_hub_kusama::BridgeHubKusamaBaseDeliveryFeeInKsms::get(),
|| {
from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
from_parachain::can_calculate_fee_for_standalone_message_delivery_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee)
},
Expand All @@ -346,12 +345,12 @@ pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
}

#[test]
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
pub fn can_calculate_fee_for_standalone_message_confirmation_transaction() {
bridge_hub_test_utils::check_sane_fees_values(
"bp_bridge_hub_kusama::BridgeHubKusamaBaseConfirmationFeeInKsms",
bp_bridge_hub_kusama::BridgeHubKusamaBaseConfirmationFeeInKsms::get(),
|| {
from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
from_parachain::can_calculate_fee_for_standalone_message_confirmation_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ frame_support::parameter_types! {
pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 177_594_900;

/// Transaction fee that is paid at the Polkadot BridgeHub for delivering single inbound message.
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`)
pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 16_912_512_364;
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`)
pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 942_115_365;

/// Transaction fee that is paid at the Polkadot BridgeHub for delivering single outbound message confirmation.
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`)
pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 16_142_641_864;
/// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_confirmation_transaction` + `33%`)
pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 172_244_865;
}

/// Compute the total estimated fee that needs to be paid in DOTs by the sender when sending
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ impl pallet_bridge_grandpa::Config<BridgeGrandpaKusamaInstance> for Runtime {
type WeightInfo = weights::pallet_bridge_grandpa::WeightInfo<Runtime>;
}

// FAIL-CI @svyatonik please check this. Also how does it work for multiple instances of the pallet?
impl pallet_bridge_grandpa::WeightInfoExt for weights::pallet_bridge_grandpa::WeightInfo<Runtime> {
fn submit_finality_proof_overhead_from_runtime() -> Weight {
todo!()
}
}

/// Add parachain bridge pallet to track Kusama BridgeHub parachain.
pub type BridgeParachainKusamaInstance = pallet_bridge_parachains::Instance1;
impl pallet_bridge_parachains::Config<BridgeParachainKusamaInstance> for Runtime {
Expand Down
14 changes: 7 additions & 7 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Get},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
};
Expand Down Expand Up @@ -761,11 +761,10 @@ impl_runtime_apis! {
BridgeKusamaGrandpa::best_finalized()
}

fn free_headers_interval() -> Option<bp_polkadot_bulletin::BlockNumber> {
todo!() // FAIL-CI @svyatonik
/*<Runtime as pallet_bridge_grandpa::Config<
bridge_common_config::BridgeGrandpaRococoBulletinInstance
>>::FreeHeadersInterval::get()*/
fn free_headers_interval() -> Option<bp_kusama::BlockNumber> {
<Runtime as pallet_bridge_grandpa::Config<
bridge_to_kusama_config::BridgeGrandpaKusamaInstance
>>::FreeHeadersInterval::get()
}

fn synced_headers_grandpa_info(
Expand All @@ -782,7 +781,8 @@ impl_runtime_apis! {
}

fn free_headers_interval() -> Option<bp_bridge_hub_kusama::BlockNumber> {
None // FAIL-CI @svyatonik
// "free interval" is not currently used for parachains
None
}
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@ fn construct_and_apply_extrinsic(
r.unwrap()
}

fn construct_and_estimate_extrinsic_fee(batch: pallet_utility::Call<Runtime>) -> Balance {
let batch_call = RuntimeCall::Utility(batch);
let batch_info = batch_call.get_dispatch_info();
let xt = construct_extrinsic(Alice, batch_call);
TransactionPayment::compute_fee(xt.encoded_size() as _, &batch_info, 0)
fn construct_and_estimate_extrinsic_fee(call: RuntimeCall) -> Balance {
let info = call.get_dispatch_info();
let xt = construct_extrinsic(Alice, call);
TransactionPayment::compute_fee(xt.encoded_size() as _, &info, 0)
}

fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime> {
Expand Down Expand Up @@ -328,12 +327,12 @@ pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
}

#[test]
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
pub fn can_calculate_fee_for_standalone_message_delivery_transaction() {
bridge_hub_test_utils::check_sane_fees_values(
"bp_bridge_hub_polkadot::BridgeHubPolkadotBaseDeliveryFeeInDots",
bp_bridge_hub_polkadot::BridgeHubPolkadotBaseDeliveryFeeInDots::get(),
|| {
from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
from_parachain::can_calculate_fee_for_standalone_message_delivery_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee)
},
Expand All @@ -347,12 +346,12 @@ pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
}

#[test]
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
pub fn can_calculate_fee_for_standalone_message_confirmation_transaction() {
bridge_hub_test_utils::check_sane_fees_values(
"bp_bridge_hub_polkadot::BridgeHubPolkadotBaseConfirmationFeeInDots",
bp_bridge_hub_polkadot::BridgeHubPolkadotBaseConfirmationFeeInDots::get(),
|| {
from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
from_parachain::can_calculate_fee_for_standalone_message_confirmation_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee)
},
Expand Down

0 comments on commit 5e61ece

Please sign in to comment.