chain

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	initialization.ChainMeta

	ValidatorInitConfigs []*initialization.NodeConfig
	// voting period is number of blocks it takes to deposit, 1.2 seconds per validator to vote on the prop, and a buffer.
	VotingPeriod          float32
	ExpeditedVotingPeriod float32
	// upgrade proposal height for chain.
	UpgradePropHeight    int64
	LatestProposalNumber int
	LatestLockNumber     int
	NodeConfigs          []*NodeConfig

	LatestCodeId int
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, containerManager *containers.Manager, id string, initValidatorConfigs []*initialization.NodeConfig) *Config

func (*Config) CreateNode

func (c *Config) CreateNode(initNode *initialization.Node) *NodeConfig

CreateNode returns new initialized NodeConfig.

func (*Config) GetDefaultNode

func (c *Config) GetDefaultNode() (*NodeConfig, error)

GetDefaultNode returns the default node of the chain. The default node is the first one created. Returns error if no ndoes created.

func (*Config) GetNodeAtIndex

func (c *Config) GetNodeAtIndex(nodeIndex int) (*NodeConfig, error)

func (*Config) GetPersistentPeers

func (c *Config) GetPersistentPeers() []string

GetPersistentPeers returns persistent peers from every node associated with a chain.

func (*Config) RemoveNode

func (c *Config) RemoveNode(nodeName string) error

RemoveNode removes node and stops it from running.

func (*Config) SendIBC

func (c *Config) SendIBC(dstChain *Config, recipient string, token sdk.Coin)

func (*Config) WaitForNumHeights

func (c *Config) WaitForNumHeights(heightsToWait int64)

WaitForNumHeights waits for all nodes to go through a given number of heights.

func (*Config) WaitUntilHeight

func (c *Config) WaitUntilHeight(height int64)

WaitUntilHeight waits for all validators to reach the specified height at the minimum. returns error, if any.

type NodeConfig

type NodeConfig struct {
	initialization.Node

	OperatorAddress  string
	SnapshotInterval uint64
	// contains filtered or unexported fields
}

func NewNodeConfig

func NewNodeConfig(t *testing.T, initNode *initialization.Node, initConfig *initialization.NodeConfig, chainId string, containerManager *containers.Manager) *NodeConfig

NewNodeConfig returens new initialized NodeConfig.

func (*NodeConfig) BankSend

func (n *NodeConfig) BankSend(amount string, sendAddress string, receiveAddress string)

func (*NodeConfig) FailIBCTransfer

func (n *NodeConfig) FailIBCTransfer(from, recipient, amount string)

func (*NodeConfig) FinalizeSealedEpochs

func (n *NodeConfig) FinalizeSealedEpochs(startEpoch uint64, lastEpoch uint64)

func (*NodeConfig) GetHostPort

func (n *NodeConfig) GetHostPort(portId string) (string, error)

func (*NodeConfig) InsertHeader

func (n *NodeConfig) InsertHeader(h *bbn.BTCHeaderBytes)

func (*NodeConfig) InsertNewEmptyBtcHeader

func (n *NodeConfig) InsertNewEmptyBtcHeader(r *rand.Rand) *blc.BTCHeaderInfo

func (*NodeConfig) InsertProofs

func (*NodeConfig) LatestBlockNumber

func (n *NodeConfig) LatestBlockNumber() uint64

func (*NodeConfig) LogActionF

func (n *NodeConfig) LogActionF(msg string, args ...interface{})

func (*NodeConfig) QueryBalances

func (n *NodeConfig) QueryBalances(address string) (sdk.Coins, error)

QueryBalances returns balances at the address.

func (*NodeConfig) QueryBtcBaseHeader

func (n *NodeConfig) QueryBtcBaseHeader() (*blc.BTCHeaderInfo, error)

func (*NodeConfig) QueryChains added in v0.6.0

func (n *NodeConfig) QueryChains() (*[]string, error)

func (*NodeConfig) QueryChainsInfo added in v0.6.0

func (n *NodeConfig) QueryChainsInfo(chainIDs []string) ([]*zctypes.ChainInfo, error)

