Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xcm] Transact v4 vs v5 compatibility #6585

Closed
bkontur opened this issue Nov 21, 2024 · 2 comments · Fixed by #6643
Closed

[xcm] Transact v4 vs v5 compatibility #6585

bkontur opened this issue Nov 21, 2024 · 2 comments · Fixed by #6643
Assignees
Labels
T6-XCM This PR/Issue is related to XCM.

Comments

@bkontur
Copy link
Contributor

bkontur commented Nov 21, 2024

E.g. Westend is sending Transact to the child: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fwestend-rpc.polkadot.io#/explorer/query/0x01cd07a4ede58f34d76422febdf1adc28669c1a2ed5fa5ccaa7d15a7d1bfb0a5

take_decoded()?.get_dispatch_info is a problem for Transact, because on the sending chain we don't know what is RuntimeCall so decoding fails here for ():

For the real usage, we use e.g. xcm router which expects Xcm<()>:

fn validate(
		dest: &mut Option<Location>,
		msg: &mut Option<Xcm<()>>,
	) -> SendResult<(HostConfiguration<BlockNumberFor<T>>, ParaId, Vec<u8>)> {
		let d = dest.take().ok_or(MissingArgument)?;
		let id = if let (0, [Parachain(id)]) = d.unpack() {
			*id
		} else {
			*dest = Some(d);
			return Err(NotApplicable)
		};

		// Downward message passing.
		let xcm = msg.take().ok_or(MissingArgument)?;
		let config = configuration::ActiveConfig::<T>::get();
		let para = id.into();
		let price = P::price_for_delivery(para, &xcm);
		let versioned_xcm = W::wrap_version(&d, xcm).map_err(|()| DestinationUnsupported)?;

and the wrap_version ends here, because it tries to decode with RuntimeCall = ()"

                       Transact { origin_kind, mut call } => {
				let require_weight_at_most = call.take_decoded()?.get_dispatch_info().call_weight;
				Self::Transact { origin_kind, require_weight_at_most, call: call.into() }
			},
@bkontur bkontur added the T6-XCM This PR/Issue is related to XCM. label Nov 21, 2024
@bkontur
Copy link
Contributor Author

bkontur commented Nov 22, 2024

Description contains problem on the sending side, when workaround with force_xcm_version(location, 5) is used then it bubbles to the problem on the receiving side Corrupt error, where ProcessXcmMessage cannot decode the received XCM:

let versioned_message = VersionedXcm::<Call>::decode(&mut &message[..]).map_err(|e| {
			log::trace!(
				target: LOG_TARGET,
				"`VersionedXcm` failed to decode: {e:?}",
			);

			ProcessMessageError::Corrupt
		})?;

e.g.: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fwestend-coretime-rpc.polkadot.io#/explorer/query/0x21f8e21c63aa8f0554c8f955d093193ef465a9fe3b86ec228b3fbcd5df692e89


cc: @georgepisaltu This is exactly what you reported to me before
cc: @franciscoaguirre so now we have both parts of the one problem :)

@bkontur
Copy link
Contributor Author

bkontur commented Nov 22, 2024

sorry, force_xcm_version(location, 5) is not a workaround and Corrupt is ok, because that is the point, we want to update new blob with xcmv4->xcmv5, but the actual runtime has 4 :)
so ignore my comment above

@bkontur bkontur moved this to Todo in Bridges + XCM Nov 25, 2024
github-merge-queue bot pushed a commit that referenced this issue Dec 5, 2024
…ns (#6643)

Closes: #6585

Removing the `require_weight_at_most` parameter in V5 Transact had only
one problem. Converting a message from V5 to V4 to send to chains that
didn't upgrade yet. The conversion would not know what weight to give to
the Transact, since V4 and below require it.

To fix this, I added back the weight in the form of an `Option<Weight>`
called `fallback_max_weight`. This can be set to `None` if you don't
intend to deal with a chain that hasn't upgraded yet. If you set it to
`Some(_)`, the behaviour is the same. The plan is to totally remove this
in V6 since there will be a good conversion path from V6 to V5.

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
@github-project-automation github-project-automation bot moved this from Todo to Done in Bridges + XCM Dec 5, 2024
franciscoaguirre added a commit that referenced this issue Dec 5, 2024
…ns (#6643)

Closes: #6585

Removing the `require_weight_at_most` parameter in V5 Transact had only
one problem. Converting a message from V5 to V4 to send to chains that
didn't upgrade yet. The conversion would not know what weight to give to
the Transact, since V4 and below require it.

To fix this, I added back the weight in the form of an `Option<Weight>`
called `fallback_max_weight`. This can be set to `None` if you don't
intend to deal with a chain that hasn't upgraded yet. If you set it to
`Some(_)`, the behaviour is the same. The plan is to totally remove this
in V6 since there will be a good conversion path from V6 to V5.

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Krayt78 pushed a commit to Krayt78/polkadot-sdk that referenced this issue Dec 18, 2024
…ns (paritytech#6643)

Closes: paritytech#6585

Removing the `require_weight_at_most` parameter in V5 Transact had only
one problem. Converting a message from V5 to V4 to send to chains that
didn't upgrade yet. The conversion would not know what weight to give to
the Transact, since V4 and below require it.

To fix this, I added back the weight in the form of an `Option<Weight>`
called `fallback_max_weight`. This can be set to `None` if you don't
intend to deal with a chain that hasn't upgraded yet. If you set it to
`Some(_)`, the behaviour is the same. The plan is to totally remove this
in V6 since there will be a good conversion path from V6 to V5.

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
dudo50 pushed a commit to paraspell-research/polkadot-sdk that referenced this issue Jan 4, 2025
…ns (paritytech#6643)

Closes: paritytech#6585

Removing the `require_weight_at_most` parameter in V5 Transact had only
one problem. Converting a message from V5 to V4 to send to chains that
didn't upgrade yet. The conversion would not know what weight to give to
the Transact, since V4 and below require it.

To fix this, I added back the weight in the form of an `Option<Weight>`
called `fallback_max_weight`. This can be set to `None` if you don't
intend to deal with a chain that hasn't upgraded yet. If you set it to
`Some(_)`, the behaviour is the same. The plan is to totally remove this
in V6 since there will be a good conversion path from V6 to V5.

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
Status: Done
2 participants