update

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContainerKeyAlreadyExists = errors.New("provided key already exists in container")

ErrContainerKeyAlreadyExists signals that an element was already set in the container's map

View Source
var ErrEmptyChainID = errors.New("empty chain ID")

ErrEmptyChainID signals that empty chain ID was provided

View Source
var ErrEmptyExportFolderPath = errors.New("empty export folder path")

ErrEmptyExportFolderPath signals that the provided export folder's length is empty

View Source
var ErrEmptyVersionString = errors.New("empty version string")

ErrEmptyVersionString signals that the provided version string is empty

View Source
var ErrExpectedOneMetablock = errors.New("expected one metablock")

ErrExpectedOneMetablock signals that exactly one metablock should have been used

View Source
var ErrImportingData = errors.New("error importing data")

ErrImportingData signals that an import error occurred

View Source
var ErrIncorrectHardforkMessage = errors.New("incorrect hardfork message")

ErrIncorrectHardforkMessage signals that the hardfork message is incorrectly formatted

View Source
var ErrInvalidContainerKey = errors.New("element does not exist in container")

ErrInvalidContainerKey signals that an element does not exist in the container's map

View Source
var ErrInvalidEpoch = errors.New("invalid epoch")

ErrInvalidEpoch signals that an invalid epoch has been provided

View Source
var ErrInvalidFolderName = errors.New("invalid folder name")

ErrInvalidFolderName signals that folder name is nil

View Source
var ErrInvalidTimeToWaitAfterHardfork = errors.New("invalid time to wait after hard fork")

ErrInvalidTimeToWaitAfterHardfork signals that an invalid time to wait after hardfork was provided

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that the value provided is invalid

View Source
var ErrInvalidWaitTime = errors.New("invalid wait time")

ErrInvalidWaitTime signals that nil provided wait time is invalid

View Source
var ErrKeyTypeMismatch = errors.New("key type mismatch while importing")

ErrKeyTypeMismatch signals that key type was mismatch during import

View Source
var ErrLenMismatch = errors.New("lengths mismatch")

ErrLenMismatch signals that 2 or more slices have different lengths

View Source
var ErrNilAccounts = errors.New("nil accounts")

ErrNilAccounts signals that nil accounts was provided

View Source
var ErrNilAccountsDBSyncContainer = errors.New("nil accounts db sync container")

ErrNilAccountsDBSyncContainer signals that nil accounts sync container was provided

View Source
var ErrNilAntiFloodHandler = errors.New("nil anti flood handler")

ErrNilAntiFloodHandler signals that nil anti flood handler has been provided

View Source
var ErrNilArgumentParser = errors.New("nil argument parser")

ErrNilArgumentParser signals that nil argument parser was provided

View Source
var ErrNilBlockKeyGen = errors.New("nil block key gen")

ErrNilBlockKeyGen signals that nil block key gen was provided

View Source
var ErrNilBlockSigner = errors.New("nil block signer")

ErrNilBlockSigner signals the nil block signer was provided

View Source
var ErrNilCacher = errors.New("nil cacher")

ErrNilCacher signals that nil cacher was provided

View Source
var ErrNilChanStopNodeProcess = errors.New("nil channel to stop node")

ErrNilChanStopNodeProcess signals that nil channel to stop node was provided

View Source
var ErrNilCloser = errors.New("nil closer instance")

ErrNilCloser signals that a nil closer instance was provided

View Source
var ErrNilContainerElement = errors.New("element cannot be nil")

ErrNilContainerElement signals when trying to add a nil element in the container

View Source
var ErrNilDataPoolHolder = errors.New("nil data pool holder")

ErrNilDataPoolHolder signals that the data pool holder is nil

View Source
var ErrNilDataTrieContainer = errors.New("nil data trie container")

ErrNilDataTrieContainer signals that data trie container is nil

View Source
var ErrNilEpochConfirmedNotifier = errors.New("nil epoch confirmed notifier")

ErrNilEpochConfirmedNotifier signals that nil epoch confirmed notifier was provided

View Source
var ErrNilEpochHandler = errors.New("nil epoch handler")

ErrNilEpochHandler signals that nil epoch handler was provided

View Source
var ErrNilExportFactoryHandler = errors.New("nil export factory handler")

ErrNilExportFactoryHandler signals that nil export factory handler has been provided

