mocks

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: AGPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpochQuery

type EpochQuery struct {
	// contains filtered or unexported fields
}

EpochQuery implements protocol.EpochQuery for testing purposes.

func NewEpochQuery

func NewEpochQuery(t *testing.T, counter uint64, epochs ...protocol.Epoch) *EpochQuery

func (*EpochQuery) Add

func (mock *EpochQuery) Add(epoch protocol.Epoch)

func (*EpochQuery) ByCounter

func (mock *EpochQuery) ByCounter(counter uint64) protocol.Epoch

func (*EpochQuery) Current

func (mock *EpochQuery) Current() protocol.Epoch

func (*EpochQuery) Next

func (mock *EpochQuery) Next() protocol.Epoch

func (*EpochQuery) Previous

func (mock *EpochQuery) Previous() protocol.Epoch

func (*EpochQuery) Transition

func (mock *EpochQuery) Transition()

type ExecutionState

type ExecutionState struct {
	sync.Mutex
	mock.ExecutionState
	// contains filtered or unexported fields
}

ExecutionState is a mocked version of execution state that simulates some of its behavior for testing purpose

func NewExecutionState

func NewExecutionState(seal *flow.Seal) *ExecutionState

func (*ExecutionState) ExecuteBlock

func (es *ExecutionState) ExecuteBlock(t *testing.T, block *flow.Block)

func (*ExecutionState) PersistStateCommitment

func (es *ExecutionState) PersistStateCommitment(ctx context.Context, blockID flow.Identifier, commit flow.StateCommitment) error

func (*ExecutionState) StateCommitmentByBlockID

func (es *ExecutionState) StateCommitmentByBlockID(ctx context.Context, blockID flow.Identifier) (flow.StateCommitment, error)

type Params

type Params struct {
	// contains filtered or unexported fields
}

func (*Params) ChainID

func (p *Params) ChainID() (flow.ChainID, error)

func (*Params) ProtocolVersion

func (p *Params) ProtocolVersion() (uint, error)

func (*Params) Root

func (p *Params) Root() (*flow.Header, error)

func (*Params) Seal

func (p *Params) Seal() (*flow.Seal, error)

func (*Params) SporkID

func (p *Params) SporkID() (flow.Identifier, error)

type ProtocolState

type ProtocolState struct {
	sync.Mutex
	protocol.MutableState
	// contains filtered or unexported fields
}

ProtocolState is a mocked version of protocol state, which has very close behavior to the real implementation but for testing purpose. If you are testing a module that depends on protocol state's behavior, but you don't want to mock up the methods and its return value, then just use this module

func NewProtocolState

func NewProtocolState() *ProtocolState

func (*ProtocolState) AtBlockID

func (ps *ProtocolState) AtBlockID(blockID flow.Identifier) protocol.Snapshot

func (*ProtocolState) AtHeight

func (ps *ProtocolState) AtHeight(height uint64) protocol.Snapshot

func (*ProtocolState) Bootstrap

func (m *ProtocolState) Bootstrap(root *flow.Block, result *flow.ExecutionResult, seal *flow.Seal) error

func (*ProtocolState) Extend

func (m *ProtocolState) Extend(block *flow.Block) error

func (*ProtocolState) Final

func (ps *ProtocolState) Final() protocol.Snapshot

func (*ProtocolState) Finalize

func (m *ProtocolState) Finalize(blockID flow.Identifier) error

func (*ProtocolState) Params

func (ps *ProtocolState) Params() protocol.Params

Jump to

Keyboard shortcuts

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