Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions beacon-chain/rpc/prysm/v1alpha1/validator/duties_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ func (vs *Server) GetPTCDuties(ctx context.Context, req *ethpb.PTCDutiesRequest)
return nil, status.Errorf(codes.InvalidArgument, "Request epoch %d is before Gloas fork epoch %d", req.Epoch, params.BeaconConfig().GloasForkEpoch)
}

// PTC assignments are not stable for the next epoch, so only allow current epoch.
currentEpoch := slots.ToEpoch(vs.TimeFetcher.CurrentSlot())
if req.Epoch > currentEpoch {
return nil, status.Errorf(codes.InvalidArgument, "Request epoch %d can not be greater than current epoch %d", req.Epoch, currentEpoch)
nextEpoch := currentEpoch.Add(1)
if req.Epoch > nextEpoch {
return nil, status.Errorf(codes.InvalidArgument, "Request epoch %d can not be greater than next epoch %d", req.Epoch, nextEpoch)
}

s, err := vs.HeadFetcher.HeadState(ctx)
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/prysm/v1alpha1/validator/duties_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ func TestGetPTCDuties_EpochOutOfBound(t *testing.T) {
SyncChecker: &mockSync.Sync{IsSyncing: false},
}
currentEpoch := primitives.Epoch(chain.CurrentSlot() / params.BeaconConfig().SlotsPerEpoch)
req := &ethpb.PTCDutiesRequest{Epoch: currentEpoch + 1}
req := &ethpb.PTCDutiesRequest{Epoch: currentEpoch + 2}
_, err := vs.GetPTCDuties(t.Context(), req)
assert.ErrorContains(t, "can not be greater than current epoch", err)
assert.ErrorContains(t, "can not be greater than next epoch", err)
}

func TestGetPTCDuties_PreGloasFork(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions changelog/james-prysm_ptc-next-duties-grpc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changed

- allows ptc duties grpc endpoint to work for next epoch.
Loading