tendermint

package
v8.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package tendermint provides interfaces for interacting with tendermint nodes.

Index

Constants

View Source
const (
	// BlockTimeSeconds (in seconds) is approx time to create a block.
	BlockTimeSeconds = 2
)

Variables

This section is empty.

Functions

func AttributeValue

func AttributeValue(events []abcitypes.Event, eventType, attrKey string) (string, bool)

AttributeValue returns an event attribute value given the eventType and attribute key tuple. In the event of duplicate types and keys, returns the first attribute value found. If not found, returns empty string and false.

Types

type PrivValidatorKey

type PrivValidatorKey struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type PrivValidatorKeyFile

type PrivValidatorKeyFile struct {
	Address string           `json:"address"`
	PubKey  PrivValidatorKey `json:"pub_key"`
	PrivKey PrivValidatorKey `json:"priv_key"`
}

type TendermintNode

type TendermintNode struct {
	Log *zap.Logger

	VolumeName   string
	Index        int
	Chain        ibc.Chain
	NetworkID    string
	DockerClient *dockerclient.Client
	Client       rpcclient.Client
	TestName     string
	Image        ibc.DockerImage
	// contains filtered or unexported fields
}

TendermintNode represents a node in the test network that is being created.

func NewTendermintNode

func NewTendermintNode(
	ctx context.Context,
	log *zap.Logger,
	i int,
	c ibc.Chain,
	dockerClient *dockerclient.Client,
	networkID string,
	testName string,
	image ibc.DockerImage,
) (*TendermintNode, error)

func (*TendermintNode) Bind

func (tn *TendermintNode) Bind() []string

Bind returns the home folder bind point for running the node.

func (*TendermintNode) CreateNodeContainer

func (tn *TendermintNode) CreateNodeContainer(ctx context.Context, additionalFlags ...string) error

func (*TendermintNode) Exec

func (tn *TendermintNode) Exec(ctx context.Context, cmd []string, env []string) ([]byte, []byte, error)

func (*TendermintNode) GenesisFileContent

func (tn *TendermintNode) GenesisFileContent(ctx context.Context) ([]byte, error)

func (*TendermintNode) GetConfigSeparator

func (tn *TendermintNode) GetConfigSeparator() (string, error)

Tenderment deprecate snake_case in config for hyphen-case in v0.34.1 https://github.com/cometbft/cometbft/blob/main/CHANGELOG.md#v0341

func (*TendermintNode) Height

func (tn *TendermintNode) Height(ctx context.Context) (int64, error)

func (*TendermintNode) HomeDir

func (tn *TendermintNode) HomeDir() string

func (*TendermintNode) HostName

func (tn *TendermintNode) HostName() string

func (*TendermintNode) InitFullNodeFiles

func (tn *TendermintNode) InitFullNodeFiles(ctx context.Context) error

func (*TendermintNode) InitHomeFolder

func (tn *TendermintNode) InitHomeFolder(ctx context.Context, mode string) error

InitHomeFolder initializes a home folder for the given node.

func (*TendermintNode) InitValidatorFiles

func (tn *TendermintNode) InitValidatorFiles(ctx context.Context) error

InitValidatorFiles creates the node files and signs a genesis transaction.

func (*TendermintNode) Name

func (tn *TendermintNode) Name() string

Name is the hostname of the test node container.

func (*TendermintNode) NewClient

func (tn *TendermintNode) NewClient(addr string) error

NewClient creates and assigns a new Tendermint RPC client to the TendermintNode.

func (*TendermintNode) NodeID

func (tn *TendermintNode) NodeID(ctx context.Context) (string, error)

NodeID returns the node of a given node.

func (*TendermintNode) OverwriteGenesisFile

func (tn *TendermintNode) OverwriteGenesisFile(ctx context.Context, content []byte) error

func (*TendermintNode) ReadFile added in v8.6.0

func (tn *TendermintNode) ReadFile(ctx context.Context, relPath string) ([]byte, error)

ReadFile reads the contents of a single file at the specified path in the docker filesystem. relPath describes the location of the file in the docker volume relative to the home directory.

func (*TendermintNode) SetConfigAndPeers

func (tn *TendermintNode) SetConfigAndPeers(ctx context.Context, peers string) error

SetConfigAndPeers modifies the config for a validator node to start a chain.

func (*TendermintNode) StartContainer

func (tn *TendermintNode) StartContainer(ctx context.Context) error

func (*TendermintNode) StopContainer

func (tn *TendermintNode) StopContainer(ctx context.Context) error

type TendermintNodes

type TendermintNodes []*TendermintNode

TendermintNodes is a collection of TendermintNode.

func (TendermintNodes) LogGenesisHashes

func (tn TendermintNodes) LogGenesisHashes(ctx context.Context) error

LogGenesisHashes logs the genesis hashes for the various nodes.

func (TendermintNodes) PeerString

func (tn TendermintNodes) PeerString(ctx context.Context, node *TendermintNode) string

PeerString returns the string for connecting the nodes passed in.

Jump to

Keyboard shortcuts

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