Skip to content

Commit

Permalink
(BIDS-2535) undo using tracer info
Browse files Browse the repository at this point in the history
  • Loading branch information
remoterami committed Nov 6, 2023
1 parent 726cc0e commit 0d5b7d6
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 300 deletions.
33 changes: 0 additions & 33 deletions rpc/erigon.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,6 @@ func (client *ErigonClient) GetBlock(number int64, traceMode string) (*types.Eth
}

c.Transactions[trace.TransactionPosition].Itx = append(c.Transactions[trace.TransactionPosition].Itx, tracePb)
if len(trace.TraceAddress) == 0 {
// can be used until an erigon version is used which fixes https://github.com/ledgerwatch/erigon/issues/7831
// afterwards, use the geth approach as shown below
c.Transactions[trace.TransactionPosition].InvokesContract = trace.Result.GasUsed != "0x0"
}
}
}
}
Expand Down Expand Up @@ -339,14 +334,6 @@ func (client *ErigonClient) GetBlock(number int64, traceMode string) (*types.Eth

c.Transactions[trace.TransactionPosition].Itx = append(c.Transactions[trace.TransactionPosition].Itx, tracePb)
}

gethOpcountData, err := client.Opcount(block.Hash())
if err != nil {
return fmt.Errorf("error tracing block via geth style traces with opcountTracer (%v), %v: %v", block.Number(), block.Hash(), err)
}
for idx, countData := range gethOpcountData {
c.Transactions[idx].InvokesContract = countData.Count > 0
}
}

timings.Traces = time.Since(start)
Expand Down Expand Up @@ -443,15 +430,6 @@ var gethTracerArg = map[string]string{
"tracer": "callTracer",
}

type GethOpcountTraceCallResult struct {
TxHash string `json:"txHash"`
Count int `json:"result"`
}

var gethOpcountTracerArg = map[string]string{
"tracer": "opcountTracer",
}

func extractCalls(r *GethTraceCallResult, d *[]*GethTraceCallResult) {
if r == nil {
return
Expand Down Expand Up @@ -484,17 +462,6 @@ func (client *ErigonClient) TraceGeth(blockHash common.Hash) ([]*GethTraceCallRe
return data, nil
}

func (client *ErigonClient) Opcount(blockHash common.Hash) ([]*GethOpcountTraceCallResult, error) {
var res []*GethOpcountTraceCallResult

err := client.rpcClient.Call(&res, "debug_traceBlockByHash", blockHash, gethOpcountTracerArg)
if err != nil {
return nil, err
}

return res, nil
}

type ParityTraceResult struct {
Action struct {
CallType string `json:"callType"`
Expand Down
Loading

0 comments on commit 0d5b7d6

Please sign in to comment.