Skip to content

Commit

Permalink
Revert execute_blob and send_blob (#4266) (#4290)
Browse files Browse the repository at this point in the history
Revert "pallet-xcm: Deprecate `execute` and `send` in favor of
`execute_blob` and `send_blob` (#3749)"

This reverts commit feee773.

---------

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Javier Bullrich <javier@bullrich.dev>
  • Loading branch information
3 people authored Apr 29, 2024
1 parent 997c165 commit 8568329
Show file tree
Hide file tree
Showing 37 changed files with 563 additions and 1,085 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ publish = false
workspace = true

[dependencies]

# Substrate
sp-core = { path = "../../../../../../../substrate/primitives/core", default-features = false, version = "32.0.0" }
sp-runtime = { path = "../../../../../../../substrate/primitives/runtime", default-features = false, version = "35.0.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,18 +362,18 @@ macro_rules! impl_send_transact_helpers_for_relay_chain {
recipient: $crate::impls::ParaId,
call: $crate::impls::DoubleEncoded<()>
) {
use $crate::impls::{bx, Chain, RelayChain, Encode};
use $crate::impls::{bx, Chain, RelayChain};

<Self as $crate::impls::TestExt>::execute_with(|| {
let root_origin = <Self as Chain>::RuntimeOrigin::root();
let destination: $crate::impls::Location = <Self as RelayChain>::child_location_of(recipient);
let xcm = $crate::impls::xcm_transact_unpaid_execution(call, $crate::impls::OriginKind::Superuser);

// Send XCM `Transact`
$crate::impls::assert_ok!(<Self as [<$chain RelayPallet>]>::XcmPallet::send_blob(
$crate::impls::assert_ok!(<Self as [<$chain RelayPallet>]>::XcmPallet::send(
root_origin,
bx!(destination.into()),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));
Self::assert_xcm_pallet_sent();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_system_assets_works() {
)]);

PenpalA::execute_with(|| {
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send_blob(
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
root_origin,
bx!(system_para_destination),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

PenpalA::assert_xcm_pallet_sent();
Expand Down Expand Up @@ -159,10 +159,10 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
)]);

PenpalA::execute_with(|| {
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send_blob(
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
root_origin,
bx!(system_para_destination),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

PenpalA::assert_xcm_pallet_sent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ fn pay_xcm_fee_with_some_asset_swapped_for_native() {
penpal.clone(),
);

assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send_blob(
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
penpal_root,
bx!(asset_hub_location),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

PenpalA::assert_xcm_pallet_sent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_system_assets_works() {
)]);

PenpalA::execute_with(|| {
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send_blob(
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
root_origin,
bx!(system_para_destination),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

PenpalA::assert_xcm_pallet_sent();
Expand Down Expand Up @@ -159,10 +159,10 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
)]);

PenpalA::execute_with(|| {
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send_blob(
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
root_origin,
bx!(system_para_destination),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

PenpalA::assert_xcm_pallet_sent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,10 @@ fn pay_xcm_fee_with_some_asset_swapped_for_native() {
penpal.clone(),
);

assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send_blob(
assert_ok!(<PenpalA as PenpalAPallet>::PolkadotXcm::send(
penpal_root,
bx!(asset_hub_location),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

PenpalA::assert_xcm_pallet_sent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.

use crate::tests::*;
use codec::Encode;

#[test]
fn send_xcm_from_rococo_relay_to_westend_asset_hub_should_fail_on_not_applicable() {
Expand All @@ -27,7 +26,7 @@ fn send_xcm_from_rococo_relay_to_westend_asset_hub_should_fail_on_not_applicable

let remote_xcm = Xcm(vec![ClearOrigin]);

let xcm = VersionedXcm::from(Xcm::<()>(vec![
let xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit, check_origin },
ExportMessage {
network: WestendId.into(),
Expand All @@ -39,10 +38,10 @@ fn send_xcm_from_rococo_relay_to_westend_asset_hub_should_fail_on_not_applicable
// Rococo Global Consensus
// Send XCM message from Relay Chain to Bridge Hub source Parachain
Rococo::execute_with(|| {
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send_blob(
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send(
sudo_origin,
bx!(destination),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn create_agent() {

let create_agent_call = SnowbridgeControl::Control(ControlCall::CreateAgent {});
// Construct XCM to create an agent for para 1001
let remote_xcm = VersionedXcm::from(Xcm::<()>(vec![
let remote_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
DescendOrigin(Parachain(origin_para).into()),
Transact {
Expand All @@ -95,10 +95,10 @@ fn create_agent() {
// Rococo Global Consensus
// Send XCM message from Relay Chain to Bridge Hub source Parachain
Rococo::execute_with(|| {
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send_blob(
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send(
sudo_origin,
bx!(destination),
remote_xcm.encode().try_into().unwrap(),
bx!(remote_xcm),
));

type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Expand Down Expand Up @@ -140,7 +140,7 @@ fn create_channel() {

let create_agent_call = SnowbridgeControl::Control(ControlCall::CreateAgent {});
// Construct XCM to create an agent for para 1001
let create_agent_xcm = VersionedXcm::from(Xcm::<()>(vec![
let create_agent_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
DescendOrigin(Parachain(origin_para).into()),
Transact {
Expand All @@ -153,7 +153,7 @@ fn create_channel() {
let create_channel_call =
SnowbridgeControl::Control(ControlCall::CreateChannel { mode: OperatingMode::Normal });
// Construct XCM to create a channel for para 1001
let create_channel_xcm = VersionedXcm::from(Xcm::<()>(vec![
let create_channel_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
DescendOrigin(Parachain(origin_para).into()),
Transact {
Expand All @@ -166,16 +166,16 @@ fn create_channel() {
// Rococo Global Consensus
// Send XCM message from Relay Chain to Bridge Hub source Parachain
Rococo::execute_with(|| {
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send_blob(
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send(
sudo_origin.clone(),
bx!(destination.clone()),
create_agent_xcm.encode().try_into().unwrap(),
bx!(create_agent_xcm),
));

assert_ok!(<Rococo as RococoPallet>::XcmPallet::send_blob(
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send(
sudo_origin,
bx!(destination),
create_channel_xcm.encode().try_into().unwrap(),
bx!(create_channel_xcm),
));

type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ publish = false
workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.0" }

# Substrate
frame-support = { path = "../../../../../../../substrate/frame/support", default-features = false, version = "32.0.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.

use crate::tests::*;
use codec::Encode;

#[test]
fn send_xcm_from_westend_relay_to_rococo_asset_hub_should_fail_on_not_applicable() {
Expand All @@ -27,7 +26,7 @@ fn send_xcm_from_westend_relay_to_rococo_asset_hub_should_fail_on_not_applicable

let remote_xcm = Xcm(vec![ClearOrigin]);

let xcm = VersionedXcm::from(Xcm::<()>(vec![
let xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit, check_origin },
ExportMessage {
network: RococoId,
Expand All @@ -39,10 +38,10 @@ fn send_xcm_from_westend_relay_to_rococo_asset_hub_should_fail_on_not_applicable
// Westend Global Consensus
// Send XCM message from Relay Chain to Bridge Hub source Parachain
Westend::execute_with(|| {
assert_ok!(<Westend as WestendPallet>::XcmPallet::send_blob(
assert_ok!(<Westend as WestendPallet>::XcmPallet::send(
sudo_origin,
bx!(destination),
xcm.encode().try_into().unwrap(),
bx!(xcm),
));

type RuntimeEvent = <Westend as Chain>::RuntimeEvent;
Expand Down
Loading

0 comments on commit 8568329

Please sign in to comment.