Skip to content

Commit

Permalink
feat: eth: add trace_filter API (#12123)
Browse files Browse the repository at this point in the history
  • Loading branch information
snissn authored Jul 25, 2024
1 parent fbae9dd commit 9063b3b
Show file tree
Hide file tree
Showing 23 changed files with 1,274 additions and 455 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
## New features

- feat: Add trace transaction API supporting RPC method `trace_transaction` ([filecoin-project/lotus#12068](https://github.com/filecoin-project/lotus/pull/12068))
- feat: Add trace filter API supporting RPC method `trace_filter` ([filecoin-project/lotus#12123](https://github.com/filecoin-project/lotus/pull/12123)). Configuring `EthTraceFilterMaxResults` sets a limit on how many results are returned in any individual `trace_filter` RPC API call.


## Improvements

Expand Down
3 changes: 3 additions & 0 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ type FullNode interface {
// Implmements OpenEthereum-compatible API method trace_transaction
EthTraceTransaction(ctx context.Context, txHash string) ([]*ethtypes.EthTraceTransaction, error) //perm:read

// Implements OpenEthereum-compatible API method trace_filter
EthTraceFilter(ctx context.Context, filter ethtypes.EthTraceFilterCriteria) ([]*ethtypes.EthTraceFilterResult, error) //perm:read

// CreateBackup creates node backup onder the specified file name. The
// method requires that the lotus daemon is running with the
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that
Expand Down
1 change: 1 addition & 0 deletions api/api_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ type Gateway interface {
EthTraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.EthTraceBlock, error)
EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)
EthTraceTransaction(ctx context.Context, txHash string) ([]*ethtypes.EthTraceTransaction, error)
EthTraceFilter(ctx context.Context, filter ethtypes.EthTraceFilterCriteria) ([]*ethtypes.EthTraceFilterResult, error)

GetActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
SubscribeActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)
Expand Down
14 changes: 14 additions & 0 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,20 @@ func init() {
Address: []ethtypes.EthAddress{ethaddr},
})

after := ethtypes.EthUint64(0)
count := ethtypes.EthUint64(100)

ethTraceFilterCriteria := ethtypes.EthTraceFilterCriteria{
FromBlock: pstring("latest"),
ToBlock: pstring("latest"),
FromAddress: ethtypes.EthAddressList{ethaddr},
ToAddress: ethtypes.EthAddressList{ethaddr},
After: &after,
Count: &count,
}
addExample(&ethTraceFilterCriteria)
addExample(ethTraceFilterCriteria)

percent := types.Percent(123)
addExample(percent)
addExample(&percent)
Expand Down
1 change: 1 addition & 0 deletions api/eth_aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func CreateEthRPCAliases(as apitypes.Aliaser) {
as.AliasMethod("trace_block", "Filecoin.EthTraceBlock")
as.AliasMethod("trace_replayBlockTransactions", "Filecoin.EthTraceReplayBlockTransactions")
as.AliasMethod("trace_transaction", "Filecoin.EthTraceTransaction")
as.AliasMethod("trace_filter", "Filecoin.EthTraceFilter")

as.AliasMethod("net_version", "Filecoin.NetVersion")
as.AliasMethod("net_listening", "Filecoin.NetListening")
Expand Down
15 changes: 15 additions & 0 deletions api/mocks/mock_full.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9063b3b

Please sign in to comment.