chaos

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitConsensus int64 = iota
	NetworkFork
	CheckBlocks
	Consensus
	Wait
)

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

Variables

This section is empty.

Functions

This section is empty.

Types

type ReorgConfig

type ReorgConfig struct {
	FromPodLabel            string
	ToPodLabel              string
	Network                 blockchain.EVMClient
	Env                     *environment.Environment
	BlockConsensusThreshold int
	Timeout                 time.Duration
}

type ReorgController

type ReorgController struct {
	ReorgDepth int
	// contains filtered or unexported fields
}

ReorgController reorg stats collecting struct

func NewReorgController

func NewReorgController(cfg *ReorgConfig) (*ReorgController, error)

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

func (*ReorgController) ReOrg

func (rc *ReorgController) ReOrg(depth int)

ReOrg start re-org

func (*ReorgController) ReceiveBlock

func (rc *ReorgController) ReceiveBlock(blk blockchain.NodeBlock) error

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

func (*ReorgController) VerifyReorgComplete

func (rc *ReorgController) VerifyReorgComplete() error

VerifyReorgComplete verifies that all blocks are replaced by reorg

func (*ReorgController) Wait

func (rc *ReorgController) Wait() error

Wait wait until reorg is done

func (*ReorgController) WaitDepthReached

func (rc *ReorgController) WaitDepthReached() error

WaitDepthReached wait until N alternative blocks are mined

func (*ReorgController) WaitReorgStarted added in v1.3.0

func (rc *ReorgController) WaitReorgStarted()

WaitReorgStarted waits until first alternative block is present

Jump to

Keyboard shortcuts

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