Skip to content

Commit

Permalink
refactor: Update FetchBeaconCommittees signature
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jul 24, 2024
1 parent 4abd16c commit 4721fe2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type Node interface {
// FetchDepositSnapshot fetches the deposit snapshot.
FetchDepositSnapshot(ctx context.Context) (*types.DepositSnapshot, error)
// FetchBeaconCommittees fetches the committees for the given epoch at the given state.
FetchBeaconCommittees(ctx context.Context, state string, epoch phase0.Epoch) ([]*v1.BeaconCommittee, error)
FetchBeaconCommittees(ctx context.Context, state string, epoch *phase0.Epoch) ([]*v1.BeaconCommittee, error)
// FetchAttestationData fetches the attestation data for the given slot and committee index.
FetchAttestationData(ctx context.Context, slot phase0.Slot, committeeIndex phase0.CommitteeIndex) (*phase0.AttestationData, error)
// FetchBeaconBlockBlobs fetches blob sidecars for the given block id.
Expand Down
13 changes: 9 additions & 4 deletions pkg/beacon/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,21 @@ func (n *node) FetchBeaconStateRoot(ctx context.Context, state string) (phase0.R
return *rsp.Data, nil
}

func (n *node) FetchBeaconCommittees(ctx context.Context, state string, epoch phase0.Epoch) ([]*v1.BeaconCommittee, error) {
func (n *node) FetchBeaconCommittees(ctx context.Context, state string, epoch *phase0.Epoch) ([]*v1.BeaconCommittee, error) {
provider, isProvider := n.client.(eth2client.BeaconCommitteesProvider)
if !isProvider {
return nil, errors.New("client does not implement eth2client.BeaconCommitteesProvider")
}

rsp, err := provider.BeaconCommittees(ctx, &api.BeaconCommitteesOpts{
opts := &api.BeaconCommitteesOpts{
State: state,
Epoch: &epoch,
})
}

if epoch != nil {
opts.Epoch = epoch
}

rsp, err := provider.BeaconCommittees(ctx, opts)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 4721fe2

Please sign in to comment.