Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
504ec83
Impl EthTraceFilterV2
sudo-shashank Feb 4, 2026
cc77df0
update changelog
sudo-shashank Feb 4, 2026
0d0ea26
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 4, 2026
23c7054
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 5, 2026
55d12d2
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 5, 2026
356d8ca
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 6, 2026
c6a3309
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 7, 2026
8ac9a07
fix open rpc test
sudo-shashank Feb 7, 2026
2caa06c
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 9, 2026
1ad61df
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 9, 2026
366bf75
fix changelog
sudo-shashank Feb 9, 2026
1f26ac9
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 10, 2026
447b015
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 10, 2026
0c0b285
update test snapshot
sudo-shashank Feb 10, 2026
52bfe93
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 11, 2026
3249762
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 16, 2026
db32e8d
default to latest
sudo-shashank Feb 16, 2026
721b337
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 16, 2026
bb1ae0a
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 17, 2026
8c7e888
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 17, 2026
045b0c9
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 18, 2026
1e3d31a
refactor and add more test
sudo-shashank Feb 19, 2026
60720d2
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 19, 2026
f6d2029
exclude from offline check
sudo-shashank Feb 19, 2026
1d35eae
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 19, 2026
6ea084b
refactor for BlockNumberOrHash
sudo-shashank Feb 20, 2026
171e53c
add Default for BlockNumberOrHash
sudo-shashank Feb 20, 2026
591a1ed
fix parse_block_range test
sudo-shashank Feb 20, 2026
c149198
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 20, 2026
68c04c3
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 23, 2026
6dee790
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 23, 2026
8258d70
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 24, 2026
634b0b6
update parse block range
sudo-shashank Feb 24, 2026
01d2fc7
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 24, 2026
0335c40
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 24, 2026
13e7d63
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 25, 2026
45b4fd4
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Feb 26, 2026
5ea40f4
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Mar 2, 2026
6345b39
filter method not supported in gateway
sudo-shashank Mar 2, 2026
a81a529
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Mar 2, 2026
9220c6d
Merge branch 'main' into shashank/EthTraceFilterV2
sudo-shashank Mar 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

- [#6498](https://github.com/ChainSafe/forest/pull/6498): Implemented `Filecoin.EthGetBlockReceiptsLimited` for API v2.

- [#6522](https://github.com/ChainSafe/forest/pull/6522): Implemented `Filecoin.EthTraceFilter` for API v2.
Comment thread
sudo-shashank marked this conversation as resolved.
Outdated

### Changed

- [#6471](https://github.com/ChainSafe/forest/pull/6471): Moved `forest-tool state` subcommand to `forest-dev`.
Expand Down
63 changes: 63 additions & 0 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4080,6 +4080,22 @@ fn get_eth_block_number_from_string<DB: Blockstore>(
))
}

async fn get_eth_block_number_from_string_v2<DB: Blockstore + Send + Sync + 'static>(
ctx: &Ctx<DB>,
block: Option<&str>,
resolve: ResolveNullTipset,
) -> Result<EthUint64> {
let block_param = match block {
Some(block_str) => ExtBlockNumberOrHash::from_str(block_str)?,
None => bail!("cannot parse fromBlock"),
Comment thread
sudo-shashank marked this conversation as resolved.
Outdated
};
Ok(EthUint64(
tipset_by_block_number_or_hash_v2(ctx, block_param, resolve)
.await?
.epoch() as u64,
))
}

pub enum EthTraceFilter {}
impl RpcMethod<1> for EthTraceFilter {
const N_REQUIRED_PARAMS: usize = 1;
Expand Down Expand Up @@ -4125,6 +4141,53 @@ impl RpcMethod<1> for EthTraceFilter {
}
}

