diff --git a/build.sbt b/build.sbt index 7390431bcad..1a912392175 100644 --- a/build.sbt +++ b/build.sbt @@ -258,6 +258,7 @@ lazy val node = (project in file("node")) apiServerDependencies ++ commonDependencies ++ kamonDependencies ++ protobufDependencies ++ Seq( catsCore, grpcNetty, + grpcServices, jline, scallop, scalaUri, diff --git a/models/src/main/protobuf/DeployService.proto b/models/src/main/protobuf/DeployService.proto index cb3f774b238..ead8ae8cfd0 100644 --- a/models/src/main/protobuf/DeployService.proto +++ b/models/src/main/protobuf/DeployService.proto @@ -23,7 +23,7 @@ option (scalapb.options) = { }; // Use `DoDeploy` to queue deployments of Rholang code and then -// `createBlock` to make a new block with the results of running them +// `ProposeService.propose` to make a new block with the results of running them // all. // // To get results back, use `listenForDataAtName`. @@ -185,3 +185,17 @@ message WaitingContinuationInfo { repeated BindPattern postBlockPatterns = 1; Par postBlockContinuation = 2; } + +// This type holds response types inside Either for DeployService methods +message DeployServiceResponseMeta { + DeployServiceResponse DoDeploy = 1; + BlockQueryResponse getBlock = 2; + VisualizeBlocksResponse visualizeDag = 3; + LightBlockInfo showMainChain = 4; + LightBlockInfo getBlocks = 5; + ListeningNameDataResponse listenForDataAtName = 6; + ListeningNameContinuationResponse listenForContinuationAtName = 7; + LightBlockQueryResponse findDeploy = 8; + PrivateNamePreviewResponse previewPrivateNames = 9; + BlockQueryResponse lastFinalizedBlock = 10; +} diff --git a/node/src/main/scala/coop/rchain/node/NodeRuntime.scala b/node/src/main/scala/coop/rchain/node/NodeRuntime.scala index 5a2ae7b724f..c1405a7625c 100644 --- a/node/src/main/scala/coop/rchain/node/NodeRuntime.scala +++ b/node/src/main/scala/coop/rchain/node/NodeRuntime.scala @@ -42,6 +42,7 @@ import monix.eval.{Task, TaskLocal} import monix.execution.Scheduler import org.http4s.implicits._ import org.http4s.server.blaze._ +import org.http4s.server.middleware._ import org.http4s.server.Router import scala.concurrent.duration._ @@ -141,9 +142,9 @@ class NodeRuntime private[node] ( .bindHttp(conf.server.httpPort, "0.0.0.0") .withHttpApp( Router( - "/metrics" -> prometheusService, - "/version" -> VersionInfo.service[Task], - "/status" -> StatusInfo.service[Task] + "/metrics" -> CORS(prometheusService), + "/version" -> CORS(VersionInfo.service[Task]), + "/status" -> CORS(StatusInfo.service[Task]) ).orNotFound ) .resource diff --git a/node/src/main/scala/coop/rchain/node/api/package.scala b/node/src/main/scala/coop/rchain/node/api/package.scala index 6675644a08d..8c7cfb3f193 100644 --- a/node/src/main/scala/coop/rchain/node/api/package.scala +++ b/node/src/main/scala/coop/rchain/node/api/package.scala @@ -13,6 +13,7 @@ import coop.rchain.node.model.repl._ import coop.rchain.rholang.interpreter.Runtime import coop.rchain.shared._ import io.grpc.netty.NettyServerBuilder +import io.grpc.protobuf.services.ProtoReflectionService import monix.eval.Task import monix.execution.Scheduler @@ -48,6 +49,7 @@ package object api { ProposeServiceGrpcMonix .bindService(ProposeGrpcService.instance(blockApiLock, tracing), grpcExecutor) ) + .addService(ProtoReflectionService.newInstance()) .build ) @@ -70,6 +72,7 @@ package object api { ProposeServiceGrpcMonix .bindService(ProposeGrpcService.instance(blockApiLock, tracing), grpcExecutor) ) + .addService(ProtoReflectionService.newInstance()) .build ) } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3b100e067fb..19d8d0f40c7 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -60,6 +60,7 @@ object Dependencies { val scalapbRuntimeLib = "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion val scalapbRuntimegGrpc = "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion val grpcNetty = "io.grpc" % "grpc-netty" % scalapb.compiler.Version.grpcJavaVersion + val grpcServices = "io.grpc" % "grpc-services" % scalapb.compiler.Version.grpcJavaVersion val nettyBoringSsl = "io.netty" % "netty-tcnative-boringssl-static" % "2.0.8.Final" val nettyTcnative = "io.netty" % "netty-tcnative" % "2.0.8.Final" classifier osClassifier val nettyTcnativeLinux = "io.netty" % "netty-tcnative" % "2.0.8.Final" classifier "linux-x86_64"