core

package
v1.0.69 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ConsensusTopic = "consensus"

ConsensusTopic is the topic used in consensus algorithm

View Source
const FileModeUserReadWrite = 0600

FileModeUserReadWrite represents the permission for a file which allows the user for reading and writing

View Source
const MaxBulkTransactionSize = 2 << 17 //128KB 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

View Source
const MaxMiniBlocksInBlock = 100

MaxMiniBlocksInBlock specifies the max number of mini blocks which can be added in one block

View Source
const MetricAppVersion = "erd_app_version"

MetricAppVersion is the metric for the current app version

View Source
const MetricCommunityPercentage = "erd_metric_community_percentage"

MetricCommunityPercentage is the metric for community rewards percentage

View Source
const MetricConnectedNodes = "erd_connected_nodes"

MetricConnectedNodes is the metric for monitoring total connected peers on the network

View Source
const MetricConsensusGroupSize = "erd_metric_consensus_group_size"

MetricConsensusGroupSize is the metric for consensus group size

View Source
const MetricConsensusRoundState = "erd_consensus_round_state"

MetricConsensusRoundState is the metric for consensus round state for a block

View Source
const MetricConsensusState = "erd_consensus_state"

MetricConsensusState is the metric for consensus state of node proposer,participant or not consensus group

View Source
const MetricCountAcceptedBlocks = "erd_count_accepted_blocks"

MetricCountAcceptedBlocks is the metric for monitoring number of blocks that was accepted proposed by a node

View Source
const MetricCountConsensus = "erd_count_consensus"

MetricCountConsensus is the metric for monitoring number of rounds when a node was in consensus group

View Source
const MetricCountConsensusAcceptedBlocks = "erd_count_consensus_accepted_blocks"

MetricCountConsensusAcceptedBlocks is the metric for monitoring number of blocks accepted when the node was in consensus group

View Source
const MetricCountLeader = "erd_count_leader"

MetricCountLeader is the metric for monitoring number of rounds when a node was leader

View Source
const MetricCpuLoadPercent = "erd_cpu_load_percent"

MetricCpuLoadPercent is the metric for monitoring CPU load [%]

View Source
const MetricCrossCheckBlockHeight = "erd_metric_cross_check_block_height"

MetricCrossCheckBlockHeight is the metric that store cross block height

View Source
const MetricCurrentBlockHash = "erd_current_block_hash"

MetricCurrentBlockHash is the metric that stores the current block hash

View Source
const MetricCurrentRound = "erd_current_round"

MetricCurrentRound is the metric for monitoring the current round of a node

View Source
const MetricCurrentRoundTimestamp = "erd_current_round_timestamp"

MetricCurrentRoundTimestamp is the metric that stores current round timestamp

View Source
const MetricDenominationCoefficient = "erc_metric_denomination_coefficient"

MetricDenominationCoefficient is the metric for denomination coefficient that is used in views

View Source
const MetricEpochNumber = "erd_epoch_number"

MetricEpochNumber is the metric for the number of epoch

View Source
const MetricHeaderSize = "erd_current_block_size"

MetricHeaderSize is the metric that stores the current block size

View Source
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

View Source
const MetricIsSyncing = "erd_is_syncing"

MetricIsSyncing is the metric for monitoring if a node is syncing

View Source
const MetricLatestTagSoftwareVersion = "erd_latest_tag_software_version"

MetricLatestTagSoftwareVersion is the metric that stores the latest tag software version

View Source
const MetricLeaderPercentage = "erd_metric_leader_percentage"

MetricLeaderPercentage is the metric for leader rewards percentage

View Source
const MetricLiveValidatorNodes = "erd_live_validator_nodes"

MetricLiveValidatorNodes is the metric for monitoring live validators on the network

View Source
const MetricMemLoadPercent = "erd_mem_load_percent"

MetricMemLoadPercent is the metric for monitoring memory load [%]

View Source
const MetricMemTotal = "erd_mem_total"

MetricMemTotal is the metric for monitoring total memory bytes

View Source
const MetricMemUsedGolang = "erd_mem_used_golang"

MetricMemUsedGolang is the metric that stores the total memory used by golang in bytes

View Source
const MetricMemUsedSystem = "erd_mem_used_sys"

MetricMemUsedSystem is the metric that stores the total memory used by the system in bytes

View Source
const MetricMiniBlocksSize = "erd_mini_blocks_size"

MetricMiniBlocksSize is the metric that stores the current block size

View Source
const MetricNetworkRecvBps = "erd_network_recv_bps"

MetricNetworkRecvBps is the metric for monitoring network received bytes per second