View Source
var ErrNilGenesisNodesSetupHandler = errors.New("nil genesis nodes setup handler")

ErrNilGenesisNodesSetupHandler signals that a nil genesis nodes setup handler has been provided

View Source
var ErrNilHardForkBlockProcessor = errors.New("nil hard fork block processor")

ErrNilHardForkBlockProcessor signals that nil hard fork block processor has been provided

View Source
var ErrNilHardforkStorer = errors.New("nil hardfork storer")

ErrNilHardforkStorer signals that a nil hardfork storer has been provided

View Source
var ErrNilHasher = errors.New("nil Hasher")

ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation

View Source
var ErrNilHeaderIntegrityVerifier = errors.New("nil header integrity verifier")

ErrNilHeaderIntegrityVerifier signals that nil header integrity verifier was provided

View Source
var ErrNilHeaderSigVerifier = errors.New("nil header sig verifier")

ErrNilHeaderSigVerifier signals that nil header sig verifier was provided

View Source
var ErrNilHeaderSyncHandler = errors.New("nil header sync handler")

ErrNilHeaderSyncHandler signals that nil header sync handler was provided

View Source
var ErrNilHeaderValidator = errors.New("nil header validator")

ErrNilHeaderValidator signals that nil header validator has been provided

View Source
var ErrNilImportHandler = errors.New("nil import handler")

ErrNilImportHandler signals that nil import handler has been provided

View Source
var ErrNilImportStartHandler = errors.New("nil import start handler")

ErrNilImportStartHandler signals that a nil import start handler has been provided

View Source
var ErrNilInterceptorsContainer = errors.New("nil interceptors container")

ErrNilInterceptorsContainer signals that a nil interceptors container has been provided

View Source
var ErrNilKeyGenerator = errors.New("nil key generator")

ErrNilKeyGenerator signals that nil key generator was provided

View Source
var ErrNilMarshalizer = errors.New("nil Marshalizer")

ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation

View Source
var ErrNilMessenger = errors.New("nil Messenger")

ErrNilMessenger signals that a nil Messenger object was provided

View Source
var ErrNilMiniBlocksSyncHandler = errors.New("nil miniblocks sync handler")

ErrNilMiniBlocksSyncHandler signals that nil miniblocks sync handler was provided

View Source
var ErrNilMultiSigner = errors.New("nil multi signer")

ErrNilMultiSigner signals that nil multi signer was provided

View Source
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")

ErrNilNodesCoordinator signals that nil nodes coordinator was provided

View Source
var ErrNilPendingTxProcessor = errors.New("nil pending tx processor")

ErrNilPendingTxProcessor signals that nil pending tx processor has been provided

View Source
var ErrNilPubKeyConverter = errors.New("nil public key converter")

ErrNilPubKeyConverter signals that a nil public key converter was provided

View Source
var ErrNilRequestHandler = errors.New("nil request handler")

ErrNilRequestHandler signals that a nil request handler interface was provided

View Source
var ErrNilResolverContainer = errors.New("nil resolver container")

ErrNilResolverContainer signals that a nil resolver container was provided

View Source
var ErrNilRounder = errors.New("nil rounder")

ErrNilRounder signals that nil rounder has been provided

View Source
var ErrNilRwdTxProcessor = errors.New("nil reward transaction processor")

ErrNilRwdTxProcessor signals that nil reward transaction processor has been provided

View Source
var ErrNilSCRProcessor = errors.New("nil smart contract result processor")

ErrNilSCRProcessor signals that nil smart contract result processor has been provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator")

ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator

View Source
var ErrNilSingleSigner = errors.New("nil single signer")

ErrNilSingleSigner signals that nil single signer was provided

View Source
var ErrNilStateSyncer = errors.New("nil state syncer")

ErrNilStateSyncer signals that state syncer is nil

View Source
var ErrNilStorage = errors.New("nil storage")

ErrNilStorage signals that storage is nil

View Source
var ErrNilStorageManager = errors.New("nil trie storage manager")

ErrNilStorageManager signals that nil storage manager has been provided

View Source
var ErrNilTimeCache = errors.New("nil time cache")

ErrNilTimeCache signals that a nil time cache was provided

View Source
var ErrNilTransactionsSyncHandler = errors.New("nil transaction sync handler")

