ethereum-optimism / ethereum-optimism/optimism
op-reth: pre-Bedrock eth_getLogs is not forwarded to the historical RPC endpoint
- Dominant language
- Go
- Stars
- 6.5k
- Forks
- 4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 145
Description
**Bug Description**
OP-Reth returns an empty result for a pre-Bedrock `eth_getLogs` request even though the matching log exists and is returned by:
- `eth_getTransactionReceipt`
- `eth_getBlockReceipts`
- The configured historical RPC endpoint directly
**Steps to Reproduce**
Start OP-Reth for OP Mainnet with a historical RPC configured:
```text
--rollup.historicalrpc=http://:8545
```
Set the OP-Reth RPC URL:
```bash
export RPC_URL="http://localhost:8545"
```
Run:
```bash
curl -sS -X POST "$RPC_URL" \
-H 'content-type: application/json' \
--data '[
{
"jsonrpc":"2.0",
"id":1,
"method":"eth_getTransactionReceipt",
"params":[
"0x0e5d841f035f868e13ba141c7edf45525394254a11c2e906a838a055163fabbb"
]
},
{
"jsonrpc":"2.0",
"id":2,
"method":"eth_getBlockReceipts",
"params":["0x5a66315"]
},
{
"jsonrpc":"2.0",
"id":3,
"method":"eth_getLogs",
"params":[{
"fromBlock":"0x5a66315",
"toBlock":"0x5a66315",
"address":"0x5e61a079a178f0e5784107a4963baae0c5a680c6",
"topics":[
"0x7568e63260f13515e4b3208667c411fbf4c7dce047496ca5f9a56f1c92440d93"
]
}]
}
]'
```
Actual result:
```text
eth_getTransactionReceipt matching logs: 1
eth_getBlockReceipts matching logs: 1
eth_getLogs matching logs: 0
RPC errors: none
```
`eth_getLogs` returns:
```json
{
"jsonrpc": "2.0",
"id": 3,
"result": []
}
```
Sending the exact `eth_getLogs` request directly to the configured historical endpoint returns one matching log.
A boundary control around OP Mainnet Bedrock block `105235063` produced:
```text
Case Block Receipt Block receipts eth_getLogs
Pre-Bedrock 105235062 / 0x645c276 1 1 0
Post-Bedrock 105239000 / 0x645d1d8 1 1 1
```
**Expected behavior**
When an `eth_getLogs` filter targets a pre-Bedrock OP Mainnet block, OP-Reth should return the logs available from its configured historical RPC endpoint.
Behavior should also be defined for:
- Fully pre-Bedrock ranges
- Fully post-Bedrock ranges
- Ranges crossing the Bedrock boundary
- Filters using `blockHash`
**Environment Information**
- Operating system: Linux, containerized Kubernetes deployment
- Network: OP Mainnet
- OP-Reth version: `v2.4.2`
- Commit: `f863ff4c12531b315d666331d43da3aeb3719388`
- op-node version: `v1.19.4`
**Configurations**
Relevant OP-Reth configuration:
```text
--rollup.historicalrpc=http://:8545
```
The historical endpoint is healthy and returns the expected log when queried directly.
**Logs**
No OP-Reth error is produced. The request succeeds with an empty JSON-RPC result:
```json
{
"jsonrpc": "2.0",
"id": 3,
"result": []
}
```
**Additional Context**
The historical middleware is implemented here:
https://github.com/ethereum-optimism/optimism/blob/f863ff4c12531b315d666331d43da3aeb3719388/rust/op-reth/crates/rpc/src/historical.rs#L482-L515
OP-Reth returns the expected pre-Bedrock data through `eth_getTransactionReceipt` and `eth_getBlockReceipts`. `eth_getBlockReceipts` is included in the historical-method matcher, while `eth_getLogs` is absent. This appears to prevent pre-Bedrock log filters from reaching the configured historical endpoint.
The observed behavior is:
```text
Pre-Bedrock receipt request
→ OP-Reth
→ historical endpoint
→ expected log returned
```
```text
Pre-Bedrock eth_getLogs
→ OP-Reth
→ not selected for historical forwarding
→ empty result returned
```
This appears similar to the historical forwarding gap previously fixed for `eth_getBlockReceipts`:
- https://github.com/ethereum-optimism/optimism/issues/21031
- https://github.com/ethereum-optimism/optimism/pull/21955
Contributor guide
Assessment
This issue has not been assessed yet.