Fallback handle string BorshIoError for InstructionError#8582
Fallback handle string BorshIoError for InstructionError#8582BriungRi wants to merge 1 commit intoanza-xyz:masterfrom
BorshIoError for InstructionError#8582Conversation
8c0325f to
030aa7f
Compare
030aa7f to
3c5a73b
Compare
InstructionError parsing fixes
3c5a73b to
20df6dc
Compare
InstructionError parsing fixesBorshIoError
Enhance the InstructionError deserializer within UiTransactionError to handle
both unit variant and newtype variant serialization formats. This improves
compatibility when deserializing errors from different SDK versions.
Specifically handles the case where BorshIoError may be serialized as:
- Unit variant: "BorshIoError" (SDK v2.0+)
- Newtype variant: {"BorshIoError": "message"} (older SDKs)
The deserializer now tries the direct deserialization first (handles unit
variants), and falls back to converting the format if needed (handles newtype
variants in older SDKs).
This defensive coding ensures forward and backward compatibility across SDK
version boundaries.
20df6dc to
94606c3
Compare
BorshIoError BorshIoError for InstructionError
|
@t-nelson the only point of this would be for a v2.3 backport for compatibility, so might as well get ahead of things w/ any feedback |
|
Hi @BriungRi - I haven't reviewed the actual PR yet, but in the future, please try to get the commits & branch a bit more "ready" before creating the PR. I see a bunch of force pushes and PR renames in a pretty short span |
|
"fixes" issue seems unrelated. where is |
|
@t-nelson I had a bad description. Went back and found the crates and versions between master and 2.3. master is using |
|
@joncinque @kevinheavey was there an existing migration plan for this change? |
|
To be honest, I thought it would Just Work since we weren't storing these, so there was no specific plan. I think the easiest way forward is to land something like this, backport it to v3, and then backport the inverse change to v2.3, ie add an empty string if an empty If that approach sounds good, I'll take over reviews for this PR and help get backports through. |
Problem
InstructionErrorfromsolana-instruction@2.3.0doesn't have a way to parse theInstructionErrorfrom 3.x validators when it comes back as"BorshIoError". This is handled in a new crate,solana-instruction-error@2.0.0, but this commit makes it possible to backport it to the 2.3 branch without the crate addition/upgradeSummary of Changes
Add fallback
InstructionErrorparsing for"BorshIoError"Fixes #8548