From 778a39c22a02ea31959a59f92e0595d9cda0776c Mon Sep 17 00:00:00 2001 From: Guillaume Potier Date: Tue, 4 Feb 2025 03:30:02 +0100 Subject: [PATCH] Fix incorrect Tipset passed to `new_eth_tx_receipt` (#5205) --- CHANGELOG.md | 3 +++ scripts/tests/api_compare/filter-list | 5 ++--- scripts/tests/api_compare/filter-list-offline | 3 --- src/rpc/methods/eth.rs | 18 +++++++++++++++++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b546370bb877..3bb1add8117c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,9 @@ - [#5006](https://github.com/ChainSafe/forest/issues/5006) Fix incorrect logs, logs bloom and event index for the `Filecoin.EthGetBlockReceipts` RPC method. +- [#4996](https://github.com/ChainSafe/forest/issues/4996) Fix incorrect logs and logs bloom for the `Filecoin.EthGetTransactionReceipt` and + `Filecoin.EthGetTransactionReceiptLimited` RPC methods on some blocks. + ## Forest v.0.23.3 "Plumber" Mandatory release for calibnet node operators. It fixes a sync error at epoch 2281645. diff --git a/scripts/tests/api_compare/filter-list b/scripts/tests/api_compare/filter-list index 7e092f219208..c08220023633 100644 --- a/scripts/tests/api_compare/filter-list +++ b/scripts/tests/api_compare/filter-list @@ -2,8 +2,7 @@ # They should be considered bugged, and not used until the root cause is resolved. # Internal Server Error on Lotus: https://github.com/ChainSafe/forest/actions/runs/8619017774/job/23623141130?pr=4170 !Filecoin.MpoolGetNonce +# CustomCheckFailed in Forest: https://github.com/ChainSafe/forest/actions/runs/9593268587/job/26453560366 +!Filecoin.StateReplay # CustomCheckFailed in Forest: https://github.com/ChainSafe/forest/issues/5213 !Filecoin.EthGetLogs -# TODO: https://github.com/ChainSafe/forest/issues/4996 -!Filecoin.EthGetTransactionReceipt -!Filecoin.EthGetTransactionReceiptLimited \ No newline at end of file diff --git a/scripts/tests/api_compare/filter-list-offline b/scripts/tests/api_compare/filter-list-offline index 111803c90d3a..0be94f5f7684 100644 --- a/scripts/tests/api_compare/filter-list-offline +++ b/scripts/tests/api_compare/filter-list-offline @@ -34,6 +34,3 @@ !Filecoin.EthGetBlockByNumber !eth_getBlockByNumber !Filecoin.ChainSetHead -# TODO: https://github.com/ChainSafe/forest/issues/4996 -!Filecoin.EthGetTransactionReceipt -!Filecoin.EthGetTransactionReceiptLimited diff --git a/src/rpc/methods/eth.rs b/src/rpc/methods/eth.rs index aaffea3f3187..86453670da1d 100644 --- a/src/rpc/methods/eth.rs +++ b/src/rpc/methods/eth.rs @@ -2360,7 +2360,23 @@ async fn get_eth_transaction_receipt( let tx = new_eth_tx_from_message_lookup(&ctx, &message_lookup, None) .with_context(|| format!("failed to convert {} into an Eth Tx", tx_hash))?; - let tx_receipt = new_eth_tx_receipt(&ctx, &tipset, &tx, &message_lookup.receipt).await?; + let ts = ctx + .chain_index() + .load_required_tipset(&message_lookup.tipset)?; + + // The tx is located in the parent tipset + let parent_ts = ctx + .chain_index() + .load_required_tipset(ts.parents()) + .map_err(|e| { + format!( + "failed to lookup tipset {} when constructing the eth txn receipt: {}", + ts.parents(), + e + ) + })?; + + let tx_receipt = new_eth_tx_receipt(&ctx, &parent_ts, &tx, &message_lookup.receipt).await?; Ok(tx_receipt) }