Skip to content

Commit

Permalink
Merge branch 'feat/logrange-asc-scribe' into feat/sinner
Browse files Browse the repository at this point in the history
  • Loading branch information
nautsimon committed Nov 2, 2023
2 parents 88b4467 + 8298d74 commit 20e770f
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 21 deletions.
18 changes: 14 additions & 4 deletions services/explorer/consumer/client/resolver-client/server.go

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

5 changes: 3 additions & 2 deletions services/scribe/api/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
. "github.com/stretchr/testify/assert"
"github.com/synapsecns/sanguine/core"
"github.com/synapsecns/sanguine/services/scribe/db"
"github.com/synapsecns/sanguine/services/scribe/graphql"
"github.com/synapsecns/sanguine/services/scribe/grpc/client/rest"
Expand Down Expand Up @@ -51,13 +52,13 @@ func (g APISuite) TestRetrieveData() {
Nil(g.T(), err)
// there were 20 logs created (2 per loop, in a loop of 10)
Equal(g.T(), 20, len(logs.Response))
logsRange, err := g.gqlClient.GetLogsRange(g.GetTestContext(), int(chainID), 2, 5, 1)
logsRange, err := g.gqlClient.GetLogsRange(g.GetTestContext(), int(chainID), 2, 5, 1, nil)
Nil(g.T(), err)
// from 2-5, there were 8 logs created (2 per loop, in a range of 4)
Equal(g.T(), 8, len(logsRange.Response))

// Test getting logs in a range in ascending order.
logsRangeAsc, err := g.gqlClient.GetLogsRange(g.GetTestContext(), int(chainID), 5, 2, 1)
logsRangeAsc, err := g.gqlClient.GetLogsRange(g.GetTestContext(), int(chainID), 2, 5, 1, core.PtrTo(true))
Nil(g.T(), err)
Equal(g.T(), 8, len(logsRangeAsc.Response))
Equal(g.T(), 2, logsRangeAsc.Response[0].BlockNumber)
Expand Down
2 changes: 1 addition & 1 deletion services/scribe/cmd/cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Scribe is a multi-chain indexing service. Scribe is designed to take a list of contracts specified by chain id and store logs, receipts, and txs for every event, past to present, in a mysql database.

Use cases
- Analytics for on chain events
- Analytics for on-chain events
- Stream events occurring across chains
- Monitor activity on your contracts

Expand Down
7 changes: 4 additions & 3 deletions services/scribe/graphql/client/client.go

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

4 changes: 2 additions & 2 deletions services/scribe/graphql/client/queries/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ query GetLogs ($chain_id: Int!, $page: Int!) {
}
}

query GetLogsRange ($chain_id: Int!, $start_block: Int!, $end_block: Int!, $page: Int!) {
response: logsRange (chain_id: $chain_id, start_block: $start_block, end_block: $end_block, page: $page) {
query GetLogsRange ($chain_id: Int!, $start_block: Int!, $end_block: Int!, $page: Int!, $asc: Boolean = false) {
response: logsRange (chain_id: $chain_id, start_block: $start_block, end_block: $end_block, page: $page,asc: $asc) {
contract_address
chain_id
topics
Expand Down
8 changes: 4 additions & 4 deletions services/scribe/graphql/server/graph/queries.resolvers.go

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

18 changes: 14 additions & 4 deletions services/scribe/graphql/server/graph/resolver/server.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Query {
start_block: Int!
end_block: Int!
page: Int!
asc: Boolean = False
): [Log]
# returns all receipts that match the given filter
receipts(
Expand Down
2 changes: 1 addition & 1 deletion services/scribe/service/indexer/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func (x *IndexerSuite) TestTxTypeNotSupported() {
}

var backendClient backend.ScribeBackend
omnirpcURL := "https://rpc.interoperability.institute/confirmations/1/rpc/42161"
omnirpcURL := "https://arbitrum.llamarpc.com"
backendClient, err := backend.DialBackend(x.GetTestContext(), omnirpcURL, x.metrics)
Nil(x.T(), err)

Expand Down

0 comments on commit 20e770f

Please sign in to comment.