e2e

package
v0.0.0-...-be384fd Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeValidator Mode = "validator"
	ModeFull      Mode = "full"
	ModeLight     Mode = "light"
	ModeSeed      Mode = "seed"

	ProtocolBuiltin    Protocol = "builtin"
	ProtocolFile       Protocol = "file"
	ProtocolGRPC       Protocol = "grpc"
	ProtocolTCP        Protocol = "tcp"
	ProtocolUNIX       Protocol = "unix"
	ProtocolHellarCore Protocol = "hellarcore"

	PerturbationDisconnect Perturbation = "disconnect"
	PerturbationKill       Perturbation = "kill"
	PerturbationPause      Perturbation = "pause"
	PerturbationRestart    Perturbation = "restart"

	EvidenceAgeHeight int64         = 7
	EvidenceAgeTime   time.Duration = 500 * time.Millisecond

	StateSyncP2P      = "p2p"
	StateSyncRPC      = "rpc"
	StateSyncDisabled = ""
)

Variables

This section is empty.

Functions

func SortManifests

func SortManifests(manifests []Manifest, reverse bool)

SortManifests orders (in-place) a list of manifests such that the manifests will be ordered in terms of complexity (or expected runtime). Complexity is determined first by the number of nodes, and then by the total number of perturbations in the network.

If reverse is true, then the manifests are ordered with the most complex networks before the less complex networks.

func SplitGroups

func SplitGroups(groups int, manifests []Manifest) [][]Manifest

SplitGroups divides a list of manifests into n groups of manifests.

func WriteManifests

func WriteManifests(prefix string, manifests []Manifest) error

WriteManifests writes a collection of manifests into files with the specified path prefix.

Types

type Manifest

type Manifest struct {
	// IPv6 uses IPv6 networking instead of IPv4. Defaults to IPv4.
	IPv6 bool `toml:"ipv6"`

	// QuorumType represents the initial quorum type
	QuorumType uint32 `toml:"quorum_type"`

	// InitialHeight specifies the initial block height, set in genesis. Defaults to 1.
	InitialHeight int64 `toml:"initial_height"`

	// GenesisCoreChainLockedHeight specifies the initial core chain locked block height, set in genesis. Defaults to 1.
	GenesisCoreChainLockedHeight uint32 `toml:"initial_core_chain_locked_height"`

	// InitAppCoreChainLockedHeight specifies initial core chain locked block height, returned by the App
	// in response to InitApp ABCI request. It overrides value set in GenesisCoreChainLockedHeight.
	InitAppCoreChainLockedHeight uint32 `toml:"init_app_core_chain_locked_height"`

	// InitialState is an initial set of key/value pairs for the application,
	// set in genesis. Defaults to nothing.
	InitialState kvstore.StateExport `toml:"initial_state"`

	// Validators is the initial validator set in genesis, given as node names
	// and power (for Hellar power must all be set to default power):
	//
	// validators = { validator01 = 100; validator02 = 100; validator03 = 100 }
	//
	// Defaults to all nodes that have mode=validator at power 100. Explicitly
	// specifying an empty set will start with no validators in genesis, and
	// the application must return the validator set in InitChain via the
	// setting validator_update.0 (see below).
	Validators map[string]int64 `toml:"validators"`

	// ValidatorUpdates is a map of heights to validator proTxHashes and their power,
	// and will be returned by the ABCI application. For example, the following
	// adds validator01 and validator02 at height 1000:
	//
	// [validator_update.1000]
	// validator01 = 100
	// validator02 = 100
	//
	// Specifying height 0 returns the validator update during InitChain. The
	// application returns the validator updates as-is, i.e. removing a
	// validator must be done by returning it with power 0, and any validators
	// not specified are not changed.
	ValidatorUpdates map[string]map[string]int64 `toml:"validator_update"`

	ChainLockUpdates map[string]int64 `toml:"chainlock_updates"`

	// Nodes specifies the network nodes. At least one node must be given.
	Nodes map[string]*ManifestNode `toml:"node"`

	// KeyType sets the curve that will be used by validators.
	// Options are ed25519 & secp256k1
	KeyType string `toml:"key_type"`

	// Evidence indicates the amount of evidence that will be injected into the
	// testnet via the RPC endpoint of a random node. Default is 0
	Evidence int `toml:"evidence"`

	// LogLevel sets the log level of the entire testnet. This can be overridden
	// by individual nodes.
	LogLevel string `toml:"log_level"`

	// QueueType describes the type of queue that the system uses internally
	QueueType string `toml:"queue_type"`

	// Number of bytes per tx. Default is 1kb (1024)
	TxSize int `toml:"tx_size"`

	// VoteExtensionsEnableHeight configures the first height during which
	// the chain will use and require vote extension data to be present
	// in precommit messages.
	VoteExtensionsEnableHeight int64 `toml:"vote_extensions_enable_height"`

	// ABCIProtocol specifies the protocol used to communicate with the ABCI
	// application: "unix", "tcp", "grpc", or "builtin". Defaults to builtin.
	// builtin will build a complete Tendermint node into the application and
	// launch it instead of launching a separate Tendermint process.
	ABCIProtocol string `toml:"abci_protocol"`

	// Add artificial delays to each of the main ABCI calls to mimic computation time
	// of the application
	PrepareProposalDelayMS uint64 `toml:"prepare_proposal_delay_ms"`
	ProcessProposalDelayMS uint64 `toml:"process_proposal_delay_ms"`
	CheckTxDelayMS         uint64 `toml:"check_tx_delay_ms"`
	VoteExtensionDelayMS   uint64 `toml:"vote_extension_delay_ms"`
	FinalizeBlockDelayMS   uint64 `toml:"finalize_block_delay_ms"`
	MaxBlockSize           uint64 `toml:"max_block_size"`
	MaxEvidenceSize        uint64 `toml:"max_evidence_size"`
}

