Skip to content

Commit 6c7bdff

Browse files
chore: readme - overrides explained (#3823)
Signed-off-by: Mariusz Jasuwienas <[email protected]>
1 parent a3ca41a commit 6c7bdff

File tree

1 file changed

+76
-0
lines changed
  • packages/server/tests/acceptance/data/conformity/overwrites

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Hedera JSON-RPC test overrides
2+
3+
This directory contains **overridden test cases** for the [Ethereum Execution API JSON-RPC test suite](https://github.com/ethereum/execution-apis/tree/main/tests), adjusted to validate **Hedera’s JSON-RPC relay**.
4+
5+
## Purpose
6+
7+
The upstream `rpc-compat` test suite is designed for Ethereum clients and assumes compatibility with Ethereum-specific data (e.g., signed blocks in `chain.rlp`, Ethereum chain IDs, transaction signatures). However, due to protocol differences, **some test cases cannot be executed as-is against a Hedera node**.
8+
9+
This directory provides **Hedera-compatible test overrides** that:
10+
11+
- Mirror the structure of the upstream tests.
12+
- Reflect behavior specific to the Hedera JSON-RPC relay.
13+
- Serve as a drop-in replacement when upstream tests are not applicable.
14+
15+
## Structure
16+
17+
Each test override is stored using the `.io` format:
18+
19+
```
20+
Overrides
21+
eth_call/
22+
call-callenv.io
23+
eth_getLogs/
24+
no-topics.io
25+
````
26+
27+
Each file consists of a single round-trip request and response:
28+
29+
```
30+
>> {"jsonrpc":"2.0","id":1,"method":"eth_blockNumber"}
31+
<< {"jsonrpc":"2.0","id":1,"result":"0x3"}
32+
````
33+
34+
The folder structure mirrors the upstream suite (`tests/{method}/{test-name}.io`), making it easy to identify which test is being overridden.
35+
36+
## When to create an override
37+
38+
You should create an override when:
39+
40+
* A test in the upstream suite fails or must be skipped due to Hedera-specific limitations (e.g., unsupported chain id, which prevents us from replaying pre-signed transactions from chain.rlp. This is especially problematic when the test depends on a smart contract being deployed to a specific address; something we cannot replicate because we can't recreate those transactions without re-signing them using the original, unsupported chain id).
41+
* You want to define a **custom behavior** or scenario that applies specifically to Hedera's implementation.
42+
* You need to **test features not currently supported in the standard Ethereum Execution APIs**, such as Hedera-specific endpoints or modified responses.
43+
44+
## How to create a new override
45+
46+
1. **Identify the test** that cannot be executed or validated as-is.
47+
48+
2. **Create a new `.io` file** under `tests-overrides/{method}/{test-name}.io`.
49+
50+
3. Use the following format:
51+
52+
```
53+
>> { JSON-RPC request }
54+
<< { Expected JSON-RPC response }
55+
```
56+
57+
4. Make sure the test reflects realistic Hedera state. You can:
58+
59+
* Preset required accounts and balances on your local node.
60+
* Deploy required contracts manually if the original test assumes them.
61+
* Emulate necessary conditions to simulate the expected behavior.
62+
63+
5. If applicable, **add a comment (inside the file or a companion note)** explaining why the override exists and how it differs from the upstream test.
64+
65+
## Test format rules
66+
67+
* Tests **must be single round-trip** (request → response).
68+
* Subscription methods are **not currently supported**.
69+
* Follow JSON-RPC 2.0 format strictly.
70+
* Avoid relying on chain.rlp or genesis.json files. Instead, manually recreate (or "shadow") the required transactions and state setup before running the tests.
71+
72+
## Documentation and references
73+
74+
* [Ethereum Execution APIs test suite](https://github.com/ethereum/execution-apis/tree/main/tests)
75+
* [Hive rpc-compat simulator](https://github.com/ethereum/hive/tree/master/simulators/ethereum/rpc-compat)
76+
* [Hedera JSON-RPC Relay (internal documentation)](https://your-internal-docs-link-if-applicable)

0 commit comments

Comments
 (0)