Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix committed Mar 19, 2024
1 parent 320da93 commit ea5e12d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions disperser/dataapi/subgraph/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (a *api) QueryOperatorAddedToQuorum(ctx context.Context, startBlock, endBlo
}
skip := 0
result := new(queryOperatorAddedToQuorum)
addedQuorums := make([]*OperatorQuorum, 0)
addedToQuorums := make([]*OperatorQuorum, 0)
for {
variables["first"] = graphql.Int(maxEntriesPerQuery)
variables["skip"] = graphql.Int(skip)
Expand All @@ -232,10 +232,10 @@ func (a *api) QueryOperatorAddedToQuorum(ctx context.Context, startBlock, endBlo
if len(result.OperatorAddedToQuorum) == 0 {
break
}
addedQuorums = append(addedQuorums, result.OperatorAddedToQuorum...)
addedToQuorums = append(addedToQuorums, result.OperatorAddedToQuorum...)
skip += maxEntriesPerQuery
}
return addedQuorums, nil
return addedToQuorums, nil
}

// QueryOperatorRemovedFromQuorum finds operators' quorum opt-out history in range [startBlock, endBlock].
Expand All @@ -249,7 +249,7 @@ func (a *api) QueryOperatorRemovedFromQuorum(ctx context.Context, startBlock, en
}
skip := 0
result := new(queryOperatorRemovedFromQuorum)
removedQuorums := make([]*OperatorQuorum, 0)
removedFromQuorums := make([]*OperatorQuorum, 0)
for {
variables["first"] = graphql.Int(maxEntriesPerQuery)
variables["skip"] = graphql.Int(skip)
Expand All @@ -260,8 +260,8 @@ func (a *api) QueryOperatorRemovedFromQuorum(ctx context.Context, startBlock, en
if len(result.OperatorRemovedFromQuorum) == 0 {
break
}
removedQuorums = append(removedQuorums, result.OperatorRemovedFromQuorum...)
removedFromQuorums = append(removedFromQuorums, result.OperatorRemovedFromQuorum...)
skip += maxEntriesPerQuery
}
return removedQuorums, nil
return removedFromQuorums, nil
}
4 changes: 4 additions & 0 deletions disperser/dataapi/subgraph_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ func parseOperatorQuorum(operatorQuorum []*subgraph.OperatorQuorum) ([]*Operator
if err != nil {
return nil, err
}
if len(opq.QuorumNumbers) < 2 || len(opq.QuorumNumbers)%2 != 0 {
return nil, fmt.Errorf("the QuorumNumbers is expected to start with 0x and have an even length, QuorumNumbers: %s", string(opq.QuorumNumbers))
}
// The quorum numbers string starts with "0x", so we should skip it.
quorumStr := string(opq.QuorumNumbers)[2:]
quorumNumbers := make([]byte, 0)
for i := 0; i < len(quorumStr); i += 2 {
Expand Down

0 comments on commit ea5e12d

Please sign in to comment.