func (d *Duty) CommitteeSize(committeeIndex phase0.CommitteeIndex) uint64 {
	return d.committeeLengths[committeeIndex]
}
CommitteeSize provides the committee size for a given index.
package attester
import (
	"context"
	"fmt"
	"github.com/attestantio/go-eth2-client/spec/phase0"
)
type Duty struct {
	slot                      phase0.Slot
	committeesAtSlot          uint64
	validatorIndices          []phase0.ValidatorIndex
	committeeIndices          []phase0.CommitteeIndex
	validatorCommitteeIndices []uint64
	committeeLengths          map[phase0.CommitteeIndex]uint64
}
func NewDuty(ctx context.Context,
	slot phase0.Slot,
	committeesAtSlot uint64,
	validatorIndices []phase0.ValidatorIndex,
	committeeIndices []phase0.CommitteeIndex,
	validatorCommitteeIndices []uint64,
	committeeLengths map[phase0.CommitteeIndex]uint64,
) (*Duty, error) {
	for i := range committeeIndices {
		if _, exists := committeeLengths[committeeIndices[i]]; !exists {
			return nil, fmt.Errorf("committee %d does not have a committee size; duty invalid", committeeIndices[i])
		}
	}
	return &Duty{
		slot:                      slot,
		committeesAtSlot:          committeesAtSlot,
		validatorIndices:          validatorIndices,
		committeeIndices:          committeeIndices,
		validatorCommitteeIndices: validatorCommitteeIndices,
		committeeLengths:          committeeLengths,
	}, nil
}
func (d *Duty) Slot() phase0.Slot {
	return d.slot
}
func (d *Duty) CommitteesAtSlot() uint64 {
	return d.committeesAtSlot
}
func (d *Duty) ValidatorIndices() []phase0.ValidatorIndex {
	return d.validatorIndices
}
func (d *Duty) CommitteeIndices() []phase0.CommitteeIndex {
	return d.committeeIndices
}
func (d *Duty) ValidatorCommitteeIndices() []uint64 {
	return d.validatorCommitteeIndices
}