Skip to content

Commit

Permalink
run new benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
lrazovic authored and JuaniRios committed Jul 8, 2024
1 parent bcebb39 commit cfa3351
Show file tree
Hide file tree
Showing 4 changed files with 522 additions and 44 deletions.
25 changes: 24 additions & 1 deletion integration-tests/src/tests/ct_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
use crate::*;
use frame_support::traits::{fungible::Mutate, fungibles::Inspect};
use itertools::Itertools;
use pallet_funding::{assert_close_enough, types::*, ProjectId};
use pallet_funding::{assert_close_enough, types::*, ProjectId, WeightInfo};
use polimec_common::migration_types::{MigrationStatus, Migrations, ParticipationType};
use polimec_runtime::{Funding, RuntimeOrigin};
use polkadot_service::chain_spec::get_account_id_from_seed;
use sp_runtime::Perquintill;
use std::collections::HashMap;
use tests::defaults::*;
use xcm_executor::traits::WeightBounds;

fn alice() -> AccountId {
get_account_id_from_seed::<sr25519::Public>(ALICE)
Expand Down Expand Up @@ -318,3 +319,25 @@ fn cannot_start_pallet_migration_with_unsettled_participations() {
});
}
}

#[test]
fn hrmp_functions_weight_is_under_assumed_maximum() {
type WeightInfo = <PolimecRuntime as pallet_funding::Config>::WeightInfo;
type XcmWeigher = <polimec_runtime::xcm_config::XcmConfig as polimec_xcm_executor::Config>::Weigher;

let open_channel_message = xcm::v3::Instruction::<PolimecCall>::HrmpNewChannelOpenRequest {
sender: 6969,
max_message_size: 102_300,
max_capacity: 1000,
};
let channel_accepted_message = xcm::v3::Instruction::<PolimecCall>::HrmpChannelAccepted { recipient: 6969u32 };

let open_channel_message_real_weight = WeightInfo::do_handle_channel_open_request();
let open_channel_message_deducted_weight = XcmWeigher::instr_weight(&open_channel_message).unwrap();

let channel_accepted_message_real_weight = WeightInfo::do_handle_channel_accepted();
let channel_accepted_message_deducted_weight = XcmWeigher::instr_weight(&channel_accepted_message).unwrap();

assert!(open_channel_message_deducted_weight.all_gte(open_channel_message_real_weight));
assert!(channel_accepted_message_deducted_weight.all_gte(channel_accepted_message_real_weight));
}
2 changes: 1 addition & 1 deletion integration-tests/src/tests/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ fn execution_fees_go_to_treasury() {
assert_reserve_asset_fee_goes_to_treasury(usdt_amount);
assert_reserve_asset_fee_goes_to_treasury(usdc_amount);
assert_plmc_fee_goes_to_treasury();
}
}
Loading

0 comments on commit cfa3351

Please sign in to comment.