View Source
const MetricNetworkRecvBpsPeak = "erd_network_recv_bps_peak"

MetricNetworkRecvBpsPeak is the metric for monitoring network received peak bytes per second

View Source
const MetricNetworkRecvPercent = "erd_network_recv_percent"

MetricNetworkRecvPercent is the metric for monitoring network receive load [%]

View Source
const MetricNetworkSentBps = "erd_network_sent_bps"

MetricNetworkSentBps is the metric for monitoring network sent bytes per second

View Source
const MetricNetworkSentBpsPeak = "erd_network_sent_bps_peak"

MetricNetworkSentBpsPeak is the metric for monitoring network sent peak bytes per second

View Source
const MetricNetworkSentPercent = "erd_network_sent_percent"

MetricNetworkSentPercent is the metric for monitoring network sent load [%]

View Source
const MetricNodeDisplayName = "erd_node_display_name"

MetricNodeDisplayName is the metric that stores the name of the node

View Source
const MetricNodeType = "erd_node_type"

MetricNodeType is the metric for monitoring the type of the node

View Source
const MetricNonce = "erd_nonce"

MetricNonce is the metric for monitoring the nonce of a node

View Source
const MetricNumConnectedPeers = "erd_num_connected_peers"

MetricNumConnectedPeers is the metric for monitoring the number of connected peers

View Source
const MetricNumMiniBlocks = "erd_num_mini_blocks"

MetricNumMiniBlocks is the metric for number of miniblocks in a block

View Source
const MetricNumProcessedTxs = "erd_num_transactions_processed"

MetricNumProcessedTxs is the metric that stores the number of transactions processed

View Source
const MetricNumShardHeadersFromPool = "erd_num_shard_headers_from_pool"

MetricNumShardHeadersFromPool is the metric that stores number of shard header from pool

View Source
const MetricNumShardHeadersProcessed = "erd_num_shard_headers_processed"

MetricNumShardHeadersProcessed is the metric that stores number of shard header processed

View Source
const MetricNumTimesInForkChoice = "erd_fork_choice_count"

MetricNumTimesInForkChoice is the metric that counts how many time a node was in fork choice

View Source
const MetricNumTxInBlock = "erd_num_tx_block"

MetricNumTxInBlock is the metric for the number of transactions in the proposed block

View Source
const MetricNumValidators = "erd_metric_num_validators"

MetricNumValidators is the metric for the number of validators

View Source
const MetricP2pNetworkNumProcessedMessages = "erd_p2p_network_num_processed_messages"

MetricP2pNetworkNumProcessedMessages represents the current total network number of processed messages in the amount of time. It represents the sum of all processed messages from all connected peers

View Source
const MetricP2pNetworkNumReceivedMessages = "erd_p2p_network_num_received_messages"

MetricP2pNetworkNumReceivedMessages represents the current total network number of received messages in the amount of time. It represents the sum of all received messages from all connected peers

View Source
const MetricP2pNetworkSizeProcessedMessages = "erd_p2p_network_size_processed_messages"

MetricP2pNetworkSizeProcessedMessages represents the current total network size of processed messages in the amount of time. It represents the sum of all processed messages from all connected peers

View Source
const MetricP2pNetworkSizeReceivedMessages = "erd_p2p_network_size_received_messages"

MetricP2pNetworkSizeReceivedMessages represents the current total network size of received messages in the amount of time. It represents the sum of all received messages from all connected peers

View Source
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

View Source
const MetricP2pPeakNetworkNumProcessedMessages = "erd_p2p_peak_network_num_processed_messages"

MetricP2pPeakNetworkNumProcessedMessages represents the peak network number of processed messages in the amount of time It represents the peak sum of all processed messages from all connected peers

View Source
const MetricP2pPeakNetworkNumReceivedMessages = "erd_p2p_peak_network_num_received_messages"

MetricP2pPeakNetworkNumReceivedMessages represents the peak network number of received messages in the amount of time It represents the peak sum of all received messages from all connected peers

View Source
const MetricP2pPeakNetworkSizeProcessedMessages = "erd_p2p_peak_network_size_processed_messages"

MetricP2pPeakNetworkSizeProcessedMessages represents the peak network size of processed messages in the amount of time It represents the peak sum of all processed messages from all connected peers

View Source
const MetricP2pPeakNetworkSizeReceivedMessages = "erd_p2p_peak_network_size_received_messages"

MetricP2pPeakNetworkSizeReceivedMessages represents the peak network size of received messages in the amount of time It represents the peak sum of all received messages from all connected peers

