| 42 | } |
| 43 | |
| 44 | func (qe *EvmQueryExecutor) queryBlocks(ctx context.Context, req *evm.QueryBlocksRequest, onPage func(proto.Message) error) error { |
| 45 | ctx, span := common.StartDetailSpan(ctx, "Query.Execute", |
| 46 | trace.WithAttributes(attribute.String("query.method", "eth_queryBlocks")), |
| 47 | ) |
| 48 | defer span.End() |
| 49 | |
| 50 | fromBlock, toBlock, err := qe.resolveQueryBounds(ctx, req.GetFromBlock(), req.GetToBlock(), req.GetOrder(), req.GetCursor()) |
| 51 | if err != nil { |
| 52 | common.SetTraceSpanError(span, err) |
| 53 | return err |
| 54 | } |
| 55 | |
| 56 | span.SetAttributes( |
| 57 | attribute.Int64("query.fromBlock", int64(fromBlock)), |
| 58 | attribute.Int64("query.toBlock", int64(toBlock)), |
| 59 | ) |
| 60 | qe.logger.Debug().Uint64("fromBlock", fromBlock).Uint64("toBlock", toBlock).Msgf("resolved query bounds for eth_queryBlocks") |
| 61 | |
| 62 | handled, err := qe.tryQueryUpstreams(ctx, "eth_queryBlocks", func(ups common.Upstream) error { |
| 63 | return qe.pipeThroughQueryBlocks(ctx, ups, req, onPage) |
| 64 | }) |
| 65 | if handled { |
| 66 | if err != nil { |
| 67 | common.SetTraceSpanError(span, err) |
| 68 | } |
| 69 | return err |
| 70 | } |
| 71 | |
| 72 | qe.logger.Debug().Msgf("no native upstream available, using shim for eth_queryBlocks") |
| 73 | span.SetAttributes(attribute.String("query.path", "shim")) |
| 74 | return qe.shimQueryBlocks(ctx, req, fromBlock, toBlock, onPage) |
| 75 | } |
| 76 | |
| 77 | func (qe *EvmQueryExecutor) queryTransactions(ctx context.Context, req *evm.QueryTransactionsRequest, onPage func(proto.Message) error) error { |
| 78 | ctx, span := common.StartDetailSpan(ctx, "Query.Execute", |