Documentation
¶
Overview ¶
Package chaintest provides test utilities for chains
Package chaintest provides test utilities for chain testing ¶
Package chaintest provides test utilities for chain testing
Index ¶
- Variables
- type TestBlock
- func (b *TestBlock) Accept(ctx context.Context) error
- func (b *TestBlock) Bytes() []byte
- func (b *TestBlock) Height() uint64
- func (b *TestBlock) ID() ids.ID
- func (b *TestBlock) Parent() ids.ID
- func (b *TestBlock) ParentID() ids.ID
- func (b *TestBlock) Reject(ctx context.Context) error
- func (b *TestBlock) Status() uint8
- func (b *TestBlock) Timestamp() time.Time
- func (b *TestBlock) Verify(ctx context.Context) error
- type TestChain
- type VM
- func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)
- func (vm *VM) GetBlock(ctx context.Context, id ids.ID) (block.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) ParseBlock(ctx context.Context, bytes []byte) (block.Block, error)
- func (vm *VM) SetPreference(ctx context.Context, id ids.ID) error
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Genesis = &TestBlock{ id: ids.GenerateTestID(), parentID: ids.Empty, height: 0, bytes: []byte("genesis"), status: uint8(choices.Accepted), timestamp: time.Now(), BytesV: []byte("genesis"), ParentV: ids.Empty, Decidable: choices.Decidable{Status: choices.Accepted}, }
Genesis is the genesis test block
Functions ¶
This section is empty.
Types ¶
type TestBlock ¶
type TestBlock struct {
// Additional fields for BFT testing
BytesV []byte
ParentV ids.ID
Decidable choices.Decidable
// contains filtered or unexported fields
}
TestBlock is a mock block for testing
func BuildChildWithTime ¶
BuildChildWithTime builds a child block with timestamp
type TestChain ¶
type TestChain struct {
// contains filtered or unexported fields
}
TestChain provides a test implementation for chains
type VM ¶ added in v1.19.8
VM is a test VM for chain testing
func (*VM) BuildBlock ¶ added in v1.19.8
BuildBlock builds a new block
func (*VM) GetBlockIDAtHeight ¶ added in v1.19.8
GetBlockIDAtHeight gets the block ID at a given height
func (*VM) Initialize ¶ added in v1.19.8
func (vm *VM) Initialize( ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, msgChan interface{}, fxs []interface{}, appSender interface{}, ) error
Initialize initializes the VM
func (*VM) LastAccepted ¶ added in v1.19.8
LastAccepted returns the last accepted block ID
func (*VM) ParseBlock ¶ added in v1.19.8
ParseBlock parses a block from bytes
func (*VM) SetPreference ¶ added in v1.19.8
SetPreference sets the preferred block ID
Click to show internal directories.
Click to hide internal directories.