-
Notifications
You must be signed in to change notification settings - Fork 37
p-token: Fix error codes #52
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
Conversation
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.
Good looks, but I think we have a deeper problem when it comes to mismatching. As I mentioned in a few comments, since P-Token is storing primitives and using fallible on-demand deserialization, it will probably fail on different invalid account states than when SPL-Token would.
For example, if a malformed Mint
gets passed to SPL-Token, it's going to throw at Mint::unpack
for a whole range of invalid fields. On P-Token, some invalid state fields may not be caught until they are queried.
Some of these things may not be realistic test scenarios, and we can consider that fact, but it's going to make it hard to differentially fuzz these programs if we're too divergent in that respect.
eadc3ae
to
e3eee9e
Compare
eb26717
to
df7e7c3
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.
Looks good to me overall! Just a few little things
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.
Looks great to me!
Problem
Fuzzing p-token has revealed mismatches in the error codes returned by p-token compared to spl-token implementation.
Solution
Fix the mismatches. In some cases, extra validation on the account data was needed to replicate the same error code.