func (*NodeConfig) QueryCurrentEpoch

func (n *NodeConfig) QueryCurrentEpoch() (uint64, error)

func (*NodeConfig) QueryCurrentHeight

func (n *NodeConfig) QueryCurrentHeight() (int64, error)

QueryCurrentHeight returns the current block height of the node or error.

func (*NodeConfig) QueryEpochChainsInfo added in v0.6.0

func (n *NodeConfig) QueryEpochChainsInfo(epochNum uint64, chainIDs []string) ([]*zctypes.ChainInfo, error)

func (*NodeConfig) QueryFinalizedChainsInfo added in v0.6.0

func (n *NodeConfig) QueryFinalizedChainsInfo(chainIDs []string) ([]*zctypes.FinalizedChainInfo, error)

func (*NodeConfig) QueryGRPCGateway

func (n *NodeConfig) QueryGRPCGateway(path string, queryParams url.Values) ([]byte, error)

func (*NodeConfig) QueryHashFromBlock

func (n *NodeConfig) QueryHashFromBlock(height int64) (string, error)

QueryHashFromBlock gets block hash at a specific height. Otherwise, error.

func (*NodeConfig) QueryLatestBlockTime

func (n *NodeConfig) QueryLatestBlockTime() time.Time

QueryLatestBlockTime returns the latest block time.

func (*NodeConfig) QueryLightClientHeightCheckpointReported

func (n *NodeConfig) QueryLightClientHeightCheckpointReported(ckptHash []byte) (uint64, error)

func (*NodeConfig) QueryLightClientHeightEpochEnd

func (n *NodeConfig) QueryLightClientHeightEpochEnd(epoch uint64) (uint64, error)

func (*NodeConfig) QueryListSnapshots

func (n *NodeConfig) QueryListSnapshots() ([]*tmabcitypes.Snapshot, error)

QueryListSnapshots gets all snapshots currently created for a node.

func (*NodeConfig) QueryParams

func (n *NodeConfig) QueryParams(subspace, key string, result any)

TODO for now all commands are not used and left here as an example QueryParams extracts the params for a given subspace and key. This is done generically via json to avoid having to specify the QueryParamResponse type (which may not exist for all params).

func (*NodeConfig) QueryRawCheckpoint added in v0.6.0

func (n *NodeConfig) QueryRawCheckpoint(epoch uint64) (*ct.RawCheckpointWithMeta, error)

func (*NodeConfig) QueryRawCheckpoints added in v0.6.0

func (n *NodeConfig) QueryRawCheckpoints(pagination *query.PageRequest) (*ct.QueryRawCheckpointsResponse, error)

func (*NodeConfig) QuerySupplyOf

func (n *NodeConfig) QuerySupplyOf(denom string) (sdkmath.Int, error)

func (*NodeConfig) QueryTip

func (n *NodeConfig) QueryTip() (*blc.BTCHeaderInfo, error)

func (*NodeConfig) Run

func (n *NodeConfig) Run() error

Run runs a node container for the given nodeIndex. The node configuration must be already added to the chain config prior to calling this method.

func (*NodeConfig) SendHeaderHex

func (n *NodeConfig) SendHeaderHex(headerHex string)

func (*NodeConfig) Stop

func (n *NodeConfig) Stop() error

Stop stops the node from running and removes its container.

func (*NodeConfig) WaitForCondition

func (n *NodeConfig) WaitForCondition(doneCondition func() bool, errormsg string)

func (*NodeConfig) WaitUntil

func (n *NodeConfig) WaitUntil(doneCondition func(syncInfo coretypes.SyncInfo) bool)

WaitUntil waits until node reaches doneCondition. Return nil if reached, error otherwise.

func (*NodeConfig) WaitUntilBtcHeight

func (n *NodeConfig) WaitUntilBtcHeight(height uint64)

func (*NodeConfig) WithSetupTime

func (n *NodeConfig) WithSetupTime(t time.Time) *NodeConfig

Jump to

Keyboard shortcuts

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