From 5ed72d4ef93f83101c796a0cee580165af972569 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 28 Apr 2020 15:43:50 -0500 Subject: [PATCH] Add Debug RPC Service to Prysm (#5666) * adding in proto debug service * builds * debug proto * gaz ignore Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- proto/beacon/rpc/v1/BUILD.bazel | 50 +++++++++++++++++++++++++++++++++ proto/beacon/rpc/v1/debug.proto | 33 ++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 proto/beacon/rpc/v1/BUILD.bazel create mode 100644 proto/beacon/rpc/v1/debug.proto diff --git a/proto/beacon/rpc/v1/BUILD.bazel b/proto/beacon/rpc/v1/BUILD.bazel new file mode 100644 index 000000000000..6fe2bd354ea4 --- /dev/null +++ b/proto/beacon/rpc/v1/BUILD.bazel @@ -0,0 +1,50 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# gazelle:ignore +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +go_proto_library( + name = "go_grpc_gateway_library", + compilers = [ + "@io_bazel_rules_go//proto:go_grpc", + "@grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway:go_gen_grpc_gateway", + ], + importpath = "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1_gateway", + proto = ":v1_proto", + visibility = ["//visibility:public"], + deps = [ + "//proto/beacon/p2p/v1:go_default_library", + "@go_googleapis//google/api:annotations_go_proto", + "@com_github_golang_protobuf//descriptor:go_default_library", + ], +) + +go_proto_library( + name = "v1_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1", + proto = ":v1_proto", + visibility = ["//visibility:public"], + deps = [ + "//proto/beacon/p2p/v1:go_default_library", + "@go_googleapis//google/api:annotations_go_proto", + ], +) + +go_library( + name = "go_default_library", + embed = [":v1_go_proto"], + importpath = "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1", + visibility = ["//visibility:public"], +) + +proto_library( + name = "v1_proto", + srcs = ["debug.proto"], + visibility = ["//visibility:public"], + deps = [ + "//proto/beacon/p2p/v1:v1_proto", + "@go_googleapis//google/api:annotations_proto", + ], +) diff --git a/proto/beacon/rpc/v1/debug.proto b/proto/beacon/rpc/v1/debug.proto new file mode 100644 index 000000000000..cf4b037b285e --- /dev/null +++ b/proto/beacon/rpc/v1/debug.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package ethereum.beacon.rpc.v1; + +import "proto/beacon/p2p/v1/types.proto"; +import "google/api/annotations.proto"; + +// Debug service API +// +// The debug service in Prysm provides API access to various utilities +// for debugging the beacon node's functionality at runtime, such as being able +// to retrieve the beacon state by block root or state root from the node directly. +service Debug { + // Returns a beacon state by filter criteria from the beacon node. + rpc GetBeaconState(BeaconStateRequest) returns (ethereum.beacon.p2p.v1.BeaconState) { + option (google.api.http) = { + get: "/eth/v1alpha1/beacon/state" + }; + } +} + +message BeaconStateRequest { + oneof query_filter { + // The slot corresponding to a desired beacon state. + uint64 slot = 1; + + // The block root corresponding to a desired beacon state. + bytes block_root = 2; + + // The state root corresponding to a desired beacon state. + bytes state_root = 3; + } +} \ No newline at end of file