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 7, 2023
1 parent 133e51a commit 27e9233
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 96 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
89 changes: 27 additions & 62 deletions types/eth1.pb.go

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

1 change: 0 additions & 1 deletion types/eth1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ message Eth1Transaction {
uint64 gas = 6;
bytes value = 7;
bytes data = 8;
bool invokes_contract = 9;
bytes to = 12;
bytes from = 13;

Expand Down

0 comments on commit 27e9233

Please sign in to comment.