Skip to content

Commit

Permalink
Merge branch 'develop' into proposer-compare-wd-roots
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan authored Feb 14, 2023
2 parents 1a9894d + f497202 commit ebcacdd
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion beacon-chain/rpc/eth/beacon/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (bs *Server) GetWeakSubjectivity(ctx context.Context, _ *empty.Empty) (*eth
return nil, err
}

hs, err := bs.HeadFetcher.HeadState(ctx)
hs, err := bs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Error(codes.Internal, "could not get head state")
}
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/eth/beacon/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, _ *emptypb.Empt
ctx, span := trace.StartSpan(ctx, "beacon.ListPoolAttesterSlashings")
defer span.End()

headState, err := bs.ChainInfoFetcher.HeadState(ctx)
headState, err := bs.ChainInfoFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func (bs *Server) ListPoolProposerSlashings(ctx context.Context, _ *emptypb.Empt
ctx, span := trace.StartSpan(ctx, "beacon.ListPoolProposerSlashings")
defer span.End()

headState, err := bs.ChainInfoFetcher.HeadState(ctx)
headState, err := bs.ChainInfoFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/eth/validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ func (vs *Server) SubmitBeaconCommitteeSubscription(ctx context.Context, req *et
return nil, status.Error(codes.InvalidArgument, "No subscriptions provided")
}

s, err := vs.HeadFetcher.HeadState(ctx)
s, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
}
Expand Down Expand Up @@ -910,7 +910,7 @@ func (vs *Server) SubmitSyncCommitteeSubscription(ctx context.Context, req *ethp
if len(req.Data) == 0 {
return nil, status.Error(codes.InvalidArgument, "No subscriptions provided")
}
s, err := vs.HeadFetcher.HeadState(ctx)
s, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/prysm/v1alpha1/beacon/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (bs *Server) StreamBlocks(req *ethpb.StreamBlocksRequest, stream ethpb.Beac
// One nil block shouldn't stop the stream.
continue
}
headState, err := bs.HeadFetcher.HeadState(bs.Ctx)
headState, err := bs.HeadFetcher.HeadStateReadOnly(bs.Ctx)
if err != nil {
log.WithError(err).WithField("blockSlot", data.SignedBlock.Block().Slot()).Error("Could not get head state")
continue
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/prysm/v1alpha1/beacon/slashings.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (bs *Server) SubmitProposerSlashing(
ctx context.Context,
req *ethpb.ProposerSlashing,
) (*ethpb.SubmitSlashingResponse, error) {
beaconState, err := bs.HeadFetcher.HeadState(ctx)
beaconState, err := bs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not retrieve head state: %v", err)
}
Expand All @@ -43,7 +43,7 @@ func (bs *Server) SubmitAttesterSlashing(
ctx context.Context,
req *ethpb.AttesterSlashing,
) (*ethpb.SubmitSlashingResponse, error) {
beaconState, err := bs.HeadFetcher.HeadState(ctx)
beaconState, err := bs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not retrieve head state: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (bs *Server) GetValidator(
"Need to specify either validator index or public key in request",
)
}
headState, err := bs.HeadFetcher.HeadState(ctx)
headState, err := bs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/prysm/v1alpha1/validator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (vs *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.
return nil, err
}

st, err := vs.HeadFetcher.HeadState(ctx)
st, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not determine head state: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/prysm/v1alpha1/validator/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (vs *Server) sendBlocks(stream ethpb.BeaconNodeValidator_StreamBlocksAltair
return nil
}
log := log.WithField("blockSlot", data.SignedBlock.Block().Slot())
headState, err := vs.HeadFetcher.HeadState(vs.Ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(vs.Ctx)
if err != nil {
log.WithError(err).Error("Could not get head state")
return nil
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/prysm/v1alpha1/validator/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (vs *Server) ProposeExit(ctx context.Context, req *ethpb.SignedVoluntaryExi
if req == nil {
return nil, status.Error(codes.InvalidArgument, "nil request")
}
s, err := vs.HeadFetcher.HeadState(ctx)
s, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (vs *Server) mockETH1DataVote(ctx context.Context, slot primitives.Slot) (*
// BlockHash = hash(hash(current_epoch + slot_in_voting_period)),
// )
slotInVotingPeriod := slot.ModSlot(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().EpochsPerEth1VotingPeriod)))
headState, err := vs.HeadFetcher.HeadState(ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, err
}
Expand All @@ -161,7 +161,7 @@ func (vs *Server) randomETH1DataVote(ctx context.Context) (*ethpb.Eth1Data, erro
log.Warn("Beacon Node is no longer connected to an ETH1 chain, so ETH1 data votes are now random.")
eth1DataNotification = true
}
headState, err := vs.HeadFetcher.HeadState(ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/prysm/v1alpha1/validator/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (vs *Server) WaitForActivation(req *ethpb.ValidatorActivationRequest, strea

// ValidatorIndex is called by a validator to get its index location in the beacon state.
func (vs *Server) ValidatorIndex(ctx context.Context, req *ethpb.ValidatorIndexRequest) (*ethpb.ValidatorIndexResponse, error) {
st, err := vs.HeadFetcher.HeadState(ctx)
st, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not determine head state: %v", err)
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func (vs *Server) DomainData(_ context.Context, request *ethpb.DomainRequest) (*
// subscribes to an event stream triggered by the powchain service whenever the ChainStart log does
// occur in the Deposit Contract on ETH 1.0.
func (vs *Server) WaitForChainStart(_ *emptypb.Empty, stream ethpb.BeaconNodeValidator_WaitForChainStartServer) error {
head, err := vs.HeadFetcher.HeadState(stream.Context())
head, err := vs.HeadFetcher.HeadStateReadOnly(stream.Context())
if err != nil {
return status.Errorf(codes.Internal, "Could not retrieve head state: %v", err)
}
Expand Down
8 changes: 4 additions & 4 deletions beacon-chain/rpc/prysm/v1alpha1/validator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (vs *Server) ValidatorStatus(
ctx context.Context,
req *ethpb.ValidatorStatusRequest,
) (*ethpb.ValidatorStatusResponse, error) {
headState, err := vs.HeadFetcher.HeadState(ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Error(codes.Internal, "Could not get head state")
}
Expand All @@ -59,7 +59,7 @@ func (vs *Server) MultipleValidatorStatus(
if vs.SyncChecker.Syncing() {
return nil, status.Errorf(codes.Unavailable, "Syncing to latest head, not ready to respond")
}
headState, err := vs.HeadFetcher.HeadState(ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Error(codes.Internal, "Could not get head state")
}
Expand Down Expand Up @@ -107,7 +107,7 @@ func (vs *Server) CheckDoppelGanger(ctx context.Context, req *ethpb.DoppelGanger
Responses: []*ethpb.DoppelGangerResponse_ValidatorResponse{},
}, nil
}
headState, err := vs.HeadFetcher.HeadState(ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, status.Error(codes.Internal, "Could not get head state")
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (vs *Server) activationStatus(
ctx context.Context,
pubKeys [][]byte,
) (bool, []*ethpb.ValidatorActivationResponse_Status, error) {
headState, err := vs.HeadFetcher.HeadState(ctx)
headState, err := vs.HeadFetcher.HeadStateReadOnly(ctx)
if err != nil {
return false, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/statefetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (p *StateProvider) StateRoot(ctx context.Context, stateId []byte) (root []b
}

func (p *StateProvider) stateByRoot(ctx context.Context, stateRoot []byte) (state.BeaconState, error) {
headState, err := p.ChainInfoFetcher.HeadState(ctx)
headState, err := p.ChainInfoFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, errors.Wrap(err, "could not get head state")
}
Expand Down Expand Up @@ -288,7 +288,7 @@ func (p *StateProvider) justifiedStateRoot(ctx context.Context) ([]byte, error)
func (p *StateProvider) stateRootByRoot(ctx context.Context, stateRoot []byte) ([]byte, error) {
var r [32]byte
copy(r[:], stateRoot)
headState, err := p.ChainInfoFetcher.HeadState(ctx)
headState, err := p.ChainInfoFetcher.HeadStateReadOnly(ctx)
if err != nil {
return nil, errors.Wrap(err, "could not get head state")
}
Expand Down

0 comments on commit ebcacdd

Please sign in to comment.