instruction: Forward compatibility for BorshIoError serde#410
Merged
joncinque merged 4 commits intoanza-xyz:maintenance/v2.xfrom Oct 29, 2025
Merged
instruction: Forward compatibility for BorshIoError serde#410joncinque merged 4 commits intoanza-xyz:maintenance/v2.xfrom
joncinque merged 4 commits intoanza-xyz:maintenance/v2.xfrom
Conversation
#### Problem As noted in anza-xyz#404, InstructionError in v2 can't deserialize the new BorshIoError variant in v3 because we removed the string component. #### Summary of changes After trying many different things, this seems like the least bad option, and actually recommended by serde's maintainer for this kind of situation. Agave should not be updated to use this, but all clients can pull in the new crate for their v2 builds to work with v3 RPC nodes.
fanatid
approved these changes
Oct 29, 2025
| { | ||
| let s = serde_json::Value::deserialize(deserializer)?; | ||
| if s.as_str().is_some_and(|v| v == "BorshIoError") { | ||
| Ok(Self::BorshIoError(String::new())) |
Contributor
There was a problem hiding this comment.
I had seen that default value is Unknown, should it be from default? but probably empty is valid 😕
Collaborator
Author
There was a problem hiding this comment.
I thought about that, but decided to go with the simplest option, since I don't even think RPC returns a value for these errors when coming from blocks.
This was referenced Oct 29, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
As noted in #404, InstructionError in v2 can't deserialize the new BorshIoError variant in v3 because we removed the string component.
Summary of changes
After trying many different things, this seems like the least bad option, and actually recommended by serde's maintainer for this kind of situation.
Agave should not be updated to use this, but all clients can pull in the new crate for their v2 builds to work with v3 RPC nodes.
cc @fanatid