Skip to content

Commit 8f94aad

Browse files
snissnMichael Seiler
andauthored
feat: Add trace transaction API (#12075)
* changelog for trace_transaction * adding boilerplate for trace_transaction to /api/ * add eth trace transaction proxy and mock api * trace tx boilerplate * trace transaction implementation - under construction * fix types for eth trace transaction * trace_transaction implemented * golint and handle transaction not found * gofmt * ran make docsgen * pointer bugfix and make docsgen * tx.BlockNumber is nil when the transaction is still in the mpool/pending and there is no trace for pending transactions * check eth trace transaction happy case and two error cases - tx not found and tx pending in itests * simplify error msg check for gh action fail --------- Co-authored-by: Michael Seiler <[email protected]>
1 parent fb3fc1f commit 8f94aad

File tree

17 files changed

+888
-441
lines changed

17 files changed

+888
-441
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# UNRELEASED
44

55
## New features
6+
- feat: Add trace transaction API supporting RPC method `trace_transaction` ([filecoin-project/lotus#12068](https://github.com/filecoin-project/lotus/pull/12068))
7+
68

79
## Improvements
810

api/api_full.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,9 @@ type FullNode interface {
825825
// Replays all transactions in a block returning the requested traces for each transaction
826826
EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error) //perm:read
827827

828+
// Implmements OpenEthereum-compatible API method trace_transaction
829+
EthTraceTransaction(ctx context.Context, txHash string) ([]*ethtypes.EthTraceTransaction, error) //perm:read
830+
828831
// CreateBackup creates node backup onder the specified file name. The
829832
// method requires that the lotus daemon is running with the
830833
// LOTUS_BACKUP_BASE_PATH environment variable set to some path, and that

api/api_gateway.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ type Gateway interface {
132132
Web3ClientVersion(ctx context.Context) (string, error)
133133
EthTraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.EthTraceBlock, error)
134134
EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)
135+
EthTraceTransaction(ctx context.Context, txHash string) ([]*ethtypes.EthTraceTransaction, error)
135136

136137
GetActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) ([]*types.ActorEvent, error)
137138
SubscribeActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error)

api/eth_aliases.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func CreateEthRPCAliases(as apitypes.Aliaser) {
4242

4343
as.AliasMethod("trace_block", "Filecoin.EthTraceBlock")
4444
as.AliasMethod("trace_replayBlockTransactions", "Filecoin.EthTraceReplayBlockTransactions")
45+
as.AliasMethod("trace_transaction", "Filecoin.EthTraceTransaction")
4546

4647
as.AliasMethod("net_version", "Filecoin.NetVersion")
4748
as.AliasMethod("net_listening", "Filecoin.NetListening")

api/mocks/mock_full.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proxy_gen.go

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)