Use head state only for bls messages broadcast (#11949)

* Use head state only for bls messages broadcast

* Fix build

---------

Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
terencechain 2023-01-31 22:01:10 -08:00 committed by GitHub
parent b10e59a144
commit 59cb9f0dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -201,7 +201,7 @@ func BLSChangesSignatureBatch(
// It validates the signature with the Capella fork version if the passed state // It validates the signature with the Capella fork version if the passed state
// is from a previous fork. // is from a previous fork.
func VerifyBLSChangeSignature( func VerifyBLSChangeSignature(
st state.BeaconState, st state.ReadOnlyBeaconState,
change *ethpbv2.SignedBLSToExecutionChange, change *ethpbv2.SignedBLSToExecutionChange,
) error { ) error {
c := params.BeaconConfig() c := params.BeaconConfig()

View File

@ -315,7 +315,7 @@ func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpbv1.SignedVo
func (bs *Server) SubmitSignedBLSToExecutionChanges(ctx context.Context, req *ethpbv2.SubmitBLSToExecutionChangesRequest) (*emptypb.Empty, error) { func (bs *Server) SubmitSignedBLSToExecutionChanges(ctx context.Context, req *ethpbv2.SubmitBLSToExecutionChangesRequest) (*emptypb.Empty, error) {
ctx, span := trace.StartSpan(ctx, "beacon.SubmitSignedBLSToExecutionChanges") ctx, span := trace.StartSpan(ctx, "beacon.SubmitSignedBLSToExecutionChanges")
defer span.End() defer span.End()
st, err := bs.ChainInfoFetcher.HeadState(ctx) st, err := bs.ChainInfoFetcher.HeadStateReadOnly(ctx)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err) return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
} }
@ -372,7 +372,7 @@ func (bs *Server) broadcastBLSBatch(ctx context.Context, ptr *[]*ethpbalpha.Sign
if len(changes) < broadcastBLSChangesRateLimit { if len(changes) < broadcastBLSChangesRateLimit {
limit = len(changes) limit = len(changes)
} }
st, err := bs.ChainInfoFetcher.HeadState(ctx) st, err := bs.ChainInfoFetcher.HeadStateReadOnly(ctx)
if err != nil { if err != nil {
log.WithError(err).Error("could not get head state") log.WithError(err).Error("could not get head state")
return return

View File

@ -49,7 +49,7 @@ func (s *Service) broadcastBLSBatch(ctx context.Context, ptr *[]*ethpb.SignedBLS
if len(changes) < broadcastBLSChangesRateLimit { if len(changes) < broadcastBLSChangesRateLimit {
limit = len(changes) limit = len(changes)
} }
st, err := s.cfg.chain.HeadState(ctx) st, err := s.cfg.chain.HeadStateReadOnly(ctx)
if err != nil { if err != nil {
log.WithError(err).Error("could not get head state") log.WithError(err).Error("could not get head state")
return return