diff --git a/CHANGELOG.md b/CHANGELOG.md index dd4d0775815..12725c34561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ ### Fixed +- [#5016](https://github.com/ChainSafe/forest/pull/5016) Filter logs for only + the block being queried. + - [#4959](https://github.com/ChainSafe/forest/pull/4959) Re-enable garbage collection after implementing a "persistent" storage for manifests. diff --git a/scripts/tests/api_compare/filter-list b/scripts/tests/api_compare/filter-list index 301ad29e8c4..2207a79c755 100644 --- a/scripts/tests/api_compare/filter-list +++ b/scripts/tests/api_compare/filter-list @@ -14,5 +14,3 @@ # TODO: https://github.com/ChainSafe/forest/issues/4701 !Filecoin.EthGetTransactionByBlockHashAndIndex !Filecoin.EthGetTransactionByBlockNumberAndIndex -# TODO: https://github.com/ChainSafe/forest/issues/5006 -!Filecoin.EthGetBlockReceipts diff --git a/scripts/tests/api_compare/filter-list-offline b/scripts/tests/api_compare/filter-list-offline index 75aa20c4123..0c79cfe162c 100644 --- a/scripts/tests/api_compare/filter-list-offline +++ b/scripts/tests/api_compare/filter-list-offline @@ -44,5 +44,3 @@ # TODO: https://github.com/ChainSafe/forest/issues/4701 !Filecoin.EthGetTransactionByBlockHashAndIndex !Filecoin.EthGetTransactionByBlockNumberAndIndex -# TODO: https://github.com/ChainSafe/forest/issues/5006 -!Filecoin.EthGetBlockReceipts diff --git a/src/rpc/methods/eth.rs b/src/rpc/methods/eth.rs index b80e1cbb741..2aa28804123 100644 --- a/src/rpc/methods/eth.rs +++ b/src/rpc/methods/eth.rs @@ -1154,6 +1154,17 @@ async fn new_eth_tx_receipt( let mut events = vec![]; EthEventHandler::collect_events(ctx, &parent_ts, None, &mut events).await?; + + let current_block_hash = &receipt.block_hash; + events.retain(|event| { + if let Ok(block_hash) = event.tipset_key.cid() { + let event_block_hash: EthHash = block_hash.into(); + &event_block_hash == current_block_hash + } else { + false + } + }); + receipt.logs = eth_filter_logs_from_events(ctx, &events)?; Ok(receipt)