Compare commits

...

2 Commits

Author SHA1 Message Date
Kasey Kirkham
e4b1b31f43 intercept and init nil [][]byte transaction slices 2021-11-11 11:41:22 -06:00
terence tsao
d2c197d040 Add debug logging 2021-11-10 12:12:47 -08:00
4 changed files with 28 additions and 4 deletions

View File

@@ -168,10 +168,6 @@ func (s *Service) GetPayload(ctx context.Context, payloadID uint64) (*catalyst.E
// Engine API definition:
// https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#engine_executepayloadv1
func (s *Service) ExecutePayload(ctx context.Context, data *catalyst.ExecutableDataV1) ([]byte, error) {
// TODO: Fix this. Somehow transactions becomes nil with grpc call server->client
if data.Transactions == nil {
data.Transactions = [][]byte{}
}
reqBody := &EngineRequest{
JsonRPC: "2.0",
Method: "engine_executePayloadV1",

View File

@@ -55,6 +55,8 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
return nil, status.Errorf(codes.Internal, "Could not fetch Merge beacon block: %v", err)
}
log.Info("Sending block to client, transaction field is nil: ", blk.Body.ExecutionPayload.Transactions == nil)
return &ethpb.GenericBeaconBlock{Block: &ethpb.GenericBeaconBlock_Merge{Merge: blk}}, nil
}

View File

@@ -572,6 +572,8 @@ func (v *validator) proposeBlockMerge(ctx context.Context, slot types.Slot, pubK
RandaoReveal: randaoReveal,
Graffiti: g,
})
log.Info("Received block from server, transaction field is nil: ", b.GetMerge().Body.ExecutionPayload.Transactions == nil)
if err != nil {
log.WithField("blockSlot", slot).WithError(err).Error("Failed to request block from beacon node")
if v.emitAccountMetrics {

View File

@@ -259,6 +259,29 @@ func (v *ValidatorService) recheckKeys(ctx context.Context) {
}
}
func fixNilTransactions(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
err := invoker(ctx, method, req, reply, cc, opts...)
if err != nil {
return err
}
if method == "/ethereum.eth.v1alpha1.BeaconNodeValidator/GetBeaconBlock" {
rp := reply.(*ethpb.GenericBeaconBlock)
mb := rp.GetMerge()
// not a merge block
if mb == nil {
return nil
}
if mb.Body.ExecutionPayload.Transactions == nil {
mb.Body.ExecutionPayload.Transactions = make([][]byte, 0)
reply = ethpb.GenericBeaconBlock{
Block: &ethpb.GenericBeaconBlock_Merge{Merge: mb},
}
}
}
return nil
}
// ConstructDialOptions constructs a list of grpc dial options
func ConstructDialOptions(
maxCallRecvMsgSize int,
@@ -299,6 +322,7 @@ func ConstructDialOptions(
grpc_prometheus.UnaryClientInterceptor,
grpc_retry.UnaryClientInterceptor(),
grpcutil.LogRequests,
fixNilTransactions,
)),
grpc.WithChainStreamInterceptor(
grpcutil.LogStream,