chaos

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TXNodeLabel    = "tx-node"
	MinerNodeLabel = "miner-node"
)

Must use that labels for all networks, TXNode is the main node connected to Chainlink

Variables

This section is empty.

Functions

This section is empty.

Types

type ReorgConfirmer

type ReorgConfirmer struct {
	NetworkStep ReorgStep
	// contains filtered or unexported fields
}

ReorgConfirmer reorg stats collecting struct

func NewReorgConfirmer

func NewReorgConfirmer(
	c client.BlockchainClient,
	env environment.Environment,
	reorgDepth int,
	blockConsensusThreshold int,
	timeout time.Duration,
) (*ReorgConfirmer, error)

NewReorgConfirmer creates a type that can create reorg chaos and confirm reorg has happened

func (*ReorgConfirmer) ReceiveBlock

func (rc *ReorgConfirmer) ReceiveBlock(blk client.NodeBlock) error

ReceiveBlock receives block marked by node that mined it, forks the network and record all alternative block numbers on node 0

func (*ReorgConfirmer) Verify

func (rc *ReorgConfirmer) Verify() error

Verify verifies that all blocks are replaced by reorg

func (*ReorgConfirmer) Wait

func (rc *ReorgConfirmer) Wait() error

Wait wait until reorg is done

type ReorgStep

type ReorgStep int

ReorgStep step enum for re-org test

const (
	InitConsensus ReorgStep = iota
	NetworkFork
	AltBlocks
	Consensus
)

The steps are: 1. Await initial network consensus for N blocks 2. Fork the network, separate node 0 from 1 and 2 3. Await alternative blocks mined on node zero, nodes 1 and 2 will have longer chain with more block difficulty so blocks of node 0 must be replaced 4. Await consensus for N blocks, check alt block hashes now

Jump to

Keyboard shortcuts

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