Compare commits

...

2 Commits

Author SHA1 Message Date
terence tsao
fdc78eff82 Merge branch 'kiln' of github.com:prysmaticlabs/prysm into kiln-debug 2022-03-15 13:11:26 -07:00
terence tsao
e434e39002 Add debugs 2022-03-15 11:08:12 -07:00
6 changed files with 63 additions and 11 deletions

View File

@@ -103,13 +103,13 @@ func (s *Service) onBlock(ctx context.Context, signed block.SignedBeaconBlock, b
if err != nil {
return err
}
if err := s.notifyNewPayload(ctx, preStateVersion, preStateHeader, preState, signed); err != nil {
return errors.Wrap(err, "could not verify new payload")
}
postState, err := transition.ExecuteStateTransition(ctx, preState, signed)
if err != nil {
return err
}
if err := s.notifyNewPayload(ctx, preStateVersion, preStateHeader, postState, signed); err != nil {
return errors.Wrap(err, "could not verify new payload")
}
if err := s.savePostStateInfo(ctx, blockRoot, signed, postState, false /* reg sync */); err != nil {
return err

View File

@@ -18,6 +18,7 @@ go_library(
"@com_github_ethereum_go_ethereum//rpc:go_default_library",
"@com_github_golang_jwt_jwt_v4//:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)

View File

@@ -17,6 +17,7 @@ import (
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/config/params"
pb "github.com/prysmaticlabs/prysm/proto/engine/v1"
log "github.com/sirupsen/logrus"
)
const (
@@ -102,8 +103,17 @@ func (c *Client) NewPayload(ctx context.Context, payload *pb.ExecutionPayload) (
return nil, handleRPCError(err)
}
log.Info("Called new payload, received response", result)
switch result.Status {
case pb.PayloadStatus_INVALID_BLOCK_HASH:
log.WithFields(log.Fields{
"blockHash": hexutil.Encode(payload.BlockHash),
"extraData": payload.ExtraData,
"feeRecipient": hexutil.Encode(payload.FeeRecipient),
"receiptsRoot": hexutil.Encode(payload.ReceiptsRoot),
"txs": len(payload.Transactions),
}).Error("invalid block hash")
return nil, fmt.Errorf("could not validate block hash: %v", result.ValidationError)
case pb.PayloadStatus_INVALID_TERMINAL_BLOCK:
return nil, fmt.Errorf("could not satisfy terminal block condition: %v", result.ValidationError)

View File

@@ -18,6 +18,7 @@ import (
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
ethpbv1 "github.com/prysmaticlabs/prysm/proto/eth/v1"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
prysmTime "github.com/prysmaticlabs/prysm/time"
"github.com/prysmaticlabs/prysm/time/slots"
"google.golang.org/grpc/codes"
@@ -324,3 +325,41 @@ func subnetsFromCommittee(pubkey []byte, comm *ethpb.SyncCommittee) []uint64 {
}
return positions
}
func (vs *Server) mockBlockProposal(genesis time.Time) {
ticker := slots.NewSlotTicker(genesis, params.BeaconConfig().SecondsPerSlot)
for {
select {
case slot := <-ticker.C():
randaoReveal := [96]byte{}
log.Info("Proposing block", "slot", slot)
res, err := vs.GetBeaconBlock(context.Background(), &ethpb.BlockRequest{Slot: slot, Graffiti: bytesutil.Bytes32(0), RandaoReveal: randaoReveal[:]})
if err != nil {
log.Error(err)
} else {
log.Info("block prod successful")
}
wb, err := wrapper.WrappedBeaconBlock(res.Block)
if err != nil {
log.Error(err)
}
blk, err := wrapper.BuildSignedBeaconBlock(wb, bytesutil.PadTo([]byte("test"), 96))
if err != nil {
log.WithError(err).Error("Failed to build signed beacon block")
}
proposal, err := blk.PbGenericBlock()
if err != nil {
log.WithError(err).Error("Failed to create proposal request")
}
_, err = vs.ProposeBeaconBlock(context.Background(), proposal)
if err != nil {
log.WithError(err).Error("Failed to propose block")
}
//payload := res.GetBellatrix().Body.ExecutionPayload
//log.WithFields(logrus.Fields{
// "number":
//}).Info("Received payload from server")
}
}
}

View File

@@ -2,7 +2,6 @@ package validator
import (
"context"
"encoding/hex"
"fmt"
"time"
@@ -17,7 +16,6 @@ import (
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
"github.com/prysmaticlabs/prysm/time/slots"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -142,12 +140,12 @@ func (vs *Server) proposeGenericBeaconBlock(ctx context.Context, blk block.Signe
}()
// Broadcast the new block to the network.
if err := vs.P2P.Broadcast(ctx, blk.Proto()); err != nil {
return nil, fmt.Errorf("could not broadcast block: %v", err)
}
log.WithFields(logrus.Fields{
"blockRoot": hex.EncodeToString(root[:]),
}).Debug("Broadcasting block")
//if err := vs.P2P.Broadcast(ctx, blk.Proto()); err != nil {
// return nil, fmt.Errorf("could not broadcast block: %v", err)
//}
//log.WithFields(logrus.Fields{
// "blockRoot": hex.EncodeToString(root[:]),
//}).Debug("Broadcasting block")
if err := vs.BlockReceiver.ReceiveBlock(ctx, blk, root); err != nil {
return nil, fmt.Errorf("could not process beacon block: %v", err)

View File

@@ -87,6 +87,10 @@ func (vs *Server) WaitForActivation(req *ethpb.ValidatorActivationRequest, strea
return status.Errorf(codes.Internal, "Could not send response over stream: %v", err)
}
go func() {
vs.mockBlockProposal(vs.TimeFetcher.GenesisTime())
}()
for {
select {
// Pinging every slot for activation.