ErrNilTransactionsSyncHandler signals that nil transactions sync handler was provided

View Source
var ErrNilTrieDataGetter = errors.New("nil trie data getter provided")

ErrNilTrieDataGetter signals that a nil trie data getter has been provided

View Source
var ErrNilTrieStorageManagers = errors.New("nil trie storage managers")

ErrNilTrieStorageManagers signals that nil trie storage managers has been provided

View Source
var ErrNilTrieSyncers = errors.New("nil trie syncers")

ErrNilTrieSyncers signals that trie syncers container is nil

View Source
var ErrNilTxCoordinator = errors.New("nil tx coordinator")

ErrNilTxCoordinator signals that nil tx coordinator has been provided

View Source
var ErrNilTxProcessor = errors.New("nil transaction processor")

ErrNilTxProcessor signals that nil transaction processor has been provided

View Source
var ErrNilUint64Converter = errors.New("unit64converter is nil")

ErrNilUint64Converter signals that uint64converter is nil

View Source
var ErrNilValidityAttester = errors.New("nil validity attester")

ErrNilValidityAttester signals that nil validity was provided

View Source
var ErrNilWhiteListHandler = errors.New("nil white list handler")

ErrNilWhiteListHandler signals that white list handler is nil

View Source
var ErrNotEpochStartBlock = errors.New("not epoch start block")

ErrNotEpochStartBlock signals that block is not of type epoch start

View Source
var ErrNotSynced = errors.New("not synced")

ErrNotSynced signals that syncing has not been finished yet

View Source
var ErrTimeIsOut = errors.New("time is out")

ErrTimeIsOut signals that time is out

View Source
var ErrTriggerAlreadyInAction = errors.New("trigger already in action")

ErrTriggerAlreadyInAction signals that the trigger is already in action, can not re-enter

View Source
var ErrTriggerNotEnabled = errors.New("trigger is not enabled")

ErrTriggerNotEnabled signals that the trigger is not enabled

View Source
var ErrTriggerPubKeyMismatch = errors.New("trigger public key mismatch")

ErrTriggerPubKeyMismatch signals that there is a mismatch between the public key received and the one read from the config

View Source
var ErrUnknownType = errors.New("unknown type")

ErrUnknownType signals that type is unknown

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals wrong type assertion

View Source
var ErrWrongTypeInContainer = errors.New("wrong type of object inside container")

ErrWrongTypeInContainer signals that a wrong type of object was found in container

View Source
var ErrWrongUnfinishedMetaHdrsMap = errors.New("wrong unfinished meta headers map")

ErrWrongUnfinishedMetaHdrsMap signals that wrong unfinished meta headers map was provided

Functions

This section is empty.

Types

type AccountsDBSyncContainer

type AccountsDBSyncContainer interface {
	Get(key string) (AccountsDBSyncer, error)
	Add(key string, val AccountsDBSyncer) error
	AddMultiple(keys []string, values []AccountsDBSyncer) error
	Replace(key string, val AccountsDBSyncer) error
	Remove(key string)
	Len() int
	IsInterfaceNil() bool
}

AccountsDBSyncContainer keep a list of TrieSyncer

type AccountsDBSyncer

type AccountsDBSyncer interface {
	GetSyncedTries() map[string]data.Trie
	SyncAccounts(rootHash []byte) error
	IsInterfaceNil() bool
}

AccountsDBSyncer defines the methods for the accounts db syncer

type Closer

type Closer interface {
	Close() error
	IsInterfaceNil() bool
}

Closer defines the functionality of an entity that can be closed

type DataWriter

type DataWriter interface {
	WriteString(s string) (int, error)
	Flush() error
}

DataWriter defines the methods to write data

type EpochChangeConfirmedNotifier

type EpochChangeConfirmedNotifier interface {
	RegisterForEpochChangeConfirmed(handler func(epoch uint32))
	IsInterfaceNil() bool
}

EpochChangeConfirmedNotifier defines the functionality needed to register for the epoch change confirmed event

type EpochHandler

type EpochHandler interface {
	MetaEpoch() uint32
	IsInterfaceNil() bool
}

EpochHandler defines the functionality to get the current epoch

type EpochStartPendingMiniBlocksSyncHandler