View Source
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

View Source
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

View Source
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

View Source
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

View Source
const MetricP2pPeakPeerxNumProcessedMessages = "erd_p2p_peak_peer_num_processed_messages"

MetricP2pPeakPeerxNumProcessedMessages represents the peak maximum number of processed messages in the amount of time counted on a connected peer

View Source
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

View Source
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

View Source
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

View Source
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

View Source
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

View Source
const MetricPublicKeyBlockSign = "erd_public_key_block_sign"

MetricPublicKeyBlockSign is the metric for monitoring public key of a node used in block signing

View Source
const MetricPublicKeyTxSign = "erd_public_key_tx_sign"

MetricPublicKeyTxSign is the metric for monitoring public key of a node used in tx signing (balance account held by the node)

View Source
const MetricRewardsValue = "erd_rewards_value"

MetricRewardsValue is the metric that stores rewards value

View Source
const MetricRoundTime = "erd_round_time"

MetricRoundTime is the metric for round time in seconds

View Source
const MetricShardId = "erd_shard_id"

MetricShardId is the metric for monitoring shard id of a node

View Source
const MetricSynchronizedRound = "erd_synchronized_round"

MetricSynchronizedRound is the metric for monitoring the synchronized round of a node

View Source
const MetricTxPoolLoad = "erd_tx_pool_load"

MetricTxPoolLoad is the metric for monitoring number of transactions from pool of a node

View Source
const NumInitCharactersForScAddress = 10

NumInitCharactersForScAddress numbers of characters for smart contract address identifier

View Source
const PathEpochPlaceholder = "[E]"

PathEpochPlaceholder represents the placeholder for the epoch number in paths

View Source
const PathIdentifierPlaceholder = "[I]"

PathIdentifierPlaceholder represents the placeholder for the identifier in paths

View Source
const PathShardPlaceholder = "[S]"

PathShardPlaceholder represents the placeholder for the shard ID in paths

View Source
const ShardIdentiferLen = 2

ShardIdentiferLen number of characters for shard identifier in an address

View Source
const UnVersionedAppString = "undefined"

UnVersionedAppString represents the default app version that indicate that the binary wasn't build by setting the appVersion flag

View Source
const VMTypeLen = 2

VMTypeLen number of characters with VMType identifier in an address, these are the last 2 characters from the initial identifier

Variables

View Source
var ErrEmptyFile = errors.New("empty file provided")

ErrEmptyFile signals that a empty file has been provided

View Source
var ErrInvalidIdentifierForEpochStartBlockRequest = errors.New("invalid identifier for epoch start block request")

ErrInvalidIdentifierForEpochStartBlockRequest

View Source
var ErrInvalidIndex = errors.New("invalid private key index")

ErrInvalidIndex signals that an invalid private key index has been provided

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

ErrInvalidValue signals that a nil value has been provided

View Source
var ErrNilAppStatusHandler = errors.New("appStatusHandler is nil")

ErrNilAppStatusHandler signals that a nil status handler has been provided

View Source
var ErrNilCoordinator = errors.New("nil coordinator provided")

ErrNilCoordinator signals that a nil shardCoordinator has been provided

View Source
var ErrNilFile = errors.New("nil file provided")

ErrNilFile signals that a nil file has been provided

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

ErrNilHasher signals that a nil hasher has been provided

View Source
var ErrNilInputData = errors.New("nil input data")

ErrNilInputData signals that a nil data has been provided

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

ErrNilMarshalizer signals that a nil marshalizer has been provided

View Source
var ErrNilUrl = errors.New("url is empty")

ErrNilUrl signals that the provided url is empty

View Source
var ErrNotPositiveValue = errors.New("the provided value is not positive")

ErrNotPositiveValue signals that a 0 or negative value has been provided

View Source
var ErrPemFileIsInvalid = errors.New("pem file is invalid")

ErrPemFileIsInvalid signals that a pem file is invalid

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

ErrWrongTypeAssertion signals that an type assertion failed

Functions

func CalculateHash

func CalculateHash(
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	object interface{},
) ([]byte, error)

CalculateHash marshalizes the interface and calculates its hash

func ConvertBytes

func ConvertBytes(bytes uint64) string

ConvertBytes converts the input bytes in a readable string using multipliers (k, M, G)

func CreateFile

func CreateFile(prefix string, subfolder string, fileExtension string) (*os.File, error)

CreateFile opens or creates a file relative to the default path

func EpochStartIdentifier

func EpochStartIdentifier(epoch uint32) string

EpochStartIdentifier returns the string for the epoch start identifier

