Documentation ¶
Index ¶
- Constants
- Variables
- func BooleanToInt(b bool) int
- func CalculateHash(marshalizer marshal.Marshalizer, hasher hashing.Hasher, object interface{}) ([]byte, error)
- func CommunicationIdentifierBetweenShards(shardId1 uint32, shardId2 uint32) string
- func ConvertBytes(bytes uint64) string
- func ConvertToEvenHex(value int) string
- func ConvertToEvenHexBigInt(value *big.Int) string
- func CreateFile(prefix string, subfolder string, fileExtension string) (*os.File, error)
- func EmptyChannel(ch chan bool) int
- func EpochStartIdentifier(epoch uint32) string
- func GetPercentageOfValue(value *big.Int, percentage float64) *big.Int
- func GetShardIdString(shardId uint32) string
- func GetTrimmedPk(pk string) string
- func IsEmptyAddress(address []byte) bool
- func IsMetachainIdentifier(identifier []byte) bool
- func IsSmartContractAddress(rcvAddress []byte) bool
- func IsSmartContractOnMetachain(identifier []byte, rcvAddress []byte) bool
- func IsUnknownEpochIdentifier(identifier []byte) (bool, error)
- func LoadGasScheduleConfig(filepath string) (map[string]map[string]uint64, error)
- func LoadJsonFile(dest interface{}, relativePath string) error
- func LoadP2PConfig(filepath string) (*config.P2PConfig, error)
- func LoadSkPkFromPemFile(relativePath string, skIndex int) ([]byte, string, error)
- func LoadTomlFile(dest interface{}, relativePath string) error
- func LoadTomlFileToMap(relativePath string) (map[string]interface{}, error)
- func MaxInt(a int, b int) int
- func MaxInt32(a int32, b int32) int32
- func MaxInt64(a int64, b int64) int64
- func MaxUint32(a uint32, b uint32) uint32
- func MaxUint64(a uint64, b uint64) uint64
- func MinInt(a int, b int) int
- func MinInt32(a int32, b int32) int32
- func MinInt64(a int64, b int64) int64
- func MinUint32(a uint32, b uint32) uint32
- func MinUint64(a uint64, b uint64) uint64
- func OpenFile(relativePath string) (*os.File, error)
- func SaveSkToPemFile(file *os.File, identifier string, skBytes []byte) error
- func SecondsToHourMinSec(input int) string
- func ShardIdToString(shardId uint32) string
- func TrimSoftwareVersion(version string) string
- func UniqueIdentifier() string
- type AppStatusHandler
- type ConnectedAddressesHandler
- type NodeState
- type NodeType
- type P2PPeerInfo
- type P2PPeerType
- type PeerID
- type PeerType
- type PubkeyConverter
- type QueryP2PPeerInfo
- type StopWatch
- func (sw *StopWatch) Add(src *StopWatch)
- func (sw *StopWatch) GetMeasurement(identifier string) float64
- func (sw *StopWatch) GetMeasurements() []interface{}
- func (sw *StopWatch) GetMeasurementsMap() map[string]float64
- func (sw *StopWatch) Start(identifier string)
- func (sw *StopWatch) Stop(identifier string)
- type TimersScheduler
- type TransactionStatus
- type WatchdogTimer
Constants ¶
const ( // StorerOrder defines the order of storers to be notified of a start of epoch event StorerOrder = iota // NodesCoordinatorOrder defines the order in which NodesCoordinator is notified of a start of epoch event NodesCoordinatorOrder // ConsensusOrder defines the order in which Consensus is notified of a start of epoch event ConsensusOrder // NetworkShardingOrder defines the order in which the network sharding subsystem is notified of a start of epoch event NetworkShardingOrder // IndexerOrder defines the order in which Indexer is notified of a start of epoch event IndexerOrder )
const AllShardId = uint32(0xFFFFFFF0)
AllShardId will be used to identify that a message is for all shards
const BaseOperationCost = "BaseOperationCost"
BaseOperationCost represents the field name for base operation costs
const BuiltInCost = "BuiltInCost"
BuiltInCost represents the field name for built in operation costs
const BuiltInFunctionChangeOwnerAddress = "ChangeOwnerAddress"
BuiltInFunctionChangeOwnerAddress is the key for the change owner built in function built-in function
const BuiltInFunctionClaimDeveloperRewards = "ClaimDeveloperRewards"
BuiltInFunctionClaimDeveloperRewards is the key for the claim developer rewards built-in function
const BuiltInFunctionESDTTransfer = "ESDTTransfer"
BuiltInFunctionESDTTransfer is the key for the elrond standard digital token transfer built-in function
const BuiltInFunctionSaveKeyValue = "SaveKeyValue"
BuiltInFunctionSaveKeyValue is the key for the save key value built-in function
const BuiltInFunctionSetUserName = "SetUserName"
BuiltInFunctionSetUserName is the key for the set user name built-in function
const CombinedPeerType = "%s (%s)"
CombinedPeerType - represents the combination of two peerTypes
const CommitMaxTime = 3 * time.Second
CommitMaxTime represents max time accepted for a commit action, after which a warn message is displayed
const ConsensusTopic = "consensus"
ConsensusTopic is the topic used in consensus algorithm
const DefaultUnstakedEpoch = math.MaxUint32
DefaultUnstakedEpoch represents the default epoch that is set for a validator that has not unstaked yet
const ElrondProtectedKeyPrefix = "ELROND"
ElrondProtectedKeyPrefix is the key prefix which is protected from writing in the trie - only for special builtin functions
const ExtraDelayBetweenBroadcastMbsAndTxs = 1 * time.Second
ExtraDelayBetweenBroadcastMbsAndTxs represents the number of seconds to wait since miniblocks have been broadcast and the moment when theirs transactions would be broadcast too
const ExtraDelayForBroadcastBlockInfo = 1 * time.Second
ExtraDelayForBroadcastBlockInfo represents the number of seconds to wait since a block has been broadcast and the moment when its components, like mini blocks and transactions, would be broadcast too
const ExtraDelayForRequestBlockInfo = ExtraDelayForBroadcastBlockInfo + ExtraDelayBetweenBroadcastMbsAndTxs + time.Second
ExtraDelayForRequestBlockInfo represents the number of seconds to wait since a block has been received and the moment when its components, like mini blocks and transactions, would be requested too if they are still missing
const FileModeUserReadWrite = 0600
FileModeUserReadWrite represents the permission for a file which allows the user for reading and writing
const HeartbeatTopic = "heartbeat"
HeartbeatTopic is the topic used for heartbeat signaling
const HighestRoundFromBootStorage = "highestRoundFromBootStorage"
HighestRoundFromBootStorage is the key for the highest round that is saved in storage
const InvalidMessageBlacklistDuration = time.Second * 3600
InvalidMessageBlacklistDuration represents the time to keep a peer in the black list if it sends a message that does not follow the protocol: example not useing the same marshaler as the other peers
const LastNonceKeyMetricsStorage = "lastNonce"
LastNonceKeyMetricsStorage holds the key used for storing the last nonce for stored metrics
const MaxBulkTransactionSize = 1 << 18 //256KB bulks
MaxBulkTransactionSize specifies the maximum size of one bulk with txs which can be send over the network TODO convert this const into a var and read it from config when this code moves to another binary
const MaxNumShards = 256
MaxNumShards represents the maximum number of shards possible in the system
const MaxRetriesToCreateDB = 10
MaxRetriesToCreateDB represents the maximum number of times to try to create DB if it failed
const MaxSoftwareVersionLengthInBytes = 10
MaxSoftwareVersionLengthInBytes represents the maximum length for the software version to be saved in block header
const MaxTxNonceDeltaAllowed = 30000
MaxTxNonceDeltaAllowed specifies the maximum difference between an account's nonce and a received transaction's nonce in order to mark the transaction as valid.
const MeasurementsLoggerFormat = "%.4fs"
MeasurementsLoggerFormat contains the formatting string to output elapsed time in seconds in a consistent way
const MegabyteSize = 1024 * 1024
MegabyteSize represents the size in bytes of a megabyte
const MetaChainSystemSCsCost = "MetaChainSystemSCsCost"
MetaChainSystemSCsCost represents the field name for metachain system smart contract operation costs
const MetachainShardId = uint32(0xFFFFFFFF)
MetachainShardId will be used to identify a shard ID as metachain
const MetricAppVersion = "erd_app_version"
MetricAppVersion is the metric for the current app version
const MetricAverageBlockTxCount = "erd_average_block_tx_count"
MetricAverageBlockTxCount holds the average count of transactions in a block
const MetricChainId = "erd_chain_id"
MetricChainId is the metric that specifies current chain id
const MetricConnectedNodes = "erd_connected_nodes"
MetricConnectedNodes is the metric for monitoring total connected nodes on the network
const MetricConsensusGroupSize = "erd_consensus_group_size"
MetricConsensusGroupSize is the metric for consensus group size for the current shard/meta
const MetricConsensusRoundState = "erd_consensus_round_state"
MetricConsensusRoundState is the metric for consensus round state for a block
const MetricConsensusState = "erd_consensus_state"
MetricConsensusState is the metric for consensus state of node proposer,participant or not consensus group
const MetricCountAcceptedBlocks = "erd_count_accepted_blocks"
MetricCountAcceptedBlocks is the metric for monitoring number of blocks that was accepted proposed by a node
const MetricCountConsensus = "erd_count_consensus"
MetricCountConsensus is the metric for monitoring number of rounds when a node was in consensus group
const MetricCountConsensusAcceptedBlocks = "erd_count_consensus_accepted_blocks"
MetricCountConsensusAcceptedBlocks is the metric for monitoring number of blocks accepted when the node was in consensus group
const MetricCountLeader = "erd_count_leader"
MetricCountLeader is the metric for monitoring number of rounds when a node was leader
const MetricCpuLoadPercent = "erd_cpu_load_percent"
MetricCpuLoadPercent is the metric for monitoring CPU load [%]
const MetricCreatedProposedBlock = "erd_consensus_created_proposed_block"
MetricCreatedProposedBlock is the metric that specify the percent of the block subround used for header and body creation (0 meaning that the block was created in no-time and 100 meaning that the block creation used all the subround spare duration)
const MetricCrossCheckBlockHeight = "erd_cross_check_block_height"
MetricCrossCheckBlockHeight is the metric that store cross block height
const MetricCurrentBlockHash = "erd_current_block_hash"
MetricCurrentBlockHash is the metric that stores the current block hash
const MetricCurrentRound = "erd_current_round"
MetricCurrentRound is the metric for monitoring the current round of a node
const MetricCurrentRoundTimestamp = "erd_current_round_timestamp"
MetricCurrentRoundTimestamp is the metric that stores current round timestamp
const MetricDenomination = "erd_denomination"
MetricDenomination is the metric for exposing the denomination
const MetricEpochNumber = "erd_epoch_number"
MetricEpochNumber is the metric for the number of epoch
const MetricGasPerDataByte = "erd_gas_per_data_byte"
MetricGasPerDataByte is the metric that specifies the required gas for a data byte
const MetricHeaderSize = "erd_current_block_size"
MetricHeaderSize is the metric that stores the current block size
const MetricHighestFinalBlockInShard = "erd_highest_notarized_block_by_metachain_for_current_shard"
MetricHighestFinalBlockInShard is the metric that stores the highest nonce block notarized by metachain for current shard
const MetricIsSyncing = "erd_is_syncing"
MetricIsSyncing is the metric for monitoring if a node is syncing
const MetricLastBlockTxCount = "erd_last_block_tx_count"
MetricLastBlockTxCount holds the number of transactions in the last block
const MetricLatestTagSoftwareVersion = "erd_latest_tag_software_version"
MetricLatestTagSoftwareVersion is the metric that stores the latest tag software version
const MetricLeaderPercentage = "erd_leader_percentage"
MetricLeaderPercentage is the metric for leader rewards percentage
const MetricLiveValidatorNodes = "erd_live_validator_nodes"
MetricLiveValidatorNodes is the metric for monitoring live validators on the network
const MetricMemLoadPercent = "erd_mem_load_percent"
MetricMemLoadPercent is the metric for monitoring memory load [%]
const MetricMemTotal = "erd_mem_total"
MetricMemTotal is the metric for monitoring total memory bytes
const MetricMemUsedGolang = "erd_mem_used_golang"
MetricMemUsedGolang is the metric that stores the total memory used by golang in bytes
const MetricMemUsedSystem = "erd_mem_used_sys"
MetricMemUsedSystem is the metric that stores the total memory used by the system in bytes
const MetricMetaConsensusGroupSize = "erd_meta_consensus_group_size"
MetricMetaConsensusGroupSize is the metric for the metachain consensus group size
const MetricMinGasLimit = "erd_min_gas_limit"
MetricMinGasLimit is the metric that specifies the minimum gas limit
const MetricMinGasPrice = "erd_min_gas_price"
MetricMinGasPrice is the metric that specifies min gas price
const MetricMiniBlocksSize = "erd_mini_blocks_size"
MetricMiniBlocksSize is the metric that stores the current block size
const MetricNetworkRecvBps = "erd_network_recv_bps"
MetricNetworkRecvBps is the metric for monitoring network received bytes per second
const MetricNetworkRecvBpsPeak = "erd_network_recv_bps_peak"
MetricNetworkRecvBpsPeak is the metric for monitoring network received peak bytes per second
const MetricNetworkRecvPercent = "erd_network_recv_percent"
MetricNetworkRecvPercent is the metric for monitoring network receive load [%]
const MetricNetworkSentBps = "erd_network_sent_bps"
MetricNetworkSentBps is the metric for monitoring network sent bytes per second
const MetricNetworkSentBpsPeak = "erd_network_sent_bps_peak"
MetricNetworkSentBpsPeak is the metric for monitoring network sent peak bytes per second
const MetricNetworkSentPercent = "erd_network_sent_percent"
MetricNetworkSentPercent is the metric for monitoring network sent load [%]
const MetricNodeDisplayName = "erd_node_display_name"
MetricNodeDisplayName is the metric that stores the name of the node
const MetricNodeType = "erd_node_type"
MetricNodeType is the metric for monitoring the type of the node
const MetricNonce = "erd_nonce"
MetricNonce is the metric for monitoring the nonce of a node
const MetricNonceAtEpochStart = "erd_nonce_at_epoch_start"
MetricNonceAtEpochStart is the metric for storing the first nonce of the current epoch
const MetricNonceForTPS = "erd_nonce_for_tps"
MetricNonceForTPS is the metric for monitoring the nonce of a node used in TPS benchmarks
const MetricNoncesPassedInCurrentEpoch = "erd_nonces_passed_in_current_epoch"
MetricNoncesPassedInCurrentEpoch is the metric that tells the number of nonces passed in current epoch
const MetricNumConnectedPeers = "erd_num_connected_peers"
MetricNumConnectedPeers is the metric for monitoring the number of connected peers
const MetricNumConnectedPeersClassification = "erd_num_connected_peers_classification"
MetricNumConnectedPeersClassification is the metric for monitoring the number of connected peers split on the connection type
const MetricNumMetachainNodes = "erd_num_metachain_nodes"
MetricNumMetachainNodes is the metric which holds the number of nodes in metachain
const MetricNumMiniBlocks = "erd_num_mini_blocks"
MetricNumMiniBlocks is the metric for number of miniblocks in a block
const MetricNumNodesPerShard = "erd_num_nodes_in_shard"
MetricNumNodesPerShard is the metric which holds the number of nodes in a shard
const MetricNumProcessedTxs = "erd_num_transactions_processed"
MetricNumProcessedTxs is the metric that stores the number of transactions processed
const MetricNumShardHeadersFromPool = "erd_num_shard_headers_from_pool"
MetricNumShardHeadersFromPool is the metric that stores number of shard header from pool
const MetricNumShardHeadersProcessed = "erd_num_shard_headers_processed"
MetricNumShardHeadersProcessed is the metric that stores number of shard header processed
const MetricNumShardsWithoutMetacahin = "erd_num_shards_without_meta"
MetricNumShardsWithoutMetacahin is the metric for monitoring the number of shards (excluding meta)
const MetricNumTimesInForkChoice = "erd_fork_choice_count"
MetricNumTimesInForkChoice is the metric that counts how many time a node was in fork choice
const MetricNumTxInBlock = "erd_num_tx_block"
MetricNumTxInBlock is the metric for the number of transactions in the proposed block
const MetricNumValidators = "erd_num_validators"
MetricNumValidators is the metric for the number of validators
const MetricP2PCrossShardObservers = "erd_p2p_cross_shard_observers"
MetricP2PCrossShardObservers is the metric that outputs the cross-shard connected observers
const MetricP2PCrossShardValidators = "erd_p2p_cross_shard_validators"
MetricP2PCrossShardValidators is the metric that outputs the cross-shard connected validators
const MetricP2PIntraShardObservers = "erd_p2p_intra_shard_observers"
MetricP2PIntraShardObservers is the metric that outputs the intra-shard connected observers
const MetricP2PIntraShardValidators = "erd_p2p_intra_shard_validators"
MetricP2PIntraShardValidators is the metric that outputs the intra-shard connected validators
const MetricP2PNumConnectedPeersClassification = "erd_p2p_num_connected_peers_classification"
MetricP2PNumConnectedPeersClassification is the metric for monitoring the number of connected peers split on the connection type
const MetricP2PNumReceiverPeers = "erd_p2p_num_receiver_peers"
MetricP2PNumReceiverPeers represents the number of connected peer sent messages to the current peer (and have been received by the current peer) in the amount of time
const MetricP2PPeakNumReceiverPeers = "erd_p2p_peak_num_receiver_peers"
MetricP2PPeakNumReceiverPeers represents the peak number of connected peer sent messages to the current peer (and have been received by the current peer) in the amount of time
const MetricP2PPeakPeerNumProcessedMessages = "erd_p2p_peak_peer_num_processed_messages"
MetricP2PPeakPeerNumProcessedMessages represents the peak maximum number of processed messages in the amount of time counted on a connected peer
const MetricP2PPeakPeerNumReceivedMessages = "erd_p2p_peak_peer_num_received_messages"
MetricP2PPeakPeerNumReceivedMessages represents the peak maximum number of received messages in the amount of time counted on a connected peer
const MetricP2PPeakPeerSizeProcessedMessages = "erd_p2p_peak_peer_size_processed_messages"
MetricP2PPeakPeerSizeProcessedMessages represents the peak maximum size of processed data (sum of all messages) in the amount of time counted on a connected peer
const MetricP2PPeakPeerSizeReceivedMessages = "erd_p2p_peak_peer_size_received_messages"
MetricP2PPeakPeerSizeReceivedMessages represents the peak maximum size of received data (sum of all messages) in the amount of time counted on a connected peer
const MetricP2PPeerInfo = "erd_p2p_peer_info"
MetricP2PPeerInfo is the metric for the node's p2p info
const MetricP2PPeerNumProcessedMessages = "erd_p2p_peer_num_processed_messages"
MetricP2PPeerNumProcessedMessages represents the current maximum number of processed messages in the amount of time counted on a connected peer
const MetricP2PPeerNumReceivedMessages = "erd_p2p_peer_num_received_messages"
MetricP2PPeerNumReceivedMessages represents the current maximum number of received messages in the amount of time counted on a connected peer
const MetricP2PPeerSizeProcessedMessages = "erd_p2p_peer_size_processed_messages"
MetricP2PPeerSizeProcessedMessages represents the current maximum size of processed data (sum of all messages) in the amount of time counted on a connected peer
const MetricP2PPeerSizeReceivedMessages = "erd_p2p_peer_size_received_messages"
MetricP2PPeerSizeReceivedMessages represents the current maximum size of received data (sum of all messages) in the amount of time counted on a connected peer
const MetricP2PUnknownPeers = "erd_p2p_unknown_shard_peers"
MetricP2PUnknownPeers is the metric that outputs the unknown-shard connected peers
const MetricPeakTPS = "erd_peak_tps"
MetricPeakTPS holds the peak transactions per second
const MetricPeerType = "erd_peer_type"
MetricPeerType is the metric which tells the peer's type (in eligible list, in waiting list, or observer)
const MetricProbableHighestNonce = "erd_probable_highest_nonce"
MetricProbableHighestNonce is the metric for monitoring the max speculative nonce received by the node by listening on the network
const MetricProcessedProposedBlock = "erd_consensus_processed_proposed_block"
MetricProcessedProposedBlock is the metric that specify the percent of the block subround used for header and body processing (0 meaning that the block was processed in no-time and 100 meaning that the block processing used all the subround spare duration)
const MetricPublicKeyBlockSign = "erd_public_key_block_sign"
MetricPublicKeyBlockSign is the metric for monitoring public key of a node used in block signing
const MetricReceivedProposedBlock = "erd_consensus_received_proposed_block"
MetricReceivedProposedBlock is the metric that specify the moment in the round when the received block has reached the current node. The value is provided in percent (0 meaning it has been received just after the round started and 100 meaning that the block has been received in the last moment of the round)
const MetricRewardsValue = "erd_rewards_value"
MetricRewardsValue is the metric that stores rewards value
const MetricRoundAtEpochStart = "erd_round_at_epoch_start"
MetricRoundAtEpochStart is the metric for storing the first round of the current epoch
const MetricRoundDuration = "erd_round_duration"
MetricRoundDuration is the metric that specifies the round duration in milliseconds
const MetricRoundTime = "erd_round_time"
MetricRoundTime is the metric for round time in seconds
const MetricRoundsPassedInCurrentEpoch = "erd_rounds_passed_in_current_epoch"
MetricRoundsPassedInCurrentEpoch is the metric that tells the number of rounds passed in current epoch
const MetricRoundsPerEpoch = "erd_rounds_per_epoch"
MetricRoundsPerEpoch is the metric that tells the number of rounds in an epoch
const MetricShardConsensusGroupSize = "erd_shard_consensus_group_size"
MetricShardConsensusGroupSize is the metric for the shard consensus group size
const MetricShardId = "erd_shard_id"
MetricShardId is the metric for monitoring shard id of a node
const MetricStartTime = "erd_start_time"
MetricStartTime is the metric that specifies the genesis start time
const MetricSynchronizedRound = "erd_synchronized_round"
MetricSynchronizedRound is the metric for monitoring the synchronized round of a node
const MetricTxPoolLoad = "erd_tx_pool_load"
MetricTxPoolLoad is the metric for monitoring number of transactions from pool of a node
const NodesCoordinatorRegistryKeyPrefix = "indexHashed_"
NodesCoordinatorRegistryKeyPrefix is the key prefix to save epoch start registry to storage
const NumInitCharactersForScAddress = 10
NumInitCharactersForScAddress numbers of characters for smart contract address identifier
const PathEpochPlaceholder = "[E]"
PathEpochPlaceholder represents the placeholder for the epoch number in paths
const PathIdentifierPlaceholder = "[I]"
PathIdentifierPlaceholder represents the placeholder for the identifier in paths
const PathShardPlaceholder = "[S]"
PathShardPlaceholder represents the placeholder for the shard ID in paths
const PublicKeyBlacklistDuration = time.Second * 7200
PublicKeyBlacklistDuration represents the time to keep a public key in the black list if it will degrade its rating to a minimum threshold due to improper messages
const PutInStorerMaxTime = time.Second
PutInStorerMaxTime represents max time accepted for a put action, after which a warn message is displayed
const RelayedTransaction = "relayedTx"
RelayedTransaction is the key for the elrond meta/gassless/relayed transaction standard
const SCDeployInitFunctionName = "_init"
SCDeployInitFunctionName is the key for the function which is called at smart contract deploy time
const ShardIdentiferLen = 2
ShardIdentiferLen number of characters for shard identifier in an address
const ShuffledOut = "shuffledOut"
ShuffledOut signals that a restart is pending because the node was shuffled out
const SleepTimeBetweenCreateDBRetries = 5 * time.Second
SleepTimeBetweenCreateDBRetries represents the number of seconds to sleep between DB creates
const TriggerRegistryInitialKeyPrefix = "initial_value_epoch_"
TriggerRegistryInitialKeyPrefix is the key prefix to save initial data to storage
const TriggerRegistryKeyPrefix = "epochStartTrigger_"
TriggerRegistryKeyPrefix is the key prefix to save epoch start registry to storage
const UnVersionedAppString = "undefined"
UnVersionedAppString represents the default app version that indicate that the binary wasn't build by setting the appVersion flag
const VMTypeLen = 2
VMTypeLen number of characters with VMType identifier in an address, these are the last 2 characters from the initial identifier
const WrongP2PMessageBlacklistDuration = time.Second * 7200
WrongP2PMessageBlacklistDuration represents the time to keep a peer id in the blacklist if it sends a message that do not follow this protocol
Variables ¶
var ErrEmptyFile = errors.New("empty file provided")
ErrEmptyFile signals that a empty file has been provided
var ErrInvalidIdentifierForEpochStartBlockRequest = errors.New("invalid identifier for epoch start block request")
ErrInvalidIdentifierForEpochStartBlockRequest signals that an invalid identifier for epoch start block request has been provided
var ErrInvalidIndex = errors.New("invalid private key index")
ErrInvalidIndex signals that an invalid private key index has been provided
var ErrInvalidPollingInterval = errors.New("invalid polling interval ")
ErrInvalidPollingInterval signals that an invalid polling interval has been provided
var ErrInvalidValue = errors.New("invalid value provided")
ErrInvalidValue signals that a nil value has been provided
var ErrMajorVersionMismatch = errors.New("major version mismatch")
ErrMajorVersionMismatch signals that the major version mismatch
var ErrMinorVersionMismatch = errors.New("minor version mismatch")
ErrMinorVersionMismatch signals that the minor version mismatch
var ErrNilAppStatusHandler = errors.New("appStatusHandler is nil")
ErrNilAppStatusHandler signals that a nil status handler has been provided
var ErrNilEpochStartNotifier = errors.New("nil epoch start notifier")
ErrNilEpochStartNotifier signals that nil epoch start notifier has been provided
var ErrNilFile = errors.New("nil file provided")
ErrNilFile signals that a nil file has been provided
var ErrNilHasher = errors.New("nil hasher provided")
ErrNilHasher signals that a nil hasher has been provided
var ErrNilInputData = errors.New("nil input data")
ErrNilInputData signals that a nil data has been provided
var ErrNilMarshalizer = errors.New("nil marshalizer provided")
ErrNilMarshalizer signals that a nil marshalizer has been provided
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")
ErrNilNodesCoordinator signals a nil nodes coordinator has been provided
var ErrNilPemBLock = errors.New("nil pem block")
ErrNilPemBLock signals that the pem block is nil
var ErrNilStatusTagProvider = errors.New("nil status tag provider")
ErrNilStatusTagProvider signals that a nil status tag provider has been given as parameter
var ErrNilUrl = errors.New("url is empty")
ErrNilUrl signals that the provided url is empty
var ErrNotPositiveValue = errors.New("the provided value is not positive")
ErrNotPositiveValue signals that a 0 or negative value has been provided
var ErrPemFileIsInvalid = errors.New("pem file is invalid")
ErrPemFileIsInvalid signals that a pem file is invalid
var ErrReleaseVersionMismatch = errors.New("release version mismatch")
ErrReleaseVersionMismatch signals that the release version mismatch
var ErrVersionNumComponents = errors.New("invalid version while checking number of components")
ErrVersionNumComponents signals that a wrong number of components was provided
Functions ¶
func BooleanToInt ¶ added in v1.0.133
BooleanToInt takes a bool argument and returns 0 for false, 1 for true
func CalculateHash ¶
func CalculateHash( marshalizer marshal.Marshalizer, hasher hashing.Hasher, object interface{}, ) ([]byte, error)
CalculateHash marshalizes the interface and calculates its hash
func CommunicationIdentifierBetweenShards ¶ added in v1.0.102
CommunicationIdentifierBetweenShards is used to generate the identifier between shardID1 and shardID2 identifier is generated such as the first shard from identifier is always smaller or equal than the last
func ConvertBytes ¶
ConvertBytes converts the input bytes in a readable string using multipliers (k, M, G)
func ConvertToEvenHex ¶ added in v1.0.133
ConvertToEvenHex converts the provided value in a hex string, even number of characters
func ConvertToEvenHexBigInt ¶ added in v1.0.133
ConvertToEvenHexBigInt converts the provided value in a hex string, even number of characters
func CreateFile ¶
CreateFile opens or creates a file relative to the default path
func EmptyChannel ¶ added in v1.0.102
EmptyChannel empties the given channel
func EpochStartIdentifier ¶
EpochStartIdentifier returns the string for the epoch start identifier
func GetPercentageOfValue ¶
GetPercentageOfValue returns the percentage part of the value
func GetShardIdString ¶
GetShardIdString will return the string representation of the shard id
func GetTrimmedPk ¶
GetTrimmedPk returns a trimmed string to the pkPrefixSize value
func IsEmptyAddress ¶ added in v1.0.67
IsEmptyAddress returns whether an address is empty
func IsMetachainIdentifier ¶
IsMetachainIdentifier verifies if the identifier is of type metachain
func IsSmartContractAddress ¶
IsSmartContractAddress verifies if a set address is of type smart contract
func IsSmartContractOnMetachain ¶
IsSmartContractOnMetachain verifies if an address is smart contract on metachain
func IsUnknownEpochIdentifier ¶
IsUnknownEpochIdentifier return if the epoch identifier represents unknown epoch
func LoadGasScheduleConfig ¶
LoadGasScheduleConfig returns a map[string]uint64 of gas costs read from the provided config file
func LoadJsonFile ¶
LoadJsonFile method to open and decode json file
func LoadP2PConfig ¶
LoadP2PConfig returns a P2PConfig by reading the config file provided
func LoadSkPkFromPemFile ¶
LoadSkPkFromPemFile loads the secret key and existing public key bytes stored in the file
func LoadTomlFile ¶
LoadTomlFile method to open and decode toml file
func LoadTomlFileToMap ¶
LoadTomlFileToMap opens and decodes a toml file as a map[string]interface{}
func SaveSkToPemFile ¶
SaveSkToPemFile saves secret key bytes in the file
func SecondsToHourMinSec ¶
SecondsToHourMinSec transform seconds input in a human friendly format
func ShardIdToString ¶ added in v1.0.102
ShardIdToString returns the string according to the shard id
func TrimSoftwareVersion ¶ added in v1.0.115
TrimSoftwareVersion returns a trimmed byte array of the software version
func UniqueIdentifier ¶ added in v1.0.126
func UniqueIdentifier() string
UniqueIdentifier returns a unique string identifier of 32 bytes
Types ¶
type AppStatusHandler ¶
type AppStatusHandler interface { IsInterfaceNil() bool Increment(key string) AddUint64(key string, val uint64) Decrement(key string) SetInt64Value(key string, value int64) SetUInt64Value(key string, value uint64) SetStringValue(key string, value string) Close() }
AppStatusHandler interface will handle different implementations of monitoring tools, such as term-ui or status metrics
type ConnectedAddressesHandler ¶
type ConnectedAddressesHandler interface {
ConnectedAddresses() []string
}
ConnectedAddressesHandler interface will be used for passing the network component to AppStatusPolling
type NodeType ¶
type NodeType string
NodeType represents the node's role in the network
const NodeTypeObserver NodeType = "observer"
NodeTypeObserver signals that a node is running as observer node
const NodeTypeValidator NodeType = "validator"
NodeTypeValidator signals that a node is running as validator node
type P2PPeerInfo ¶
type P2PPeerInfo struct { PeerType P2PPeerType ShardID uint32 PkBytes []byte }
P2PPeerInfo represents a peer info structure
type P2PPeerType ¶
type P2PPeerType int
P2PPeerType defines the type of a p2p peer
const ( // UnknownPeer defines a peer that is unknown (did not advertise data in any way) UnknownPeer P2PPeerType = iota // ValidatorPeer means that the peer is a validator ValidatorPeer // ObserverPeer means that the peer is an observer ObserverPeer )
func (P2PPeerType) String ¶ added in v1.0.106
func (pt P2PPeerType) String() string
String returns the string-ified version of P2PPeerType
type PeerID ¶ added in v1.0.127
type PeerID string
PeerID is a p2p peer identity.
type PeerType ¶
type PeerType string
PeerType represents the type of a peer
const EligibleList PeerType = "eligible"
EligibleList represents the list of peers who participate in consensus inside a shard
const InactiveList PeerType = "inactive"
InactiveList represents the list of peers who were taken out because they were leaving
const JailedList PeerType = "jailed"
JailedList represents the list of peers who have stake but are in jail
const LeavingList PeerType = "leaving"
LeavingList represents the list of peers who were taken out of eligible and waiting because of rating
const NewList PeerType = "new"
NewList -
const ObserverList PeerType = "observer"
ObserverList represents the list of peers who don't participate in consensus but will join the next epoch
const WaitingList PeerType = "waiting"
WaitingList represents the list of peers who don't participate in consensus but will join the next epoch
type PubkeyConverter ¶ added in v1.0.120
type PubkeyConverter interface { Len() int Decode(humanReadable string) ([]byte, error) Encode(pkBytes []byte) string IsInterfaceNil() bool }
PubkeyConverter can convert public key bytes to/from a human readable form
type QueryP2PPeerInfo ¶ added in v1.0.130
type QueryP2PPeerInfo struct { IsBlacklisted bool `json:"isblacklisted"` Pid string `json:"pid"` Pk string `json:"pk"` PeerType string `json:"peertype"` Addresses []string `json:"addresses"` }
QueryP2PPeerInfo represents a DTO used in exporting p2p peer info after a query
type StopWatch ¶
type StopWatch struct {
// contains filtered or unexported fields
}
StopWatch is used to measure duration
func NewStopWatch ¶
func NewStopWatch() *StopWatch
NewStopWatch returns a new stopWatch instance used to measure duration between finished and started events
func (*StopWatch) GetMeasurement ¶
GetMeasurement returns the measurement (duration in seconds) by identifier
func (*StopWatch) GetMeasurements ¶
func (sw *StopWatch) GetMeasurements() []interface{}
GetMeasurements returns a logger compatible slice of interface{} containing pairs of (identifier, duration)
func (*StopWatch) GetMeasurementsMap ¶
GetMeasurementsMap returns the measurements as a map of (identifier, duration in seconds)
type TimersScheduler ¶ added in v1.0.133
type TimersScheduler interface { Add(callback func(alarmID string), duration time.Duration, alarmID string) Cancel(alarmID string) Close() Reset(alarmID string) IsInterfaceNil() bool }
TimersScheduler exposes functionality for scheduling multiple timers
type TransactionStatus ¶ added in v1.0.125
type TransactionStatus string
TransactionStatus is the type used to represent the status of a transaction
const ( // TxStatusReceived represents the status of a transaction which was received but not yet executed TxStatusReceived TransactionStatus = "received" // TxStatusPartiallyExecuted represent the status of a transaction which was received and executed on source shard TxStatusPartiallyExecuted TransactionStatus = "partially-executed" // TxStatusExecuted represents the status of a transaction which was received and executed TxStatusExecuted TransactionStatus = "executed" )
type WatchdogTimer ¶ added in v1.0.133
type WatchdogTimer interface { Set(callback func(alarmID string), duration time.Duration, alarmID string) SetDefault(duration time.Duration, alarmID string) Stop(alarmID string) Reset(alarmID string) IsInterfaceNil() bool }
WatchdogTimer is used to set alarms for different components