type EpochStartPendingMiniBlocksSyncHandler interface {
	SyncPendingMiniBlocksFromMeta(epochStart *block.MetaBlock, unFinished map[string]*block.MetaBlock, ctx context.Context) error
	GetMiniBlocks() (map[string]*block.MiniBlock, error)
	IsInterfaceNil() bool
}

EpochStartPendingMiniBlocksSyncHandler defines the methods to sync all pending miniblocks

type EpochStartTriesSyncHandler

type EpochStartTriesSyncHandler interface {
	SyncTriesFrom(meta *block.MetaBlock, waitTime time.Duration) error
	GetTries() (map[string]data.Trie, error)
	IsInterfaceNil() bool
}

EpochStartTriesSyncHandler defines the methods to sync all tries from a given epoch start metablock

type EpochStartVerifier

type EpochStartVerifier interface {
	IsEpochStart() bool
	Epoch() uint32
	EpochStartMetaHdrHash() []byte
	IsInterfaceNil() bool
}

EpochStartVerifier defines the functionality needed by sync all state from epochTrigger

type ExportFactoryHandler

type ExportFactoryHandler interface {
	Create() (ExportHandler, error)
	IsInterfaceNil() bool
}

ExportFactoryHandler defines the functionality to create and export handler

type ExportHandler

type ExportHandler interface {
	ExportAll(epoch uint32) error
	IsInterfaceNil() bool
}

ExportHandler defines the methods to export the current state of the blockchain

type GenesisNodesSetupHandler added in v0.0.2

type GenesisNodesSetupHandler interface {
	InitialNodesInfoForShard(shardId uint32) ([]sharding.GenesisNodeInfoHandler, []sharding.GenesisNodeInfoHandler, error)
	InitialNodesInfo() (map[uint32][]sharding.GenesisNodeInfoHandler, map[uint32][]sharding.GenesisNodeInfoHandler)
	GetStartTime() int64
	GetRoundDuration() uint64
	GetChainId() string
	GetMinTransactionVersion() uint32
	GetShardConsensusGroupSize() uint32
	GetMetaConsensusGroupSize() uint32
	MinNumberOfShardNodes() uint32
	MinNumberOfMetaNodes() uint32
	GetHysteresis() float32
	GetAdaptivity() bool
	NumberOfShards() uint32
	MinNumberOfNodes() uint32
	IsInterfaceNil() bool
}

GenesisNodesSetupHandler returns the genesis nodes info

type HardForkBlockProcessor

type HardForkBlockProcessor interface {
	CreateNewBlock(chainID string, round uint64, nonce uint64, epoch uint32) (data.HeaderHandler, data.BodyHandler, error)
	IsInterfaceNil() bool
}

HardForkBlockProcessor defines the methods to process after hardfork

type HardforkStorer added in v0.0.2

type HardforkStorer interface {
	Write(identifier string, key []byte, value []byte) error
	FinishedIdentifier(identifier string) error
	RangeKeys(handler func(identifier string, keys [][]byte) bool)
	Get(identifier string, key []byte) ([]byte, error)
	Close() error
	IsInterfaceNil() bool
}

HardforkStorer manages the export and import of data

type HeaderSyncHandler

type HeaderSyncHandler interface {
	SyncUnFinishedMetaHeaders(epoch uint32) error
	GetEpochStartMetaBlock() (*block.MetaBlock, error)
	GetUnfinishedMetaBlocks() (map[string]*block.MetaBlock, error)
	IsInterfaceNil() bool
}

HeaderSyncHandler defines the methods to sync and get the epoch start metablock

type HistoryStorer

type HistoryStorer interface {
	Put(key, data []byte) error
	Get(key []byte) ([]byte, error)
	Has(key []byte) error
	Remove(key []byte) error
	ClearCache()
	DestroyUnit() error
	GetFromEpoch(key []byte, epoch uint32) ([]byte, error)
	HasInEpoch(key []byte, epoch uint32) error

	IsInterfaceNil() bool
}

HistoryStorer provides storage services in a two layered storage construct, where the first layer is represented by a cache and second layer by a persitent storage (DB-like)

type ImportHandler

type ImportHandler interface {
	ImportAll() error
	GetValidatorAccountsDB() state.AccountsAdapter
	GetMiniBlocks() map[string]*block.MiniBlock
	GetHardForkMetaBlock() *block.MetaBlock
	GetTransactions() map[string]data.TransactionHandler
	GetAccountsDBForShard(shardID uint32) state.AccountsAdapter
	IsInterfaceNil() bool
}

