chain/ethereum: send eth_getBlockReceipts block hash as plain string param (#5835)#6647
Conversation
|
Have you reported this upstream to alloy? I'd be curious what their take is |
incrypto32
left a comment
There was a problem hiding this comment.
Fix looks right.
nit: On the test it doesn’t actually call the helper, so it’d still pass even if the fix got reverted. It’s not really testing our code. I’d just drop it, test_check_block_receipts_support already covers this.
I’d prefer this fixed upstream in alloy rather than worked around here. Feels like an alloy-side fix. Did you get a chance to report it upstream? if they push back let’s just land this and rip it out once alloy ships the fix.
|
Thanks both. @incrypto32 - dropped the serialization test; you're right that it pinned @lutter @incrypto32 - reported upstream: alloy-rs/alloy#4049, asking whether Happy to treat this PR as a stopgap and rip it out once alloy ships a fix. If they decide it's the node's problem, this keeps the affected indexers on single-call block receipts in the meantime rather than degrading to per-transaction fetching. |
|
Upstream fix is now open as a PR too: alloy-rs/alloy#4050 (introduces a |
|
Thanks @cargopete for digging into this and reporting it upstream. Seems alloy fix is now merged (alloy-rs/alloy#4052) and covers our exact call path, so we won’t need to carry this workaround. Going to close it out, we’ll pick the fix up for free on the next alloy bump. Tracking in #5835 until then. |
Summary
Fixes #5835. graph-node sends
eth_getBlockReceiptswith the block hash as anEIP-1898 object param (
[{"blockHash":"0x.."}]) rather than the plain stringform (
["0x.."]). Some clients (e.g. taraxa-node) only accept the plain stringand reject the object with
INVALID_PARAMS.This happens because both block-receipts call sites go through alloy's typed
Provider::get_block_receipts(BlockId), andBlockId::from(block_hash)serializes a
BlockId::Hashas{"blockHash": ".."}.When the capability probe (
check_block_receipt_support) fails on such a node,graph-node caches "block receipts unsupported" and permanently falls back to one
eth_getTransactionReceiptper transaction — correct data, but materially sloweringestion and far more RPC load.
Fix
Add a small helper that issues a raw request with the hash as a plain string:
Both call sites (
check_block_receipt_supportandfetch_block_receipts_with_retry)now route through it. The plain-string form is accepted by all known
implementations, and remains valid for nodes that currently work (they accept
both forms).
Testing
block_receipts_param_is_plain_hash_stringasserting the newparam serializes to a string array
["0x.."], and pinning the old object formas a regression guard.
ethereum_adapterunit tests pass (incl.test_check_block_receipts_support).cargo fmt,cargo clippy --all-targets, andcargo check --releaseclean forgraph-chain-ethereum.Trade-off
A node that accepts only the EIP-1898 object form and not the plain string
would regress. In practice this is the rarer (and arguably non-conformant) case —
the plain hash string is the canonical Geth form and, per the issue reporter, the
form "all implementations" accept. Flagging it explicitly for maintainer review.