This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Cli: Decode known program custom errors returned from simulation #17652
Merged
CriesofCarrots
merged 1 commit into
solana-labs:master
from
CriesofCarrots:cli-simulation
Jun 2, 2021
Merged
Cli: Decode known program custom errors returned from simulation #17652
CriesofCarrots
merged 1 commit into
solana-labs:master
from
CriesofCarrots:cli-simulation
Jun 2, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t-nelson
approved these changes
Jun 2, 2021
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.
lgtm!
Comment on lines
+1960
to
+1974
// If transaction simulation returns a known Custom InstructionError, decode it | ||
if let ClientErrorKind::RpcError(RpcError::RpcResponseError { | ||
data: | ||
RpcResponseErrorData::SendTransactionPreflightFailure( | ||
RpcSimulateTransactionResult { | ||
err: | ||
Some(TransactionError::InstructionError( | ||
_, | ||
InstructionError::Custom(code), | ||
)), | ||
.. | ||
}, | ||
), | ||
.. | ||
}) = err.kind() |
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.
That's a mouthful! 😂
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.
Heh, I know! 😳
CI error is unrelated (#17655 ) |
mergify bot
pushed a commit
that referenced
this pull request
Jun 2, 2021
) (cherry picked from commit b7f98ea)
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
CLI actions may return cryptic error codes, even though the CLI knows how to decode the errors for all the programs it supports.
Summary of Changes
Add handling for RpcSimulateTransactionResult > InstructionError > Custom
Fixes #17637