Manifest represents a TOML testnet manifest.

func LoadManifest

func LoadManifest(file string) (Manifest, error)

LoadManifest loads a testnet manifest from a file.

func (Manifest) Save

func (m Manifest) Save(file string) error

Save saves the testnet manifest to a file.

type ManifestNode

type ManifestNode struct {
	// Mode specifies the type of node: "validator", "full", "light" or "seed".
	// Defaults to "validator". Full nodes do not get a signing key (a dummy key
	// is generated), and seed nodes run in seed mode with the PEX reactor enabled.
	Mode string `toml:"mode"`

	// Seeds is the list of node names to use as P2P seed nodes. Defaults to none.
	Seeds []string `toml:"seeds"`

	// PersistentPeers is a list of node names to maintain persistent P2P
	// connections to. If neither seeds nor persistent peers are specified,
	// this defaults to all other nodes in the network. For light clients,
	// this relates to the providers the light client is connected to.
	PersistentPeers []string `toml:"persistent_peers"`

	// Database specifies the database backend: "goleveldb", "cleveldb",
	// "rocksdb", "boltdb", or "badgerdb". Defaults to goleveldb.
	Database string `toml:"database"`

	// PrivvalProtocol specifies the protocol used to sign consensus messages:
	// "file", "unix", "tcp", "hellarcore" or "grpc". Defaults to "file". For tcp and unix, the ABCI
	// application will launch a remote signer client in a separate goroutine.
	// For grpc the ABCI application will launch a remote signer server.
	// Only nodes with mode=validator will actually make use of this.
	PrivvalProtocol string `toml:"privval_protocol"`

	// StartAt specifies the block height at which the node will be started. The
	// runner will wait for the network to reach at least this block height.
	StartAt int64 `toml:"start_at"`

	// Mempool specifies which version of mempool to use. Either "v0" or "v1"
	Mempool string `toml:"mempool_version"`

	// StateSync enables state sync. The runner automatically configures trusted
	// block hashes and RPC servers. At least one node in the network must have
	// SnapshotInterval set to non-zero, and the state syncing node must have
	// StartAt set to an appropriate height where a snapshot is available.
	// StateSync can either be "p2p" or "rpc" or an empty string to disable
	StateSync string `toml:"state_sync"`

	// PersistInterval specifies the height interval at which the application
	// will persist state to disk. Defaults to 1 (every height), setting this to
	// 0 disables state persistence.
	PersistInterval *uint64 `toml:"persist_interval"`

	// SnapshotInterval specifies the height interval at which the application
	// will take state sync snapshots. Defaults to 0 (disabled).
	SnapshotInterval uint64 `toml:"snapshot_interval"`

	// RetainBlocks specifies the number of recent blocks to retain. Defaults to
	// 0, which retains all blocks. Must be greater that PersistInterval,
	// SnapshotInterval and EvidenceAgeHeight.
	RetainBlocks uint64 `toml:"retain_blocks"`

	P2PMaxConnections            uint16        `toml:"p2p_max_connections"`
	P2PMaxOutgoingConnections    uint16        `toml:"p2p_max_outgoing_connections"`
	P2PMaxIncomingConnectionTime time.Duration `toml:"p2p_max_incoming_connection_time"`
	P2PIncomingConnectionWindow  time.Duration `toml:"p2p_incoming_connection_window"`

	// Perturb lists perturbations to apply to the node after it has been
	// started and synced with the network:
	//
	// disconnect: temporarily disconnects the node from the network
	// kill:       kills the node with SIGKILL then restarts it
	// pause:      temporarily pauses (freezes) the node
	// restart:    restarts the node, shutting it down with SIGTERM
	Perturb []string `toml:"perturb"`

	// Log level sets the log level of the specific node i.e. "info".
	// This is helpful when debugging a specific problem. This overrides the network
	// level.
	LogLevel string `toml:"log_level"`
}