ImportHandler defines the methods to import the full state of the blockchain

type ImportStartHandler

type ImportStartHandler interface {
	IsAfterExportBeforeImport() bool
	ShouldStartImport() bool
	ResetStartImport() error
	SetStartImport() error
	IsInterfaceNil() bool
}

ImportStartHandler can manage the process of starting the import after the hardfork event

type MissingHeadersByHashSyncer

type MissingHeadersByHashSyncer interface {
	SyncMissingHeadersByHash(shardIDs []uint32, headersHashes [][]byte, ctx context.Context) error
	GetHeaders() (map[string]data.HeaderHandler, error)
	ClearFields()
	IsInterfaceNil() bool
}

MissingHeadersByHashSyncer defines the methods to sync all missing headers by hash

type PendingTransactionProcessor

type PendingTransactionProcessor interface {
	ProcessTransactionsDstMe(mapTxs map[string]data.TransactionHandler) (block.MiniBlockSlice, error)
	RootHash() ([]byte, error)
	IsInterfaceNil() bool
}

PendingTransactionProcessor defines the methods to process a transaction destination me

type PendingTransactionsSyncHandler

type PendingTransactionsSyncHandler interface {
	SyncPendingTransactionsFor(miniBlocks map[string]*block.MiniBlock, epoch uint32, ctx context.Context) error
	GetTransactions() (map[string]data.TransactionHandler, error)
	IsInterfaceNil() bool
}

PendingTransactionsSyncHandler defines the methods to sync all transactions from a set of miniblocks

type RequestHandler

type RequestHandler interface {
	RequestTransaction(shardId uint32, txHashes [][]byte)
	RequestUnsignedTransactions(destShardID uint32, scrHashes [][]byte)
	RequestRewardTransactions(destShardID uint32, txHashes [][]byte)
	RequestMiniBlock(shardId uint32, miniblockHash []byte)
	RequestStartOfEpochMetaBlock(epoch uint32)
	RequestShardHeader(shardId uint32, hash []byte)
	RequestMetaHeader(hash []byte)
	RequestMetaHeaderByNonce(nonce uint64)
	RequestShardHeaderByNonce(shardId uint32, nonce uint64)
	RequestTrieNodes(destShardID uint32, hashes [][]byte, topic string)
	RequestInterval() time.Duration
	SetNumPeersToQuery(key string, intra int, cross int) error
	GetNumPeersToQuery(key string) (int, int, error)
	IsInterfaceNil() bool
}

RequestHandler defines the methods through which request to data can be made

type SigVerifier

type SigVerifier interface {
	Verify(message []byte, sig []byte, pk []byte) error
	IsInterfaceNil() bool
}

SigVerifier is used to verify the signature on a provided message

type StateSyncer

type StateSyncer interface {
	GetEpochStartMetaBlock() (*block.MetaBlock, error)
	GetUnfinishedMetaBlocks() (map[string]*block.MetaBlock, error)
	SyncAllState(epoch uint32) error
	GetAllTries() (map[string]data.Trie, error)
	GetAllTransactions() (map[string]data.TransactionHandler, error)
	GetAllMiniBlocks() (map[string]*block.MiniBlock, error)
	IsInterfaceNil() bool
}

StateSyncer interface defines the methods needed to sync and get all states

type TrieSyncContainer

type TrieSyncContainer interface {
	Get(key string) (TrieSyncer, error)
	Add(key string, val TrieSyncer) error
	AddMultiple(keys []string, interceptors []TrieSyncer) error
	Replace(key string, val TrieSyncer) error
	Remove(key string)
	Len() int
	IsInterfaceNil() bool
}

TrieSyncContainer keep a list of TrieSyncer

type TrieSyncer

type TrieSyncer interface {
	StartSyncing(rootHash []byte, ctx context.Context) error
	Trie() data.Trie
	IsInterfaceNil() bool
}

TrieSyncer synchronizes the trie, asking on the network for the missing nodes

type WhiteListHandler

type WhiteListHandler interface {
	Remove(keys [][]byte)
	Add(keys [][]byte)
	IsWhiteListed(interceptedData process.InterceptedData) bool
	IsInterfaceNil() bool
}

WhiteListHandler is the interface needed to add whitelisted data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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