Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Introduce XcmConversionError #5307

Open
wants to merge 157 commits into
base: master
Choose a base branch
from
Open

Conversation

KiChjang
Copy link
Contributor

@KiChjang KiChjang commented Apr 11, 2022

Fixes paritytech/polkadot-sdk#920.

Create two new types ConversionError and VersionedConversionError so that XCM APIs that attempt to convert from older versions of XCM to newer ones would throw a ConversionError instead of just ().

Each variant of the ConversionError enum will indicate the reason why the error was thrown. The VersionedConversionError enum is then used to wrap the ConversionError into one of its variants to indicate which version that the code was attempting to upgrade to threw an error.

One of the design considerations here is that converting from newer versions to older versions will not generate a ConversionError, and instead would still result in a catch-all UnsupportedVersion error. This is so that we push people towards using newer XCM versions, instead of continually supporting older versions, because technically speaking, older version will indeed be unsupported as time goes by.

CannotConvertBlob,
CannotConvertGeneralKey,
MaxAssetCountExceeded,
UnsupportedXcmErrorVariant,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I should use #[codec(index = $u8)] here to ensure that all enum variants have a well-defined SCALE encoding? I don't surmise that this enum would grow in the number of variants, but perhaps it's still a good practice to keep regardless?

KiChjang and others added 12 commits April 14, 2022 22:10
…-- benchmark pallet --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
…-- benchmark pallet --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
Base automatically changed from gav-xcm-v3 to master January 17, 2023 07:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out a good error reporting mechanism for XCM
4 participants