ManifestNode represents a node in a testnet manifest.

func (ManifestNode) Stateless

func (m ManifestNode) Stateless() bool

Stateless reports whether m is a node that does not own state, including light and seed nodes.

type Mode

type Mode string

type Node

type Node struct {
	Name                         string
	Testnet                      *Testnet
	Mode                         Mode
	PrivvalKeys                  map[string]crypto.QuorumKeys
	PrivvalUpdateHeights         map[string]crypto.QuorumHash
	NodeKey                      crypto.PrivKey
	ProTxHash                    crypto.ProTxHash
	IP                           net.IP
	ProxyPort                    uint32
	StartAt                      int64
	Mempool                      string
	StateSync                    string
	Database                     string
	PrivvalProtocol              Protocol
	PersistInterval              uint64
	SnapshotInterval             uint64
	RetainBlocks                 uint64
	P2PMaxConnections            uint16
	P2PMaxOutgoingConnections    uint16
	P2PMaxIncomingConnectionTime time.Duration
	P2PIncomingConnectionWindow  time.Duration
	Seeds                        []*Node
	PersistentPeers              []*Node
	Perturbations                []Perturbation
	LogLevel                     string
	QueueType                    string
	HasStarted                   bool
}

Node represents a Tenderhellar node in a testnet.

func (Node) AddressP2P

func (n Node) AddressP2P(withID bool) string

Address returns a P2P endpoint address for the node.

func (Node) AddressRPC

func (n Node) AddressRPC() string

Address returns an RPC endpoint address for the node.

func (Node) Client

func (n Node) Client() (*rpchttp.HTTP, error)

Client returns an RPC client for a node.

func (Node) Stateless

func (n Node) Stateless() bool

Stateless returns true if the node is either a seed node or a light node

func (Node) Validate

func (n Node) Validate(testnet Testnet) error

Validate validates a node.

type Perturbation

type Perturbation string

type Protocol

type Protocol string

type Testnet

type Testnet struct {
	Name                   string
	File                   string
	Dir                    string
	IP                     *net.IPNet
	InitialHeight          int64
	InitialState           kvstore.StateExport
	Validators             ValidatorsMap
	ValidatorUpdates       map[int64]ValidatorsMap
	Nodes                  []*Node
	KeyType                string
	Evidence               int
	LogLevel               string
	TxSize                 int
	ABCIProtocol           Protocol
	PrepareProposalDelayMS int
	ProcessProposalDelayMS int
	CheckTxDelayMS         int
	VoteExtensionDelayMS   int
	FinalizeBlockDelayMS   int
	MaxBlockSize           int64
	MaxEvidenceSize        int64

	// Tenderhellar-specific fields
	GenesisCoreHeight         uint32 // InitialCoreHeight is a core height put into genesis file
	InitAppCoreHeight         uint32 // InitAppCoreHeight returned in InitApp response
	ChainLockUpdates          map[int64]int64
	ThresholdPublicKey        crypto.PubKey
	ThresholdPublicKeyUpdates map[int64]crypto.PubKey
	QuorumType                btcjson.LLMQType
	QuorumHash                crypto.QuorumHash
	QuorumHashUpdates         map[int64]crypto.QuorumHash
}

func LoadTestnet

func LoadTestnet(file string) (*Testnet, error)

LoadTestnet loads a testnet from a manifest file, using the filename to determine the testnet name and directory (from the basename of the file). The testnet generation must be deterministic, since it is generated separately by the runner and the test cases. For this reason, testnets use a random seed to generate e.g. keys.

func (Testnet) ArchiveNodes

func (t Testnet) ArchiveNodes() []*Node

ArchiveNodes returns a list of archive nodes that start at the initial height and contain the entire blockchain history. They are used e.g. as light client RPC servers.

func (Testnet) HasPerturbations

func (t Testnet) HasPerturbations() bool

HasPerturbations returns whether the network has any perturbations.

func (Testnet) IPv6

func (t Testnet) IPv6() bool

IPv6 returns true if the testnet is an IPv6 network.

func (Testnet) LookupNode

func (t Testnet) LookupNode(name string) *Node

LookupNode looks up a node by name. For now, simply do a linear search.

func (Testnet) LookupNodeByProTxHash

func (t Testnet) LookupNodeByProTxHash(proTxHash crypto.ProTxHash) *Node

LookupNode looks up a node by name. For now, simply do a linear search.

func (Testnet) Validate

func (t Testnet) Validate() error

Validate validates a testnet.

type ValidatorConfig

type ValidatorConfig struct {
	abci.ValidatorUpdate
}

type ValidatorsMap

type ValidatorsMap map[*Node]ValidatorConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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