func GetShardIdString

func GetShardIdString(shardId uint32) string

GetShardIdString will return the string representation of the shard id

func GetTrimmedPk

func GetTrimmedPk(pk string) string

GetTrimmedPk returns a trimmed string to the pkPrefixSize value

func GetVMType

func GetVMType(rcvAddress []byte) []byte

GetVMType

func IsEmptyAddress added in v1.0.67

func IsEmptyAddress(rcvAddress []byte) bool

IsEmptyAddress verifies if a set address is of empty - so it is deployment address

func IsMetachainIdentifier

func IsMetachainIdentifier(identifier []byte) bool

IsMetachainIdentifier verifies if the identifier is of type metachain

func IsSmartContractAddress

func IsSmartContractAddress(rcvAddress []byte) bool

IsSmartContractAddress verifies if a set address is of type smart contract

func IsSmartContractOnMetachain

func IsSmartContractOnMetachain(identifier []byte, rcvAddress []byte) bool

IsSmartContractOnMetachain verifies if an address is smart contract on metachain

func IsUnknownEpochIdentifier

func IsUnknownEpochIdentifier(identifier []byte) (bool, error)

IsUnknownEpochIdentifier return if the epoch identifier represents unknown epoch

func LoadGasScheduleConfig

func LoadGasScheduleConfig(filepath string) (map[string]map[string]uint64, error)

LoadGasScheduleConfig returns a map[string]uint64 of gas costs read from the provided config file

func LoadJsonFile

func LoadJsonFile(dest interface{}, relativePath string) error

LoadJsonFile method to open and decode json file

func LoadP2PConfig

func LoadP2PConfig(filepath string) (*config.P2PConfig, error)

LoadP2PConfig returns a P2PConfig by reading the config file provided

func LoadServersPConfig added in v1.0.3

func LoadServersPConfig(filepath string) (*config.ServersConfig, error)

LoadServersPConfig returns a ServersConfig by reading the config file provided

func LoadSkFromPemFile added in v1.0.3

func LoadSkFromPemFile(relativePath string, skIndex int) ([]byte, error)

LoadSkFromPemFile loads the secret key bytes stored in the file

func LoadTomlFile

func LoadTomlFile(dest interface{}, relativePath string) error

LoadTomlFile method to open and decode toml file

func LoadTomlFileToMap

func LoadTomlFileToMap(relativePath string) (map[string]interface{}, error)

LoadTomlFileToMap opens and decodes a toml file as a map[string]interface{}

func MaxInt32

func MaxInt32(a int32, b int32) int32

MaxInt32 returns the maximum of two given numbers

func MaxUint32

func MaxUint32(a uint32, b uint32) uint32

MaxUint32 returns the maximum of two given numbers

func MaxUint64

func MaxUint64(a uint64, b uint64) uint64

MaxUint64 returns the maximum of two given numbers

func MinInt

func MinInt(a int, b int) int

MinInt returns the minimum of two given numbers

func MinInt32

func MinInt32(a int32, b int32) int32

MinInt32 returns the minimum of two given numbers

func MinUint32

func MinUint32(a uint32, b uint32) uint32

MinUint32 returns the minimum of two given numbers

func MinUint64

func MinUint64(a uint64, b uint64) uint64

MinUint64 returns the minimum of two given numbers

func OpenFile

func OpenFile(relativePath string) (*os.File, error)

OpenFile method opens the file from given path - does not close the file

func SaveSkToPemFile

func SaveSkToPemFile(file *os.File, identifier string, skBytes []byte) error

SaveSkToPemFile saves secret key bytes in the file

func SecondsToHourMinSec

func SecondsToHourMinSec(input int) string

SecondsToHourMinSec transform seconds input in a human friendly format

func ToB64 added in v1.0.3

func ToB64(buff []byte) string

ToB64 encodes the given buff to base64

func ToHex

func ToHex(buff []byte) string

ToHex encodes the given buff to hex

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 AtomicCounter added in v1.0.64

type AtomicCounter int64

AtomicCounter is

func (*AtomicCounter) Decrement added in v1.0.64

func (counter *AtomicCounter) Decrement() int64

Decrement decrements counter

func (*AtomicCounter) Get added in v1.0.64

func (counter *AtomicCounter) Get() int64

Get gets counter

func (*AtomicCounter) Increment added in v1.0.64

func (counter *AtomicCounter) Increment() int64

Increment increments counter

func (*AtomicCounter) Set added in v1.0.64

func (counter *AtomicCounter) Set(value int64)

Set sets counter

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

Jump to

Keyboard shortcuts

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