Documentation ¶
Index ¶
- Variables
- type AccountsDBSyncContainer
- type AccountsDBSyncer
- type Closer
- type DataWriter
- type EpochChangeConfirmedNotifier
- type EpochHandler
- type EpochStartPendingMiniBlocksSyncHandler
- type EpochStartTriesSyncHandler
- type EpochStartVerifier
- type ExportFactoryHandler
- type ExportHandler
- type GenesisNodesSetupHandler
- type HardForkBlockProcessor
- type HardforkStorer
- type HeaderSyncHandler
- type HistoryStorer
- type ImportHandler
- type ImportStartHandler
- type MissingHeadersByHashSyncer
- type PendingTransactionProcessor
- type PendingTransactionsSyncHandler
- type RequestHandler
- type SigVerifier
- type StateSyncer
- type TrieSyncContainer
- type TrieSyncer
- type WhiteListHandler
Constants ¶
This section is empty.
Variables ¶
var ErrContainerKeyAlreadyExists = errors.New("provided key already exists in container")
ErrContainerKeyAlreadyExists signals that an element was already set in the container's map
var ErrEmptyChainID = errors.New("empty chain ID")
ErrEmptyChainID signals that empty chain ID was provided
var ErrEmptyExportFolderPath = errors.New("empty export folder path")
ErrEmptyExportFolderPath signals that the provided export folder's length is empty
var ErrEmptyVersionString = errors.New("empty version string")
ErrEmptyVersionString signals that the provided version string is empty
var ErrExpectedOneMetablock = errors.New("expected one metablock")
ErrExpectedOneMetablock signals that exactly one metablock should have been used
var ErrImportingData = errors.New("error importing data")
ErrImportingData signals that an import error occurred
var ErrIncorrectHardforkMessage = errors.New("incorrect hardfork message")
ErrIncorrectHardforkMessage signals that the hardfork message is incorrectly formatted
var ErrInvalidContainerKey = errors.New("element does not exist in container")
ErrInvalidContainerKey signals that an element does not exist in the container's map
var ErrInvalidEpoch = errors.New("invalid epoch")
ErrInvalidEpoch signals that an invalid epoch has been provided
var ErrInvalidFolderName = errors.New("invalid folder name")
ErrInvalidFolderName signals that folder name is nil
var ErrInvalidTimeToWaitAfterHardfork = errors.New("invalid time to wait after hard fork")
ErrInvalidTimeToWaitAfterHardfork signals that an invalid time to wait after hardfork was provided
var ErrInvalidValue = errors.New("invalid value")
ErrInvalidValue signals that the value provided is invalid
var ErrInvalidWaitTime = errors.New("invalid wait time")
ErrInvalidWaitTime signals that nil provided wait time is invalid
var ErrKeyTypeMismatch = errors.New("key type mismatch while importing")
ErrKeyTypeMismatch signals that key type was mismatch during import
var ErrLenMismatch = errors.New("lengths mismatch")
ErrLenMismatch signals that 2 or more slices have different lengths
var ErrNilAccounts = errors.New("nil accounts")
ErrNilAccounts signals that nil accounts was provided
var ErrNilAccountsDBSyncContainer = errors.New("nil accounts db sync container")
ErrNilAccountsDBSyncContainer signals that nil accounts sync container was provided
var ErrNilAntiFloodHandler = errors.New("nil anti flood handler")
ErrNilAntiFloodHandler signals that nil anti flood handler has been provided
var ErrNilArgumentParser = errors.New("nil argument parser")
ErrNilArgumentParser signals that nil argument parser was provided
var ErrNilBlockKeyGen = errors.New("nil block key gen")
ErrNilBlockKeyGen signals that nil block key gen was provided
var ErrNilBlockSigner = errors.New("nil block signer")
ErrNilBlockSigner signals the nil block signer was provided
var ErrNilCacher = errors.New("nil cacher")
ErrNilCacher signals that nil cacher was provided
var ErrNilChanStopNodeProcess = errors.New("nil channel to stop node")
ErrNilChanStopNodeProcess signals that nil channel to stop node was provided
var ErrNilCloser = errors.New("nil closer instance")
ErrNilCloser signals that a nil closer instance was provided
var ErrNilContainerElement = errors.New("element cannot be nil")
ErrNilContainerElement signals when trying to add a nil element in the container
var ErrNilDataPoolHolder = errors.New("nil data pool holder")
ErrNilDataPoolHolder signals that the data pool holder is nil
var ErrNilDataTrieContainer = errors.New("nil data trie container")
ErrNilDataTrieContainer signals that data trie container is nil
var ErrNilEpochConfirmedNotifier = errors.New("nil epoch confirmed notifier")
ErrNilEpochConfirmedNotifier signals that nil epoch confirmed notifier was provided
var ErrNilEpochHandler = errors.New("nil epoch handler")
ErrNilEpochHandler signals that nil epoch handler was provided
var ErrNilExportFactoryHandler = errors.New("nil export factory handler")
ErrNilExportFactoryHandler signals that nil export factory handler has been provided
var ErrNilGenesisNodesSetupHandler = errors.New("nil genesis nodes setup handler")
ErrNilGenesisNodesSetupHandler signals that a nil genesis nodes setup handler has been provided
var ErrNilHardForkBlockProcessor = errors.New("nil hard fork block processor")
ErrNilHardForkBlockProcessor signals that nil hard fork block processor has been provided
var ErrNilHardforkStorer = errors.New("nil hardfork storer")
ErrNilHardforkStorer signals that a nil hardfork storer has been provided
var ErrNilHasher = errors.New("nil Hasher")
ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation
var ErrNilHeaderIntegrityVerifier = errors.New("nil header integrity verifier")
ErrNilHeaderIntegrityVerifier signals that nil header integrity verifier was provided
var ErrNilHeaderSigVerifier = errors.New("nil header sig verifier")
ErrNilHeaderSigVerifier signals that nil header sig verifier was provided
var ErrNilHeaderSyncHandler = errors.New("nil header sync handler")
ErrNilHeaderSyncHandler signals that nil header sync handler was provided
var ErrNilHeaderValidator = errors.New("nil header validator")
ErrNilHeaderValidator signals that nil header validator has been provided
var ErrNilImportHandler = errors.New("nil import handler")
ErrNilImportHandler signals that nil import handler has been provided
var ErrNilImportStartHandler = errors.New("nil import start handler")
ErrNilImportStartHandler signals that a nil import start handler has been provided
var ErrNilInterceptorsContainer = errors.New("nil interceptors container")
ErrNilInterceptorsContainer signals that a nil interceptors container has been provided
var ErrNilKeyGenerator = errors.New("nil key generator")
ErrNilKeyGenerator signals that nil key generator was provided
var ErrNilMarshalizer = errors.New("nil Marshalizer")
ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation
var ErrNilMessenger = errors.New("nil Messenger")
ErrNilMessenger signals that a nil Messenger object was provided
var ErrNilMiniBlocksSyncHandler = errors.New("nil miniblocks sync handler")
ErrNilMiniBlocksSyncHandler signals that nil miniblocks sync handler was provided
var ErrNilMultiSigner = errors.New("nil multi signer")
ErrNilMultiSigner signals that nil multi signer was provided
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")
ErrNilNodesCoordinator signals that nil nodes coordinator was provided
var ErrNilPendingTxProcessor = errors.New("nil pending tx processor")
ErrNilPendingTxProcessor signals that nil pending tx processor has been provided
var ErrNilPubKeyConverter = errors.New("nil public key converter")
ErrNilPubKeyConverter signals that a nil public key converter was provided
var ErrNilRequestHandler = errors.New("nil request handler")
ErrNilRequestHandler signals that a nil request handler interface was provided
var ErrNilResolverContainer = errors.New("nil resolver container")
ErrNilResolverContainer signals that a nil resolver container was provided
var ErrNilRounder = errors.New("nil rounder")
ErrNilRounder signals that nil rounder has been provided
var ErrNilRwdTxProcessor = errors.New("nil reward transaction processor")
ErrNilRwdTxProcessor signals that nil reward transaction processor has been provided
var ErrNilSCRProcessor = errors.New("nil smart contract result processor")
ErrNilSCRProcessor signals that nil smart contract result processor has been provided
var ErrNilShardCoordinator = errors.New("nil shard coordinator")
ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator
var ErrNilSingleSigner = errors.New("nil single signer")
ErrNilSingleSigner signals that nil single signer was provided
var ErrNilStateSyncer = errors.New("nil state syncer")
ErrNilStateSyncer signals that state syncer is nil
var ErrNilStorage = errors.New("nil storage")
ErrNilStorage signals that storage is nil
var ErrNilStorageManager = errors.New("nil trie storage manager")
ErrNilStorageManager signals that nil storage manager has been provided
var ErrNilTimeCache = errors.New("nil time cache")
ErrNilTimeCache signals that a nil time cache was provided
var ErrNilTransactionsSyncHandler = errors.New("nil transaction sync handler")
ErrNilTransactionsSyncHandler signals that nil transactions sync handler was provided
var ErrNilTrieDataGetter = errors.New("nil trie data getter provided")
ErrNilTrieDataGetter signals that a nil trie data getter has been provided
var ErrNilTrieStorageManagers = errors.New("nil trie storage managers")
ErrNilTrieStorageManagers signals that nil trie storage managers has been provided
var ErrNilTrieSyncers = errors.New("nil trie syncers")
ErrNilTrieSyncers signals that trie syncers container is nil
var ErrNilTxCoordinator = errors.New("nil tx coordinator")
ErrNilTxCoordinator signals that nil tx coordinator has been provided
var ErrNilTxProcessor = errors.New("nil transaction processor")
ErrNilTxProcessor signals that nil transaction processor has been provided
var ErrNilUint64Converter = errors.New("unit64converter is nil")
ErrNilUint64Converter signals that uint64converter is nil
var ErrNilValidityAttester = errors.New("nil validity attester")
ErrNilValidityAttester signals that nil validity was provided
var ErrNilWhiteListHandler = errors.New("nil white list handler")
ErrNilWhiteListHandler signals that white list handler is nil
var ErrNotEpochStartBlock = errors.New("not epoch start block")
ErrNotEpochStartBlock signals that block is not of type epoch start
var ErrNotSynced = errors.New("not synced")
ErrNotSynced signals that syncing has not been finished yet
var ErrTimeIsOut = errors.New("time is out")
ErrTimeIsOut signals that time is out
var ErrTriggerAlreadyInAction = errors.New("trigger already in action")
ErrTriggerAlreadyInAction signals that the trigger is already in action, can not re-enter
var ErrTriggerNotEnabled = errors.New("trigger is not enabled")
ErrTriggerNotEnabled signals that the trigger is not enabled
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
var ErrUnknownType = errors.New("unknown type")
ErrUnknownType signals that type is unknown
var ErrWrongTypeAssertion = errors.New("wrong type assertion")
ErrWrongTypeAssertion signals wrong type assertion
var ErrWrongTypeInContainer = errors.New("wrong type of object inside container")
ErrWrongTypeInContainer signals that a wrong type of object was found in container
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 DataWriter ¶
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 ¶
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 ¶
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