erigon-pulse/cmd/rpcdaemon22/commands/trace_api.go
ledgerwatch 8e3ac8a21c
Erigon2 upgrade 2 prototype (#4341)
* Erigon2 upgrade 2 prototype

* Latest erigon-lib

* Fixes

* Fix print

* Fix maxSpan

* Reduce maxSpan

* Remove duplicate joins

* TxNum

* Fix resuming

* first draft of history22

* Introduce historical reads

* Update to erigon-lib

* Update erigon-lib

* Update erigon-lib

* Fixes and tracing for checkChangeSets

* More trace

* Print account details

* fix getHeader

* Update to erigon-lib main

* Add tracer indices and event log indices

* Fix calltracer

* Fix calltracer

* Duplicate rpcdaemon into rpcdaemon22

* Fix tests

* Fix tests

* Fix tests

* Update to latest erigon-lib

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-06-10 16:18:43 +01:00

50 lines
1.9 KiB
Go

package commands
import (
"context"
"encoding/json"
jsoniter "github.com/json-iterator/go"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cmd/rpcdaemon22/cli/httpcfg"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/common/hexutil"
"github.com/ledgerwatch/erigon/rpc"
)
// TraceAPI RPC interface into tracing API
type TraceAPI interface {
// Ad-hoc (see ./trace_adhoc.go)
ReplayBlockTransactions(ctx context.Context, blockNr rpc.BlockNumberOrHash, traceTypes []string) ([]*TraceCallResult, error)
ReplayTransaction(ctx context.Context, txHash common.Hash, traceTypes []string) (*TraceCallResult, error)
Call(ctx context.Context, call TraceCallParam, types []string, blockNr *rpc.BlockNumberOrHash) (*TraceCallResult, error)
CallMany(ctx context.Context, calls json.RawMessage, blockNr *rpc.BlockNumberOrHash) ([]*TraceCallResult, error)
RawTransaction(ctx context.Context, txHash common.Hash, traceTypes []string) ([]interface{}, error)
// Filtering (see ./trace_filtering.go)
Transaction(ctx context.Context, txHash common.Hash) (ParityTraces, error)
Get(ctx context.Context, txHash common.Hash, txIndicies []hexutil.Uint64) (*ParityTrace, error)
Block(ctx context.Context, blockNr rpc.BlockNumber) (ParityTraces, error)
Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream) error
}
// TraceAPIImpl is implementation of the TraceAPI interface based on remote Db access
type TraceAPIImpl struct {
*BaseAPI
kv kv.RoDB
maxTraces uint64
gasCap uint64
compatibility bool // Bug for bug compatiblity with OpenEthereum
}
// NewTraceAPI returns NewTraceAPI instance
func NewTraceAPI(base *BaseAPI, kv kv.RoDB, cfg *httpcfg.HttpCfg) *TraceAPIImpl {
return &TraceAPIImpl{
BaseAPI: base,
kv: kv,
maxTraces: cfg.MaxTraces,
gasCap: cfg.Gascap,
compatibility: cfg.TraceCompatibility,
}
}