-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Custom error decoder #3783
Custom error decoder #3783
Conversation
There's a clippy error in the num_derive crate (rust-num/num-derive#20). Because it's in a proc macro, it can't be narrowly ignored. There's a fix coming in clippy (rust-lang/rust-clippy#3932), but it hasn't landed yet, and it doesn't look like it's in Rust-1.34 clippy either. |
Codecov Report
@@ Coverage Diff @@
## master #3783 +/- ##
========================================
- Coverage 77.6% 77.5% -0.2%
========================================
Files 162 164 +2
Lines 27737 27806 +69
========================================
+ Hits 21533 21552 +19
- Misses 6204 6254 +50 |
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.
oops, I didn't see this review request until now. looks great
f0c3e3d
to
f9f2706
Compare
Update: num_derive is fixed, woot! Rebased and removed the ugly clippy fix :) |
solana-labs#3783) * Adding additional logging when overflow occurs in calculate_stake_rewards No change in functional behavior * Updated code to use expects statements, and test case macros based on review feedback * Resolving Performance Degredation by removing formatted output
Problem
The solana-sdk offers an easy way to encode custom program instruction errors (into
InstructionError::CustomError(<u32>)
), but no easy way to decode them.Summary of Changes
Add DecodeError trait to solana-sdk
Impl DecodeError for relevant solana native programs
Plumb through wallet to log and return decoded custom errors
FYI, @rob-solana