MCPcopy Create free account
hub / github.com/erpc/erpc / queryBlocks

Method queryBlocks

erpc/query_executor.go:44–75  ·  view source on GitHub ↗
(ctx context.Context, req *evm.QueryBlocksRequest, onPage func(proto.Message) error)

Source from the content-addressed store, hash-verified

42}
43
44func (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
77func (qe *EvmQueryExecutor) queryTransactions(ctx context.Context, req *evm.QueryTransactionsRequest, onPage func(proto.Message) error) error {
78 ctx, span := common.StartDetailSpan(ctx, "Query.Execute",

Calls 11

resolveQueryBoundsMethod · 0.95
tryQueryUpstreamsMethod · 0.95
shimQueryBlocksMethod · 0.95
StartDetailSpanFunction · 0.92
SetTraceSpanErrorFunction · 0.92
EndMethod · 0.80
GetFromBlockMethod · 0.80
GetToBlockMethod · 0.80
SetAttributesMethod · 0.80
StringMethod · 0.45