[docs-agent] Add eth_getCodeByHash, eth_getHeaderByHash, eth_getHeaderByNumber method definitions for MegaETH#1458
Merged
Conversation
…rByNumber method definitions for MegaETH Adds three new MegaETH-supported JSON-RPC method definitions to the custom method group and wires them into chains/megaeth/megaeth.yaml. Schemas verified live against https://mainnet.megaeth.com/rpc; see DOCS-144 for source citations. Refs DOCS-144 Requested-by: @dslovinsky
🔗 Preview Mode
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc4f1a2fa9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…example; revert megaeth.yaml wiring Codex flagged that the eth_getCodeByHash example result was a truncated bytecode prefix, so users running the example receive a longer response than documented. Replaced with the complete bytecode returned by the live API for the referenced code hash. Also reverted the chains/megaeth/megaeth.yaml $ref additions and x-bot-ignore updates per requester (those will be wired in a separate change, presumably via chain-config/Daikon). Refs DOCS-144 Requested-by: @dslovinsky
vahnag
approved these changes
Jul 17, 2026
hmvien
approved these changes
Jul 17, 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.
Summary
Adds three new JSON-RPC method definitions to the custom method group and wires them into MegaETH:
eth_getCodeByHash— resolves contract bytecode by keccak256 code-hash (params:codeHash: hash32→ result:bytes).eth_getHeaderByHash— returns the block header (no body-level fields) identified byblockHash: hash32.eth_getHeaderByNumber— same, identified byBlockNumberOrTag.All three schemas were verified live against
https://mainnet.megaeth.com/rpc(block0x14855a6), and both header methods return the same header-shape object minussize,transactions,uncles,withdrawalscompared toeth_getBlockByHash/ByNumber. Both returnnullfor unknown blocks and-32602 Invalid paramsfor missing/malformed parameters.Sources
eth_getCodeByHash— MegaETH's stateless-validator docs explicitly reference this method (metricstateless_validator_code_fetch_time_seconds= "Per-calleth_getCodeByHashlatency";--data-max-concurrent-requestscoverseth_get*"blocks, headers, code, tx"). Verified: keccak256 of the OP-style proxy bytecode at0x4200...0011(0xfa8c9db6...) resolves viaeth_getCodeByHashand returns the same bytecode aseth_getCode; unknown hashes return"0x".eth_getHeaderByHash/eth_getHeaderByNumber— Standard go-ethereum backend methods (HeaderByHash/HeaderByNumber) exposed as JSON-RPC by several EVM chains (Kaia, Somnia). MegaETH's stateless validation quickstart useseth_getHeaderByNumberas the canonical way to fetch a trusted anchor header. All five block tags (earliest,latest,safe,finalized,pending) return valid headers on MegaETH mainnet.New
BlockHeaderschemaAdds a
BlockHeaderschema to_components/custom/components.yaml(scoped to the custom group since these methods are MegaETH-specific for now). It mirrors theBlockschema in_components/evm/block.yamlminus the body-level fields, plusrequestsHash(EIP-7685, Pectra) which is present in MegaETH mainnet responses.Daikon safety
Added the three new methods to
x-bot-ignoreinchains/megaeth/megaeth.yamlto prevent Daikon's daily chain-config sync from stripping them before the corresponding chain-config entries land upstream. Once Daikon manages these methods, thex-bot-ignoreentries should be removed (seeLEARNINGS.md→ "Daikon x-bot-ignore sequencing trap").Open questions
x-compute-units— set to20for all three (matcheseth_getCode,eth_getBlockByHash,eth_getBlockByNumber), but the authoritative CU costs live inOMGWINNING/chain-config/topconfig.yml. Please confirm the CU values and adjust before merge.mainnet.megaeth.com/rpc. The spec lists both mainnet and testnet servers; assumed both endpoints support these methods (typical for MegaETH's public RPC parity), but please confirm.Linear
DOCS-144 — https://linear.app/alchemyapi/issue/DOCS-144/add-eth-getcodebyhash-eth-getheaderbyhash-eth-getheaderbynumber-method
Requested by
@dslovinsky (via Slack thread)