inspect

package
v38.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package inspect provides a tool for investigating the state of a failed CometBFT node.

This package provides the Inspector type. The Inspector type runs a subset of the CometBFT RPC endpoints that are useful for debugging issues with CometBFT's consensus.

When a node running the CometBFT's consensus engine detects an inconsistent consensus state, the entire node will crash. The CometBFT's consensus engine cannot run in this inconsistent state so the node will not be able to start up again.

The RPC endpoints provided by the Inspector type allow for a node operator to inspect the block store and state store to better understand what may have caused the inconsistent state.

The Inspector type's lifecycle is controlled by a context.Context

ins := inspect.NewFromConfig(rpcConfig)
ctx, cancelFunc:= context.WithCancel(context.Background())

// Run blocks until the Inspector server is shut down.
go ins.Run(ctx)
...

// calling the cancel function will stop the running inspect server
cancelFunc()

Inspector serves its RPC endpoints on the address configured in the RPC configuration

rpcConfig.ListenAddress = "tcp://127.0.0.1:26657"
ins := inspect.NewFromConfig(rpcConfig)
go ins.Run(ctx)

The list of available RPC endpoints can then be viewed by navigating to http://127.0.0.1:26657/ in the web browser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inspector

type Inspector struct {
	// contains filtered or unexported fields
}

Inspector manages an RPC service that exports methods to debug a failed node. After a node shuts down due to a consensus failure, it will no longer start up its state cannot easily be inspected. An Inspector value provides a similar interface to the node, using the underlying CometBFT data stores, without bringing up any other components. A caller can query the Inspector service to inspect the persisted state and debug the failure.

func New

New returns an Inspector that serves RPC on the specified BlockStore and StateStore. The Inspector type does not modify the state or block stores. The sinks are used to enable block and transaction querying via the RPC server. The caller is responsible for starting and stopping the Inspector service.

func NewFromConfig

func NewFromConfig(cfg *config.Config) (*Inspector, error)

NewFromConfig constructs an Inspector using the values defined in the passed in config.

func (*Inspector) Run

func (ins *Inspector) Run(ctx context.Context) error

Run starts the Inspector servers and blocks until the servers shut down. The passed in context is used to control the lifecycle of the servers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL