Skip to content

Commit

Permalink
refactor: handle zero bitmap (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
renlulu authored Sep 4, 2024
1 parent 8757e81 commit 6f4461d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions chainio/clients/avsregistry/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,26 @@ func (r *ChainReader) QueryRegistrationDetail(
) ([]bool, error) {
operatorId, err := r.GetOperatorId(opts, operatorAddress)
if err != nil {
return nil, err
return nil, utils.WrapError("Failed to get operator id", err)
}
value, err := r.registryCoordinator.GetCurrentQuorumBitmap(opts, operatorId)
if err != nil {
return nil, err
return nil, utils.WrapError("Failed to get operator quorums", err)
}
numBits := value.BitLen()
var quorums []bool
for i := 0; i < numBits; i++ {
quorums = append(quorums, value.Int64()&(1<<i) != 0)
}
if len(quorums) == 0 {
numQuorums, err := r.GetQuorumCount(opts)
if err != nil {
return nil, utils.WrapError("Failed to get quorum count", err)
}
for i := uint8(0); i < numQuorums; i++ {
quorums = append(quorums, false)
}
}
return quorums, nil
}

Expand Down

0 comments on commit 6f4461d

Please sign in to comment.