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

Fix decoding of LangError #919

Merged
merged 2 commits into from
Jan 25, 2023
Merged

Fix decoding of LangError #919

merged 2 commits into from
Jan 25, 2023

Conversation

ascjones
Copy link
Collaborator

As reported by @lean-apple, there was a bug decoding a LangError:

cargo contract call -m switch --dry-run --suri //Alice  --contract $CONTRACT
ERROR: Error decoding type 6: Result

Caused by:
    0: Error decoding type 8: ink_primitives::LangError
    1: No variant found with discriminant 1

This is because we were ignoring the explicitly assigned discriminant:

pub enum LangError {
    /// Failed to read execution input for the dispatchable.
    CouldNotReadInput = 1u32,
}

and instead using the implicit discriminant to decode.

The issue now is that the result is possibly not very useful to the user:

image

Perhaps we should consider explicitly decoding the LangError?

@ascjones ascjones merged commit 30ba1ec into master Jan 25, 2023
@ascjones ascjones deleted the aj/handle-lang-error branch January 25, 2023 17:02
@ascjones ascjones mentioned this pull request Jan 27, 2023
3 tasks
@SkymanOne SkymanOne mentioned this pull request Feb 1, 2023
@ascjones ascjones mentioned this pull request Feb 14, 2023
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

Successfully merging this pull request may close these issues.

2 participants