Skip to content

Commit

Permalink
wip(bridge-hubs/bridge-hub-polkadot): decrease refTime in `snowbrid…
Browse files Browse the repository at this point in the history
…ge_pallet_ethereum_client::WeightInfo::submit_with_sync_committee` to assert tests are passing
  • Loading branch information
pandres95 committed Oct 25, 2024
1 parent 4e59b21 commit 16a2cf1
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1055,3 +1055,58 @@ fn reserve_transfer_ksm_from_para_to_para_through_relay() {
// Receiver's balance is increased
assert!(receiver_assets_after > receiver_assets_before);
}

/// Reserve Withdraw Native Asset from AssetHub to Parachain fails.
#[test]
fn reserve_withdraw_from_untrusted_reserve_fails() {
// Init values for Parachain Origin
let destination = AssetHubKusama::sibling_location_of(PenpalA::para_id());
let signed_origin =
<AssetHubKusama as Chain>::RuntimeOrigin::signed(AssetHubKusamaSender::get().into());
let ksm_to_send: Balance = KUSAMA_ED * 10000;
let ksm_location = KsmLocation::get();

// Assets to send
let assets: Vec<Asset> = vec![(ksm_location.clone(), ksm_to_send).into()];
let fee_id: AssetId = ksm_location.into();

// this should fail
AssetHubKusama::execute_with(|| {
let result = <AssetHubKusama as AssetHubKusamaPallet>::PolkadotXcm::transfer_assets_using_type_and_then(
signed_origin.clone(),
bx!(destination.clone().into()),
bx!(assets.clone().into()),
bx!(TransferType::DestinationReserve),
bx!(fee_id.into()),
bx!(TransferType::DestinationReserve),
bx!(VersionedXcm::from(Xcm::<()>::new())),
Unlimited,
);
assert_err!(
result,
DispatchError::Module(sp_runtime::ModuleError {
index: 31,
error: [22, 0, 0, 0],
message: Some("InvalidAssetUnsupportedReserve")
})
);
});

// this should also fail
AssetHubKusama::execute_with(|| {
let xcm: Xcm<asset_hub_kusama_runtime::RuntimeCall> = Xcm(vec![
WithdrawAsset(assets.into()),
InitiateReserveWithdraw {
assets: Wild(All),
reserve: destination,
xcm: Xcm::<()>::new(),
},
]);
let result = <AssetHubKusama as AssetHubKusamaPallet>::PolkadotXcm::execute(
signed_origin,
bx!(xcm::VersionedXcm::V4(xcm)),
Weight::MAX,
);
assert!(result.is_err());
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ frame_support::parameter_types! {

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

/// 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_standalone_message_confirmation_transaction` + `33%`)
pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 86_188_932;
pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 86_255_432;
}

/// Compute the total estimated fee that needs to be paid in DOTs by the sender when sending
Expand Down

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

0 comments on commit 16a2cf1

Please sign in to comment.