Skip to content

Commit

Permalink
Fix gql error
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth More authored and Siddharth More committed Apr 22, 2024
1 parent da23ea7 commit 5e5a18e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
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[:]))),
}
)
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

0 comments on commit 5e5a18e

Please sign in to comment.