diff --git a/grpc/execution/server.go b/grpc/execution/server.go index 6898a6af16..dac5dc8b7b 100644 --- a/grpc/execution/server.go +++ b/grpc/execution/server.go @@ -97,10 +97,11 @@ func (s *ExecutionServiceServer) DoBlock(ctx context.Context, req *executionv1.D s.eth.TxPool().RemoveTx(tx.Hash()) } + finalizedBlock := s.bc.CurrentFinalBlock() newForkChoice := &engine.ForkchoiceStateV1{ HeadBlockHash: block.Hash(), SafeBlockHash: block.Hash(), - FinalizedBlockHash: block.Hash(), + FinalizedBlockHash: finalizedBlock.Hash(), } fcEndResp, err := s.consensus.ForkchoiceUpdatedV1(*newForkChoice, nil) if err != nil { @@ -114,6 +115,16 @@ func (s *ExecutionServiceServer) DoBlock(ctx context.Context, req *executionv1.D return res, nil } +func (s *ExecutionServiceServer) FinalizeBlock(ctx context.Context, req *executionv1.FinalizeBlockRequest) (*executionv1.FinalizeBlockResponse, error) { + header := s.bc.GetHeaderByHash(common.BytesToHash(req.BlockHash)) + if header == nil { + return nil, fmt.Errorf("failed to get header for block hash 0x%x", req.BlockHash) + } + + s.bc.SetFinalized(header) + return &executionv1.FinalizeBlockResponse{}, nil +} + func (s *ExecutionServiceServer) InitState(ctx context.Context, req *executionv1.InitStateRequest) (*executionv1.InitStateResponse, error) { currHead := s.eth.BlockChain().CurrentHeader() res := &executionv1.InitStateResponse{ diff --git a/grpc/gen/proto/execution/v1/execution.pb.go b/grpc/gen/proto/execution/v1/execution.pb.go index a47be286cc..a458af648e 100644 --- a/grpc/gen/proto/execution/v1/execution.pb.go +++ b/grpc/gen/proto/execution/v1/execution.pb.go @@ -131,6 +131,91 @@ func (x *DoBlockResponse) GetBlockHash() []byte { return nil } +type FinalizeBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` +} + +func (x *FinalizeBlockRequest) Reset() { + *x = FinalizeBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_execution_v1_execution_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FinalizeBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FinalizeBlockRequest) ProtoMessage() {} + +func (x *FinalizeBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_execution_v1_execution_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FinalizeBlockRequest.ProtoReflect.Descriptor instead. +func (*FinalizeBlockRequest) Descriptor() ([]byte, []int) { + return file_proto_execution_v1_execution_proto_rawDescGZIP(), []int{2} +} + +func (x *FinalizeBlockRequest) GetBlockHash() []byte { + if x != nil { + return x.BlockHash + } + return nil +} + +type FinalizeBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *FinalizeBlockResponse) Reset() { + *x = FinalizeBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_execution_v1_execution_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FinalizeBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FinalizeBlockResponse) ProtoMessage() {} + +func (x *FinalizeBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_execution_v1_execution_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FinalizeBlockResponse.ProtoReflect.Descriptor instead. +func (*FinalizeBlockResponse) Descriptor() ([]byte, []int) { + return file_proto_execution_v1_execution_proto_rawDescGZIP(), []int{3} +} + type InitStateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -140,7 +225,7 @@ type InitStateRequest struct { func (x *InitStateRequest) Reset() { *x = InitStateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_execution_v1_execution_proto_msgTypes[2] + mi := &file_proto_execution_v1_execution_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -153,7 +238,7 @@ func (x *InitStateRequest) String() string { func (*InitStateRequest) ProtoMessage() {} func (x *InitStateRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_execution_v1_execution_proto_msgTypes[2] + mi := &file_proto_execution_v1_execution_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -166,7 +251,7 @@ func (x *InitStateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use InitStateRequest.ProtoReflect.Descriptor instead. func (*InitStateRequest) Descriptor() ([]byte, []int) { - return file_proto_execution_v1_execution_proto_rawDescGZIP(), []int{2} + return file_proto_execution_v1_execution_proto_rawDescGZIP(), []int{4} } type InitStateResponse struct { @@ -180,7 +265,7 @@ type InitStateResponse struct { func (x *InitStateResponse) Reset() { *x = InitStateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_execution_v1_execution_proto_msgTypes[3] + mi := &file_proto_execution_v1_execution_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -193,7 +278,7 @@ func (x *InitStateResponse) String() string { func (*InitStateResponse) ProtoMessage() {} func (x *InitStateResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_execution_v1_execution_proto_msgTypes[3] + mi := &file_proto_execution_v1_execution_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -206,7 +291,7 @@ func (x *InitStateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use InitStateResponse.ProtoReflect.Descriptor instead. func (*InitStateResponse) Descriptor() ([]byte, []int) { - return file_proto_execution_v1_execution_proto_rawDescGZIP(), []int{3} + return file_proto_execution_v1_execution_proto_rawDescGZIP(), []int{5} } func (x *InitStateResponse) GetBlockHash() []byte { @@ -236,35 +321,45 @@ var file_proto_execution_v1_execution_proto_rawDesc = []byte{ 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x30, 0x0a, 0x0f, 0x44, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x12, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x35, + 0x0a, 0x14, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x17, 0x0a, 0x15, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, + 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x32, 0x0a, 0x11, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x32, 0xa8, 0x01, 0x0a, 0x10, 0x45, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x07, 0x44, - 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x1e, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1f, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0xb8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, - 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2f, 0x67, 0x6f, - 0x2d, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, - 0x31, 0x3b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, - 0x45, 0x58, 0x58, 0xaa, 0x02, 0x0c, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x0c, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, - 0x31, 0xe2, 0x02, 0x18, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x32, 0x82, 0x02, 0x0a, 0x10, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x09, 0x49, + 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x07, 0x44, 0x6f, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x58, 0x0a, 0x0d, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x22, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xb8, 0x01, 0x0a, 0x10, + 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x42, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x65, 0x74, 0x68, 0x65, 0x72, + 0x65, 0x75, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x45, 0x58, 0x58, 0xaa, 0x02, 0x0c, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -279,22 +374,26 @@ func file_proto_execution_v1_execution_proto_rawDescGZIP() []byte { return file_proto_execution_v1_execution_proto_rawDescData } -var file_proto_execution_v1_execution_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_execution_v1_execution_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_proto_execution_v1_execution_proto_goTypes = []interface{}{ (*DoBlockRequest)(nil), // 0: execution.v1.DoBlockRequest (*DoBlockResponse)(nil), // 1: execution.v1.DoBlockResponse - (*InitStateRequest)(nil), // 2: execution.v1.InitStateRequest - (*InitStateResponse)(nil), // 3: execution.v1.InitStateResponse - (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*FinalizeBlockRequest)(nil), // 2: execution.v1.FinalizeBlockRequest + (*FinalizeBlockResponse)(nil), // 3: execution.v1.FinalizeBlockResponse + (*InitStateRequest)(nil), // 4: execution.v1.InitStateRequest + (*InitStateResponse)(nil), // 5: execution.v1.InitStateResponse + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp } var file_proto_execution_v1_execution_proto_depIdxs = []int32{ - 4, // 0: execution.v1.DoBlockRequest.timestamp:type_name -> google.protobuf.Timestamp - 0, // 1: execution.v1.ExecutionService.DoBlock:input_type -> execution.v1.DoBlockRequest - 2, // 2: execution.v1.ExecutionService.InitState:input_type -> execution.v1.InitStateRequest - 1, // 3: execution.v1.ExecutionService.DoBlock:output_type -> execution.v1.DoBlockResponse - 3, // 4: execution.v1.ExecutionService.InitState:output_type -> execution.v1.InitStateResponse - 3, // [3:5] is the sub-list for method output_type - 1, // [1:3] is the sub-list for method input_type + 6, // 0: execution.v1.DoBlockRequest.timestamp:type_name -> google.protobuf.Timestamp + 4, // 1: execution.v1.ExecutionService.InitState:input_type -> execution.v1.InitStateRequest + 0, // 2: execution.v1.ExecutionService.DoBlock:input_type -> execution.v1.DoBlockRequest + 2, // 3: execution.v1.ExecutionService.FinalizeBlock:input_type -> execution.v1.FinalizeBlockRequest + 5, // 4: execution.v1.ExecutionService.InitState:output_type -> execution.v1.InitStateResponse + 1, // 5: execution.v1.ExecutionService.DoBlock:output_type -> execution.v1.DoBlockResponse + 3, // 6: execution.v1.ExecutionService.FinalizeBlock:output_type -> execution.v1.FinalizeBlockResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name @@ -331,7 +430,7 @@ func file_proto_execution_v1_execution_proto_init() { } } file_proto_execution_v1_execution_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitStateRequest); i { + switch v := v.(*FinalizeBlockRequest); i { case 0: return &v.state case 1: @@ -343,6 +442,30 @@ func file_proto_execution_v1_execution_proto_init() { } } file_proto_execution_v1_execution_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FinalizeBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_execution_v1_execution_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InitStateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_execution_v1_execution_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InitStateResponse); i { case 0: return &v.state @@ -361,7 +484,7 @@ func file_proto_execution_v1_execution_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_execution_v1_execution_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/grpc/gen/proto/execution/v1/execution_grpc.pb.go b/grpc/gen/proto/execution/v1/execution_grpc.pb.go index 1faf8aeb74..39fb7146d4 100644 --- a/grpc/gen/proto/execution/v1/execution_grpc.pb.go +++ b/grpc/gen/proto/execution/v1/execution_grpc.pb.go @@ -19,16 +19,18 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - ExecutionService_DoBlock_FullMethodName = "/execution.v1.ExecutionService/DoBlock" - ExecutionService_InitState_FullMethodName = "/execution.v1.ExecutionService/InitState" + ExecutionService_InitState_FullMethodName = "/execution.v1.ExecutionService/InitState" + ExecutionService_DoBlock_FullMethodName = "/execution.v1.ExecutionService/DoBlock" + ExecutionService_FinalizeBlock_FullMethodName = "/execution.v1.ExecutionService/FinalizeBlock" ) // ExecutionServiceClient is the client API for ExecutionService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ExecutionServiceClient interface { - DoBlock(ctx context.Context, in *DoBlockRequest, opts ...grpc.CallOption) (*DoBlockResponse, error) InitState(ctx context.Context, in *InitStateRequest, opts ...grpc.CallOption) (*InitStateResponse, error) + DoBlock(ctx context.Context, in *DoBlockRequest, opts ...grpc.CallOption) (*DoBlockResponse, error) + FinalizeBlock(ctx context.Context, in *FinalizeBlockRequest, opts ...grpc.CallOption) (*FinalizeBlockResponse, error) } type executionServiceClient struct { @@ -39,15 +41,6 @@ func NewExecutionServiceClient(cc grpc.ClientConnInterface) ExecutionServiceClie return &executionServiceClient{cc} } -func (c *executionServiceClient) DoBlock(ctx context.Context, in *DoBlockRequest, opts ...grpc.CallOption) (*DoBlockResponse, error) { - out := new(DoBlockResponse) - err := c.cc.Invoke(ctx, ExecutionService_DoBlock_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *executionServiceClient) InitState(ctx context.Context, in *InitStateRequest, opts ...grpc.CallOption) (*InitStateResponse, error) { out := new(InitStateResponse) err := c.cc.Invoke(ctx, ExecutionService_InitState_FullMethodName, in, out, opts...) @@ -57,12 +50,31 @@ func (c *executionServiceClient) InitState(ctx context.Context, in *InitStateReq return out, nil } +func (c *executionServiceClient) DoBlock(ctx context.Context, in *DoBlockRequest, opts ...grpc.CallOption) (*DoBlockResponse, error) { + out := new(DoBlockResponse) + err := c.cc.Invoke(ctx, ExecutionService_DoBlock_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *executionServiceClient) FinalizeBlock(ctx context.Context, in *FinalizeBlockRequest, opts ...grpc.CallOption) (*FinalizeBlockResponse, error) { + out := new(FinalizeBlockResponse) + err := c.cc.Invoke(ctx, ExecutionService_FinalizeBlock_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ExecutionServiceServer is the server API for ExecutionService service. // All implementations must embed UnimplementedExecutionServiceServer // for forward compatibility type ExecutionServiceServer interface { - DoBlock(context.Context, *DoBlockRequest) (*DoBlockResponse, error) InitState(context.Context, *InitStateRequest) (*InitStateResponse, error) + DoBlock(context.Context, *DoBlockRequest) (*DoBlockResponse, error) + FinalizeBlock(context.Context, *FinalizeBlockRequest) (*FinalizeBlockResponse, error) mustEmbedUnimplementedExecutionServiceServer() } @@ -70,11 +82,14 @@ type ExecutionServiceServer interface { type UnimplementedExecutionServiceServer struct { } +func (UnimplementedExecutionServiceServer) InitState(context.Context, *InitStateRequest) (*InitStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InitState not implemented") +} func (UnimplementedExecutionServiceServer) DoBlock(context.Context, *DoBlockRequest) (*DoBlockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DoBlock not implemented") } -func (UnimplementedExecutionServiceServer) InitState(context.Context, *InitStateRequest) (*InitStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InitState not implemented") +func (UnimplementedExecutionServiceServer) FinalizeBlock(context.Context, *FinalizeBlockRequest) (*FinalizeBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FinalizeBlock not implemented") } func (UnimplementedExecutionServiceServer) mustEmbedUnimplementedExecutionServiceServer() {} @@ -89,24 +104,6 @@ func RegisterExecutionServiceServer(s grpc.ServiceRegistrar, srv ExecutionServic s.RegisterService(&ExecutionService_ServiceDesc, srv) } -func _ExecutionService_DoBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DoBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ExecutionServiceServer).DoBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ExecutionService_DoBlock_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ExecutionServiceServer).DoBlock(ctx, req.(*DoBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _ExecutionService_InitState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(InitStateRequest) if err := dec(in); err != nil { @@ -125,6 +122,42 @@ func _ExecutionService_InitState_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _ExecutionService_DoBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DoBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionServiceServer).DoBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ExecutionService_DoBlock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionServiceServer).DoBlock(ctx, req.(*DoBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ExecutionService_FinalizeBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FinalizeBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExecutionServiceServer).FinalizeBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ExecutionService_FinalizeBlock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExecutionServiceServer).FinalizeBlock(ctx, req.(*FinalizeBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ExecutionService_ServiceDesc is the grpc.ServiceDesc for ExecutionService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -132,13 +165,17 @@ var ExecutionService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "execution.v1.ExecutionService", HandlerType: (*ExecutionServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "InitState", + Handler: _ExecutionService_InitState_Handler, + }, { MethodName: "DoBlock", Handler: _ExecutionService_DoBlock_Handler, }, { - MethodName: "InitState", - Handler: _ExecutionService_InitState_Handler, + MethodName: "FinalizeBlock", + Handler: _ExecutionService_FinalizeBlock_Handler, }, }, Streams: []grpc.StreamDesc{},