-
Notifications
You must be signed in to change notification settings - Fork 238
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
Extract decode-error from solana-program #1813
Conversation
d14b1c1
to
5fd6dc0
Compare
a1731c8
to
b967e9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears to me that we can instead just eliminate this trait.
The decode_custom_error_to_enum
is just indirection around FromPrimitive::from_u32
, and it's only used in tests and impl PrintProgramError for ProgramError
, which can just use FromPrimitive
directly.
I also can't see where fn type_of()
is used anymore. I can take the DecodeError
impl out of some builtin program errors without issue, and I can change it within SPL programs and it doesn't affect anything as far as I can tell.
The direction would then be to use FromPrimitive::from_u32
directly within impl PrintProgramError for ProgramError
and then deprecate the trait. What do you think?
@buffalojoec makes sense, though CI fails when I do that because it requires a change to spl-token too:
The PR to deprecate DecodeError is here #2046 |
Yeah that's expected. I left a comment over on that PR about taking a little slower deprecation approach. We can maybe leave this one open for a bit in case we decide it's better to go with the extracted crate. |
If we leave the DecodeError implementations in then we should still move it to a new crate imo, otherwise we can't do any more SDK splitting for a year or however long it is until the 3.0 release |
44ba209
to
3212858
Compare
3212858
to
9ce5578
Compare
Problem
The DecodeError trait in decode_error.rs gets used all over solana-program, making it hard to move anything out of solana-program.
Summary of Changes