fix(blue-sdk-viem): avoid deployless EIP-5267 reverts#528
Closed
prd-carapulse[bot] wants to merge 1 commit intomainfrom
Closed
fix(blue-sdk-viem): avoid deployless EIP-5267 reverts#528prd-carapulse[bot] wants to merge 1 commit intomainfrom
prd-carapulse[bot] wants to merge 1 commit intomainfrom
Conversation
Rubilmax
approved these changes
Mar 17, 2026
Collaborator
Rubilmax
left a comment
There was a problem hiding this comment.
Probably affects other cases with try/catch in deployless?
oumar-fall
approved these changes
Mar 19, 2026
Collaborator
|
Superseded by #531, which preserves the same patch with a signed commit. |
auto-merge was automatically disabled
March 19, 2026 09:57
Pull request was closed
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.
Summary
Fix
@morpho-org/blue-sdk-viem's deploylessGetToken.query()helper so it does not revert on valid ERC-20s that implement EIP-5267.This was causing the consumer app to emit
RpcRequestError: execution revertedfor deployless token fetches even though the underlying token RPC calls were succeeding.User-facing impact
This addresses the Sentry issue reported from
morpho-consumer:MORPHO-CONSUMER-4F722,906events /1,264usersThe failure was noisy because
fetchToken()would first attempt the deployless helper, hit a revert, and then fall back to non-deployless reads. So users often still got the right token metadata, but only after an avoidable revertedeth_callthat was surfacing in Sentry.Root cause
The failing selector in Sentry was the deployless helper selector:
0x287861f9→GetToken.query(address,bool)I reproduced the issue on the Morpho cached mainnet RPC and on a forked Anvil instance at block
24,671,815using the exact token that appeared in the failing trace:0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8(Treehouse ETH/tETH)Direct calls to the token all succeed:
name()→Treehouse ETHsymbol()→tETHdecimals()→18eip712Domain()→fields = 0x0fname = "Treehouse ETH"version = "1"chainId = 1verifyingContract = tokensalt = 0x0extensions = []The old deployless
GetTokenbytecode still reverted aftereip712Domain()returned successfully. Tracing showed that the revert happened inside the helper's local decode/copy path for:So this was not:
tETHimplementationeip712Domain()responseIt was a deployless helper decode issue triggered by valid EIP-5267 return data.
Fix
Instead of decoding
eip712Domain()through Solidity'stry ... returns (Eip5267Domain memory)path,GetTokennow:staticcalltoeip712Domain()abi.decodes the returndata locally as(bytes1, string, string, uint256, address, bytes32, uint256[])Eip5267Domainstruct in the responseThis keeps the query ABI and the TypeScript SDK API unchanged, but avoids the buggy deployless decode path that was reverting.
Why this approach
I intentionally kept the change narrow:
That means callers still get the single deployless token read, but without the spurious revert.
Tests added / tightened
Strengthened existing coverage
The existing EIP-5267 token test now uses:
This is important because the previous test could still pass if deployless reverted and the implementation silently fell back to non-deployless reads.
New regression test
Added a regression test pinned to the failing mainnet era:
24,671,815Treehouse ETH(0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8)deployless: "force"This fails on the old helper bytecode and passes with this patch.
Validation
Manual onchain validation
Reproduced and validated on a mainnet fork built from the Morpho cached RPC:
GetTokenhelper bytecode to local Anvilquery(tETH, false)eip712Domain()Automated validation
Both passed locally.
Notes
I kept this PR scoped to
GetToken, which is the helper involved in the reported Sentry issue. If we see the same pattern elsewhere, we should audit any other deployless helpers that decodeEip5267Domainthrough the same Solidity path.