Documentation ¶
Index ¶
- Constants
- Variables
- func EmptyChannel(ch chan bool) int
- func GetMarshalizedHeaderFromStorage(blockUnit dataRetriever.UnitType, hash []byte, marshalizer marshal.Marshalizer, ...) ([]byte, error)
- func GetMetaHeader(hash []byte, cacher storage.Cacher, marshalizer marshal.Marshalizer, ...) (*block.MetaBlock, error)
- func GetMetaHeaderFromPool(hash []byte, cacher storage.Cacher) (*block.MetaBlock, error)
- func GetMetaHeaderFromPoolWithNonce(nonce uint64, cacher storage.Cacher, ...) (*block.MetaBlock, []byte, error)
- func GetMetaHeaderFromStorage(hash []byte, marshalizer marshal.Marshalizer, ...) (*block.MetaBlock, error)
- func GetMetaHeaderFromStorageWithNonce(nonce uint64, storageService dataRetriever.StorageService, ...) (*block.MetaBlock, []byte, error)
- func GetMetaHeaderWithNonce(nonce uint64, cacher storage.Cacher, ...) (*block.MetaBlock, []byte, error)
- func GetShardHeader(hash []byte, cacher storage.Cacher, marshalizer marshal.Marshalizer, ...) (*block.Header, error)
- func GetShardHeaderFromPool(hash []byte, cacher storage.Cacher) (*block.Header, error)
- func GetShardHeaderFromPoolWithNonce(nonce uint64, shardId uint32, cacher storage.Cacher, ...) (*block.Header, []byte, error)
- func GetShardHeaderFromStorage(hash []byte, marshalizer marshal.Marshalizer, ...) (*block.Header, error)
- func GetShardHeaderFromStorageWithNonce(nonce uint64, shardId uint32, storageService dataRetriever.StorageService, ...) (*block.Header, []byte, error)
- func GetShardHeaderWithNonce(nonce uint64, shardId uint32, cacher storage.Cacher, ...) (*block.Header, []byte, error)
- func GetTransactionHandler(senderShardID uint32, destShardID uint32, txHash []byte, ...) (data.TransactionHandler, error)
- func GetTransactionHandlerFromPool(senderShardID uint32, destShardID uint32, txHash []byte, ...) (data.TransactionHandler, error)
- func GetTransactionHandlerFromStorage(txHash []byte, storageService dataRetriever.StorageService, ...) (data.TransactionHandler, error)
- func ShardCacherIdentifier(senderShardId uint32, destinationShardId uint32) string
- type ArgumentsParser
- type BlockHeaderState
- type BlockProcessor
- type BlockSizeThrottler
- type BlocksTracker
- type Bootstrapper
- type Checker
- type ChronologyValidator
- type DataPacker
- type ForkDetector
- type HashAccesser
- type HeaderValidator
- type InterceptedBlockBody
- type Interceptor
- type InterceptorsContainer
- type InterceptorsContainerFactory
- type IntermediateProcessorContainer
- type IntermediateProcessorsContainerFactory
- type IntermediateTransactionHandler
- type MessageHandler
- type PoolsCleaner
- type PreProcessor
- type PreProcessorsContainer
- type PreProcessorsContainerFactory
- type RequestHandler
- type RequiredDataPool
- type SigVerifier
- type SignedDataValidator
- type SmartContractProcessor
- type SmartContractResultProcessor
- type TemporaryAccountsHandler
- type TopicHandler
- type TopicMessageHandler
- type TransactionCoordinator
- type TransactionProcessor
- type TransactionType
- type TxTypeHandler
- type TxValidator
- type TxValidatorHandler
- type VirtualMachinesContainer
- type VirtualMachinesContainerFactory
Constants ¶
const GenesisBlockNonce = 0
const MaxGasLimitPerMiniBlock = uint64(100000)
TODO - calculate exactly in case of the VM, for every VM to have a similar constant, operations / seconds
const MaxHeaderRequestsAllowed = 10
const MaxItemsInBlock = 15000
const MaxNoncesDifference = 5
const MaxRequestsWithTimeoutAllowed = 10
const MetaBlockFinality = 1
const MinItemsInBlock = 1000
const ShardBlockFinality = 1
Variables ¶
var ErrAccountStateDirty = errors.New("accountState was dirty before starting to change")
ErrAccountStateDirty signals that the accounts were modified before starting the current modification
var ErrBlockHashDoesNotMatch = errors.New("block hash does not match")
ErrBlockHashDoesNotMatch signals that header hash does not match with the previous one
var ErrBlockHashDoesNotMatchInOtherChainBlock = errors.New("block hash does not match in other chain block")
ErrBlockHashDoesNotMatchInOtherChainBlock signals that header hash does not match with the previous one
var ErrContainerKeyAlreadyExists = errors.New("provided key already exists in container")
ErrContainerKeyAlreadyExists signals that an element was already set in the container's map
var ErrCouldNotDecodeUnderlyingBody = errors.New("could not decode InterceptedBlockBody to block.Body")
ErrCouldNotDecodeUnderlyingBody signals that an InterceptedBlockBody could not be decoded to a block.Body using type assertion
var ErrCrossShardMBWithoutConfirmationFromMeta = errors.New("cross shard miniblock with destination current shard is not confirmed by metachain")
ErrCrossShardMBWithoutConfirmationFromMeta signals that miniblock was not yet notarized by metachain
var ErrEmptyFunctionName = errors.New("empty function name")
ErrEmptyFunctionName signals that an empty function name has been provided
var ErrHeaderBodyMismatch = errors.New("body cannot be validated from header data")
ErrHeaderBodyMismatch signals that the header does not attest all data from the block
var ErrHeaderNotFinal = errors.New("header in metablock is not final")
ErrHeaderNotFinal signals that header is not final and it should be
var ErrHigherNonceInTransaction = errors.New("higher nonce in transaction")
ErrHigherNonceInTransaction signals the nonce in transaction is higher than the account's nonce
var ErrInsufficientFunds = errors.New("insufficient funds")
ErrInsufficientFunds signals the funds are insufficient
var ErrInvalidBlockBodyType = errors.New("invalid block body type")
ErrInvalidBlockBodyType signals that an operation has been attempted with an invalid block body type
var ErrInvalidContainerKey = errors.New("element does not exist in container")
ErrInvalidContainerKey signals that an element does not exist in the container's map
var ErrInvalidDataInput = errors.New("data input is invalid to create key, value storage output")
ErrInvalidDataInput signals that the data input is invalid for parsing
var ErrInvalidRcvAddr = errors.New("invalid receiver address")
ErrInvalidRcvAddr signals that an operation has been attempted to or with an invalid receiver address
var ErrInvalidShardId = errors.New("invalid shard id")
ErrInvalidShardId signals that the shard id is invalid
var ErrInvalidSndAddr = errors.New("invalid sender address")
ErrInvalidSndAddr signals that an operation has been attempted to or with an invalid sender address
var ErrInvalidTxInPool = errors.New("invalid transaction in the transactions pool")
ErrInvalidTxInPool signals an invalid transaction in the transactions pool
var ErrLenMismatch = errors.New("lengths mismatch")
ErrLenMismatch signals that 2 or more slices have different lengths
var ErrLowerNonceInTransaction = errors.New("lower nonce in transaction")
ErrLowerNonceInTransaction signals the nonce in transaction is lower than the account's nonce
var ErrLowerRoundInBlock = errors.New("header round is lower than last committed")
ErrLowerRoundInBlock signals that a header round is too low for processing it
var ErrLowerRoundInOtherChainBlock = errors.New("header round is lower than last committed in other chain block")
ErrLowerRoundInOtherChainBlock signals that header round too low for processing it
var ErrMarshalWithoutSuccess = errors.New("marshal without success")
ErrMarshalWithoutSuccess signals that marshal some data was not done with success
var ErrMiniBlockHashMismatch = errors.New("miniblocks does not match")
ErrMiniBlockHashMismatch signals that miniblock hashes does not match
var ErrMintAddressNotInThisShard = errors.New("mint address does not belong to current shard")
ErrMintAddressNotInThisShard signals that the mint address does not belong to current shard
var ErrMissingBody = errors.New("missing body")
ErrMissingBody signals that body of the block is missing
var ErrMissingHashForHeaderNonce = errors.New("missing hash for header nonce")
ErrMissingHashForHeaderNonce signals that hash of the block is missing
var ErrMissingHeader = errors.New("missing header")
ErrMissingHeader signals that header of the block is missing
var ErrMissingPreProcessor = errors.New("pre processor is missing")
ErrMissingPreProcessor signals that required pre processor is missing
var ErrMissingTransaction = errors.New("missing transaction")
ErrMissingTransaction signals that one transaction is missing
var ErrNegativeValue = errors.New("negative value")
ErrNegativeValue signals that a negative value has been detected and it is not allowed
var ErrNilAccountsAdapter = errors.New("nil AccountsAdapter")
ErrNilAccountsAdapter defines the error when trying to use a nil AccountsAddapter
var ErrNilAddressContainer = errors.New("nil AddressContainer")
ErrNilAddressContainer signals that an operation has been attempted to or with a nil AddressContainer implementation
var ErrNilAddressConverter = errors.New("nil AddressConverter")
ErrNilAddressConverter signals that an operation has been attempted to or with a nil AddressConverter implementation
var ErrNilAppStatusHandler = errors.New("nil AppStatusHandler")
ErrNilAppStatusHandler defines the error for setting a nil AppStatusHandler
var ErrNilArgumentParser = errors.New("argument parser is nil")
ErrNilArgumentParser signals that the argument parser is nil
var ErrNilArguments = errors.New("smart contract arguments are nil")
ErrNilArguments signals that arguments from transactions data is nil
var ErrNilBalanceFromSC = errors.New("output balance from VM is nil")
ErrNilBalanceFromSC signals that balance is nil
var ErrNilBlockBody = errors.New("nil block body")
ErrNilBlockBody signals that an operation has been attempted to or with a nil block body
var ErrNilBlockBodyStorage = errors.New("nil block body storage")
ErrNilBlockBodyStorage signals that a nil block body storage has been provided
var ErrNilBlockChain = errors.New("nil block chain")
ErrNilBlockChain signals that an operation has been attempted to or with a nil blockchain
var ErrNilBlockExecutor = errors.New("nil BlockExecutor")
ErrNilBlockExecutor signals that an operation has been attempted to or with a nil BlockExecutor implementation
var ErrNilBlockHeader = errors.New("nil block header")
ErrNilBlockHeader signals that an operation has been attempted to or with a nil block header
var ErrNilBlocksTracker = errors.New("nil blocks tracker")
ErrNilBlocksTracker signals that a nil blocks tracker has been provided
var ErrNilBuffer = errors.New("provided byte buffer is nil")
ErrNilBuffer signals that a provided byte buffer is nil
var ErrNilCacher = errors.New("nil cacher")
ErrNilCacher signals that a nil cache has been provided
var ErrNilChronologyValidator = errors.New("provided chronology validator object is nil")
ErrNilChronologyValidator signals that a nil chronology validator has been provided
var ErrNilCode = errors.New("smart contract code is nil")
ErrNilCode signals that code from transaction data is nil
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 ErrNilDataToProcess = errors.New("nil data to process")
ErrNilDataToProcess signals that nil data was provided
var ErrNilForkDetector = errors.New("nil fork detector")
ErrNilForkDetector signals that the fork detector is nil
var ErrNilFunction = errors.New("smart contract function is nil")
ErrNilFunction signals that function from transaction data is nil
var ErrNilHasher = errors.New("nil Hasher")
ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation
var ErrNilHaveTimeHandler = errors.New("nil have time handler")
ErrNilHaveTimeHandler signals that a nil have time handler func was provided
var ErrNilHeaderHandlerValidator = errors.New("nil header handler validator provided")
ErrNilHeaderHandlerValidator signals that a nil header handler validator has been provided
var ErrNilHeadersDataPool = errors.New("nil headers data pool")
ErrNilHeadersDataPool signals that a nil headers pool has been provided
var ErrNilHeadersNonceHashStorage = errors.New("nil headers nonce hash storage")
ErrNilHeadersNonceHashStorage signals that a nil header nonce hash storage has been provided
var ErrNilHeadersNoncesDataPool = errors.New("nil headers nonces cache")
ErrNilHeadersNoncesDataPool signals that a nil header - nonce cache
var ErrNilHeadersStorage = errors.New("nil headers storage")
ErrNilHeadersStorage signals that a nil header storage has been provided
var ErrNilIntermediateProcessorContainer = errors.New("intermediate processor container is nil")
ErrNilIntermediateProcessorContainer signals that intermediate processors container is nil
var ErrNilIntermediateTransactionHandler = errors.New("intermediate transaction handler is nil")
ErrNilIntermediateTransactionHandler signals that nil intermediate transaction handler was provided
var ErrNilKeyGen = errors.New("nil key generator")
ErrNilKeyGen signals that an operation has been attempted to or with a nil single sign key generator
var ErrNilMarshalizer = errors.New("nil Marshalizer")
ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation
var ErrNilMessage = errors.New("nil message")
ErrNilMessage signals that a nil message has been received
var ErrNilMessenger = errors.New("nil Messenger")
ErrNilMessenger signals that a nil Messenger object was provided
var ErrNilMetaBlockHeader = errors.New("nil metablock header")
ErrNilMetaBlockHeader signals that an operation has been attempted to or with a nil metablock
var ErrNilMetaBlockPool = errors.New("nil meta block pool")
ErrNilMetaBlockPool signals that a nil meta blocks pool was used
var ErrNilMetaHeadersDataPool = errors.New("nil meta headers data pool")
ErrNilMetaHeadersDataPool signals that a nil metachain header pool has been provided
var ErrNilMetaHeadersNoncesDataPool = errors.New("nil meta headers nonces cache")
ErrNilMetaHeadersNoncesDataPool signals a nil metachain header - nonce cache
var ErrNilMiniBlockHeaders = errors.New("nil mini block headers")
ErrNilMiniBlockHeaders signals that an operation has been attempted with a nil mini-block
var ErrNilMiniBlockPool = errors.New("nil mini block pool")
ErrNilMiniBlockPool signals that a nil mini blocks pool was used
var ErrNilMiniBlocks = errors.New("nil mini blocks")
ErrNilMiniBlocks signals that an operation has been attempted with a nil mini-block
var ErrNilMultiSigVerifier = errors.New("nil multi-signature verifier")
ErrNilMultiSigVerifier signals that a nil multi-signature verifier is used
var ErrNilPeerBlockBody = errors.New("nil block body")
ErrNilPeerBlockBody signals that an operation has been attempted to or with a nil block body
var ErrNilPoolsHolder = errors.New("nil pools holder")
ErrNilPoolsHolder signals that an operation has been attempted to or with a nil pools holder object
var ErrNilPreProcessorsContainer = errors.New("preprocessors container is nil")
ErrNilPreProcessorsContainer signals that preprocessors container is nil
var ErrNilPrevRandSeed = errors.New("provided previous rand seed is nil")
ErrNilPrevRandSeed signals that a nil previous rand seed has been provided
var ErrNilPreviousBlockHash = errors.New("nil previous block header hash")
ErrNilPreviousBlockHash signals that a operation has been attempted with a nil previous block header hash
var ErrNilPubKeysBitmap = errors.New("nil public keys bitmap")
ErrNilPubKeysBitmap signals that a operation has been attempted with a nil public keys bitmap
var ErrNilPublicKey = errors.New("nil public key")
ErrNilPublicKey signals that a operation has been attempted with a nil public key
var ErrNilRandSeed = errors.New("provided rand seed is nil")
ErrNilRandSeed signals that a nil rand seed has been provided
var ErrNilRcvAddr = errors.New("nil receiver address")
ErrNilRcvAddr signals that an operation has been attempted to or with a nil receiver address
var ErrNilRequestHandler = errors.New("nil request handler")
ErrNilRequestHandler signals that a nil request handler interface was provided
var ErrNilRequestHeaderHandlerByNonce = errors.New("nil request header handler by nonce")
ErrNilRequestHeaderHandlerByNonce signals that a nil header request handler by nonce func was provided
var ErrNilResolverContainer = errors.New("nil resolver container")
ErrNilResolverContainer signals that a nil resolver container was provided
var ErrNilRootHash = errors.New("root hash is nil")
ErrNilRootHash signals that an operation has been attempted with a nil root hash
var ErrNilRounder = errors.New("nil Rounder")
ErrNilRounder signals that an operation has been attempted to or with a nil Rounder implementation
var ErrNilSCDestAccount = errors.New("nil destination SC account")
ErrNilSCDestAccount signals that destination account is nil
var ErrNilScAddress = errors.New("nil SC address")
ErrNilScAddress signals that a nil smart contract address has been provided
var ErrNilShardBlockPool = errors.New("nil shard block pool")
ErrNilShardBlockPool signals that a nil shard blocks pool was used
var ErrNilShardCoordinator = errors.New("nil shard coordinator")
ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator
var ErrNilShardedDataCacherNotifier = errors.New("nil sharded data cacher notifier")
ErrNilShardedDataCacherNotifier signals that a nil sharded data cacher notifier has been provided
var ErrNilSignature = errors.New("nil signature")
ErrNilSignature signals that a operation has been attempted with a nil signature
var ErrNilSingleSigner = errors.New("nil single signer")
ErrNilSingleSigner signals that a nil single signer is used
var ErrNilSmartContractProcessor = errors.New("smart contract processor is nil")
ErrNilSmartContractProcessor signals that smart contract call executor is nil
var ErrNilSmartContractResult = errors.New("smart contract result is nil")
ErrNilSmartContractResult signals that the smart contract result is nil
var ErrNilSmartContractResultProcessor = errors.New("nil smart contract result processor")
ErrNilSmartContractResultProcessor signals that smart contract result processor is nil
var ErrNilSndAddr = errors.New("nil sender address")
ErrNilSndAddr signals that an operation has been attempted to or with a nil sender address
var ErrNilStorage = errors.New("nil storage")
ErrNilStorage signals that a nil storage has been provided
var ErrNilStore = errors.New("nil data storage service")
ErrNilStore signals that the provided storage service is nil
var ErrNilTemporaryAccountsHandler = errors.New("temporary accounts handler is nil")
ErrNilTemporaryAccountsHandler signals that temporary accounts handler is nil
var ErrNilTransaction = errors.New("nil transaction")
ErrNilTransaction signals that an operation has been attempted to or with a nil transaction
var ErrNilTransactionCoordinator = errors.New("transaction coordinator is nil")
ErrNilTransactionCoordinator signals that transaction coordinator is nil
var ErrNilTransactionPool = errors.New("nil transaction pool")
ErrNilTransactionPool signals that a nil transaction pool was used
var ErrNilTxBlockBody = errors.New("nil tx block body")
ErrNilTxBlockBody signals that an operation has been attempted to or with a nil tx block body
var ErrNilTxDataPool = errors.New("nil transaction data pool")
ErrNilTxDataPool signals that a nil transaction pool has been provided
var ErrNilTxHandlerValidator = errors.New("nil tx handler validator provided")
ErrNilTxHandlerValidator signals that a nil tx handler validator has been provided
var ErrNilTxHash = errors.New("nil transaction hash")
ErrNilTxHash signals that an operation has been attempted with a nil hash
var ErrNilTxHashes = errors.New("nil transaction hashes")
ErrNilTxHashes signals that an operation has been atempted with nil transaction hashes
var ErrNilTxProcessor = errors.New("nil transactions processor")
ErrNilTxProcessor signals that a nil transactions processor was used
var ErrNilTxStorage = errors.New("nil transaction storage")
ErrNilTxStorage signals that a nil transaction storage has been provided
var ErrNilTxsPoolsCleaner = errors.New("nil transactions pools cleaner")
ErrNilTxsPoolsCleaner signals that a nil transactions pools cleaner has been provided
var ErrNilUTxDataPool = errors.New("unsigned transactions pool is nil")
ErrNilUTxDataPool signals that unsigned transaction pool is nil
var ErrNilUTxStorage = errors.New("unsigned transactions storage is nil")
ErrNilUTxStorage signals that unsigned transaction storage is nil
var ErrNilUint64Converter = errors.New("unit64converter is nil")
ErrNilUint64Converter signals that uint64converter is nil
var ErrNilUint64SyncMapCacher = errors.New("nil Uint64SyncMapCacher")
ErrNilUint64SyncMapCacher signals that a nil Uint64SyncMapCache has been provided
var ErrNilVMOutput = errors.New("nil vm output")
ErrNilVMOutput signals that vmoutput is nil
var ErrNilValue = errors.New("nil value")
ErrNilValue signals the value is nil
var ErrNoSortedHdrsForShard = errors.New("no sorted headers in pool")
ErrNoSortedHdrsForShard signals that there are no sorted hdrs in pool
var ErrNoTransactionInMessage = errors.New("no transaction found in received message")
ErrNoTransactionInMessage signals that no transaction was found after parsing received p2p message
var ErrNoUnsignedTransactionInMessage = errors.New("no unsigned transactions in message")
ErrNoUnsignedTransactionInMessage signals that message does not contain required data
var ErrNoVM = errors.New("no VM (hook not set)")
ErrNoVM signals that no SCHandler has been set
var ErrNotEnoughArgumentsToDeploy = errors.New("not enough arguments to deploy the smart contract")
ErrNotEnoughArgumentsToDeploy signals that there are not enough arguments to deploy the smart contract
var ErrNotEnoughValidBlocksInStorage = errors.New("not enough valid blocks in storage")
ErrNotEnoughValidBlocksInStorage signals that bootstrap from storage failed due to not enough valid blocks stored
var ErrNotarizedHdrsSliceIsNil = errors.New("notarized shard headers slice is nil")
ErrNotarizedHdrsSliceIsNil signals that the slice holding last notarized headers is nil
var ErrOverallBalanceChangeFromSC = errors.New("SC output balance updates are wrong")
ErrOverallBalanceChangeFromSC signals that all sumed balance changes are not zero
var ErrRandSeedDoesNotMatch = errors.New("random seed do not match")
ErrRandSeedDoesNotMatch signals that random seed does not match with the previous one
var ErrRandSeedDoesNotMatchInOtherChainBlock = errors.New("random seed does not match in other chain block")
ErrRandSeedDoesNotMatchInOtherChainBlock signals that seed does not match with the previous one
var ErrRollbackFromGenesis = errors.New("roll back from genesis is not supported")
ErrRollbackFromGenesis signals that a rollback from genesis is called
var ErrRootStateDoesNotMatch = errors.New("root state does not match")
ErrRootStateDoesNotMatch signals that root state does not match
var ErrRootStateDoesNotMatchInOtherChainBlock = errors.New("root state does not match in other chain block")
ErrRootStateDoesNotMatchInOtherChainBlock signals that root state does not match
var ErrShardIdMissmatch = errors.New("shard ID missmatch")
ErrShardIdMissmatch signals shard ID does not match expectations
var ErrStringSplitFailed = errors.New("data splitting into arguments and code/function failed")
ErrStringSplitFailed signals that data splitting into arguments and code failed
var ErrTimeIsOut = errors.New("time is out")
ErrTimeIsOut signals that time is out
var ErrTxNotFound = errors.New("transaction not found")
ErrTxNotFound signals that a transaction has not found
var ErrUnknownBlockType = errors.New("block type is unknown")
ErrUnknownBlockType signals that block type is not correct
var ErrUnmarshalWithoutSuccess = errors.New("unmarshal without success")
ErrUnmarshalWithoutSuccess signals that unmarshal some data was not done with success
var ErrVMTypeLengthInvalid = errors.New("vm type length is too long")
ErrVMTypeLengthInvalid signals that vm type length is too long
var ErrWrongNonceInBlock = errors.New("wrong nonce in block")
ErrWrongNonceInBlock signals the nonce in block is different than expected nonce
var ErrWrongNonceInOtherChainBlock = errors.New("wrong nonce in other chain block")
ErrWrongNonceInOtherChainBlock signals the nonce in block is different than expected nonce
var ErrWrongNonceInVMOutput = errors.New("nonce invalid from SC run")
ErrWrongNonceInVMOutput signals that nonce in vm output is wrong
var ErrWrongTransaction = errors.New("invalid transaction")
ErrWrongTransaction signals that transaction is invalid
var ErrWrongTypeAssertion = errors.New("wrong type assertion")
ErrWrongTypeAssertion signals that an type assertion failed
var ErrWrongTypeInContainer = errors.New("wrong type of object inside container")
ErrWrongTypeInContainer signals that a wrong type of object was found in container
var ErrWrongTypeInMiniBlock = errors.New("type in miniblock is not correct for processing")
ErrWrongTypeInMiniBlock signals that type is not correct for processing
var ErrZeroMaxCleanTime = errors.New("cleaning time is equal or less than zero")
ErrZeroMaxCleanTime signal that cleaning time for pools its less or equals with 0
Functions ¶
func GetMarshalizedHeaderFromStorage ¶
func GetMarshalizedHeaderFromStorage( blockUnit dataRetriever.UnitType, hash []byte, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, ) ([]byte, error)
GetMarshalizedHeaderFromStorage gets the marshalized header, which is associated with the given hash, from storage
func GetMetaHeader ¶
func GetMetaHeader( hash []byte, cacher storage.Cacher, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, ) (*block.MetaBlock, error)
GetMetaHeader gets the header, which is associated with the given hash, from pool or storage
func GetMetaHeaderFromPool ¶
GetMetaHeaderFromPool gets the header, which is associated with the given hash, from pool
func GetMetaHeaderFromPoolWithNonce ¶
func GetMetaHeaderFromPoolWithNonce( nonce uint64, cacher storage.Cacher, uint64SyncMapCacher dataRetriever.Uint64SyncMapCacher, ) (*block.MetaBlock, []byte, error)
GetMetaHeaderFromPoolWithNonce method returns a meta block header from pool with a given nonce
func GetMetaHeaderFromStorage ¶
func GetMetaHeaderFromStorage( hash []byte, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, ) (*block.MetaBlock, error)
GetMetaHeaderFromStorage gets the header, which is associated with the given hash, from storage
func GetMetaHeaderFromStorageWithNonce ¶
func GetMetaHeaderFromStorageWithNonce( nonce uint64, storageService dataRetriever.StorageService, uint64Converter typeConverters.Uint64ByteSliceConverter, marshalizer marshal.Marshalizer, ) (*block.MetaBlock, []byte, error)
GetMetaHeaderFromStorageWithNonce method returns a meta block header from storage with a given nonce
func GetMetaHeaderWithNonce ¶
func GetMetaHeaderWithNonce( nonce uint64, cacher storage.Cacher, uint64SyncMapCacher dataRetriever.Uint64SyncMapCacher, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, uint64Converter typeConverters.Uint64ByteSliceConverter, ) (*block.MetaBlock, []byte, error)
GetMetaHeaderWithNonce method returns a meta block header with a given nonce
func GetShardHeader ¶
func GetShardHeader( hash []byte, cacher storage.Cacher, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, ) (*block.Header, error)
GetShardHeader gets the header, which is associated with the given hash, from pool or storage
func GetShardHeaderFromPool ¶
GetShardHeaderFromPool gets the header, which is associated with the given hash, from pool
func GetShardHeaderFromPoolWithNonce ¶
func GetShardHeaderFromPoolWithNonce( nonce uint64, shardId uint32, cacher storage.Cacher, uint64SyncMapCacher dataRetriever.Uint64SyncMapCacher, ) (*block.Header, []byte, error)
GetShardHeaderFromPoolWithNonce method returns a shard block header from pool with a given nonce and shardId
func GetShardHeaderFromStorage ¶
func GetShardHeaderFromStorage( hash []byte, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, ) (*block.Header, error)
GetShardHeaderFromStorage gets the header, which is associated with the given hash, from storage
func GetShardHeaderFromStorageWithNonce ¶
func GetShardHeaderFromStorageWithNonce( nonce uint64, shardId uint32, storageService dataRetriever.StorageService, uint64Converter typeConverters.Uint64ByteSliceConverter, marshalizer marshal.Marshalizer, ) (*block.Header, []byte, error)
GetShardHeaderFromStorageWithNonce method returns a shard block header from storage with a given nonce and shardId
func GetShardHeaderWithNonce ¶
func GetShardHeaderWithNonce( nonce uint64, shardId uint32, cacher storage.Cacher, uint64SyncMapCacher dataRetriever.Uint64SyncMapCacher, marshalizer marshal.Marshalizer, storageService dataRetriever.StorageService, uint64Converter typeConverters.Uint64ByteSliceConverter, ) (*block.Header, []byte, error)
GetShardHeaderWithNonce method returns a shard block header with a given nonce and shardId
func GetTransactionHandler ¶
func GetTransactionHandler( senderShardID uint32, destShardID uint32, txHash []byte, shardedDataCacherNotifier dataRetriever.ShardedDataCacherNotifier, storageService dataRetriever.StorageService, marshalizer marshal.Marshalizer, ) (data.TransactionHandler, error)
GetTransactionHandler gets the transaction with a given sender/receiver shardId and txHash
func GetTransactionHandlerFromPool ¶
func GetTransactionHandlerFromPool( senderShardID uint32, destShardID uint32, txHash []byte, shardedDataCacherNotifier dataRetriever.ShardedDataCacherNotifier, ) (data.TransactionHandler, error)
GetTransactionHandlerFromPool gets the transaction from pool with a given sender/receiver shardId and txHash
func GetTransactionHandlerFromStorage ¶
func GetTransactionHandlerFromStorage( txHash []byte, storageService dataRetriever.StorageService, marshalizer marshal.Marshalizer, ) (data.TransactionHandler, error)
GetTransactionHandlerFromStorage gets the transaction from storage with a given sender/receiver shardId and txHash
func ShardCacherIdentifier ¶
ShardCacherIdentifier generates a string identifier between 2 shards
Types ¶
type ArgumentsParser ¶
type ArgumentsParser interface { GetArguments() ([]*big.Int, error) GetCode() ([]byte, error) GetFunction() (string, error) ParseData(data string) error CreateDataFromStorageUpdate(storageUpdates []*vmcommon.StorageUpdate) string GetStorageUpdates(data string) ([]*vmcommon.StorageUpdate, error) IsInterfaceNil() bool }
ArgumentsParser defines the functionality to parse transaction data into arguments and code for smart contracts
type BlockHeaderState ¶
type BlockHeaderState int
BlockHeaderState specifies which is the state of the block header received
const ( // BHReceived defines ID of a received block header BHReceived BlockHeaderState = iota // BHProcessed defines ID of a processed block header BHProcessed // BHProposed defines ID of a proposed block header BHProposed // BHNotarized defines ID of a notarized block header BHNotarized )
type BlockProcessor ¶
type BlockProcessor interface { ProcessBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error CommitBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error RevertAccountState() CreateBlockBody(round uint64, haveTime func() bool) (data.BodyHandler, error) RestoreBlockIntoPools(header data.HeaderHandler, body data.BodyHandler) error CreateBlockHeader(body data.BodyHandler, round uint64, haveTime func() bool) (data.HeaderHandler, error) MarshalizedDataToBroadcast(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error) DecodeBlockBody(dta []byte) data.BodyHandler DecodeBlockHeader(dta []byte) data.HeaderHandler AddLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler) IsInterfaceNil() bool }
BlockProcessor is the main interface for block execution engine
type BlockSizeThrottler ¶
type BlockSizeThrottler interface { MaxItemsToAdd() uint32 Add(round uint64, items uint32) Succeed(round uint64) ComputeMaxItems() IsInterfaceNil() bool }
BlockSizeThrottler defines the functionality of adapting the node to the network speed/latency when it should send a block to its peers which should be received in a limited time frame
type BlocksTracker ¶ added in v1.0.3
type BlocksTracker interface { UnnotarisedBlocks() []data.HeaderHandler RemoveNotarisedBlocks(headerHandler data.HeaderHandler) error AddBlock(headerHandler data.HeaderHandler) SetBlockBroadcastRound(nonce uint64, round int64) BlockBroadcastRound(nonce uint64) int64 IsInterfaceNil() bool }
BlocksTracker defines the functionality to track all the notarised blocks
type Bootstrapper ¶
type Bootstrapper interface { AddSyncStateListener(func(isSyncing bool)) ShouldSync() bool StopSync() StartSync() SetStatusHandler(handler core.AppStatusHandler) error IsInterfaceNil() bool }
Bootstrapper is an interface that defines the behaviour of a struct that is able to synchronize the node
type Checker ¶
type Checker interface { // IntegrityAndValidity does both validity and integrity checks on the data structure IntegrityAndValidity(coordinator sharding.Coordinator) error // Integrity checks only the integrity of the data Integrity(coordinator sharding.Coordinator) error // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
Checker provides functionality to checks the integrity and validity of a data structure
type ChronologyValidator ¶ added in v1.0.3
type ChronologyValidator interface { ValidateReceivedBlock(shardID uint32, epoch uint32, nonce uint64, round uint64) error IsInterfaceNil() bool }
ChronologyValidator defines the functionality needed to validate a received header block (shard or metachain) from chronology point of view
type DataPacker ¶
type DataPacker interface { PackDataInChunks(data [][]byte, limit int) ([][]byte, error) IsInterfaceNil() bool }
DataPacker can split a large slice of byte slices in smaller packets
type ForkDetector ¶
type ForkDetector interface { AddHeader(header data.HeaderHandler, headerHash []byte, state BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte) error RemoveHeaders(nonce uint64, hash []byte) CheckFork() (forkDetected bool, nonce uint64, hash []byte) GetHighestFinalBlockNonce() uint64 ProbableHighestNonce() uint64 ResetProbableHighestNonceIfNeeded() IsInterfaceNil() bool }
ForkDetector is an interface that defines the behaviour of a struct that is able to detect forks
type HashAccesser ¶
HashAccesser interface provides functionality over hashable objects
type HeaderValidator ¶
type HeaderValidator interface { IsHeaderValidForProcessing(headerHandler data.HeaderHandler) bool IsInterfaceNil() bool }
HeaderValidator can determine if a provided header handler is valid or not from the process point of view
type InterceptedBlockBody ¶ added in v1.0.3
type InterceptedBlockBody interface { Checker HashAccesser GetUnderlyingObject() interface{} }
InterceptedBlockBody interface provides functionality over intercepted blocks
type Interceptor ¶
type Interceptor interface { ProcessReceivedMessage(message p2p.MessageP2P) error IsInterfaceNil() bool }
Interceptor defines what a data interceptor should do It should also adhere to the p2p.MessageProcessor interface so it can wire to a p2p.Messenger
type InterceptorsContainer ¶
type InterceptorsContainer interface { Get(key string) (Interceptor, error) Add(key string, val Interceptor) error AddMultiple(keys []string, interceptors []Interceptor) error Replace(key string, val Interceptor) error Remove(key string) Len() int IsInterfaceNil() bool }
InterceptorsContainer defines an interceptors holder data type with basic functionality
type InterceptorsContainerFactory ¶
type InterceptorsContainerFactory interface { Create() (InterceptorsContainer, error) IsInterfaceNil() bool }
InterceptorsContainerFactory defines the functionality to create an interceptors container
type IntermediateProcessorContainer ¶
type IntermediateProcessorContainer interface { Get(key block.Type) (IntermediateTransactionHandler, error) Add(key block.Type, val IntermediateTransactionHandler) error AddMultiple(keys []block.Type, preprocessors []IntermediateTransactionHandler) error Replace(key block.Type, val IntermediateTransactionHandler) error Remove(key block.Type) Len() int Keys() []block.Type IsInterfaceNil() bool }
IntermediateProcessorContainer defines an IntermediateProcessor holder data type with basic functionality
type IntermediateProcessorsContainerFactory ¶
type IntermediateProcessorsContainerFactory interface { Create() (IntermediateProcessorContainer, error) IsInterfaceNil() bool }
IntermediateProcessorsContainerFactory defines the functionality to create an IntermediateProcessors container
type IntermediateTransactionHandler ¶
type IntermediateTransactionHandler interface { AddIntermediateTransactions(txs []data.TransactionHandler) error CreateAllInterMiniBlocks() map[uint32]*block.MiniBlock VerifyInterMiniBlocks(body block.Body) error CreateMarshalizedData(txHashes [][]byte) ([][]byte, error) SaveCurrentIntermediateTxToStorage() error GetAllCurrentFinishedTxs() map[string]data.TransactionHandler CreateBlockStarted() IsInterfaceNil() bool }
IntermediateTransactionHandler handles transactions which are not resolved in only one step
type MessageHandler ¶ added in v1.0.3
type MessageHandler interface { ConnectedPeersOnTopic(topic string) []p2p.PeerID SendToConnectedPeer(topic string, buff []byte, peerID p2p.PeerID) error IsInterfaceNil() bool }
MessageHandler defines the functionality needed by structs to send data to other peers
type PoolsCleaner ¶
type PoolsCleaner interface { Clean(duration time.Duration) (bool, error) NumRemovedTxs() uint64 IsInterfaceNil() bool }
PoolsCleaner define the functionality that is needed for a pools cleaner
type PreProcessor ¶
type PreProcessor interface { CreateBlockStarted() IsDataPrepared(requestedTxs int, haveTime func() time.Duration) error RemoveTxBlockFromPools(body block.Body, miniBlockPool storage.Cacher) error RestoreTxBlockIntoPools(body block.Body, miniBlockPool storage.Cacher) (int, error) SaveTxBlockToStorage(body block.Body) error ProcessBlockTransactions(body block.Body, round uint64, haveTime func() time.Duration) error RequestBlockTransactions(body block.Body) int CreateMarshalizedData(txHashes [][]byte) ([][]byte, error) RequestTransactionsForMiniBlock(mb block.MiniBlock) int ProcessMiniBlock(miniBlock *block.MiniBlock, haveTime func() bool, round uint64) error CreateAndProcessMiniBlock(sndShardId, dstShardId uint32, spaceRemained int, haveTime func() bool, round uint64) (*block.MiniBlock, error) GetAllCurrentUsedTxs() map[string]data.TransactionHandler IsInterfaceNil() bool }
PreProcessor is an interface used to prepare and process transaction data
type PreProcessorsContainer ¶
type PreProcessorsContainer interface { Get(key block.Type) (PreProcessor, error) Add(key block.Type, val PreProcessor) error AddMultiple(keys []block.Type, preprocessors []PreProcessor) error Replace(key block.Type, val PreProcessor) error Remove(key block.Type) Len() int Keys() []block.Type IsInterfaceNil() bool }
PreProcessorsContainer defines an PreProcessors holder data type with basic functionality
type PreProcessorsContainerFactory ¶
type PreProcessorsContainerFactory interface { Create() (PreProcessorsContainer, error) IsInterfaceNil() bool }
PreProcessorsContainerFactory defines the functionality to create an PreProcessors container
type RequestHandler ¶
type RequestHandler interface { RequestHeaderByNonce(shardId uint32, nonce uint64) RequestTransaction(shardId uint32, txHashes [][]byte) RequestUnsignedTransactions(destShardID uint32, scrHashes [][]byte) RequestMiniBlock(shardId uint32, miniblockHash []byte) RequestHeader(shardId uint32, hash []byte) IsInterfaceNil() bool }
RequestHandler defines the methods through which request to data can be made
type RequiredDataPool ¶
type RequiredDataPool struct {
// contains filtered or unexported fields
}
RequiredDataPool represents a structure that can hold a list of required data. Any time one of the expected hash value is received, the associated bit in the receivedBitmap property is set to 1. All of the data is considered received when the ones count of the received bitmap is equal to the expected data length
func (*RequiredDataPool) ExpectedData ¶
func (rh *RequiredDataPool) ExpectedData() [][]byte
ExpectedData returns the RequiredDataPool's expected data
func (*RequiredDataPool) ReceivedAll ¶
func (rh *RequiredDataPool) ReceivedAll() bool
ReceivedAll will return true if the count of ones in the bitmap is greater or equal to the expected data length
func (*RequiredDataPool) SetHashes ¶
func (rh *RequiredDataPool) SetHashes(hashes [][]byte)
SetHashes sets the expected data to the passed hashes parameter. The bitmap is also reset and adapted to the length of the new expected data
func (*RequiredDataPool) SetReceivedHash ¶
func (rh *RequiredDataPool) SetReceivedHash(hash []byte)
SetReceivedHash finds the hash in the expected values and sets the appropriate bit to 1. Nothing will happen if the hash is not actually expected
type SigVerifier ¶
type SigVerifier interface {
VerifySig() error
}
SigVerifier provides functionality to verify a signature of a signed data structure that holds also the verifying parameters
type SignedDataValidator ¶
type SignedDataValidator interface { SigVerifier Checker }
SignedDataValidator provides functionality to check the validity and signature of a data structure
type SmartContractProcessor ¶
type SmartContractProcessor interface { ComputeTransactionType(tx *transaction.Transaction) (TransactionType, error) ExecuteSmartContractTransaction(tx *transaction.Transaction, acntSrc, acntDst state.AccountHandler, round uint64) error DeploySmartContract(tx *transaction.Transaction, acntSrc state.AccountHandler, round uint64) error IsInterfaceNil() bool }
SmartContractProcessor is the main interface for the smart contract caller engine
type SmartContractResultProcessor ¶
type SmartContractResultProcessor interface { ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) error IsInterfaceNil() bool }
SmartContractResultProcessor is the main interface for smart contract result execution engine
type TemporaryAccountsHandler ¶
type TemporaryAccountsHandler interface { AddTempAccount(address []byte, balance *big.Int, nonce uint64) CleanTempAccounts() TempAccount(address []byte) state.AccountHandler IsInterfaceNil() bool }
TemporaryAccountsHandler defines the functionality to create temporary accounts and pass to VM. This holder will contain usually one account from shard X that calls a SC in shard Y so when executing the code in shard Y, this impl will hold an ephemeral copy of the sender account from shard X
type TopicHandler ¶
type TopicHandler interface { HasTopic(name string) bool CreateTopic(name string, createChannelForTopic bool) error RegisterMessageProcessor(topic string, handler p2p.MessageProcessor) error }
TopicHandler defines the functionality needed by structs to manage topics and message processors
type TopicMessageHandler ¶ added in v1.0.3
type TopicMessageHandler interface { MessageHandler TopicHandler }
TopicMessageHandler defines the functionality needed by structs to manage topics, message processors and to send data to other peers
type TransactionCoordinator ¶
type TransactionCoordinator interface { RequestMiniBlocks(header data.HeaderHandler) RequestBlockTransactions(body block.Body) IsDataPreparedForProcessing(haveTime func() time.Duration) error SaveBlockDataToStorage(body block.Body) error RestoreBlockDataFromStorage(body block.Body) (int, error) RemoveBlockDataFromPool(body block.Body) error ProcessBlockTransaction(body block.Body, round uint64, haveTime func() time.Duration) error CreateBlockStarted() CreateMbsAndProcessCrossShardTransactionsDstMe(header data.HeaderHandler, processedMiniBlocksHashes map[string]struct{}, maxTxSpaceRemained uint32, maxMbSpaceRemained uint32, round uint64, haveTime func() bool) (block.MiniBlockSlice, uint32, bool) CreateMbsAndProcessTransactionsFromMe(maxTxSpaceRemained uint32, maxMbSpaceRemained uint32, round uint64, haveTime func() bool) block.MiniBlockSlice CreateMarshalizedData(body block.Body) (map[uint32]block.MiniBlockSlice, map[string][][]byte) GetAllCurrentUsedTxs(blockType block.Type) map[string]data.TransactionHandler VerifyCreatedBlockTransactions(body block.Body) error IsInterfaceNil() bool }
TransactionCoordinator is an interface to coordinate transaction processing using multiple processors
type TransactionProcessor ¶
type TransactionProcessor interface { ProcessTransaction(transaction *transaction.Transaction, round uint64) error IsInterfaceNil() bool }
TransactionProcessor is the main interface for transaction execution engine
type TransactionType ¶
type TransactionType int
TransactionType specifies the type of the transaction
const ( // MoveBalance defines ID of a payment transaction - moving balances MoveBalance TransactionType = iota // SCDeployment defines ID of a transaction to store a smart contract SCDeployment // SCInvoking defines ID of a transaction of type smart contract call SCInvoking // InvalidTransaction defines unknown transaction type InvalidTransaction )
type TxTypeHandler ¶
type TxTypeHandler interface { ComputeTransactionType(tx data.TransactionHandler) (TransactionType, error) IsInterfaceNil() bool }
TxTypeHandler is an interface to calculate the transaction type
type TxValidator ¶
type TxValidator interface { IsTxValidForProcessing(txHandler TxValidatorHandler) bool NumRejectedTxs() uint64 IsInterfaceNil() bool }
TxValidator can determine if a provided transaction handler is valid or not from the process point of view
type TxValidatorHandler ¶
type TxValidatorHandler interface { SenderShardId() uint32 Nonce() uint64 SenderAddress() state.AddressContainer TotalValue() *big.Int }
TxValidatorHandler defines the functionality that is needed for a TxValidator to validate a transaction
type VirtualMachinesContainer ¶
type VirtualMachinesContainer interface { Get(key []byte) (vmcommon.VMExecutionHandler, error) Add(key []byte, val vmcommon.VMExecutionHandler) error AddMultiple(keys [][]byte, vms []vmcommon.VMExecutionHandler) error Replace(key []byte, val vmcommon.VMExecutionHandler) error Remove(key []byte) Len() int Keys() [][]byte IsInterfaceNil() bool }
VirtualMachinesContainer defines a virtual machine holder data type with basic functionality
type VirtualMachinesContainerFactory ¶
type VirtualMachinesContainerFactory interface { Create() (VirtualMachinesContainer, error) VMAccountsDB() *hooks.VMAccountsDB IsInterfaceNil() bool }
VirtualMachinesContainerFactory defines the functionality to create a virtual machine container