Skip to content

Commit 56637fe

Browse files
committed
fix
1 parent 69e6e23 commit 56637fe

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

benchmarks/ens/fake_rpc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Ensures all names in NAMES_FULL_COVERAGE resolve successfully in benchmarks.
2+
from benchmarks.web3._utils.params import BLOCK_DICT
3+
24
FAKE_ENS_REGISTRY = "0x0000000000000000000000000000000000000002"
35
FAKE_RESOLVER = "0x0000000000000000000000000000000000000001"
46
FAKE_RESULT_ADDR = "0x314159265dD8dbb310642f98f50C066173C1259b"
57

6-
78
def fake_json_rpc_response(request_data: dict):
89
method = request_data.get("method")
910
params = request_data.get("params", [])
@@ -41,5 +42,12 @@ def fake_json_rpc_response(request_data: dict):
4142
}
4243
else:
4344
return {"jsonrpc": "2.0", "id": request_data["id"], "result": "0x"}
45+
elif method == "eth_getBlockByNumber":
46+
# Return a realistic block dict for block queries (shared with tests)
47+
return {
48+
"jsonrpc": "2.0",
49+
"id": request_data["id"],
50+
"result": BLOCK_DICT,
51+
}
4452
# Default: always return a valid hex string for any other method
4553
return {"jsonrpc": "2.0", "id": request_data["id"], "result": "0x"}

0 commit comments

Comments
 (0)