sm_gpa_utils

package
v1.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockFromFilePath

func BlockFromFilePath(filePath string) (state.Block, error)

func BlockIndexFromFilePath

func BlockIndexFromFilePath(filePath string) (uint32, error)

func CheckBlockInStore

func CheckBlockInStore(t require.TestingT, store state.Store, origBlock state.Block)

func CheckStateInStore

func CheckStateInStore(t require.TestingT, store state.Store, origState state.State)

func CheckStateInStores

func CheckStateInStores(t require.TestingT, storeOrig, storeNew state.Store, commitment *state.L1Commitment)

-----------------------------------------------------------------------------

func NewReadOnlyStore

func NewReadOnlyStore(store state.Store) state.Store

Types

type BlockCache

type BlockCache interface {
	AddBlock(state.Block)
	GetBlock(*state.L1Commitment) state.Block
	CleanOlderThan(time.Time)
	Size() int
}

func NewBlockCache

func NewBlockCache(tp TimeProvider, maxCacheSize int, wal BlockWAL, metrics *metrics.ChainStateManagerMetrics, log *logger.Logger) (BlockCache, error)

type BlockFactory

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

func NewBlockFactory

func NewBlockFactory(t require.TestingT, chainInitParamsOpt ...dict.Dict) *BlockFactory

func (*BlockFactory) GetAliasOutput

func (bfT *BlockFactory) GetAliasOutput(commitment *state.L1Commitment) *isc.AliasOutputWithID

func (*BlockFactory) GetBlocks

func (bfT *BlockFactory) GetBlocks(
	count,
	branchingFactor int,
) []state.Block

func (*BlockFactory) GetBlocksFrom

func (bfT *BlockFactory) GetBlocksFrom(
	count,
	branchingFactor int,
	commitment *state.L1Commitment,
	incrementFactorOpt ...uint64,
) []state.Block

func (*BlockFactory) GetChainID

func (bfT *BlockFactory) GetChainID() isc.ChainID

func (*BlockFactory) GetChainInitParameters

func (bfT *BlockFactory) GetChainInitParameters() dict.Dict

func (*BlockFactory) GetNextBlock

func (bfT *BlockFactory) GetNextBlock(
	commitment *state.L1Commitment,
	incrementOpt ...uint64,
) state.Block

func (*BlockFactory) GetOriginBlock

func (bfT *BlockFactory) GetOriginBlock() state.Block

func (*BlockFactory) GetOriginOutput

func (bfT *BlockFactory) GetOriginOutput() *isc.AliasOutputWithID

func (*BlockFactory) GetStateDraft

func (bfT *BlockFactory) GetStateDraft(block state.Block) state.StateDraft

func (*BlockFactory) GetStore

func (bfT *BlockFactory) GetStore() state.Store

type BlockKey

type BlockKey state.BlockHash

Type for block identifier to be used when putting blocks in maps.

func NewBlockKey

func NewBlockKey(commitment *state.L1Commitment) BlockKey

func (BlockKey) AsBlockHash

func (bkT BlockKey) AsBlockHash() state.BlockHash

func (BlockKey) Equals

func (bkT BlockKey) Equals(other BlockKey) bool

func (BlockKey) String

func (bkT BlockKey) String() string

type BlockWAL

type BlockWAL interface {
	Write(state.Block) error
	Contains(state.BlockHash) bool
	Read(state.BlockHash) (state.Block, error)
	ReadAllByStateIndex(cb func(stateIndex uint32, block state.Block) bool) error
}

func NewBlockWAL

func NewBlockWAL(log *logger.Logger, baseDir string, chainID isc.ChainID, metrics *metrics.ChainBlockWALMetrics) (BlockWAL, error)

func NewEmptyBlockWAL

func NewEmptyBlockWAL() BlockWAL

type TestBlockWAL

type TestBlockWAL interface {
	BlockWAL
	Delete(state.BlockHash) bool
}

May be used only for tests; deleting in production should not be available.

func NewEmptyTestBlockWAL

func NewEmptyTestBlockWAL() TestBlockWAL

func NewMockedTestBlockWAL

func NewMockedTestBlockWAL() TestBlockWAL

type TimeProvider

type TimeProvider interface {
	SetNow(time.Time)
	GetNow() time.Time
	After(time.Duration) <-chan time.Time
}

func NewArtifficialTimeProvider

func NewArtifficialTimeProvider(nowOpt ...time.Time) TimeProvider

func NewDefaultTimeProvider

func NewDefaultTimeProvider() TimeProvider

Jump to

Keyboard shortcuts

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