Skip to content

Best effort for decoding nested errors in reverts#98

Open
davecrighton wants to merge 4 commits intohyperledger:mainfrom
davecrighton:djc/nestedErrors
Open

Best effort for decoding nested errors in reverts#98
davecrighton wants to merge 4 commits intohyperledger:mainfrom
davecrighton:djc/nestedErrors

Conversation

@davecrighton
Copy link

This PR creates a common utility function that can be used to give a best-effort decoding of nested error strings in revert reasons. See hyperledger/firefly#1717 for further details.

The logic here is to scan to unwrap an error string as normal then walk through it looking at 4 byte chunks and comparing that to the list of known error ABI selectors (including the default). If we detect a known error ABI then we use the existing methods to decode and format this otherwise we will recursively unwrap up to depth 10.

If we are unable to decode, or if any error string contains non printable characters then the output is hex encoded instead.

Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
@davecrighton davecrighton requested a review from a team as a code owner February 27, 2026 16:07
@davecrighton davecrighton changed the title Djc/nested errors Best effort for decoding nested errors in reverts Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant