Skip to content

Commit bc4f1a2

Browse files
committed
[docs-agent] Add eth_getCodeByHash, eth_getHeaderByHash, eth_getHeaderByNumber 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
1 parent 88f7994 commit bc4f1a2

3 files changed

Lines changed: 257 additions & 0 deletions

File tree

‎src/openrpc/chains/_components/custom/components.yaml‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,96 @@ components:
1414
title: hex encoded unsigned integer (any case)
1515
type: string
1616
pattern: ^0[xX]([1-9A-Fa-f]+[0-9A-Fa-f]*|0)$
17+
18+
BlockHeader:
19+
title: Block header object
20+
description: >-
21+
The consensus fields of a block header, as returned by
22+
`eth_getHeaderByHash` and `eth_getHeaderByNumber`. Structurally
23+
identical to the `Block` object but without body-level fields
24+
(`size`, `transactions`, `uncles`, `withdrawals`).
25+
type: object
26+
required:
27+
- hash
28+
- parentHash
29+
- sha3Uncles
30+
- miner
31+
- stateRoot
32+
- transactionsRoot
33+
- receiptsRoot
34+
- logsBloom
35+
- number
36+
- gasLimit
37+
- gasUsed
38+
- timestamp
39+
- extraData
40+
- mixHash
41+
- nonce
42+
additionalProperties: false
43+
properties:
44+
hash:
45+
title: Hash
46+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
47+
parentHash:
48+
title: Parent block hash
49+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
50+
sha3Uncles:
51+
title: Ommers hash
52+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
53+
miner:
54+
title: Coinbase
55+
$ref: "../evm/base-types.yaml#/components/schemas/address"
56+
stateRoot:
57+
title: State root
58+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
59+
transactionsRoot:
60+
title: Transactions root
61+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
62+
receiptsRoot:
63+
title: Receipts root
64+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
65+
logsBloom:
66+
title: Bloom filter
67+
$ref: "../evm/base-types.yaml#/components/schemas/bytes256"
68+
difficulty:
69+
title: Difficulty
70+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
71+
number:
72+
title: Number
73+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
74+
gasLimit:
75+
title: Gas limit
76+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
77+
gasUsed:
78+
title: Gas used
79+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
80+
timestamp:
81+
title: Timestamp
82+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
83+
extraData:
84+
title: Extra data
85+
$ref: "../evm/base-types.yaml#/components/schemas/bytes"
86+
mixHash:
87+
title: Mix hash
88+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
89+
nonce:
90+
title: Nonce
91+
$ref: "../evm/base-types.yaml#/components/schemas/bytes8"
92+
baseFeePerGas:
93+
title: Base fee per gas (EIP-1559, London)
94+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
95+
withdrawalsRoot:
96+
title: Withdrawals root (EIP-4895, Shanghai)
97+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
98+
blobGasUsed:
99+
title: Blob gas used (EIP-4844, Cancun)
100+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
101+
excessBlobGas:
102+
title: Excess blob gas (EIP-4844, Cancun)
103+
$ref: "../evm/base-types.yaml#/components/schemas/uint"
104+
parentBeaconBlockRoot:
105+
title: Parent Beacon Block Root (EIP-4788, Cancun)
106+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
107+
requestsHash:
108+
title: Requests hash (EIP-7685, Prague/Pectra)
109+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"

‎src/openrpc/chains/_components/custom/methods.yaml‎

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,3 +2332,154 @@ components:
23322332
params:
23332333
- name: transaction
23342334
value: "AAAAAgAAAAA7mRE4Dv6Yi6CokA6xz+RPNm99vpRr7QdyQPf2JN8VxQAAAGQAAAAAAAAAZQAAAAEAAAAAAAAAAAAAAABp/P05AAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABJbT82FmuwvpjSEOMSJs8PBDJi20hvk/TyzDLaJU++XcAAAAEbmFtZQAAAAAAAAAAAAAAAAAAAAA="
2335+
2336+
eth_getCodeByHash:
2337+
name: eth_getCodeByHash
2338+
description: >-
2339+
Returns the contract bytecode associated with a given code hash
2340+
(the keccak256 hash of the bytecode). Unlike `eth_getCode`, which
2341+
looks up code via an account address at a specific block, this
2342+
method resolves code directly from its hash, letting callers
2343+
deduplicate bytecode fetches when multiple accounts share the
2344+
same implementation (e.g., minimal proxies, upgradeable proxies,
2345+
EIP-7702 delegators). Used by MegaETH's stateless validator to
2346+
fetch witness-referenced contract code on demand.
2347+
x-compute-units: 20
2348+
params:
2349+
- name: Code hash
2350+
required: true
2351+
description: >-
2352+
The 32-byte keccak256 hash of the contract bytecode
2353+
(`codeHash` field from an account).
2354+
schema:
2355+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
2356+
result:
2357+
name: Bytecode
2358+
description: >-
2359+
The bytecode associated with the given code hash, as a
2360+
hexadecimal string. Returns `"0x"` if no code is stored under
2361+
this hash.
2362+
schema:
2363+
$ref: "../evm/base-types.yaml#/components/schemas/bytes"
2364+
examples:
2365+
- name: eth_getCodeByHash example
2366+
params:
2367+
- name: Code hash
2368+
value: "0xfa8c9db6c6cab7108dea276f4cd09d575674eb0852c0fa3187e59e98ef977998"
2369+
result:
2370+
name: Bytecode
2371+
value: "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100be5780638f2839701461"
2372+
2373+
eth_getHeaderByHash:
2374+
name: eth_getHeaderByHash
2375+
description: >-
2376+
Returns the block header identified by the given block hash.
2377+
Structurally identical to `eth_getBlockByHash` but omits body-level
2378+
fields (`size`, `transactions`, `uncles`, `withdrawals`), making it
2379+
cheaper to fetch when only consensus fields are needed (e.g.,
2380+
chain-tip anchoring for light clients or stateless validators).
2381+
x-compute-units: 20
2382+
params:
2383+
- name: Block hash
2384+
required: true
2385+
description: The 32-byte hash of the block to retrieve.
2386+
schema:
2387+
$ref: "../evm/base-types.yaml#/components/schemas/hash32"
2388+
result:
2389+
name: Block header
2390+
description: >-
2391+
The block header object, or `null` if no block with the given
2392+
hash is known.
2393+
schema:
2394+
oneOf:
2395+
- $ref: "../evm/base-types.yaml#/components/schemas/notFound"
2396+
- $ref: "./components.yaml#/components/schemas/BlockHeader"
2397+
examples:
2398+
- name: eth_getHeaderByHash example
2399+
params:
2400+
- name: Block hash
2401+
value: "0xec3c34973b6ba593643668f2279a715e241fc0ffe95f593b2d49fda556f1c512"
2402+
result:
2403+
name: Block header
2404+
value:
2405+
hash: "0xec3c34973b6ba593643668f2279a715e241fc0ffe95f593b2d49fda556f1c512"
2406+
parentHash: "0x85b055abc1eab8d988d160dd8ae9a2c07d6548f9609746348c53077cebd80262"
2407+
sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
2408+
miner: "0x4200000000000000000000000000000000000011"
2409+
stateRoot: "0x80d2e1ad2720c9f9f3fd25a7312e0c9e158c792a37f0ce37f7f6ba2d5a8cfa04"
2410+
transactionsRoot: "0x92e3342c97eba7aaf7da9d96755ddda67c00574b4d90518a3ab051e5d05d7886"
2411+
receiptsRoot: "0x42d0fd6b9b85b2da166fb9cf8b73d6f0325b14d676a2913fd7e3c8876d7430b7"
2412+
logsBloom: "0x0000000100000040001000000000000000200000020080008000000000200500000002000200008000000001000000000000000020000800000040000840008000000000000000000000010840040010001000000000000000010000000100000000000002000000000000000000880080004400000000000004001000000000000000000068000000000001000000001000000000004102000000000040000010080000000000000200000000000004402000402000000000008002000201000000000200a2000000000000000440000000000000000000400000000000a0000400000000008000000000000000000000000080080440000000000000000000"
2413+
difficulty: "0x0"
2414+
number: "0x14855a6"
2415+
gasLimit: "0x2540be400"
2416+
gasUsed: "0x855371"
2417+
timestamp: "0x6a5a7b79"
2418+
extraData: "0x00000000fa00000001"
2419+
mixHash: "0xcb1f34415ed865cc2a378d1dd767225c8f594560dd39fbf92c29aadec3a4ab78"
2420+
nonce: "0x0000000000000000"
2421+
baseFeePerGas: "0xf4240"
2422+
withdrawalsRoot: "0xcd9d73e1502e68817b06212100d7529fc71d1e8741d712ef8e68310e3600cc26"
2423+
blobGasUsed: "0x0"
2424+
excessBlobGas: "0x0"
2425+
parentBeaconBlockRoot: "0x602625e5c228d3ea1c71f2c9a596ce93c7c9a9e2f2a1c733c832e3a0369cb31c"
2426+
requestsHash: "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
2427+
2428+
eth_getHeaderByNumber:
2429+
name: eth_getHeaderByNumber
2430+
description: >-
2431+
Returns the block header identified by the given block number or
2432+
tag. Structurally identical to `eth_getBlockByNumber` but omits
2433+
body-level fields (`size`, `transactions`, `uncles`,
2434+
`withdrawals`). Accepts the standard block tags (`earliest`,
2435+
`latest`, `safe`, `finalized`, `pending`) in addition to a
2436+
hex-encoded block number.
2437+
x-compute-units: 20
2438+
params:
2439+
- name: Block number or tag
2440+
required: true
2441+
description: >-
2442+
The block number as a hex-encoded quantity, or one of the
2443+
named tags `earliest`, `latest`, `safe`, `finalized`,
2444+
`pending`.
2445+
schema:
2446+
$ref: "../evm/block.yaml#/components/schemas/BlockNumberOrTag"
2447+
result:
2448+
name: Block header
2449+
description: >-
2450+
The block header object, or `null` if the block does not
2451+
exist (for example, a future block number).
2452+
schema:
2453+
oneOf:
2454+
- $ref: "../evm/base-types.yaml#/components/schemas/notFound"
2455+
- $ref: "./components.yaml#/components/schemas/BlockHeader"
2456+
examples:
2457+
- name: eth_getHeaderByNumber example
2458+
params:
2459+
- name: Block number or tag
2460+
value: "finalized"
2461+
result:
2462+
name: Block header
2463+
value:
2464+
hash: "0xec3c34973b6ba593643668f2279a715e241fc0ffe95f593b2d49fda556f1c512"
2465+
parentHash: "0x85b055abc1eab8d988d160dd8ae9a2c07d6548f9609746348c53077cebd80262"
2466+
sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
2467+
miner: "0x4200000000000000000000000000000000000011"
2468+
stateRoot: "0x80d2e1ad2720c9f9f3fd25a7312e0c9e158c792a37f0ce37f7f6ba2d5a8cfa04"
2469+
transactionsRoot: "0x92e3342c97eba7aaf7da9d96755ddda67c00574b4d90518a3ab051e5d05d7886"
2470+
receiptsRoot: "0x42d0fd6b9b85b2da166fb9cf8b73d6f0325b14d676a2913fd7e3c8876d7430b7"
2471+
logsBloom: "0x0000000100000040001000000000000000200000020080008000000000200500000002000200008000000001000000000000000020000800000040000840008000000000000000000000010840040010001000000000000000010000000100000000000002000000000000000000880080004400000000000004001000000000000000000068000000000001000000001000000000004102000000000040000010080000000000000200000000000004402000402000000000008002000201000000000200a2000000000000000440000000000000000000400000000000a0000400000000008000000000000000000000000080080440000000000000000000"
2472+
difficulty: "0x0"
2473+
number: "0x14855a6"
2474+
gasLimit: "0x2540be400"
2475+
gasUsed: "0x855371"
2476+
timestamp: "0x6a5a7b79"
2477+
extraData: "0x00000000fa00000001"
2478+
mixHash: "0xcb1f34415ed865cc2a378d1dd767225c8f594560dd39fbf92c29aadec3a4ab78"
2479+
nonce: "0x0000000000000000"
2480+
baseFeePerGas: "0xf4240"
2481+
withdrawalsRoot: "0xcd9d73e1502e68817b06212100d7529fc71d1e8741d712ef8e68310e3600cc26"
2482+
blobGasUsed: "0x0"
2483+
excessBlobGas: "0x0"
2484+
parentBeaconBlockRoot: "0x602625e5c228d3ea1c71f2c9a596ce93c7c9a9e2f2a1c733c832e3a0369cb31c"
2485+
requestsHash: "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

‎src/openrpc/chains/megaeth/megaeth.yaml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ methods:
3939
- $ref: >-
4040
../_components/evm/methods.yaml#/components/methods/eth_getBlockTransactionCountByNumber
4141
- $ref: ../_components/evm/methods.yaml#/components/methods/eth_getCode
42+
- $ref: >-
43+
../_components/custom/methods.yaml#/components/methods/eth_getCodeByHash
4244
- $ref: ../_components/evm/methods.yaml#/components/methods/eth_getFilterChanges
4345
- $ref: ../_components/evm/methods.yaml#/components/methods/eth_getFilterLogs
46+
- $ref: >-
47+
../_components/custom/methods.yaml#/components/methods/eth_getHeaderByHash
48+
- $ref: >-
49+
../_components/custom/methods.yaml#/components/methods/eth_getHeaderByNumber
4450
- $ref: ../_components/evm/methods.yaml#/components/methods/eth_getLogs
4551
- $ref: >-
4652
../_components/evm/methods.yaml#/components/methods/eth_getRawTransactionByHash
@@ -69,3 +75,10 @@ methods:
6975
../_components/custom/methods.yaml#/components/methods/realtime_sendRawTransaction
7076
x-bot-ignore:
7177
- realtime_sendRawTransaction
78+
# Temporarily protect these three custom methods from Daikon strip until the
79+
# corresponding chain-config entries land upstream (see DOCS-144). Remove
80+
# these entries once Daikon's chain-config includes the custom method group
81+
# for MegaETH covering these methods.
82+
- eth_getCodeByHash
83+
- eth_getHeaderByHash
84+
- eth_getHeaderByNumber

0 commit comments

Comments
 (0)