feat: Surface human-readable delegated revert reasons#245
Merged
Conversation
jeffsmale90
previously approved these changes
May 26, 2026
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.
📝 Description
Adds a helper for decoding revert reasons from delegated execution errors while preserving the original raw errors thrown by viem/providers.
🔄 What Changed?
List the specific changes made:
decodeRevertReason/decodeRevertDatautilities for standard Solidity errors and known Delegation Framework ABIs.DelegationManager.decode.redeemDelegationsErrorfor simulate/executeredeemDelegationsfailures.Before
After
🚀 Why?
Explain the motivation behind these changes:
ContractFunctionRevertedErrorchains and bundler/provider raw revert data formats.🧪 How to Test?
Describe how to test these changes:
redeemDelegationssimulate failure.DelegationManager.decode.redeemDelegationsError.List any breaking changes:
📋 Checklist
Check off completed items:
🔗 Related Issues
Link to related issues:
Closes N/A
Related to N/A
📚 Additional Notes
CHANGELOG entry:
Note
Low Risk
Additive, opt-in decoding API; simulate/execute/7710 flows still throw unchanged errors. No auth or on-chain behavior changes.
Overview
Adds opt-in helpers to turn raw viem/bundler/RPC failures from delegated execution into readable revert text without changing what gets thrown.
New
decodeRevertReason/decodeRevertDatawalk viemContractFunctionRevertedErrorchains and scrape hex from common error shapes, then decode against standard Solidity errors and@metamask/delegation-abis.DelegationManager.decode.redeemDelegationsErrorwraps that forsimulate/executeredeemDelegationsfailures. The same decoders are re-exported from@metamask/smart-accounts-kit/utils.Tests cover unit decoding, mocked simulate/execute paths, ERC-7710 wallet/bundler errors (still rethrowing the original error), and a delegator e2e case that asserts enforcer messages like
AllowedMethodsEnforcer:method-not-allowed.Reviewed by Cursor Bugbot for commit 16ef21b. Bugbot is set up for automated code reviews on this repo. Configure here.