Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dataapi] Fix gql error #514

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions disperser/dataapi/subgraph/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package subgraph

import (
"context"
"encoding/hex"
"fmt"
"sync"
"time"

"github.com/Layr-Labs/eigenda/core"
"github.com/shurcooL/graphql"
)

Expand All @@ -26,7 +24,7 @@ type (
QueryBatchNonSigningInfo(ctx context.Context, startTime, endTime int64) ([]*BatchNonSigningInfo, error)
QueryDeregisteredOperatorsGreaterThanBlockTimestamp(ctx context.Context, blockTimestamp uint64) ([]*Operator, error)
QueryRegisteredOperatorsGreaterThanBlockTimestamp(ctx context.Context, blockTimestamp uint64) ([]*Operator, error)
QueryOperatorInfoByOperatorIdAtBlockNumber(ctx context.Context, operatorId core.OperatorID, blockNumber uint32) (*IndexedOperatorInfo, error)
QueryOperatorInfoByOperatorIdAtBlockNumber(ctx context.Context, operatorId []byte, blockNumber uint32) (*IndexedOperatorInfo, error)
QueryOperatorAddedToQuorum(ctx context.Context, startBlock, endBlock uint32) ([]*OperatorQuorum, error)
QueryOperatorRemovedFromQuorum(ctx context.Context, startBlock, endBlock uint32) ([]*OperatorQuorum, error)
}
Expand Down Expand Up @@ -196,11 +194,11 @@ func (a *api) QueryDeregisteredOperatorsGreaterThanBlockTimestamp(ctx context.Co
return query.OperatorDeregistereds, nil
}

func (a *api) QueryOperatorInfoByOperatorIdAtBlockNumber(ctx context.Context, operatorId core.OperatorID, blockNumber uint32) (*IndexedOperatorInfo, error) {
func (a *api) QueryOperatorInfoByOperatorIdAtBlockNumber(ctx context.Context, operatorId []byte, blockNumber uint32) (*IndexedOperatorInfo, error) {
var (
query queryOperatorById
variables = map[string]any{
"id": graphql.String(fmt.Sprintf("0x%s", hex.EncodeToString(operatorId[:]))),
"id": graphql.String(fmt.Sprintf("0x%s", string(operatorId[:]))),
siddimore marked this conversation as resolved.
Show resolved Hide resolved
}
)
err := a.operatorStateGql.Query(context.Background(), &query, variables)
Expand Down
3 changes: 1 addition & 2 deletions disperser/dataapi/subgraph/mock/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"slices"

"github.com/Layr-Labs/eigenda/core"
"github.com/Layr-Labs/eigenda/disperser/dataapi/subgraph"
"github.com/stretchr/testify/mock"
)
Expand Down Expand Up @@ -115,7 +114,7 @@ func (m *MockSubgraphApi) QueryDeregisteredOperatorsGreaterThanBlockTimestamp(ct
return value, args.Error(1)
}

func (m *MockSubgraphApi) QueryOperatorInfoByOperatorIdAtBlockNumber(ctx context.Context, operatorId core.OperatorID, blockNumber uint32) (*subgraph.IndexedOperatorInfo, error) {
func (m *MockSubgraphApi) QueryOperatorInfoByOperatorIdAtBlockNumber(ctx context.Context, operatorId []byte, blockNumber uint32) (*subgraph.IndexedOperatorInfo, error) {
args := m.Called()

var value *subgraph.IndexedOperatorInfo
Expand Down
2 changes: 1 addition & 1 deletion disperser/dataapi/subgraph_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (sc *subgraphClient) QueryIndexedDeregisteredOperatorsForTimeWindow(ctx con
// Copy the operator id to a 32 byte array.
copy(operatorId[:], operator.OperatorId)

operatorInfo, err := sc.api.QueryOperatorInfoByOperatorIdAtBlockNumber(ctx, operatorId, uint32(operator.BlockNumber))
operatorInfo, err := sc.api.QueryOperatorInfoByOperatorIdAtBlockNumber(ctx, operator.OperatorId, uint32(operator.BlockNumber))
if err != nil {
operatorIdString := "0x" + hex.EncodeToString(operatorId[:])
errorMessage := fmt.Sprintf("query operator info by operator id at block number failed: %d for operator %s", uint32(operator.BlockNumber), operatorIdString)
Expand Down
Loading