pub enum EthTraceFilterV2 {}
impl RpcMethod<1> for EthTraceFilterV2 {
const N_REQUIRED_PARAMS: usize = 1;
const NAME: &'static str = "Filecoin.EthTraceFilter";
const NAME_ALIAS: Option<&'static str> = Some("trace_filter");
const PARAM_NAMES: [&'static str; 1] = ["filter"];
const API_PATHS: BitFlags<ApiPaths> = make_bitflags!(ApiPaths::V2);
const PERMISSION: Permission = Permission::Read;
const DESCRIPTION: Option<&'static str> =
Some("Returns the traces for transactions matching the filter criteria.");
type Params = (EthTraceFilterCriteria,);
type Ok = Vec<EthBlockTrace>;

async fn handle(
ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
(filter,): Self::Params,
) -> Result<Self::Ok, ServerError> {
let from_block = get_eth_block_number_from_string_v2(
&ctx,
filter.from_block.as_deref(),
ResolveNullTipset::TakeNewer,
)
.await
.context("cannot parse fromBlock")?;

let to_block = get_eth_block_number_from_string_v2(
&ctx,
filter.to_block.as_deref(),
ResolveNullTipset::TakeOlder,
)
.await
.context("cannot parse toBlock")?;

Ok(trace_filter(ctx, filter, from_block, to_block)
.await?
.into_iter()
.sorted_by_key(|trace| {
(
trace.block_number,
trace.transaction_position,
trace.trace.trace_address.clone(),
)
})
.collect::<Vec<_>>())
}
Comment thread
sudo-shashank marked this conversation as resolved.
Outdated
}
Comment thread
sudo-shashank marked this conversation as resolved.

async fn trace_filter(
ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
filter: EthTraceFilterCriteria,
Expand Down
1 change: 1 addition & 0 deletions src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ macro_rules! for_each_rpc_method {
$callback!($crate::rpc::eth::EthTraceBlock);
$callback!($crate::rpc::eth::EthTraceBlockV2);
$callback!($crate::rpc::eth::EthTraceFilter);
$callback!($crate::rpc::eth::EthTraceFilterV2);
$callback!($crate::rpc::eth::EthTraceTransaction);
$callback!($crate::rpc::eth::EthTraceReplayBlockTransactions);
$callback!($crate::rpc::eth::EthTraceReplayBlockTransactionsV2);
Expand Down
12 changes: 12 additions & 0 deletions src/tool/subcommands/api_cmd/api_compare_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,18 @@ fn eth_tests_with_tipset<DB: Blockstore>(store: &Arc<DB>, shared_tipset: &Tipset
// both nodes could fail on, e.g., "too many results, maximum supported is 500, try paginating
// requests with After and Count"
.policy_on_rejected(PolicyOnRejected::PassWithIdenticalError),
RpcTest::identity(
EthTraceFilterV2::request((EthTraceFilterCriteria {
Comment thread
sudo-shashank marked this conversation as resolved.
from_block: Some(format!(
"0x{:x}",
shared_tipset.epoch() - (SAFE_EPOCH_DELAY + 1)
)),
to_block: Some(format!("0x{:x}", shared_tipset.epoch() - SAFE_EPOCH_DELAY)),
..Default::default()
},))
.unwrap(),
)
.policy_on_rejected(PolicyOnRejected::PassWithIdenticalError),
RpcTest::identity(
EthGetTransactionReceipt::request((
// A transaction that should not exist, to test the `null` response in case
Expand Down
1 change: 1 addition & 0 deletions src/tool/subcommands/api_cmd/test_snapshots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ filecoin_ethtraceblock_v2_safe_1769092401374979.rpcsnap.json.zst
filecoin_ethtracefilter_1742371405673188.rpcsnap.json.zst
filecoin_ethtracefilter_1742983898701553.rpcsnap.json.zst
filecoin_ethtracefilter_1746449543820062.rpcsnap.json.zst
filecoin_ethtracefilter_1770191732520294.rpcsnap.json.zst
filecoin_ethtracereplayblocktransactions_1768898971081023.rpcsnap.json.zst
filecoin_ethtracereplayblocktransactions_1768898971153948.rpcsnap.json.zst
filecoin_ethtracetransaction_1741765677273941.rpcsnap.json.zst
Expand Down
Loading