swamp

package
v0.3.1-dirty Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components

type Components struct {
	App     types.Application
	CoreCfg *tn.Config
}

Components struct represents a set of pre-requisite attributes from the test scenario

func DefaultComponents

func DefaultComponents() *Components

DefaultComponents creates a KvStore with a block retention of 200 In addition, the empty block interval is set to 200ms

type Option added in v0.3.0

type Option func(*Components)

Option for modifying Swamp's Config.

func WithBlockInterval

func WithBlockInterval(interval time.Duration) Option

WithBlockInterval sets a custom interval for block creation.

type Swamp

type Swamp struct {
	Network     mocknet.Mocknet
	CoreClient  core.Client
	BridgeNodes []*node.Node
	FullNodes   []*node.Node
	LightNodes  []*node.Node
	// contains filtered or unexported fields
}

Swamp represents the main functionality that is needed for the test-case: - Network to link the nodes - CoreClient to share between Bridge nodes - Slices of created Bridge/Full/Light Nodes - trustedHash taken from the CoreClient and shared between nodes

func NewSwamp

func NewSwamp(t *testing.T, options ...Option) *Swamp

NewSwamp creates a new instance of Swamp.

func (*Swamp) GetCoreBlockHashByHeight added in v0.3.0

func (s *Swamp) GetCoreBlockHashByHeight(ctx context.Context, height int64) bytes.HexBytes

GetCoreBlockHashByHeight returns a tendermint block's hash by provided height

func (*Swamp) NewBridgeNode

func (s *Swamp) NewBridgeNode(options ...node.Option) *node.Node

NewBridgeNode creates a new instance of a BridgeNode providing a default config and a mockstore to the NewNodeWithStore method

func (*Swamp) NewFullNode added in v0.3.0

func (s *Swamp) NewFullNode(options ...node.Option) *node.Node

NewFullNode creates a new instance of a FullNode providing a default config and a mockstore to the NewNodeWithStore method

func (*Swamp) NewLightNode

func (s *Swamp) NewLightNode(options ...node.Option) *node.Node

NewLightNode creates a new instance of a LightNode providing a default config and a mockstore to the NewNodeWithStore method

func (*Swamp) NewNodeWithStore added in v0.3.0

func (s *Swamp) NewNodeWithStore(t node.Type, store node.Store, options ...node.Option) *node.Node

NewNodeWithStore creates a new instance of Node with predefined Store. Afterwards, the instance is stored in the swamp's Nodes' slice according to the node's type provided from the user.

func (*Swamp) RemoveNode added in v0.3.0

func (s *Swamp) RemoveNode(n *node.Node, t node.Type) error

RemoveNode removes a node from the swamp's node slice this allows reusage of the same var in the test scenario if the user needs to stop and start the same node

func (*Swamp) WaitTillHeight

func (s *Swamp) WaitTillHeight(ctx context.Context, height int64)

WaitTillHeight holds the test execution until the given amount of blocks has been produced by the CoreClient.

Jump to

Keyboard shortcuts

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