Class Validator

Implementation of the Validator node

class Validator
  : FullNode
  , API ;

This class implement the business code of the node. Communication with the other nodes is handled by the Network class.

Constructors

NameDescription
this (config) Ctor

Fields

NameTypeDescription
nominator NominatorNominator instance
qc QuorumConfigCurrently active quorum configuration
quorum_params QuorumParamsQuorum generator parameters
required_peer_utxos UTXO[geod24.bitblob.BitBlob!(64L)]The current required set of peers UTXOs to connect to
app_stats Stats!(agora.stats.App.ApplicationStatsValue,agora.stats.App.ApplicationStatsLabels)Persistence-related fields
block_handlers agora.node.FullNode.FullNode.HandlerInfo!(agora.api.Handlers.BlockExternalizedHandler)[]List of handlers for specific actions
block_header_handlers agora.node.FullNode.FullNode.HandlerInfo!(agora.api.Handlers.BlockHeaderUpdatedHandler)[]List of handlers for specific actions
cacheDB ManagedDatabasePersistence-related fields
clock ClockClock instance
config ConfigConfig instance
endpoint_request_stats Stats!(agora.stats.EndpointReq.EndpointReqStatsValue,agora.stats.EndpointReq.EndpointReqStatsLabel)Persistence-related fields
enroll_man EnrollmentManagerEnrollment manager
is_shutting_down boolNode is shutting down
ledger NodeLedgerThe Ledger is the main class driving consensus
log LoggerLogger instance
network NetworkManagerNetwork of connected nodes
params immutable(ConsensusParams)Parameters for consensus-critical constants
pool TransactionPoolTransaction pool
preimage_handlers agora.node.FullNode.FullNode.HandlerInfo!(agora.api.Handlers.PreImageReceivedHandler)[]List of handlers for specific actions
registry NameRegistryName registry, if enabled for this node
stateDB ManagedDatabasePersistence-related fields
storage IBlockStoragePersistence-related fields
taskman ITaskManagerTask manager
timers ITimer[int]Timers this node has started
transaction_handlers agora.node.FullNode.FullNode.HandlerInfo!(agora.api.Handlers.TransactionReceivedHandler)[]List of handlers for specific actions
transaction_relayer TransactionRelayerTransaction relayer

Methods

NameDescription
getPublicKey (key) GET /public_key
getSCPState ()
getTxSet (hash) Set of TX hashes represented by the given hash
handshake (peer)
makeAdminInterface () Instantiate a new instance of the Admin interface
postBlockSignature (block_sig) Receive a block signature.
postEnvelope (envelope) Receive an SCP envelope.
shutdown () Calls the base class shutdown and store the latest SCP state
start () Begins asynchronous tasks for node discovery and periodic catchup.
getBlock (height)
getBlockHeaders (heights)
getBlockHeight ()
getBlocksFrom (height, max_blocks)
getConsensusParams ()
getEnrollment (enroll_hash)
getLocalTime () GET /local_time
getLocalTime ()
getMerklePath (height, hash)
getNetworkManager ()
getNodeInfo ()
getPreimages (enroll_keys)
getPreimagesFrom (start_height)
getTaskManager ()
getTransactions (tx_hashes)
getTransactions (from)
getValidators (height)
hasTransactionHash (tx)
makeConsensusParams (config) Make a new instance of the consensus parameters based on the config
postEnrollment (enroll, avail_height) POST /enrollment
postPreimage (preimage) POST /preimage
postTransaction (tx) Receive a transaction.
acceptBlock (block) Store the block in the ledger if valid.
acceptHeader (header) If block header is valid and after last paid height we add our signature in case missing and any other signatures we have in memory. Then the ledger is updated and the header is pushed to configured listeners.
checkAndEnroll (height) Check if the next enrollment is available or validator is not enrolled. Enroll when necessary.
discoveryTask () Begins asynchronous tasks for node discovery and periodic catchup.
invalidNominationHandler (_, msg) A delegate to be called by Nominator when node's own nomination is invalid
makeClock () Get a Clock instance. May be overriden in unittests to simulate clock disparities, as well as provide a custom median retrieveal delegate to simulate delays (task.wait() calls).
makeLedger () Returns an instance of a ValidatingLedger.
makeLogger ()
makeNominator (clock, network, ledger, enroll_man, taskman, block_catchup_timer) Returns an instance of a Nominator.
onAcceptedBlock (block, validators_changed) Calls the base class onAcceptedBlock and additionally shuffles the quorum set if the new block header height is QuorumShuffleInterval blocks newer than the last shuffle height.
onPreImageRevealTimer () Periodically called to perform pre-images revelation.
potentialExtraSigs (header) Count extra signatures that could be added to the provided header.
preImageCatchupTask () Periodically retrieve pre-images if we are missing any.
catchupTask () Periodically retrieve the latest blocks and apply them to the provided ledger.
getDoubleSpentSelector (txs) Returns an instance of a DoubleSpentSelector
makeBlockStorage () Returns an instance of an IBlockStorage
makeCacheDB ()
makeEnrollmentManager () Returns an instance of a EnrollmentManager
makeLedger () Returns an instance of a Ledger to be used for a Fullnode.
makeNetworkManager () Returns an instance of a NetworkManager
makeStateDB ()
makeTaskManager () Returns an instance of a TaskManager
pushBlockHeader (header) Push an updated block header to the blockheader_handlers target server list set in config. The blockheader can have signatures from validators added even after the block has been externalized.
pushPreImage (pre_image) Push the preimage to the preimage_handlers target server list set in config.
pushTransaction (tx) Push the transaction to the transaction_handlers target server list set in config.
recordReq (endpoint, weight) Convenience function to increase an endpoint stats

Enums

NameDescription
TimersIdx