fix: detect standard contract creation bytecode prefix in decodeTxData - #1309
Open
mariazuheros wants to merge 1 commit into
Open
fix: detect standard contract creation bytecode prefix in decodeTxData#1309mariazuheros wants to merge 1 commit into
mariazuheros wants to merge 1 commit into
Conversation
The contract-creation guard only skipped inputs starting with 0x60e06040, but the common Solidity init code prefix is 0x60806040 (PUSH1 0x80 PUSH1 0x40 MSTORE). As a result, standard contract creation transactions fell through to the function decoder and were mislabeled as "⚠️ Unknown" in the block explorer. Check against both known init-code prefixes (0x60806040 and 0x60e06040, the latter used when a contract stores immutables) so deployments are correctly skipped while regular function calls still decode. Fixes scaffold-eth#1246 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
The contract-creation guard in
decodeTxData.tsonly skipped inputs starting with0x60e06040, but the common Solidity init code prefix is0x60806040(PUSH1 0x80 PUSH1 0x40 MSTORE).As a result, standard contract creation transactions fell through to the function decoder, failed to match any ABI, and were mislabeled as
⚠️ Unknownin the block explorer.Fix
Check the input against both known init-code prefixes:
0x60806040— the common prefix0x60e06040— used when a contract stores immutables (preserves the previous behavior)This way deployments are correctly detected and skipped, while regular function calls still decode normally.
Testing
yarn next:check-types— passesyarn next:lint— passes0x60806040), immutable deploys (0x60e06040), and normal function calls (transfer,approve): deployments are now skipped and function calls still decode.Fixes #1246