Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Roznovjak committed Aug 29, 2024
1 parent a22e058 commit eaf9496
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions integration-tests/src/cross_chain_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ fn basilisk_should_receive_asset_when_transferred_from_relaychain() {
));
});
Rococo::execute_with(|| {
assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets(
assert_ok!(rococo_runtime::XcmPallet::limited_reserve_transfer_assets(
rococo_runtime::RuntimeOrigin::signed(ALICE.into()),
Box::new(Parachain(BASILISK_PARA_ID).into_versioned()),
Box::new(Junction::AccountId32 { id: BOB, network: None }.into_versioned()),
Box::new((Here, 300 * UNITS).into()),
0,
WeightLimit::Unlimited,
));

assert_eq!(
Expand Down Expand Up @@ -624,7 +625,7 @@ fn polkadot_xcm_execute_extrinsic_should_not_be_allowed() {
),
sp_runtime::DispatchErrorWithPostInfo {
post_info: frame_support::dispatch::PostDispatchInfo {
actual_weight: Some(Weight::from_parts(10613000, 0)),
actual_weight: Some(Weight::from_parts(10355000, 0)),
pays_fee: frame_support::dispatch::Pays::Yes,
},
error: pallet_xcm::Error::<basilisk_runtime::Runtime>::Filtered.into()
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ fn transaction_fees_should_be_as_expected_when_nft_is_minted() {
format_num(min_multiplier_rust_fees * 10_000 / UNITS, 4),
);

// before trying to fix this test, make sure that CREATE_COLLECTION_OFFSET and MINT_OFFSET
// were added to the rebenchmarked weights.
assert_eq_approx!(
rust_encoded_fees,
expected_rust_encoded_fees,
Expand All @@ -133,8 +135,8 @@ fn transaction_fees_should_be_as_expected_when_nft_is_minted() {
#[test]
fn transaction_fees_should_be_as_expected_when_nft_collection_is_created() {
Basilisk::execute_with(|| {
let expected_rust_encoded_fees = 76_492 * UNITS / 100; //764.92
let expected_ui_fees = 76_597 * UNITS / 100; //765.97
let expected_rust_encoded_fees = 61_167 * UNITS / 100; //611.67
let expected_ui_fees = 61_167 * UNITS / 100; //611.67

let call = pallet_nft::Call::<basilisk_runtime::Runtime>::create_collection {
collection_id: 0,
Expand Down
5 changes: 5 additions & 0 deletions runtime/basilisk/src/weights/pallet_nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ use core::marker::PhantomData;
/// Weights for `pallet_nft`.
pub struct WeightInfo<T>(PhantomData<T>);

const CREATE_COLLECTION_OFFSET: u64 = 400;
const MINT_OFFSET: u64 = 300;

/// Weights for `pallet_nft` using the Basilisk node and recommended hardware.
pub struct BasiliskWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_nft::WeightInfo for BasiliskWeight<T> {
Expand All @@ -71,6 +74,7 @@ impl<T: frame_system::Config> pallet_nft::WeightInfo for BasiliskWeight<T> {
// Estimated: `4087`
// Minimum execution time: 25_899_000 picoseconds.
Weight::from_parts(26_333_000, 4087)
.saturating_mul(CREATE_COLLECTION_OFFSET)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
Expand All @@ -96,6 +100,7 @@ impl<T: frame_system::Config> pallet_nft::WeightInfo for BasiliskWeight<T> {
// Estimated: `4087`
// Minimum execution time: 47_577_000 picoseconds.
Weight::from_parts(49_099_000, 4087)
.saturating_mul(MINT_OFFSET)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand Down

0 comments on commit eaf9496

Please sign in to comment.