fix(explorer): use known ABI for precompiles instead of external signature DBs#682
Open
fix(explorer): use known ABI for precompiles instead of external signature DBs#682
Conversation
Bundle Size Report
Chunk changes (>1KB)
Compared against main branch (baseline from 2/4/2026, 5:13:51 PM) |
Cloudflare Deployments
|
…ature DBs Skip whatsabi/OpenChain lookup for addresses with known ABIs (TIP-20 tokens, system contracts). External signature databases return false positives like "setPrice" for precompile selectors. Co-authored-by: o-az <23618431+o-az@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019cd8d6-2eab-716f-8b32-d5f273bb7675
…ases Two fixes: 1. lookupSignature() now checks a pre-computed selector map from all viem/tempo ABIs before hitting OpenChain/4byte/Samczun. Prevents false positives like "setPrice" for TIP-20 selectors. 2. TxDecodedCalldata no longer prefers external signature results over autoloadAbi results based on input count. When autoloadAbi returns a match (known ABI), it is always trusted. Co-authored-by: o-az <23618431+o-az@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019cd8d6-2eab-716f-8b32-d5f273bb7675
Co-Authored-By: o-az <23618431+o-az@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019cdb9f-ca6d-7749-bec7-b3b253b35fcc
fc25991 to
ad8318d
Compare
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
Short-circuits ABI resolution for known Tempo contracts (TIP-20 tokens, Fee Manager, Stablecoin DEX, etc.) so we never hit external signature databases (OpenChain, 4byte, Samczun) or whatsabi bytecode extraction for them.
Motivation
Investigated whether
setPriceon the PathUSD address page was a false positive — it's not, it's a real function on a LayerZero oracle contract (0xca3bb...). But while auditing the code, found that we're making unnecessary external API calls for contracts where we already have the ABI locally.Verified via Snowflake: every selector used on-chain against known Tempo precompiles currently resolves correctly in external DBs (no active false positives). But this is fragile — any new collision in external DBs would surface bogus names. This PR removes that dependency.
Changes
autoloadAbi()returns the known ABI immediately fromgetContractAbi()for registered contracts, skipping whatsabi + network callslookupSignature()checks a pre-computed selector map from allviem/tempoABIs before hitting external databasesTxDecodedCalldataalways trustsautoloadAbiover external signature results (previously preferred external results if they had more inputs)Testing
pnpm check:types— passespnpm check:biome— passesaccountKeychain.authorizeKeyPrompted by: omar