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

Decoding XCM Dry Run error messages #6922

Closed
dudo50 opened this issue Dec 17, 2024 · 5 comments
Closed

Decoding XCM Dry Run error messages #6922

dudo50 opened this issue Dec 17, 2024 · 5 comments
Assignees

Comments

@dudo50
Copy link
Contributor

dudo50 commented Dec 17, 2024

Hello, we are currently implementing the dry run feature into our packages. We have met with one issue - decoding the XCM DRY Run error codes.

Is there any register where we can decode these for user?

Because currently we only receive HEX. I went through XCM Format repository, but it doesn't contain any information regarding this.

Many thanks in advance!

Here is example output:

"error":{
               "Module":{
                  "index":"31", //Pallet index
                  "error":"0x18000000" //Unknown error hex - where to find these?
               }
            }

Here is expected output:

 {
    "type": "Module",
    "value": {
        "type": "PolkadotXcm",
        "value": {
            "type": "LocalExecutionIncomplete"
        }
    }
}

Where do we find "error":"0x18000000" hex codes?

Thanks!

@dudo50
Copy link
Contributor Author

dudo50 commented Dec 17, 2024

So I found it in codebase of XCM Pallet:

#[pallet::error]
	pub enum Error<T> {
		/// The desired destination was unreachable, generally because there is a no way of routing
		/// to it.
		Unreachable,
		/// There was some other issue (i.e. not to do with routing) in sending the message.
		/// Perhaps a lack of space for buffering the message.
		SendFailure,
		/// The message execution fails the filter.
		Filtered,
		/// The message's weight could not be determined.
		UnweighableMessage,
		/// The destination `Location` provided cannot be inverted.
		DestinationNotInvertible,
		/// The assets to be sent are empty.
		Empty,
		/// Could not re-anchor the assets to declare the fees for the destination chain.
		CannotReanchor,
		/// Too many assets have been attempted for transfer.
		TooManyAssets,
		/// Origin is invalid for sending.
		InvalidOrigin,
		/// The version of the `Versioned` value used is not able to be interpreted.
		BadVersion,
		/// The given location could not be used (e.g. because it cannot be expressed in the
		/// desired version of XCM).
		BadLocation,
		/// The referenced subscription could not be found.
		NoSubscription,
		/// The location is invalid since it already has a subscription from us.
		AlreadySubscribed,
		/// Could not check-out the assets for teleportation to the destination chain.
		CannotCheckOutTeleport,
		/// The owner does not own (all) of the asset that they wish to do the operation on.
		LowBalance,
		/// The asset owner has too many locks on the asset.
		TooManyLocks,
		/// The given account is not an identifiable sovereign account for any location.
		AccountNotSovereign,
		/// The operation required fees to be paid which the initiator could not meet.
		FeesNotMet,
		/// A remote lock with the corresponding data could not be found.
		LockNotFound,
		/// The unlock operation cannot succeed because there are still consumers of the lock.
		InUse,
		/// Invalid asset, reserve chain could not be determined for it.
		#[codec(index = 21)]
		InvalidAssetUnknownReserve,
		/// Invalid asset, do not support remote asset reserves with different fees reserves.
		#[codec(index = 22)]
		InvalidAssetUnsupportedReserve,
		/// Too many assets with different reserve locations have been attempted for transfer.
		#[codec(index = 23)]
		TooManyReserves,
		/// Local XCM execution incomplete.
		#[codec(index = 24)]
		LocalExecutionIncomplete,
	}

Do I understand it right, that we just convert HEX to DECIMAL to get concrete error? Because in this case 0x18 HEX to decimal is 24 which is exact error we are getting in the test - LocalExecutionIncomplete

@acatangiu
Copy link
Contributor

Do I understand it right, that we just convert HEX to DECIMAL to get concrete error? Because in this case 0x18 HEX to decimal is 24 which is exact error we are getting in the test - LocalExecutionIncomplete

Yes, that is correct

@dudo50
Copy link
Contributor Author

dudo50 commented Dec 17, 2024

Okay then, thank you! Please document it somewhere for others!

Closing this issue as resolved now :).

@dudo50 dudo50 closed this as completed Dec 17, 2024
@dudo50
Copy link
Contributor Author

dudo50 commented Dec 17, 2024

@acatangiu We have one more issue. These errors start from index 0?

Because when we observe xTokens errors they start from index 0. However here it seems, that the errors start either from index 0 and skip index 20 manually overriding last 4 issues to 21-24. Or if it start from index 1 and no index is skipped.

Thanks a lot for information!

Dudo

@acatangiu
Copy link
Contributor

Yes, they start from 0 (default enum starting index) and skip index 20 because of an old error which was deprecated and removed. Indexing is meant to not change, you can even hardcode it, we will only ever add new entries or, if we remove any their indices will also be skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants