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

DispatchError changes after encoding and then decoding #8400

Closed
shaunxw opened this issue Mar 19, 2021 · 1 comment · Fixed by #8407
Closed

DispatchError changes after encoding and then decoding #8400

shaunxw opened this issue Mar 19, 2021 · 1 comment · Fixed by #8407
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.

Comments

@shaunxw
Copy link
Contributor

shaunxw commented Mar 19, 2021

If we have a DispatchError::Module variant like this:

DispatchError::Module { index: 1, error: 1, message: Some("foo") }

After encoding and then decoding, it will become different:

DispatchError::Module { index: 1, error: 1, message: None }

IMHO it needs be fixed as in general variables should be the same. It could cause troubles while doing equal assertion. Like in ORML unit tests, when a event contains DispatchError, comparing the built even in test function with System::events() results unexpected unequal, unless with a manual conversion like here.

@bkchr
Copy link
Member

bkchr commented Mar 19, 2021

This is done by intention, because we don't want to store the message on chain.

I'm open to accept a pr that changes the PartialEq to ignore message.

@shawntabrizi shawntabrizi added Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. labels Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants