fix(contracts): swap init_code_hash and code_hash keccak256 inputs#249
Open
AuburyEssentian wants to merge 1 commit intoparadigmxyz:mainfrom
Open
fix(contracts): swap init_code_hash and code_hash keccak256 inputs#249AuburyEssentian wants to merge 1 commit intoparadigmxyz:mainfrom
AuburyEssentian wants to merge 1 commit intoparadigmxyz:mainfrom
Conversation
init_code_hash should hash create.init (the initialization bytecode), and code_hash should hash result.code (the deployed runtime bytecode). The two keccak256 calls were reversed, causing the columns to contain each other's values in the canonical_execution_contracts table. The n_init_code_bytes / n_code_bytes byte-count columns reference the correct inputs already — only the hash columns were affected. Fixes ethpandaops/xatu#688.
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.
Problem
init_code_hashandcode_hashin thecontractsdataset are populated with each other's values. The twokeccak256calls on lines 101–102 ofcontracts.rsreference the wrong inputs:init_code_hashshould hashcreate.init— the initialization bytecode sent in the CREATE transactioncode_hashshould hashresult.code— the runtime bytecode stored at the contract addressThis was confirmed in ethpandaops/xatu#688 by comparing against
geth snapshot inspect-account: the value ininit_code_hashmatches geth'saccount.codehash(the deployed code hash), and distinct count ofcode_hash(~4.5M) far exceeds the known unique deployed code count (~1.7M).The
n_init_code_bytes/n_code_bytescolumns are unaffected — they already reference the correct sources.Fix
Swap the two
keccak256arguments so each column hashes the right input.