mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 05:57:59 +00:00
xcm: SovereignPaidRemoteExporter: remove unused RefundSurplus instruction (#2312)
Refunding surplus happens anyway on xcm_executor::post_process(), automatically refunding surplus to original_origin at the end of execution. Since SovereignPaidRemoteExporter doesn't ClearOrigin, it can simply rely on the automatic mechanism. Furthermore, RefundSurplus instruction refunds _surplus_. Surplus exists only as a result of Transact, SetErrorHandler or SetAppendix instructions, none of which being part of the SovereignPaidRemoteExporter XCM program. So surplus is always zero here anyway.
This commit is contained in:
@@ -909,7 +909,6 @@ where
|
||||
]),
|
||||
]),
|
||||
},
|
||||
RefundSurplus,
|
||||
DepositAsset {
|
||||
assets: Wild(All),
|
||||
beneficiary: MultiLocation { parents: 1, interior: X1(Parachain(1000)) },
|
||||
|
||||
@@ -44,7 +44,7 @@ fn sending_to_bridged_chain_works() {
|
||||
maybe_with_topic(|| {
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
let dest = (Parent, Parent, Remote::get(), Parachain(1)).into();
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, (Here, 100).into());
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, Price::get());
|
||||
assert_eq!(TheBridge::service(), 1);
|
||||
assert_eq!(
|
||||
take_received_remote_messages(),
|
||||
@@ -78,7 +78,7 @@ fn sending_to_parachain_of_bridged_chain_works() {
|
||||
maybe_with_topic(|| {
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
let dest = (Parent, Parent, Remote::get(), Parachain(1000)).into();
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, (Here, 100).into());
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, Price::get());
|
||||
assert_eq!(TheBridge::service(), 1);
|
||||
let expected = vec![(
|
||||
(Parent, Parachain(1000)).into(),
|
||||
@@ -110,7 +110,7 @@ fn sending_to_relay_chain_of_bridged_chain_works() {
|
||||
maybe_with_topic(|| {
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
let dest = (Parent, Parent, Remote::get()).into();
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, (Here, 100).into());
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, Price::get());
|
||||
assert_eq!(TheBridge::service(), 1);
|
||||
let expected = vec![(
|
||||
Parent.into(),
|
||||
|
||||
@@ -41,7 +41,7 @@ fn sending_to_bridged_chain_works() {
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
assert_eq!(
|
||||
send_xcm::<Router>((Parent, Remote::get()).into(), msg).unwrap().1,
|
||||
(Here, 100).into()
|
||||
Price::get()
|
||||
);
|
||||
assert_eq!(TheBridge::service(), 1);
|
||||
let expected = vec![(
|
||||
@@ -68,7 +68,7 @@ fn sending_to_parachain_of_bridged_chain_works() {
|
||||
maybe_with_topic(|| {
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
let dest = (Parent, Remote::get(), Parachain(1000)).into();
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, (Here, 100).into());
|
||||
assert_eq!(send_xcm::<Router>(dest, msg).unwrap().1, Price::get());
|
||||
assert_eq!(TheBridge::service(), 1);
|
||||
let expected = vec![(
|
||||
Parachain(1000).into(),
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
use super::*;
|
||||
|
||||
parameter_types! {
|
||||
// 100 to use the bridge (export) and 80 for the remote execution weight (4 instructions x (10 +
|
||||
// 10) weight each).
|
||||
pub SendOverBridgePrice: u128 = 180u128 + if UsingTopic::get() { 20 } else { 0 };
|
||||
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(100));
|
||||
pub RelayUniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
||||
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
||||
@@ -32,11 +35,9 @@ parameter_types! {
|
||||
Remote::get(),
|
||||
None,
|
||||
MultiLocation::parent(),
|
||||
Some((Parent, 200u128 + if UsingTopic::get() { 20 } else { 0 }).into())
|
||||
Some((Parent, SendOverBridgePrice::get()).into())
|
||||
)
|
||||
];
|
||||
// ^^^ 100 to use the bridge (export) and 100 for the remote execution weight (5 instructions
|
||||
// x (10 + 10) weight each).
|
||||
}
|
||||
type TheBridge =
|
||||
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
||||
@@ -68,7 +69,7 @@ fn sending_to_bridged_chain_works() {
|
||||
clear_assets(Parachain(100));
|
||||
add_asset(Parachain(100), (Here, 1000u128));
|
||||
|
||||
let price = 200u128 + if UsingTopic::get() { 20 } else { 0 };
|
||||
let price = SendOverBridgePrice::get();
|
||||
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
assert_eq!(send_xcm::<LocalRouter>(dest, msg).unwrap().1, (Parent, price).into());
|
||||
@@ -86,7 +87,7 @@ fn sending_to_bridged_chain_works() {
|
||||
)];
|
||||
assert_eq!(take_received_remote_messages(), expected);
|
||||
|
||||
// The export cost 50 ref time and 50 proof size weight units (and thus 100 units of
|
||||
// The export cost 40 ref time and 40 proof size weight units (and thus 80 units of
|
||||
// balance).
|
||||
assert_eq!(asset_list(Parachain(100)), vec![(Here, 1000u128 - price).into()]);
|
||||
|
||||
@@ -104,11 +105,10 @@ fn sending_to_bridged_chain_works() {
|
||||
destination: Here,
|
||||
xcm: xcm_with_topic([0; 32], vec![Trap(1)]),
|
||||
},
|
||||
RefundSurplus,
|
||||
DepositAsset { assets: Wild(All), beneficiary: Parachain(100).into() },
|
||||
],
|
||||
),
|
||||
outcome: Outcome::Complete(test_weight(5)),
|
||||
outcome: Outcome::Complete(test_weight(4)),
|
||||
paid: true,
|
||||
};
|
||||
assert_eq!(RoutingLog::take(), vec![entry]);
|
||||
@@ -143,7 +143,7 @@ fn sending_to_parachain_of_bridged_chain_works() {
|
||||
clear_assets(Parachain(100));
|
||||
add_asset(Parachain(100), (Here, 1000u128));
|
||||
|
||||
let price = 200u128 + if UsingTopic::get() { 20 } else { 0 };
|
||||
let price = SendOverBridgePrice::get();
|
||||
|
||||
let msg = Xcm(vec![Trap(1)]);
|
||||
assert_eq!(send_xcm::<LocalRouter>(dest, msg).unwrap().1, (Parent, price).into());
|
||||
@@ -161,7 +161,7 @@ fn sending_to_parachain_of_bridged_chain_works() {
|
||||
)];
|
||||
assert_eq!(take_received_remote_messages(), expected);
|
||||
|
||||
// The export cost 50 ref time and 50 proof size weight units (and thus 100 units of
|
||||
// The export cost 40 ref time and 40 proof size weight units (and thus 80 units of
|
||||
// balance).
|
||||
assert_eq!(asset_list(Parachain(100)), vec![(Here, 1000u128 - price).into()]);
|
||||
|
||||
@@ -179,11 +179,10 @@ fn sending_to_parachain_of_bridged_chain_works() {
|
||||
destination: Parachain(100).into(),
|
||||
xcm: xcm_with_topic([0; 32], vec![Trap(1)]),
|
||||
},
|
||||
RefundSurplus,
|
||||
DepositAsset { assets: Wild(All), beneficiary: Parachain(100).into() },
|
||||
],
|
||||
),
|
||||
outcome: Outcome::Complete(test_weight(5)),
|
||||
outcome: Outcome::Complete(test_weight(4)),
|
||||
paid: true,
|
||||
};
|
||||
assert_eq!(RoutingLog::take(), vec![entry]);
|
||||
|
||||
@@ -305,7 +305,6 @@ impl<Bridges: ExporterFor, Router: SendXcm, UniversalLocation: Get<InteriorMulti
|
||||
WithdrawAsset(fees.clone().into()),
|
||||
BuyExecution { fees, weight_limit: Unlimited },
|
||||
export_instruction,
|
||||
RefundSurplus,
|
||||
DepositAsset { assets: All.into(), beneficiary: local_from_bridge },
|
||||
]
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user