From 0d2b1d0630ab81e9646c84d9f0a95b38e7feb1de Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Mon, 6 Jun 2022 14:54:05 +0530 Subject: [PATCH] internal/cli: add block tracing (#397) * bad block tracing * Add debug env framework * add implementation of custom block tracing * add few comments * use tar name fn * wip: add unit tests for block tracing * complete test for block tracer * fix: close grpc server * refactor cli tests * fix: change condition for parsing args * Fix port binding for test server * add helper for creating and closing mock server for tests * consume mock server in tests * fixes due to geth merge * fix: handle port selection for http server * update help and markdown for debug command * update docs * update debug synopsis * fix: use chunked encoder to handle large data over grpc * fix prints * lint * rm unused function, rename fn to TraceBorBlock Co-authored-by: Ferran Borreguero --- docs/cli/README.md | 4 + docs/cli/debug.md | 8 +- docs/cli/debug_block.md | 9 + docs/cli/debug_pprof.md | 11 + eth/tracers/api_bor.go | 143 +++ internal/cli/command.go | 10 + internal/cli/debug.go | 232 ++--- internal/cli/debug_block.go | 126 +++ internal/cli/debug_pprof.go | 159 ++++ internal/cli/debug_test.go | 112 +++ internal/cli/server/helper.go | 72 ++ internal/cli/server/proto/server.pb.go | 954 ++++++++++++-------- internal/cli/server/proto/server.proto | 25 +- internal/cli/server/proto/server_grpc.pb.go | 193 ++-- internal/cli/server/server.go | 14 + internal/cli/server/server_test.go | 35 +- internal/cli/server/service.go | 96 +- 17 files changed, 1560 insertions(+), 643 deletions(-) create mode 100644 docs/cli/debug_block.md create mode 100644 docs/cli/debug_pprof.md create mode 100644 eth/tracers/api_bor.go create mode 100644 internal/cli/debug_block.go create mode 100644 internal/cli/debug_pprof.go create mode 100644 internal/cli/debug_test.go create mode 100644 internal/cli/server/helper.go diff --git a/docs/cli/README.md b/docs/cli/README.md index d5648dca7dc0..d92a7b5a057b 100644 --- a/docs/cli/README.md +++ b/docs/cli/README.md @@ -22,6 +22,10 @@ - [```debug```](./debug.md) +- [```debug block```](./debug_block.md) + +- [```debug pprof```](./debug_pprof.md) + - [```fingerprint```](./fingerprint.md) - [```peers```](./peers.md) diff --git a/docs/cli/debug.md b/docs/cli/debug.md index eecc6c6ef08a..a59e4657452b 100644 --- a/docs/cli/debug.md +++ b/docs/cli/debug.md @@ -2,13 +2,9 @@ The ```bor debug``` command takes a debug dump of the running client. -## Options +- [```bor debug pprof```](./debug_pprof.md): Dumps bor pprof traces. -- ```address```: Address of the grpc endpoint - -- ```seconds```: seconds to trace - -- ```output```: Output directory +- [```bor debug block ```](./debug_block.md): Dumps bor block traces. ## Examples diff --git a/docs/cli/debug_block.md b/docs/cli/debug_block.md new file mode 100644 index 000000000000..ced7e482eec7 --- /dev/null +++ b/docs/cli/debug_block.md @@ -0,0 +1,9 @@ +# Debug trace + +The ```bor debug block ``` command will create an archive containing traces of a bor block. + +## Options + +- ```address```: Address of the grpc endpoint + +- ```output```: Output directory \ No newline at end of file diff --git a/docs/cli/debug_pprof.md b/docs/cli/debug_pprof.md new file mode 100644 index 000000000000..86a84b60654d --- /dev/null +++ b/docs/cli/debug_pprof.md @@ -0,0 +1,11 @@ +# Debug Pprof + +The ```debug pprof ``` command will create an archive containing bor pprof traces. + +## Options + +- ```address```: Address of the grpc endpoint + +- ```seconds```: seconds to trace + +- ```output```: Output directory \ No newline at end of file diff --git a/eth/tracers/api_bor.go b/eth/tracers/api_bor.go new file mode 100644 index 000000000000..7f5e2c34d603 --- /dev/null +++ b/eth/tracers/api_bor.go @@ -0,0 +1,143 @@ +package tracers + +import ( + "context" + "fmt" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/eth/tracers/logger" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rpc" +) + +type BlockTraceResult struct { + // Trace of each transaction executed + Transactions []*TxTraceResult `json:"transactions,omitempty"` + + // Block that we are executing on the trace + Block interface{} `json:"block"` +} + +type TxTraceResult struct { + // Trace results produced by the tracer + Result interface{} `json:"result,omitempty"` + + // Trace failure produced by the tracer + Error string `json:"error,omitempty"` + + // IntermediateHash of the execution if succeeds + IntermediateHash common.Hash `json:"intermediatehash"` +} + +func (api *API) traceBorBlock(ctx context.Context, block *types.Block, config *TraceConfig) (*BlockTraceResult, error) { + if block.NumberU64() == 0 { + return nil, fmt.Errorf("genesis is not traceable") + } + + res := &BlockTraceResult{ + Block: block, + } + + // block object cannot be converted to JSON since much of the fields are non-public + blockFields, err := ethapi.RPCMarshalBlock(block, true, true, api.backend.ChainConfig()) + if err != nil { + return nil, err + } + res.Block = blockFields + + parent, err := api.blockByNumberAndHash(ctx, rpc.BlockNumber(block.NumberU64()-1), block.ParentHash()) + if err != nil { + return nil, err + } + reexec := defaultTraceReexec + if config != nil && config.Reexec != nil { + reexec = *config.Reexec + } + // TODO: discuss consequences of setting preferDisk false. + statedb, err := api.backend.StateAtBlock(ctx, parent, reexec, nil, true, false) + if err != nil { + return nil, err + } + + // Execute all the transaction contained within the block concurrently + var ( + signer = types.MakeSigner(api.backend.ChainConfig(), block.Number()) + txs = block.Transactions() + deleteEmptyObjects = api.backend.ChainConfig().IsEIP158(block.Number()) + ) + + blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil) + + traceTxn := func(indx int, tx *types.Transaction) *TxTraceResult { + message, _ := tx.AsMessage(signer, block.BaseFee()) + txContext := core.NewEVMTxContext(message) + + tracer := logger.NewStructLogger(config.Config) + + // Run the transaction with tracing enabled. + vmenv := vm.NewEVM(blockCtx, txContext, statedb, api.backend.ChainConfig(), vm.Config{Debug: true, Tracer: tracer, NoBaseFee: true}) + + // Call Prepare to clear out the statedb access list + // Not sure if we need to do this + statedb.Prepare(tx.Hash(), indx) + + execRes, err := core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.Gas())) + if err != nil { + return &TxTraceResult{ + Error: err.Error(), + } + } + + returnVal := fmt.Sprintf("%x", execRes.Return()) + if len(execRes.Revert()) > 0 { + returnVal = fmt.Sprintf("%x", execRes.Revert()) + } + result := ðapi.ExecutionResult{ + Gas: execRes.UsedGas, + Failed: execRes.Failed(), + ReturnValue: returnVal, + StructLogs: ethapi.FormatLogs(tracer.StructLogs()), + } + res := &TxTraceResult{ + Result: result, + IntermediateHash: statedb.IntermediateRoot(deleteEmptyObjects), + } + return res + } + + for indx, tx := range txs { + res.Transactions = append(res.Transactions, traceTxn(indx, tx)) + } + return res, nil +} + +type TraceBlockRequest struct { + Number int64 + Hash string + IsBadBlock bool + Config *TraceConfig +} + +// If you use context as first parameter this function gets exposed automaticall on rpc endpoint +func (api *API) TraceBorBlock(req *TraceBlockRequest) (*BlockTraceResult, error) { + ctx := context.Background() + + var blockNumber rpc.BlockNumber + if req.Number == -1 { + blockNumber = rpc.LatestBlockNumber + } else { + blockNumber = rpc.BlockNumber(req.Number) + } + + log.Debug("Tracing Bor Block", "block number", blockNumber) + + block, err := api.blockByNumber(ctx, blockNumber) + if err != nil { + return nil, err + } + return api.traceBorBlock(ctx, block, req.Config) +} diff --git a/internal/cli/command.go b/internal/cli/command.go index 34f7c4ef129c..1ff95b410fae 100644 --- a/internal/cli/command.go +++ b/internal/cli/command.go @@ -84,6 +84,16 @@ func Commands() map[string]MarkDownCommandFactory { }, "debug": func() (MarkDownCommand, error) { return &DebugCommand{ + UI: ui, + }, nil + }, + "debug pprof": func() (MarkDownCommand, error) { + return &DebugPprofCommand{ + Meta2: meta2, + }, nil + }, + "debug block": func() (MarkDownCommand, error) { + return &DebugBlockCommand{ Meta2: meta2, }, nil }, diff --git a/internal/cli/debug.go b/internal/cli/debug.go index fb998ee4b9e3..6e083a6974cc 100644 --- a/internal/cli/debug.go +++ b/internal/cli/debug.go @@ -1,11 +1,8 @@ package cli -// Based on https://github.com/hashicorp/nomad/blob/main/command/operator_debug.go - import ( "archive/tar" "compress/gzip" - "context" "fmt" "io" "io/ioutil" @@ -16,20 +13,20 @@ import ( "syscall" "time" - "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/mitchellh/cli" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/golang/protobuf/jsonpb" // nolint:staticcheck gproto "github.com/golang/protobuf/proto" // nolint:staticcheck - "github.com/golang/protobuf/ptypes/empty" grpc_net_conn "github.com/mitchellh/go-grpc-net-conn" + "google.golang.org/grpc" + "google.golang.org/protobuf/runtime/protoiface" ) +// DebugCommand is the command to group the peers commands type DebugCommand struct { - *Meta2 - - seconds uint64 - output string + UI cli.Ui } // MarkDown implements cli.MarkDown interface @@ -53,7 +50,8 @@ func (d *DebugCommand) MarkDown() string { items := []string{ "# Debug", "The ```bor debug``` command takes a debug dump of the running client.", - d.Flags().MarkDown(), + "- [```bor debug pprof```](./debug_pprof.md): Dumps bor pprof traces.", + "- [```bor debug block ```](./debug_block.md): Dumps bor block traces.", } items = append(items, examples...) @@ -61,185 +59,141 @@ func (d *DebugCommand) MarkDown() string { } // Help implements the cli.Command interface -func (d *DebugCommand) Help() string { - return `Usage: bor debug +func (c *DebugCommand) Help() string { + return `Usage: bor debug - Build an archive containing Bor pprof traces + This command takes a debug dump of the running client. + + Get the pprof traces: - ` + d.Flags().Help() -} + $ bor debug pprof -func (d *DebugCommand) Flags() *flagset.Flagset { - flags := d.NewFlagSet("debug") + Get the block traces: - flags.Uint64Flag(&flagset.Uint64Flag{ - Name: "seconds", - Usage: "seconds to trace", - Value: &d.seconds, - Default: 2, - }) - flags.StringFlag(&flagset.StringFlag{ - Name: "output", - Value: &d.output, - Usage: "Output directory", - }) - - return flags + $ bor debug block ` } // Synopsis implements the cli.Command interface -func (d *DebugCommand) Synopsis() string { - return "Build an archive containing Bor pprof traces" +func (c *DebugCommand) Synopsis() string { + return "Get traces of the running client" } // Run implements the cli.Command interface -func (d *DebugCommand) Run(args []string) int { - flags := d.Flags() - if err := flags.Parse(args); err != nil { - d.UI.Error(err.Error()) - return 1 - } +func (c *DebugCommand) Run(args []string) int { + return cli.RunResultHelp +} - clt, err := d.BorConn() - if err != nil { - d.UI.Error(err.Error()) - return 1 - } +type debugEnv struct { + output string + prefix string + + name string + dst string +} - stamped := "bor-debug-" + time.Now().UTC().Format("2006-01-02-150405Z") +func (d *debugEnv) init() error { + d.name = d.prefix + time.Now().UTC().Format("2006-01-02-150405Z") + + var err error // Create the output directory var tmp string if d.output != "" { // User specified output directory - tmp = filepath.Join(d.output, stamped) + tmp = filepath.Join(d.output, d.name) _, err := os.Stat(tmp) if !os.IsNotExist(err) { - d.UI.Error("Output directory already exists") - return 1 + return fmt.Errorf("output directory already exists") } } else { // Generate temp directory - tmp, err = ioutil.TempDir(os.TempDir(), stamped) + tmp, err = ioutil.TempDir(os.TempDir(), d.name) if err != nil { - d.UI.Error(fmt.Sprintf("Error creating tmp directory: %s", err.Error())) - return 1 + return fmt.Errorf("error creating tmp directory: %s", err.Error()) } - defer os.RemoveAll(tmp) } - d.UI.Output("Starting debugger...") - d.UI.Output("") - // ensure destine folder exists if err := os.MkdirAll(tmp, os.ModePerm); err != nil { - d.UI.Error(fmt.Sprintf("failed to create parent directory: %v", err)) - return 1 + return fmt.Errorf("failed to create parent directory: %v", err) } - pprofProfile := func(ctx context.Context, profile string, filename string) error { - req := &proto.PprofRequest{ - Seconds: int64(d.seconds), - } + d.dst = tmp - switch profile { - case "cpu": - req.Type = proto.PprofRequest_CPU - case "trace": - req.Type = proto.PprofRequest_TRACE - default: - req.Type = proto.PprofRequest_LOOKUP - req.Profile = profile - } - - stream, err := clt.Pprof(ctx, req) + return nil +} - if err != nil { - return err - } - // wait for open request - msg, err := stream.Recv() - if err != nil { - return err - } +func (d *debugEnv) tarName() string { + return d.name + ".tar.gz" +} - if _, ok := msg.Event.(*proto.PprofResponse_Open_); !ok { - return fmt.Errorf("expected open message") - } +func (d *debugEnv) finish() error { + // Exit before archive if output directory was specified + if d.output != "" { + return nil + } - // create the stream - conn := &grpc_net_conn.Conn{ - Stream: stream, - Response: &proto.PprofResponse_Input{}, - Decode: grpc_net_conn.SimpleDecoder(func(msg gproto.Message) *[]byte { - return &msg.(*proto.PprofResponse_Input).Data - }), - } + // Create archive tarball + archiveFile := d.tarName() + if err := tarCZF(archiveFile, d.dst, d.name); err != nil { + return fmt.Errorf("error creating archive: %s", err.Error()) + } - file, err := os.OpenFile(filepath.Join(tmp, filename+".prof"), os.O_RDWR|os.O_CREATE, 0644) - if err != nil { - return err - } - defer file.Close() + return nil +} - if _, err := io.Copy(file, conn); err != nil { - return err - } +type debugStream interface { + Recv() (*proto.DebugFileResponse, error) + grpc.ClientStream +} - return nil +func (d *debugEnv) writeFromStream(name string, stream debugStream) error { + // wait for open request + msg, err := stream.Recv() + if err != nil { + return err } - ctx, cancelFn := context.WithCancel(context.Background()) - trapSignal(cancelFn) - - profiles := map[string]string{ - "heap": "heap", - "cpu": "cpu", - "trace": "trace", + if _, ok := msg.Event.(*proto.DebugFileResponse_Open_); !ok { + return fmt.Errorf("expected open message") } - for profile, filename := range profiles { - if err := pprofProfile(ctx, profile, filename); err != nil { - d.UI.Error(fmt.Sprintf("Error creating profile '%s': %v", profile, err)) - return 1 - } + + // create the stream + conn := &grpc_net_conn.Conn{ + Stream: stream, + Response: &proto.DebugFileResponse_Input{}, + Decode: grpc_net_conn.SimpleDecoder(func(msg gproto.Message) *[]byte { + return &msg.(*proto.DebugFileResponse_Input).Data + }), } - // append the status - { - statusResp, err := clt.Status(ctx, &empty.Empty{}) - if err != nil { - d.UI.Output(fmt.Sprintf("Failed to get status: %v", err)) - return 1 - } - m := jsonpb.Marshaler{} - data, err := m.MarshalToString(statusResp) - if err != nil { - d.UI.Output(err.Error()) - return 1 - } - if err := ioutil.WriteFile(filepath.Join(tmp, "status.json"), []byte(data), 0600); err != nil { - d.UI.Output(fmt.Sprintf("Failed to write status: %v", err)) - return 1 - } + file, err := os.OpenFile(filepath.Join(d.dst, name), os.O_RDWR|os.O_CREATE, 0644) + if err != nil { + return err } + defer file.Close() - // Exit before archive if output directory was specified - if d.output != "" { - d.UI.Output(fmt.Sprintf("Created debug directory: %s", tmp)) - return 0 + if _, err := io.Copy(file, conn); err != nil { + return err } - // Create archive tarball - archiveFile := stamped + ".tar.gz" - if err = tarCZF(archiveFile, tmp, stamped); err != nil { - d.UI.Error(fmt.Sprintf("Error creating archive: %s", err.Error())) - return 1 + return nil +} + +func (d *debugEnv) writeJSON(name string, msg protoiface.MessageV1) error { + m := jsonpb.Marshaler{} + data, err := m.MarshalToString(msg) + + if err != nil { + return err } - d.UI.Output(fmt.Sprintf("Created debug archive: %s", archiveFile)) + if err := ioutil.WriteFile(filepath.Join(d.dst, name), []byte(data), 0600); err != nil { + return fmt.Errorf("failed to write status: %v", err) + } - return 0 + return nil } func trapSignal(cancel func()) { diff --git a/internal/cli/debug_block.go b/internal/cli/debug_block.go new file mode 100644 index 000000000000..5a282cc5507a --- /dev/null +++ b/internal/cli/debug_block.go @@ -0,0 +1,126 @@ +package cli + +import ( + "context" + "fmt" + "strconv" + "strings" + + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" +) + +// DebugBlockCommand is the command to group the peers commands +type DebugBlockCommand struct { + *Meta2 + + output string +} + +func (p *DebugBlockCommand) MarkDown() string { + items := []string{ + "# Debug trace", + "The ```bor debug block ``` command will create an archive containing traces of a bor block.", + p.Flags().MarkDown(), + } + + return strings.Join(items, "\n\n") +} + +// Help implements the cli.Command interface +func (c *DebugBlockCommand) Help() string { + return `Usage: bor debug block + + This command is used get traces of a bor block` +} + +func (c *DebugBlockCommand) Flags() *flagset.Flagset { + flags := c.NewFlagSet("trace") + + flags.StringFlag(&flagset.StringFlag{ + Name: "output", + Value: &c.output, + Usage: "Output directory", + }) + + return flags +} + +// Synopsis implements the cli.Command interface +func (c *DebugBlockCommand) Synopsis() string { + return "Get trace of a bor block" +} + +// Run implements the cli.Command interface +func (c *DebugBlockCommand) Run(args []string) int { + flags := c.Flags() + + var number *int64 = nil + + // parse the block number (if available) + if len(args)%2 != 0 { + num, err := strconv.ParseInt(args[0], 10, 64) + if err == nil { + number = &num + } + + args = args[1:] + } + // parse output directory + if err := flags.Parse(args); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + borClt, err := c.BorConn() + if err != nil { + c.UI.Error(err.Error()) + return 1 + } + + dEnv := &debugEnv{ + output: c.output, + prefix: "bor-block-trace-", + } + if err := dEnv.init(); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + c.UI.Output("Starting block tracer...") + c.UI.Output("") + + // create a debug block request + var debugRequest *proto.DebugBlockRequest = &proto.DebugBlockRequest{} + if number != nil { + debugRequest.Number = *number + } else { + debugRequest.Number = -1 + } + + // send the request + // receives a grpc stream of debug block response + stream, err := borClt.DebugBlock(context.Background(), debugRequest) + if err != nil { + c.UI.Error(err.Error()) + return 1 + } + + if err := dEnv.writeFromStream("block.json", stream); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + if err := dEnv.finish(); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + if c.output != "" { + c.UI.Output(fmt.Sprintf("Created debug directory: %s", dEnv.dst)) + } else { + c.UI.Output(fmt.Sprintf("Created block trace archive: %s", dEnv.tarName())) + } + + return 0 +} diff --git a/internal/cli/debug_pprof.go b/internal/cli/debug_pprof.go new file mode 100644 index 000000000000..ef15e45b5815 --- /dev/null +++ b/internal/cli/debug_pprof.go @@ -0,0 +1,159 @@ +package cli + +// Based on https://github.com/hashicorp/nomad/blob/main/command/operator_debug.go + +import ( + "context" + "fmt" + "strings" + + "github.com/golang/protobuf/ptypes/empty" + + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" +) + +type DebugPprofCommand struct { + *Meta2 + + seconds uint64 + output string +} + +func (p *DebugPprofCommand) MarkDown() string { + items := []string{ + "# Debug Pprof", + "The ```debug pprof ``` command will create an archive containing bor pprof traces.", + p.Flags().MarkDown(), + } + + return strings.Join(items, "\n\n") +} + +// Help implements the cli.Command interface +func (d *DebugPprofCommand) Help() string { + return `Usage: bor debug + + Build an archive containing Bor pprof traces + + ` + d.Flags().Help() +} + +func (d *DebugPprofCommand) Flags() *flagset.Flagset { + flags := d.NewFlagSet("debug") + + flags.Uint64Flag(&flagset.Uint64Flag{ + Name: "seconds", + Usage: "seconds to trace", + Value: &d.seconds, + Default: 2, + }) + flags.StringFlag(&flagset.StringFlag{ + Name: "output", + Value: &d.output, + Usage: "Output directory", + }) + + return flags +} + +// Synopsis implements the cli.Command interface +func (d *DebugPprofCommand) Synopsis() string { + return "Build an archive containing Bor pprof traces" +} + +// Run implements the cli.Command interface +func (d *DebugPprofCommand) Run(args []string) int { + flags := d.Flags() + if err := flags.Parse(args); err != nil { + d.UI.Error(err.Error()) + return 1 + } + + clt, err := d.BorConn() + if err != nil { + d.UI.Error(err.Error()) + return 1 + } + + dEnv := &debugEnv{ + output: d.output, + prefix: "bor-debug-", + } + if err := dEnv.init(); err != nil { + d.UI.Error(err.Error()) + return 1 + } + + d.UI.Output("Starting debugger...") + d.UI.Output("") + + pprofProfile := func(ctx context.Context, profile string, filename string) error { + req := &proto.DebugPprofRequest{ + Seconds: int64(d.seconds), + } + + switch profile { + case "cpu": + req.Type = proto.DebugPprofRequest_CPU + case "trace": + req.Type = proto.DebugPprofRequest_TRACE + default: + req.Type = proto.DebugPprofRequest_LOOKUP + req.Profile = profile + } + + stream, err := clt.DebugPprof(ctx, req) + + if err != nil { + return err + } + + if err := dEnv.writeFromStream(filename+".prof", stream); err != nil { + return err + } + + return nil + } + + ctx, cancelFn := context.WithCancel(context.Background()) + trapSignal(cancelFn) + + profiles := map[string]string{ + "heap": "heap", + "cpu": "cpu", + "trace": "trace", + } + for profile, filename := range profiles { + if err := pprofProfile(ctx, profile, filename); err != nil { + d.UI.Error(fmt.Sprintf("Error creating profile '%s': %v", profile, err)) + return 1 + } + } + + // append the status + { + statusResp, err := clt.Status(ctx, &empty.Empty{}) + if err != nil { + d.UI.Output(fmt.Sprintf("Failed to get status: %v", err)) + return 1 + } + if err := dEnv.writeJSON("status.json", statusResp); err != nil { + d.UI.Error(err.Error()) + return 1 + } + } + + if err := dEnv.finish(); err != nil { + d.UI.Error(err.Error()) + return 1 + } + + if d.output != "" { + d.UI.Output(fmt.Sprintf("Created debug directory: %s", dEnv.dst)) + } else { + d.UI.Output(fmt.Sprintf("Created debug archive: %s", dEnv.tarName())) + } + + return 0 +} diff --git a/internal/cli/debug_test.go b/internal/cli/debug_test.go new file mode 100644 index 000000000000..f77cf839ace9 --- /dev/null +++ b/internal/cli/debug_test.go @@ -0,0 +1,112 @@ +package cli + +import ( + "os" + "path" + "strconv" + "testing" + "time" + + "github.com/mitchellh/cli" + "github.com/stretchr/testify/assert" + + "github.com/ethereum/go-ethereum/internal/cli/server" +) + +var currentDir string = "" + +func TestCommand_DebugBlock(t *testing.T) { + t.Parallel() + + // Start a blockchain in developer mode and get trace of block + config := server.DefaultConfig() + + // enable developer mode + config.Developer.Enabled = true + config.Developer.Period = 2 // block time + + // enable archive mode for getting traces of ancient blocks + config.GcMode = "archive" + + // start the mock server + srv, err := server.CreateMockServer(config) + assert.NoError(t, err) + + defer server.CloseMockServer(srv) + + // get the grpc port + port := srv.GetGrpcAddr() + + // wait for 4 seconds to mine a 2 blocks + time.Sleep(2 * time.Duration(config.Developer.Period) * time.Second) + + // add prefix for debug trace + prefix := "bor-block-trace-" + + // output dir + output := "debug_block_test" + + // set current directory + currentDir, _ = os.Getwd() + + // trace 1st block + start := time.Now() + dst1 := path.Join(output, prefix+time.Now().UTC().Format("2006-01-02-150405Z"), "block.json") + res := traceBlock(port, 1, output) + assert.Equal(t, 0, res) + t.Logf("Completed trace of block %d in %d ms at %s", 1, time.Since(start).Milliseconds(), dst1) + + // adding this to avoid debug directory name conflicts + time.Sleep(time.Second) + + // trace last/recent block + start = time.Now() + latestBlock := srv.GetLatestBlockNumber().Int64() + dst2 := path.Join(output, prefix+time.Now().UTC().Format("2006-01-02-150405Z"), "block.json") + res = traceBlock(port, latestBlock, output) + assert.Equal(t, 0, res) + t.Logf("Completed trace of block %d in %d ms at %s", latestBlock, time.Since(start).Milliseconds(), dst2) + + // verify if the trace files are created + done := verify(dst1) + assert.Equal(t, true, done) + done = verify(dst2) + assert.Equal(t, true, done) + + // delete the traces + deleteTraces(output) +} + +// traceBlock calls the cli command to trace a block +func traceBlock(port string, number int64, output string) int { + ui := cli.NewMockUi() + command := &DebugBlockCommand{ + Meta2: &Meta2{ + UI: ui, + addr: "127.0.0.1:" + port, + }, + } + + // run trace (by explicitly passing the output directory and grpc address) + return command.Run([]string{strconv.FormatInt(number, 10), "--output", output, "--address", command.Meta2.addr}) +} + +// verify checks if the trace file is created at the destination +// directory or not +func verify(dst string) bool { + dst = path.Join(currentDir, dst) + if file, err := os.Stat(dst); err == nil { + // check if the file has content + if file.Size() > 0 { + return true + } + } + + return false +} + +// deleteTraces removes the traces created during the test +func deleteTraces(dst string) { + dst = path.Join(currentDir, dst) + os.RemoveAll(dst) +} diff --git a/internal/cli/server/helper.go b/internal/cli/server/helper.go new file mode 100644 index 000000000000..c6831382b39f --- /dev/null +++ b/internal/cli/server/helper.go @@ -0,0 +1,72 @@ +package server + +import ( + "fmt" + "io/ioutil" + "math/rand" + "net" + "os" + "sync/atomic" + "time" +) + +var maxPortCheck int32 = 100 + +// findAvailablePort returns the next available port starting from `from` +func findAvailablePort(from int32, count int32) (int32, error) { + if count == maxPortCheck { + return 0, fmt.Errorf("no available port found") + } + port := atomic.AddInt32(&from, 1) + addr := fmt.Sprintf("localhost:%d", port) + lis, err := net.Listen("tcp", addr) + count++ + if err == nil { + lis.Close() + return port, nil + } else { + return findAvailablePort(from, count) + } +} + +func CreateMockServer(config *Config) (*Server, error) { + if config == nil { + config = DefaultConfig() + } + + // find available port for grpc server + rand.Seed(time.Now().UnixNano()) + var from int32 = 60000 // the min port to start checking from + var to int32 = 61000 // the max port to start checking from + port, err := findAvailablePort(rand.Int31n(to-from+1)+from, 0) + if err != nil { + return nil, err + } + + // grpc port + config.GRPC.Addr = fmt.Sprintf(":%d", port) + + // datadir + datadir, _ := ioutil.TempDir("/tmp", "bor-cli-test") + config.DataDir = datadir + + // find available port for http server + from = 8545 + to = 9545 + port, err = findAvailablePort(rand.Int31n(to-from+1)+from, 0) + if err != nil { + return nil, err + } + config.JsonRPC.Http.Port = uint64(port) + + // start the server + return NewServer(config) +} + +func CloseMockServer(server *Server) { + // remove the contents of temp data dir + os.RemoveAll(server.config.DataDir) + + // close the server + server.Stop() +} diff --git a/internal/cli/server/proto/server.pb.go b/internal/cli/server/proto/server.pb.go index 2b45fb37e9fd..5512d83b72d5 100644 --- a/internal/cli/server/proto/server.pb.go +++ b/internal/cli/server/proto/server.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 +// protoc-gen-go v1.27.1 // protoc v3.19.3 // source: internal/cli/server/proto/server.proto package proto import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -22,57 +21,138 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type PprofRequest_Type int32 +type DebugPprofRequest_Type int32 const ( - PprofRequest_LOOKUP PprofRequest_Type = 0 - PprofRequest_CPU PprofRequest_Type = 1 - PprofRequest_TRACE PprofRequest_Type = 2 + DebugPprofRequest_LOOKUP DebugPprofRequest_Type = 0 + DebugPprofRequest_CPU DebugPprofRequest_Type = 1 + DebugPprofRequest_TRACE DebugPprofRequest_Type = 2 ) -// Enum value maps for PprofRequest_Type. +// Enum value maps for DebugPprofRequest_Type. var ( - PprofRequest_Type_name = map[int32]string{ + DebugPprofRequest_Type_name = map[int32]string{ 0: "LOOKUP", 1: "CPU", 2: "TRACE", } - PprofRequest_Type_value = map[string]int32{ + DebugPprofRequest_Type_value = map[string]int32{ "LOOKUP": 0, "CPU": 1, "TRACE": 2, } ) -func (x PprofRequest_Type) Enum() *PprofRequest_Type { - p := new(PprofRequest_Type) +func (x DebugPprofRequest_Type) Enum() *DebugPprofRequest_Type { + p := new(DebugPprofRequest_Type) *p = x return p } -func (x PprofRequest_Type) String() string { +func (x DebugPprofRequest_Type) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (PprofRequest_Type) Descriptor() protoreflect.EnumDescriptor { +func (DebugPprofRequest_Type) Descriptor() protoreflect.EnumDescriptor { return file_internal_cli_server_proto_server_proto_enumTypes[0].Descriptor() } -func (PprofRequest_Type) Type() protoreflect.EnumType { +func (DebugPprofRequest_Type) Type() protoreflect.EnumType { return &file_internal_cli_server_proto_server_proto_enumTypes[0] } -func (x PprofRequest_Type) Number() protoreflect.EnumNumber { +func (x DebugPprofRequest_Type) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use PprofRequest_Type.Descriptor instead. -func (PprofRequest_Type) EnumDescriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 0} +// Deprecated: Use DebugPprofRequest_Type.Descriptor instead. +func (DebugPprofRequest_Type) EnumDescriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18, 0} +} + +type TraceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` +} + +func (x *TraceRequest) Reset() { + *x = TraceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TraceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceRequest) ProtoMessage() {} + +func (x *TraceRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[0] + 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 TraceRequest.ProtoReflect.Descriptor instead. +func (*TraceRequest) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{0} +} + +func (x *TraceRequest) GetNumber() int64 { + if x != nil { + return x.Number + } + return 0 +} + +type TraceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *TraceResponse) Reset() { + *x = TraceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TraceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceResponse) ProtoMessage() {} + +func (x *TraceResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[1] + 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 TraceResponse.ProtoReflect.Descriptor instead. +func (*TraceResponse) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{1} } type ChainWatchRequest struct { @@ -84,7 +164,7 @@ type ChainWatchRequest struct { func (x *ChainWatchRequest) Reset() { *x = ChainWatchRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[0] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97,7 +177,7 @@ func (x *ChainWatchRequest) String() string { func (*ChainWatchRequest) ProtoMessage() {} func (x *ChainWatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[0] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110,7 +190,7 @@ func (x *ChainWatchRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ChainWatchRequest.ProtoReflect.Descriptor instead. func (*ChainWatchRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{0} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{2} } type ChainWatchResponse struct { @@ -126,7 +206,7 @@ type ChainWatchResponse struct { func (x *ChainWatchResponse) Reset() { *x = ChainWatchResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[1] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -139,7 +219,7 @@ func (x *ChainWatchResponse) String() string { func (*ChainWatchResponse) ProtoMessage() {} func (x *ChainWatchResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[1] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -152,7 +232,7 @@ func (x *ChainWatchResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ChainWatchResponse.ProtoReflect.Descriptor instead. func (*ChainWatchResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{1} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{3} } func (x *ChainWatchResponse) GetOldchain() []*BlockStub { @@ -188,7 +268,7 @@ type BlockStub struct { func (x *BlockStub) Reset() { *x = BlockStub{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[2] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -201,7 +281,7 @@ func (x *BlockStub) String() string { func (*BlockStub) ProtoMessage() {} func (x *BlockStub) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[2] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -214,7 +294,7 @@ func (x *BlockStub) ProtoReflect() protoreflect.Message { // Deprecated: Use BlockStub.ProtoReflect.Descriptor instead. func (*BlockStub) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{2} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{4} } func (x *BlockStub) GetHash() string { @@ -243,7 +323,7 @@ type PeersAddRequest struct { func (x *PeersAddRequest) Reset() { *x = PeersAddRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[3] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -256,7 +336,7 @@ func (x *PeersAddRequest) String() string { func (*PeersAddRequest) ProtoMessage() {} func (x *PeersAddRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[3] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -269,7 +349,7 @@ func (x *PeersAddRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersAddRequest.ProtoReflect.Descriptor instead. func (*PeersAddRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{3} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{5} } func (x *PeersAddRequest) GetEnode() string { @@ -295,7 +375,7 @@ type PeersAddResponse struct { func (x *PeersAddResponse) Reset() { *x = PeersAddResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[4] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -308,7 +388,7 @@ func (x *PeersAddResponse) String() string { func (*PeersAddResponse) ProtoMessage() {} func (x *PeersAddResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[4] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -321,7 +401,7 @@ func (x *PeersAddResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersAddResponse.ProtoReflect.Descriptor instead. func (*PeersAddResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{4} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{6} } type PeersRemoveRequest struct { @@ -336,7 +416,7 @@ type PeersRemoveRequest struct { func (x *PeersRemoveRequest) Reset() { *x = PeersRemoveRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[5] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -349,7 +429,7 @@ func (x *PeersRemoveRequest) String() string { func (*PeersRemoveRequest) ProtoMessage() {} func (x *PeersRemoveRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[5] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -362,7 +442,7 @@ func (x *PeersRemoveRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersRemoveRequest.ProtoReflect.Descriptor instead. func (*PeersRemoveRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{5} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{7} } func (x *PeersRemoveRequest) GetEnode() string { @@ -388,7 +468,7 @@ type PeersRemoveResponse struct { func (x *PeersRemoveResponse) Reset() { *x = PeersRemoveResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[6] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -401,7 +481,7 @@ func (x *PeersRemoveResponse) String() string { func (*PeersRemoveResponse) ProtoMessage() {} func (x *PeersRemoveResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[6] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -414,7 +494,7 @@ func (x *PeersRemoveResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersRemoveResponse.ProtoReflect.Descriptor instead. func (*PeersRemoveResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{6} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{8} } type PeersListRequest struct { @@ -426,7 +506,7 @@ type PeersListRequest struct { func (x *PeersListRequest) Reset() { *x = PeersListRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[7] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -439,7 +519,7 @@ func (x *PeersListRequest) String() string { func (*PeersListRequest) ProtoMessage() {} func (x *PeersListRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[7] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -452,7 +532,7 @@ func (x *PeersListRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersListRequest.ProtoReflect.Descriptor instead. func (*PeersListRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{7} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{9} } type PeersListResponse struct { @@ -466,7 +546,7 @@ type PeersListResponse struct { func (x *PeersListResponse) Reset() { *x = PeersListResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[8] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -479,7 +559,7 @@ func (x *PeersListResponse) String() string { func (*PeersListResponse) ProtoMessage() {} func (x *PeersListResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[8] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -492,7 +572,7 @@ func (x *PeersListResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersListResponse.ProtoReflect.Descriptor instead. func (*PeersListResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{8} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{10} } func (x *PeersListResponse) GetPeers() []*Peer { @@ -513,7 +593,7 @@ type PeersStatusRequest struct { func (x *PeersStatusRequest) Reset() { *x = PeersStatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[9] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -526,7 +606,7 @@ func (x *PeersStatusRequest) String() string { func (*PeersStatusRequest) ProtoMessage() {} func (x *PeersStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[9] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -539,7 +619,7 @@ func (x *PeersStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersStatusRequest.ProtoReflect.Descriptor instead. func (*PeersStatusRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{9} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{11} } func (x *PeersStatusRequest) GetEnode() string { @@ -560,7 +640,7 @@ type PeersStatusResponse struct { func (x *PeersStatusResponse) Reset() { *x = PeersStatusResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[10] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -573,7 +653,7 @@ func (x *PeersStatusResponse) String() string { func (*PeersStatusResponse) ProtoMessage() {} func (x *PeersStatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[10] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -586,7 +666,7 @@ func (x *PeersStatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PeersStatusResponse.ProtoReflect.Descriptor instead. func (*PeersStatusResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{10} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{12} } func (x *PeersStatusResponse) GetPeer() *Peer { @@ -613,7 +693,7 @@ type Peer struct { func (x *Peer) Reset() { *x = Peer{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[11] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -626,7 +706,7 @@ func (x *Peer) String() string { func (*Peer) ProtoMessage() {} func (x *Peer) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[11] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -639,7 +719,7 @@ func (x *Peer) ProtoReflect() protoreflect.Message { // Deprecated: Use Peer.ProtoReflect.Descriptor instead. func (*Peer) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{11} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{13} } func (x *Peer) GetId() string { @@ -702,7 +782,7 @@ type ChainSetHeadRequest struct { func (x *ChainSetHeadRequest) Reset() { *x = ChainSetHeadRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[12] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -715,7 +795,7 @@ func (x *ChainSetHeadRequest) String() string { func (*ChainSetHeadRequest) ProtoMessage() {} func (x *ChainSetHeadRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[12] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -728,7 +808,7 @@ func (x *ChainSetHeadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ChainSetHeadRequest.ProtoReflect.Descriptor instead. func (*ChainSetHeadRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{12} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{14} } func (x *ChainSetHeadRequest) GetNumber() uint64 { @@ -747,7 +827,7 @@ type ChainSetHeadResponse struct { func (x *ChainSetHeadResponse) Reset() { *x = ChainSetHeadResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[13] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -760,7 +840,7 @@ func (x *ChainSetHeadResponse) String() string { func (*ChainSetHeadResponse) ProtoMessage() {} func (x *ChainSetHeadResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[13] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -773,7 +853,7 @@ func (x *ChainSetHeadResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ChainSetHeadResponse.ProtoReflect.Descriptor instead. func (*ChainSetHeadResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{13} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{15} } type StatusResponse struct { @@ -792,7 +872,7 @@ type StatusResponse struct { func (x *StatusResponse) Reset() { *x = StatusResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[14] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -805,7 +885,7 @@ func (x *StatusResponse) String() string { func (*StatusResponse) ProtoMessage() {} func (x *StatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[14] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -818,7 +898,7 @@ func (x *StatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. func (*StatusResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{14} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16} } func (x *StatusResponse) GetCurrentBlock() *Header { @@ -875,7 +955,7 @@ type Header struct { func (x *Header) Reset() { *x = Header{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[15] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -888,7 +968,7 @@ func (x *Header) String() string { func (*Header) ProtoMessage() {} func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[15] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -901,7 +981,7 @@ func (x *Header) ProtoReflect() protoreflect.Message { // Deprecated: Use Header.ProtoReflect.Descriptor instead. func (*Header) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{15} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17} } func (x *Header) GetHash() string { @@ -918,33 +998,33 @@ func (x *Header) GetNumber() uint64 { return 0 } -type PprofRequest struct { +type DebugPprofRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type PprofRequest_Type `protobuf:"varint,1,opt,name=type,proto3,enum=proto.PprofRequest_Type" json:"type,omitempty"` - Profile string `protobuf:"bytes,2,opt,name=profile,proto3" json:"profile,omitempty"` - Seconds int64 `protobuf:"varint,3,opt,name=seconds,proto3" json:"seconds,omitempty"` + Type DebugPprofRequest_Type `protobuf:"varint,1,opt,name=type,proto3,enum=proto.DebugPprofRequest_Type" json:"type,omitempty"` + Profile string `protobuf:"bytes,2,opt,name=profile,proto3" json:"profile,omitempty"` + Seconds int64 `protobuf:"varint,3,opt,name=seconds,proto3" json:"seconds,omitempty"` } -func (x *PprofRequest) Reset() { - *x = PprofRequest{} +func (x *DebugPprofRequest) Reset() { + *x = DebugPprofRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *PprofRequest) String() string { +func (x *DebugPprofRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PprofRequest) ProtoMessage() {} +func (*DebugPprofRequest) ProtoMessage() {} -func (x *PprofRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] +func (x *DebugPprofRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -955,61 +1035,108 @@ func (x *PprofRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PprofRequest.ProtoReflect.Descriptor instead. -func (*PprofRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16} +// Deprecated: Use DebugPprofRequest.ProtoReflect.Descriptor instead. +func (*DebugPprofRequest) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18} } -func (x *PprofRequest) GetType() PprofRequest_Type { +func (x *DebugPprofRequest) GetType() DebugPprofRequest_Type { if x != nil { return x.Type } - return PprofRequest_LOOKUP + return DebugPprofRequest_LOOKUP } -func (x *PprofRequest) GetProfile() string { +func (x *DebugPprofRequest) GetProfile() string { if x != nil { return x.Profile } return "" } -func (x *PprofRequest) GetSeconds() int64 { +func (x *DebugPprofRequest) GetSeconds() int64 { if x != nil { return x.Seconds } return 0 } -type PprofResponse struct { +type DebugBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` +} + +func (x *DebugBlockRequest) Reset() { + *x = DebugBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DebugBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DebugBlockRequest) ProtoMessage() {} + +func (x *DebugBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] + 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 DebugBlockRequest.ProtoReflect.Descriptor instead. +func (*DebugBlockRequest) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19} +} + +func (x *DebugBlockRequest) GetNumber() int64 { + if x != nil { + return x.Number + } + return 0 +} + +type DebugFileResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Event: - // *PprofResponse_Open_ - // *PprofResponse_Input_ - // *PprofResponse_Eof - Event isPprofResponse_Event `protobuf_oneof:"event"` + // *DebugFileResponse_Open_ + // *DebugFileResponse_Input_ + // *DebugFileResponse_Eof + Event isDebugFileResponse_Event `protobuf_oneof:"event"` } -func (x *PprofResponse) Reset() { - *x = PprofResponse{} +func (x *DebugFileResponse) Reset() { + *x = DebugFileResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *PprofResponse) String() string { +func (x *DebugFileResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PprofResponse) ProtoMessage() {} +func (*DebugFileResponse) ProtoMessage() {} -func (x *PprofResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] +func (x *DebugFileResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1020,60 +1147,60 @@ func (x *PprofResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PprofResponse.ProtoReflect.Descriptor instead. -func (*PprofResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17} +// Deprecated: Use DebugFileResponse.ProtoReflect.Descriptor instead. +func (*DebugFileResponse) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20} } -func (m *PprofResponse) GetEvent() isPprofResponse_Event { +func (m *DebugFileResponse) GetEvent() isDebugFileResponse_Event { if m != nil { return m.Event } return nil } -func (x *PprofResponse) GetOpen() *PprofResponse_Open { - if x, ok := x.GetEvent().(*PprofResponse_Open_); ok { +func (x *DebugFileResponse) GetOpen() *DebugFileResponse_Open { + if x, ok := x.GetEvent().(*DebugFileResponse_Open_); ok { return x.Open } return nil } -func (x *PprofResponse) GetInput() *PprofResponse_Input { - if x, ok := x.GetEvent().(*PprofResponse_Input_); ok { +func (x *DebugFileResponse) GetInput() *DebugFileResponse_Input { + if x, ok := x.GetEvent().(*DebugFileResponse_Input_); ok { return x.Input } return nil } -func (x *PprofResponse) GetEof() *emptypb.Empty { - if x, ok := x.GetEvent().(*PprofResponse_Eof); ok { +func (x *DebugFileResponse) GetEof() *emptypb.Empty { + if x, ok := x.GetEvent().(*DebugFileResponse_Eof); ok { return x.Eof } return nil } -type isPprofResponse_Event interface { - isPprofResponse_Event() +type isDebugFileResponse_Event interface { + isDebugFileResponse_Event() } -type PprofResponse_Open_ struct { - Open *PprofResponse_Open `protobuf:"bytes,1,opt,name=open,proto3,oneof"` +type DebugFileResponse_Open_ struct { + Open *DebugFileResponse_Open `protobuf:"bytes,1,opt,name=open,proto3,oneof"` } -type PprofResponse_Input_ struct { - Input *PprofResponse_Input `protobuf:"bytes,2,opt,name=input,proto3,oneof"` +type DebugFileResponse_Input_ struct { + Input *DebugFileResponse_Input `protobuf:"bytes,2,opt,name=input,proto3,oneof"` } -type PprofResponse_Eof struct { +type DebugFileResponse_Eof struct { Eof *emptypb.Empty `protobuf:"bytes,3,opt,name=eof,proto3,oneof"` } -func (*PprofResponse_Open_) isPprofResponse_Event() {} +func (*DebugFileResponse_Open_) isDebugFileResponse_Event() {} -func (*PprofResponse_Input_) isPprofResponse_Event() {} +func (*DebugFileResponse_Input_) isDebugFileResponse_Event() {} -func (*PprofResponse_Eof) isPprofResponse_Event() {} +func (*DebugFileResponse_Eof) isDebugFileResponse_Event() {} type StatusResponse_Fork struct { state protoimpl.MessageState @@ -1088,7 +1215,7 @@ type StatusResponse_Fork struct { func (x *StatusResponse_Fork) Reset() { *x = StatusResponse_Fork{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1101,7 +1228,7 @@ func (x *StatusResponse_Fork) String() string { func (*StatusResponse_Fork) ProtoMessage() {} func (x *StatusResponse_Fork) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1114,7 +1241,7 @@ func (x *StatusResponse_Fork) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse_Fork.ProtoReflect.Descriptor instead. func (*StatusResponse_Fork) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{14, 0} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 0} } func (x *StatusResponse_Fork) GetName() string { @@ -1151,7 +1278,7 @@ type StatusResponse_Syncing struct { func (x *StatusResponse_Syncing) Reset() { *x = StatusResponse_Syncing{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1164,7 +1291,7 @@ func (x *StatusResponse_Syncing) String() string { func (*StatusResponse_Syncing) ProtoMessage() {} func (x *StatusResponse_Syncing) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1177,7 +1304,7 @@ func (x *StatusResponse_Syncing) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse_Syncing.ProtoReflect.Descriptor instead. func (*StatusResponse_Syncing) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{14, 1} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 1} } func (x *StatusResponse_Syncing) GetStartingBlock() int64 { @@ -1201,32 +1328,31 @@ func (x *StatusResponse_Syncing) GetCurrentBlock() int64 { return 0 } -type PprofResponse_Open struct { +type DebugFileResponse_Open struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` } -func (x *PprofResponse_Open) Reset() { - *x = PprofResponse_Open{} +func (x *DebugFileResponse_Open) Reset() { + *x = DebugFileResponse_Open{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *PprofResponse_Open) String() string { +func (x *DebugFileResponse_Open) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PprofResponse_Open) ProtoMessage() {} +func (*DebugFileResponse_Open) ProtoMessage() {} -func (x *PprofResponse_Open) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] +func (x *DebugFileResponse_Open) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1237,26 +1363,19 @@ func (x *PprofResponse_Open) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PprofResponse_Open.ProtoReflect.Descriptor instead. -func (*PprofResponse_Open) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17, 0} +// Deprecated: Use DebugFileResponse_Open.ProtoReflect.Descriptor instead. +func (*DebugFileResponse_Open) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20, 0} } -func (x *PprofResponse_Open) GetHeaders() map[string]string { +func (x *DebugFileResponse_Open) GetHeaders() map[string]string { if x != nil { return x.Headers } return nil } -func (x *PprofResponse_Open) GetSize() int64 { - if x != nil { - return x.Size - } - return 0 -} - -type PprofResponse_Input struct { +type DebugFileResponse_Input struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1264,23 +1383,23 @@ type PprofResponse_Input struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } -func (x *PprofResponse_Input) Reset() { - *x = PprofResponse_Input{} +func (x *DebugFileResponse_Input) Reset() { + *x = DebugFileResponse_Input{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *PprofResponse_Input) String() string { +func (x *DebugFileResponse_Input) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PprofResponse_Input) ProtoMessage() {} +func (*DebugFileResponse_Input) ProtoMessage() {} -func (x *PprofResponse_Input) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] +func (x *DebugFileResponse_Input) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1291,12 +1410,12 @@ func (x *PprofResponse_Input) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PprofResponse_Input.ProtoReflect.Descriptor instead. -func (*PprofResponse_Input) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17, 1} +// Deprecated: Use DebugFileResponse_Input.ProtoReflect.Descriptor instead. +func (*DebugFileResponse_Input) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20, 1} } -func (x *PprofResponse_Input) GetData() []byte { +func (x *DebugFileResponse_Input) GetData() []byte { if x != nil { return x.Data } @@ -1310,158 +1429,170 @@ var file_internal_cli_server_proto_server_proto_rawDesc = []byte{ 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x84, 0x01, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x74, 0x75, 0x62, 0x52, 0x08, 0x6f, 0x6c, - 0x64, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x2c, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x74, 0x75, 0x62, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x37, 0x0a, 0x09, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x53, 0x74, 0x75, 0x62, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x22, 0x41, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, - 0x75, 0x73, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x72, 0x75, - 0x73, 0x74, 0x65, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x12, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x22, 0x15, - 0x0a, 0x13, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x11, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, - 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x22, 0x2a, 0x0a, 0x12, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x0c, + 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x22, 0x0f, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x84, 0x01, 0x0a, 0x12, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x6f, 0x6c, 0x64, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x53, 0x74, 0x75, 0x62, 0x52, 0x08, 0x6f, 0x6c, 0x64, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x2c, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, + 0x74, 0x75, 0x62, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x22, 0x37, 0x0a, 0x09, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x74, 0x75, 0x62, 0x12, 0x12, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, + 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x41, 0x0a, 0x0f, 0x50, 0x65, + 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, + 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x22, 0x12, 0x0a, + 0x10, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x44, 0x0a, 0x12, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x36, 0x0a, - 0x13, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, - 0x04, 0x70, 0x65, 0x65, 0x72, 0x22, 0x98, 0x01, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x65, 0x6e, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x61, 0x70, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x63, 0x61, 0x70, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, - 0x22, 0x2d, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, - 0x16, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, - 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x0a, - 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x79, - 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x50, 0x65, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, + 0x0a, 0x10, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x36, 0x0a, 0x11, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, + 0x65, 0x65, 0x72, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x2a, 0x0a, 0x12, 0x50, 0x65, + 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x36, 0x0a, 0x13, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, + 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x22, 0x98, + 0x01, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x65, 0x6e, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x63, 0x61, 0x70, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x63, + 0x61, 0x70, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, + 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x22, 0x2d, 0x0a, 0x13, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6e, + 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, + 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d, + 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d, + 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x05, + 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x79, 0x6e, 0x63, - 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x05, - 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x1a, 0x4c, 0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x1a, 0x77, 0x0a, 0x07, 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x24, - 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x68, 0x69, 0x67, 0x68, - 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x34, 0x0a, 0x06, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x22, 0x98, 0x01, 0x0a, 0x0c, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, - 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, - 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x43, 0x50, 0x55, - 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x02, 0x22, 0xe1, 0x02, - 0x0a, 0x0d, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2f, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, - 0x12, 0x32, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, 0x52, 0x05, 0x69, - 0x6e, 0x70, 0x75, 0x74, 0x12, 0x2a, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x03, 0x65, 0x6f, 0x66, - 0x1a, 0x98, 0x01, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x40, 0x0a, 0x07, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x73, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x1a, 0x4c, + 0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x77, 0x0a, 0x07, + 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, + 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x34, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, + 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xa2, 0x01, 0x0a, 0x11, + 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, + 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, + 0x43, 0x50, 0x55, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x02, + 0x22, 0x2b, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xdd, 0x02, + 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, + 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x48, 0x00, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x36, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x12, 0x2a, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x03, 0x65, 0x6f, 0x66, 0x1a, 0x88, 0x01, 0x0a, + 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x44, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, - 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x1a, - 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1b, 0x0a, 0x05, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x32, 0x8b, 0x04, 0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x34, 0x0a, 0x05, 0x50, 0x70, 0x72, - 0x6f, 0x66, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x70, 0x72, 0x6f, 0x66, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, - 0x3b, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, - 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, - 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, - 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, - 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, - 0x1c, 0x5a, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c, 0x69, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1b, 0x0a, 0x05, 0x49, 0x6e, 0x70, 0x75, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x32, 0xdd, 0x04, + 0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, + 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, + 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, + 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, + 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, + 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x43, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x18, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, + 0x72, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, + 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, + 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, + 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x1c, 0x5a, + 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1477,66 +1608,71 @@ func file_internal_cli_server_proto_server_proto_rawDescGZIP() []byte { } var file_internal_cli_server_proto_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_internal_cli_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_internal_cli_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 26) var file_internal_cli_server_proto_server_proto_goTypes = []interface{}{ - (PprofRequest_Type)(0), // 0: proto.PprofRequest.Type - (*ChainWatchRequest)(nil), // 1: proto.ChainWatchRequest - (*ChainWatchResponse)(nil), // 2: proto.ChainWatchResponse - (*BlockStub)(nil), // 3: proto.BlockStub - (*PeersAddRequest)(nil), // 4: proto.PeersAddRequest - (*PeersAddResponse)(nil), // 5: proto.PeersAddResponse - (*PeersRemoveRequest)(nil), // 6: proto.PeersRemoveRequest - (*PeersRemoveResponse)(nil), // 7: proto.PeersRemoveResponse - (*PeersListRequest)(nil), // 8: proto.PeersListRequest - (*PeersListResponse)(nil), // 9: proto.PeersListResponse - (*PeersStatusRequest)(nil), // 10: proto.PeersStatusRequest - (*PeersStatusResponse)(nil), // 11: proto.PeersStatusResponse - (*Peer)(nil), // 12: proto.Peer - (*ChainSetHeadRequest)(nil), // 13: proto.ChainSetHeadRequest - (*ChainSetHeadResponse)(nil), // 14: proto.ChainSetHeadResponse - (*StatusResponse)(nil), // 15: proto.StatusResponse - (*Header)(nil), // 16: proto.Header - (*PprofRequest)(nil), // 17: proto.PprofRequest - (*PprofResponse)(nil), // 18: proto.PprofResponse - (*StatusResponse_Fork)(nil), // 19: proto.StatusResponse.Fork - (*StatusResponse_Syncing)(nil), // 20: proto.StatusResponse.Syncing - (*PprofResponse_Open)(nil), // 21: proto.PprofResponse.Open - (*PprofResponse_Input)(nil), // 22: proto.PprofResponse.Input - nil, // 23: proto.PprofResponse.Open.HeadersEntry - (*emptypb.Empty)(nil), // 24: google.protobuf.Empty + (DebugPprofRequest_Type)(0), // 0: proto.DebugPprofRequest.Type + (*TraceRequest)(nil), // 1: proto.TraceRequest + (*TraceResponse)(nil), // 2: proto.TraceResponse + (*ChainWatchRequest)(nil), // 3: proto.ChainWatchRequest + (*ChainWatchResponse)(nil), // 4: proto.ChainWatchResponse + (*BlockStub)(nil), // 5: proto.BlockStub + (*PeersAddRequest)(nil), // 6: proto.PeersAddRequest + (*PeersAddResponse)(nil), // 7: proto.PeersAddResponse + (*PeersRemoveRequest)(nil), // 8: proto.PeersRemoveRequest + (*PeersRemoveResponse)(nil), // 9: proto.PeersRemoveResponse + (*PeersListRequest)(nil), // 10: proto.PeersListRequest + (*PeersListResponse)(nil), // 11: proto.PeersListResponse + (*PeersStatusRequest)(nil), // 12: proto.PeersStatusRequest + (*PeersStatusResponse)(nil), // 13: proto.PeersStatusResponse + (*Peer)(nil), // 14: proto.Peer + (*ChainSetHeadRequest)(nil), // 15: proto.ChainSetHeadRequest + (*ChainSetHeadResponse)(nil), // 16: proto.ChainSetHeadResponse + (*StatusResponse)(nil), // 17: proto.StatusResponse + (*Header)(nil), // 18: proto.Header + (*DebugPprofRequest)(nil), // 19: proto.DebugPprofRequest + (*DebugBlockRequest)(nil), // 20: proto.DebugBlockRequest + (*DebugFileResponse)(nil), // 21: proto.DebugFileResponse + (*StatusResponse_Fork)(nil), // 22: proto.StatusResponse.Fork + (*StatusResponse_Syncing)(nil), // 23: proto.StatusResponse.Syncing + (*DebugFileResponse_Open)(nil), // 24: proto.DebugFileResponse.Open + (*DebugFileResponse_Input)(nil), // 25: proto.DebugFileResponse.Input + nil, // 26: proto.DebugFileResponse.Open.HeadersEntry + (*emptypb.Empty)(nil), // 27: google.protobuf.Empty } var file_internal_cli_server_proto_server_proto_depIdxs = []int32{ - 3, // 0: proto.ChainWatchResponse.oldchain:type_name -> proto.BlockStub - 3, // 1: proto.ChainWatchResponse.newchain:type_name -> proto.BlockStub - 12, // 2: proto.PeersListResponse.peers:type_name -> proto.Peer - 12, // 3: proto.PeersStatusResponse.peer:type_name -> proto.Peer - 16, // 4: proto.StatusResponse.currentBlock:type_name -> proto.Header - 16, // 5: proto.StatusResponse.currentHeader:type_name -> proto.Header - 20, // 6: proto.StatusResponse.syncing:type_name -> proto.StatusResponse.Syncing - 19, // 7: proto.StatusResponse.forks:type_name -> proto.StatusResponse.Fork - 0, // 8: proto.PprofRequest.type:type_name -> proto.PprofRequest.Type - 21, // 9: proto.PprofResponse.open:type_name -> proto.PprofResponse.Open - 22, // 10: proto.PprofResponse.input:type_name -> proto.PprofResponse.Input - 24, // 11: proto.PprofResponse.eof:type_name -> google.protobuf.Empty - 23, // 12: proto.PprofResponse.Open.headers:type_name -> proto.PprofResponse.Open.HeadersEntry - 17, // 13: proto.Bor.Pprof:input_type -> proto.PprofRequest - 4, // 14: proto.Bor.PeersAdd:input_type -> proto.PeersAddRequest - 6, // 15: proto.Bor.PeersRemove:input_type -> proto.PeersRemoveRequest - 8, // 16: proto.Bor.PeersList:input_type -> proto.PeersListRequest - 10, // 17: proto.Bor.PeersStatus:input_type -> proto.PeersStatusRequest - 13, // 18: proto.Bor.ChainSetHead:input_type -> proto.ChainSetHeadRequest - 24, // 19: proto.Bor.Status:input_type -> google.protobuf.Empty - 1, // 20: proto.Bor.ChainWatch:input_type -> proto.ChainWatchRequest - 18, // 21: proto.Bor.Pprof:output_type -> proto.PprofResponse - 5, // 22: proto.Bor.PeersAdd:output_type -> proto.PeersAddResponse - 7, // 23: proto.Bor.PeersRemove:output_type -> proto.PeersRemoveResponse - 9, // 24: proto.Bor.PeersList:output_type -> proto.PeersListResponse - 11, // 25: proto.Bor.PeersStatus:output_type -> proto.PeersStatusResponse - 14, // 26: proto.Bor.ChainSetHead:output_type -> proto.ChainSetHeadResponse - 15, // 27: proto.Bor.Status:output_type -> proto.StatusResponse - 2, // 28: proto.Bor.ChainWatch:output_type -> proto.ChainWatchResponse - 21, // [21:29] is the sub-list for method output_type - 13, // [13:21] is the sub-list for method input_type + 5, // 0: proto.ChainWatchResponse.oldchain:type_name -> proto.BlockStub + 5, // 1: proto.ChainWatchResponse.newchain:type_name -> proto.BlockStub + 14, // 2: proto.PeersListResponse.peers:type_name -> proto.Peer + 14, // 3: proto.PeersStatusResponse.peer:type_name -> proto.Peer + 18, // 4: proto.StatusResponse.currentBlock:type_name -> proto.Header + 18, // 5: proto.StatusResponse.currentHeader:type_name -> proto.Header + 23, // 6: proto.StatusResponse.syncing:type_name -> proto.StatusResponse.Syncing + 22, // 7: proto.StatusResponse.forks:type_name -> proto.StatusResponse.Fork + 0, // 8: proto.DebugPprofRequest.type:type_name -> proto.DebugPprofRequest.Type + 24, // 9: proto.DebugFileResponse.open:type_name -> proto.DebugFileResponse.Open + 25, // 10: proto.DebugFileResponse.input:type_name -> proto.DebugFileResponse.Input + 27, // 11: proto.DebugFileResponse.eof:type_name -> google.protobuf.Empty + 26, // 12: proto.DebugFileResponse.Open.headers:type_name -> proto.DebugFileResponse.Open.HeadersEntry + 6, // 13: proto.Bor.PeersAdd:input_type -> proto.PeersAddRequest + 8, // 14: proto.Bor.PeersRemove:input_type -> proto.PeersRemoveRequest + 10, // 15: proto.Bor.PeersList:input_type -> proto.PeersListRequest + 12, // 16: proto.Bor.PeersStatus:input_type -> proto.PeersStatusRequest + 15, // 17: proto.Bor.ChainSetHead:input_type -> proto.ChainSetHeadRequest + 27, // 18: proto.Bor.Status:input_type -> google.protobuf.Empty + 3, // 19: proto.Bor.ChainWatch:input_type -> proto.ChainWatchRequest + 19, // 20: proto.Bor.DebugPprof:input_type -> proto.DebugPprofRequest + 20, // 21: proto.Bor.DebugBlock:input_type -> proto.DebugBlockRequest + 7, // 22: proto.Bor.PeersAdd:output_type -> proto.PeersAddResponse + 9, // 23: proto.Bor.PeersRemove:output_type -> proto.PeersRemoveResponse + 11, // 24: proto.Bor.PeersList:output_type -> proto.PeersListResponse + 13, // 25: proto.Bor.PeersStatus:output_type -> proto.PeersStatusResponse + 16, // 26: proto.Bor.ChainSetHead:output_type -> proto.ChainSetHeadResponse + 17, // 27: proto.Bor.Status:output_type -> proto.StatusResponse + 4, // 28: proto.Bor.ChainWatch:output_type -> proto.ChainWatchResponse + 21, // 29: proto.Bor.DebugPprof:output_type -> proto.DebugFileResponse + 21, // 30: proto.Bor.DebugBlock:output_type -> proto.DebugFileResponse + 22, // [22:31] is the sub-list for method output_type + 13, // [13:22] is the sub-list for method input_type 13, // [13:13] is the sub-list for extension type_name 13, // [13:13] is the sub-list for extension extendee 0, // [0:13] is the sub-list for field type_name @@ -1549,7 +1685,7 @@ func file_internal_cli_server_proto_server_proto_init() { } if !protoimpl.UnsafeEnabled { file_internal_cli_server_proto_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChainWatchRequest); i { + switch v := v.(*TraceRequest); i { case 0: return &v.state case 1: @@ -1561,7 +1697,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChainWatchResponse); i { + switch v := v.(*TraceResponse); i { case 0: return &v.state case 1: @@ -1573,7 +1709,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BlockStub); i { + switch v := v.(*ChainWatchRequest); i { case 0: return &v.state case 1: @@ -1585,7 +1721,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersAddRequest); i { + switch v := v.(*ChainWatchResponse); i { case 0: return &v.state case 1: @@ -1597,7 +1733,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersAddResponse); i { + switch v := v.(*BlockStub); i { case 0: return &v.state case 1: @@ -1609,7 +1745,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersRemoveRequest); i { + switch v := v.(*PeersAddRequest); i { case 0: return &v.state case 1: @@ -1621,7 +1757,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersRemoveResponse); i { + switch v := v.(*PeersAddResponse); i { case 0: return &v.state case 1: @@ -1633,7 +1769,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersListRequest); i { + switch v := v.(*PeersRemoveRequest); i { case 0: return &v.state case 1: @@ -1645,7 +1781,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersListResponse); i { + switch v := v.(*PeersRemoveResponse); i { case 0: return &v.state case 1: @@ -1657,7 +1793,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersStatusRequest); i { + switch v := v.(*PeersListRequest); i { case 0: return &v.state case 1: @@ -1669,7 +1805,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersStatusResponse); i { + switch v := v.(*PeersListResponse); i { case 0: return &v.state case 1: @@ -1681,7 +1817,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Peer); i { + switch v := v.(*PeersStatusRequest); i { case 0: return &v.state case 1: @@ -1693,7 +1829,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChainSetHeadRequest); i { + switch v := v.(*PeersStatusResponse); i { case 0: return &v.state case 1: @@ -1705,7 +1841,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChainSetHeadResponse); i { + switch v := v.(*Peer); i { case 0: return &v.state case 1: @@ -1717,7 +1853,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse); i { + switch v := v.(*ChainSetHeadRequest); i { case 0: return &v.state case 1: @@ -1729,7 +1865,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { + switch v := v.(*ChainSetHeadResponse); i { case 0: return &v.state case 1: @@ -1741,7 +1877,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PprofRequest); i { + switch v := v.(*StatusResponse); i { case 0: return &v.state case 1: @@ -1753,7 +1889,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PprofResponse); i { + switch v := v.(*Header); i { case 0: return &v.state case 1: @@ -1765,7 +1901,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse_Fork); i { + switch v := v.(*DebugPprofRequest); i { case 0: return &v.state case 1: @@ -1777,7 +1913,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse_Syncing); i { + switch v := v.(*DebugBlockRequest); i { case 0: return &v.state case 1: @@ -1789,7 +1925,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PprofResponse_Open); i { + switch v := v.(*DebugFileResponse); i { case 0: return &v.state case 1: @@ -1801,7 +1937,43 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PprofResponse_Input); i { + switch v := v.(*StatusResponse_Fork); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_cli_server_proto_server_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatusResponse_Syncing); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_cli_server_proto_server_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DebugFileResponse_Open); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_cli_server_proto_server_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DebugFileResponse_Input); i { case 0: return &v.state case 1: @@ -1813,10 +1985,10 @@ func file_internal_cli_server_proto_server_proto_init() { } } } - file_internal_cli_server_proto_server_proto_msgTypes[17].OneofWrappers = []interface{}{ - (*PprofResponse_Open_)(nil), - (*PprofResponse_Input_)(nil), - (*PprofResponse_Eof)(nil), + file_internal_cli_server_proto_server_proto_msgTypes[20].OneofWrappers = []interface{}{ + (*DebugFileResponse_Open_)(nil), + (*DebugFileResponse_Input_)(nil), + (*DebugFileResponse_Eof)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1824,7 +1996,7 @@ func file_internal_cli_server_proto_server_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_cli_server_proto_server_proto_rawDesc, NumEnums: 1, - NumMessages: 23, + NumMessages: 26, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/cli/server/proto/server.proto b/internal/cli/server/proto/server.proto index 7259e7dacbfe..1520ab6536dd 100644 --- a/internal/cli/server/proto/server.proto +++ b/internal/cli/server/proto/server.proto @@ -7,8 +7,6 @@ import "google/protobuf/empty.proto"; option go_package = "/internal/cli/server/proto"; service Bor { - rpc Pprof(PprofRequest) returns (stream PprofResponse); - rpc PeersAdd(PeersAddRequest) returns (PeersAddResponse); rpc PeersRemove(PeersRemoveRequest) returns (PeersRemoveResponse); @@ -20,8 +18,20 @@ service Bor { rpc ChainSetHead(ChainSetHeadRequest) returns (ChainSetHeadResponse); rpc Status(google.protobuf.Empty) returns (StatusResponse); - + rpc ChainWatch(ChainWatchRequest) returns (stream ChainWatchResponse); + + rpc DebugPprof(DebugPprofRequest) returns (stream DebugFileResponse); + + rpc DebugBlock(DebugBlockRequest) returns (stream DebugFileResponse); +} + +message TraceRequest { + int64 number = 1; +} + +message TraceResponse { + } message ChainWatchRequest { @@ -113,7 +123,7 @@ message Header { uint64 number = 2; } -message PprofRequest { +message DebugPprofRequest { Type type = 1; string profile = 2; @@ -127,7 +137,11 @@ message PprofRequest { } } -message PprofResponse { +message DebugBlockRequest { + int64 number = 1; +} + +message DebugFileResponse { oneof event { Open open = 1; Input input = 2; @@ -136,7 +150,6 @@ message PprofResponse { message Open { map headers = 1; - int64 size = 2; } message Input { diff --git a/internal/cli/server/proto/server_grpc.pb.go b/internal/cli/server/proto/server_grpc.pb.go index b3a6244c1806..63f1fa6187cb 100644 --- a/internal/cli/server/proto/server_grpc.pb.go +++ b/internal/cli/server/proto/server_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.3 +// source: internal/cli/server/proto/server.proto package proto @@ -19,7 +23,6 @@ const _ = grpc.SupportPackageIsVersion7 // // 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 BorClient interface { - Pprof(ctx context.Context, in *PprofRequest, opts ...grpc.CallOption) (Bor_PprofClient, error) PeersAdd(ctx context.Context, in *PeersAddRequest, opts ...grpc.CallOption) (*PeersAddResponse, error) PeersRemove(ctx context.Context, in *PeersRemoveRequest, opts ...grpc.CallOption) (*PeersRemoveResponse, error) PeersList(ctx context.Context, in *PeersListRequest, opts ...grpc.CallOption) (*PeersListResponse, error) @@ -27,6 +30,8 @@ type BorClient interface { ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, opts ...grpc.CallOption) (*ChainSetHeadResponse, error) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) ChainWatch(ctx context.Context, in *ChainWatchRequest, opts ...grpc.CallOption) (Bor_ChainWatchClient, error) + DebugPprof(ctx context.Context, in *DebugPprofRequest, opts ...grpc.CallOption) (Bor_DebugPprofClient, error) + DebugBlock(ctx context.Context, in *DebugBlockRequest, opts ...grpc.CallOption) (Bor_DebugBlockClient, error) } type borClient struct { @@ -37,38 +42,6 @@ func NewBorClient(cc grpc.ClientConnInterface) BorClient { return &borClient{cc} } -func (c *borClient) Pprof(ctx context.Context, in *PprofRequest, opts ...grpc.CallOption) (Bor_PprofClient, error) { - stream, err := c.cc.NewStream(ctx, &Bor_ServiceDesc.Streams[0], "/proto.Bor/Pprof", opts...) - if err != nil { - return nil, err - } - x := &borPprofClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Bor_PprofClient interface { - Recv() (*PprofResponse, error) - grpc.ClientStream -} - -type borPprofClient struct { - grpc.ClientStream -} - -func (x *borPprofClient) Recv() (*PprofResponse, error) { - m := new(PprofResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *borClient) PeersAdd(ctx context.Context, in *PeersAddRequest, opts ...grpc.CallOption) (*PeersAddResponse, error) { out := new(PeersAddResponse) err := c.cc.Invoke(ctx, "/proto.Bor/PeersAdd", in, out, opts...) @@ -124,7 +97,7 @@ func (c *borClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc. } func (c *borClient) ChainWatch(ctx context.Context, in *ChainWatchRequest, opts ...grpc.CallOption) (Bor_ChainWatchClient, error) { - stream, err := c.cc.NewStream(ctx, &Bor_ServiceDesc.Streams[1], "/proto.Bor/ChainWatch", opts...) + stream, err := c.cc.NewStream(ctx, &Bor_ServiceDesc.Streams[0], "/proto.Bor/ChainWatch", opts...) if err != nil { return nil, err } @@ -155,11 +128,74 @@ func (x *borChainWatchClient) Recv() (*ChainWatchResponse, error) { return m, nil } +func (c *borClient) DebugPprof(ctx context.Context, in *DebugPprofRequest, opts ...grpc.CallOption) (Bor_DebugPprofClient, error) { + stream, err := c.cc.NewStream(ctx, &Bor_ServiceDesc.Streams[1], "/proto.Bor/DebugPprof", opts...) + if err != nil { + return nil, err + } + x := &borDebugPprofClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Bor_DebugPprofClient interface { + Recv() (*DebugFileResponse, error) + grpc.ClientStream +} + +type borDebugPprofClient struct { + grpc.ClientStream +} + +func (x *borDebugPprofClient) Recv() (*DebugFileResponse, error) { + m := new(DebugFileResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *borClient) DebugBlock(ctx context.Context, in *DebugBlockRequest, opts ...grpc.CallOption) (Bor_DebugBlockClient, error) { + stream, err := c.cc.NewStream(ctx, &Bor_ServiceDesc.Streams[2], "/proto.Bor/DebugBlock", opts...) + if err != nil { + return nil, err + } + x := &borDebugBlockClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Bor_DebugBlockClient interface { + Recv() (*DebugFileResponse, error) + grpc.ClientStream +} + +type borDebugBlockClient struct { + grpc.ClientStream +} + +func (x *borDebugBlockClient) Recv() (*DebugFileResponse, error) { + m := new(DebugFileResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // BorServer is the server API for Bor service. // All implementations must embed UnimplementedBorServer // for forward compatibility type BorServer interface { - Pprof(*PprofRequest, Bor_PprofServer) error PeersAdd(context.Context, *PeersAddRequest) (*PeersAddResponse, error) PeersRemove(context.Context, *PeersRemoveRequest) (*PeersRemoveResponse, error) PeersList(context.Context, *PeersListRequest) (*PeersListResponse, error) @@ -167,6 +203,8 @@ type BorServer interface { ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error) Status(context.Context, *emptypb.Empty) (*StatusResponse, error) ChainWatch(*ChainWatchRequest, Bor_ChainWatchServer) error + DebugPprof(*DebugPprofRequest, Bor_DebugPprofServer) error + DebugBlock(*DebugBlockRequest, Bor_DebugBlockServer) error mustEmbedUnimplementedBorServer() } @@ -174,9 +212,6 @@ type BorServer interface { type UnimplementedBorServer struct { } -func (UnimplementedBorServer) Pprof(*PprofRequest, Bor_PprofServer) error { - return status.Errorf(codes.Unimplemented, "method Pprof not implemented") -} func (UnimplementedBorServer) PeersAdd(context.Context, *PeersAddRequest) (*PeersAddResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PeersAdd not implemented") } @@ -198,6 +233,12 @@ func (UnimplementedBorServer) Status(context.Context, *emptypb.Empty) (*StatusRe func (UnimplementedBorServer) ChainWatch(*ChainWatchRequest, Bor_ChainWatchServer) error { return status.Errorf(codes.Unimplemented, "method ChainWatch not implemented") } +func (UnimplementedBorServer) DebugPprof(*DebugPprofRequest, Bor_DebugPprofServer) error { + return status.Errorf(codes.Unimplemented, "method DebugPprof not implemented") +} +func (UnimplementedBorServer) DebugBlock(*DebugBlockRequest, Bor_DebugBlockServer) error { + return status.Errorf(codes.Unimplemented, "method DebugBlock not implemented") +} func (UnimplementedBorServer) mustEmbedUnimplementedBorServer() {} // UnsafeBorServer may be embedded to opt out of forward compatibility for this service. @@ -211,27 +252,6 @@ func RegisterBorServer(s grpc.ServiceRegistrar, srv BorServer) { s.RegisterService(&Bor_ServiceDesc, srv) } -func _Bor_Pprof_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(PprofRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(BorServer).Pprof(m, &borPprofServer{stream}) -} - -type Bor_PprofServer interface { - Send(*PprofResponse) error - grpc.ServerStream -} - -type borPprofServer struct { - grpc.ServerStream -} - -func (x *borPprofServer) Send(m *PprofResponse) error { - return x.ServerStream.SendMsg(m) -} - func _Bor_PeersAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PeersAddRequest) if err := dec(in); err != nil { @@ -361,6 +381,48 @@ func (x *borChainWatchServer) Send(m *ChainWatchResponse) error { return x.ServerStream.SendMsg(m) } +func _Bor_DebugPprof_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DebugPprofRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(BorServer).DebugPprof(m, &borDebugPprofServer{stream}) +} + +type Bor_DebugPprofServer interface { + Send(*DebugFileResponse) error + grpc.ServerStream +} + +type borDebugPprofServer struct { + grpc.ServerStream +} + +func (x *borDebugPprofServer) Send(m *DebugFileResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Bor_DebugBlock_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DebugBlockRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(BorServer).DebugBlock(m, &borDebugBlockServer{stream}) +} + +type Bor_DebugBlockServer interface { + Send(*DebugFileResponse) error + grpc.ServerStream +} + +type borDebugBlockServer struct { + grpc.ServerStream +} + +func (x *borDebugBlockServer) Send(m *DebugFileResponse) error { + return x.ServerStream.SendMsg(m) +} + // Bor_ServiceDesc is the grpc.ServiceDesc for Bor service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -395,13 +457,18 @@ var Bor_ServiceDesc = grpc.ServiceDesc{ }, Streams: []grpc.StreamDesc{ { - StreamName: "Pprof", - Handler: _Bor_Pprof_Handler, + StreamName: "ChainWatch", + Handler: _Bor_ChainWatch_Handler, ServerStreams: true, }, { - StreamName: "ChainWatch", - Handler: _Bor_ChainWatch_Handler, + StreamName: "DebugPprof", + Handler: _Bor_DebugPprof_Handler, + ServerStreams: true, + }, + { + StreamName: "DebugBlock", + Handler: _Bor_DebugBlock_Handler, ServerStreams: true, }, }, diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index 371e588d026f..3d0b55e09406 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "math/big" "net" "net/http" "os" @@ -43,6 +44,9 @@ type Server struct { grpcServer *grpc.Server tracer *sdktrace.TracerProvider config *Config + + // tracerAPI to trace block executions + tracerAPI *tracers.API } func NewServer(config *Config) (*Server, error) { @@ -162,6 +166,7 @@ func NewServer(config *Config) (*Server, error) { // debug tracing is enabled by default stack.RegisterAPIs(tracers.APIs(srv.backend.APIBackend)) + srv.tracerAPI = tracers.NewAPI(srv.backend.APIBackend) // graphql is started from another place if config.JsonRPC.Graphql.Enabled { @@ -200,6 +205,7 @@ func NewServer(config *Config) (*Server, error) { func (s *Server) Stop() { s.node.Close() + s.grpcServer.Stop() // shutdown the tracer if s.tracer != nil { @@ -354,3 +360,11 @@ func setupLogger(logLevel string) { } log.Root().SetHandler(glogger) } + +func (s *Server) GetLatestBlockNumber() *big.Int { + return s.backend.BlockChain().CurrentBlock().Number() +} + +func (s *Server) GetGrpcAddr() string { + return s.config.GRPC.Addr[1:] +} diff --git a/internal/cli/server/server_test.go b/internal/cli/server/server_test.go index 070739c68742..a0b6dee2e389 100644 --- a/internal/cli/server/server_test.go +++ b/internal/cli/server/server_test.go @@ -1,14 +1,33 @@ package server import ( + "fmt" + "net" + "sync/atomic" "testing" "time" + "github.com/ethereum/go-ethereum/log" "github.com/stretchr/testify/assert" ) -func TestServer_DeveloperMode(t *testing.T) { +var initialPort uint64 = 61000 + +// nextPort gives the next available port starting from 60000 +func nextPort() uint64 { + log.Info("Checking for new port", "current", initialPort) + port := atomic.AddUint64(&initialPort, 1) + addr := fmt.Sprintf("localhost:%d", port) + lis, err := net.Listen("tcp", addr) + if err == nil { + lis.Close() + return port + } else { + return nextPort() + } +} +func TestServer_DeveloperMode(t *testing.T) { // get the default config config := DefaultConfig() @@ -16,17 +35,16 @@ func TestServer_DeveloperMode(t *testing.T) { config.Developer.Enabled = true config.Developer.Period = 2 // block time - // start the server - server, err1 := NewServer(config) - if err1 != nil { - t.Fatalf("failed to start server: %v", err1) - } + // start the mock server + server, err := CreateMockServer(config) + assert.NoError(t, err) + defer CloseMockServer(server) // record the initial block number blockNumber := server.backend.BlockChain().CurrentBlock().Header().Number.Int64() var i int64 = 0 - for i = 0; i < 10; i++ { + for i = 0; i < 3; i++ { // We expect the node to mine blocks every `config.Developer.Period` time period time.Sleep(time.Duration(config.Developer.Period) * time.Second) currBlock := server.backend.BlockChain().CurrentBlock().Header().Number.Int64() @@ -35,7 +53,4 @@ func TestServer_DeveloperMode(t *testing.T) { break } } - - // stop the server - server.Stop() } diff --git a/internal/cli/server/service.go b/internal/cli/server/service.go index e8e39285810c..304b61b7d000 100644 --- a/internal/cli/server/service.go +++ b/internal/cli/server/service.go @@ -2,6 +2,7 @@ package server import ( "context" + "encoding/json" "fmt" "math/big" "reflect" @@ -9,6 +10,8 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ethereum/go-ethereum/eth/tracers/logger" "github.com/ethereum/go-ethereum/internal/cli/server/pprof" "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/ethereum/go-ethereum/p2p" @@ -18,30 +21,14 @@ import ( grpc_net_conn "github.com/mitchellh/go-grpc-net-conn" ) -func (s *Server) Pprof(req *proto.PprofRequest, stream proto.Bor_PprofServer) error { - var payload []byte - var headers map[string]string - var err error - - ctx := context.Background() - switch req.Type { - case proto.PprofRequest_CPU: - payload, headers, err = pprof.CPUProfile(ctx, int(req.Seconds)) - case proto.PprofRequest_TRACE: - payload, headers, err = pprof.Trace(ctx, int(req.Seconds)) - case proto.PprofRequest_LOOKUP: - payload, headers, err = pprof.Profile(req.Profile, 0, 0) - } - if err != nil { - return err - } +const chunkSize = 1024 * 1024 * 1024 +func sendStreamDebugFile(stream proto.Bor_DebugPprofServer, headers map[string]string, data []byte) error { // open the stream and send the headers - err = stream.Send(&proto.PprofResponse{ - Event: &proto.PprofResponse_Open_{ - Open: &proto.PprofResponse_Open{ + err := stream.Send(&proto.DebugFileResponse{ + Event: &proto.DebugFileResponse_Open_{ + Open: &proto.DebugFileResponse_Open{ Headers: headers, - Size: int64(len(payload)), }, }, }) @@ -50,24 +37,51 @@ func (s *Server) Pprof(req *proto.PprofRequest, stream proto.Bor_PprofServer) er } // Wrap our conn around the response. + encoder := grpc_net_conn.SimpleEncoder(func(msg gproto.Message) *[]byte { + return &msg.(*proto.DebugFileResponse_Input).Data + }) conn := &grpc_net_conn.Conn{ Stream: stream, - Request: &proto.PprofResponse_Input{}, - Encode: grpc_net_conn.SimpleEncoder(func(msg gproto.Message) *[]byte { - return &msg.(*proto.PprofResponse_Input).Data - }), + Request: &proto.DebugFileResponse_Input{}, + Encode: grpc_net_conn.ChunkedEncoder(encoder, chunkSize), } - if _, err := conn.Write(payload); err != nil { + if _, err := conn.Write(data); err != nil { return err } // send the eof - err = stream.Send(&proto.PprofResponse{ - Event: &proto.PprofResponse_Eof{}, + err = stream.Send(&proto.DebugFileResponse{ + Event: &proto.DebugFileResponse_Eof{}, }) if err != nil { return err } + + return nil +} + +func (s *Server) DebugPprof(req *proto.DebugPprofRequest, stream proto.Bor_DebugPprofServer) error { + var payload []byte + var headers map[string]string + var err error + + ctx := context.Background() + switch req.Type { + case proto.DebugPprofRequest_CPU: + payload, headers, err = pprof.CPUProfile(ctx, int(req.Seconds)) + case proto.DebugPprofRequest_TRACE: + payload, headers, err = pprof.Trace(ctx, int(req.Seconds)) + case proto.DebugPprofRequest_LOOKUP: + payload, headers, err = pprof.Profile(req.Profile, 0, 0) + } + if err != nil { + return err + } + + // send the file on a grpc stream + if err := sendStreamDebugFile(stream, headers, payload); err != nil { + return err + } return nil } @@ -169,6 +183,32 @@ func headerToProtoHeader(h *types.Header) *proto.Header { } } +func (s *Server) DebugBlock(req *proto.DebugBlockRequest, stream proto.Bor_DebugBlockServer) error { + traceReq := &tracers.TraceBlockRequest{ + Number: req.Number, + Config: &tracers.TraceConfig{ + Config: &logger.Config{ + EnableMemory: true, + }, + }, + } + res, err := s.tracerAPI.TraceBorBlock(traceReq) + if err != nil { + return err + } + + // this is memory heavy + data, err := json.Marshal(res) + if err != nil { + return err + } + if err := sendStreamDebugFile(stream, map[string]string{}, data); err != nil { + return err + } + + return nil +} + var bigIntT = reflect.TypeOf(new(big.Int)).Kind() // gatherForks gathers all the fork numbers via reflection