Bitcoin ABC  0.25.8
P2P Digital Currency
Classes | Typedefs | Enumerations | Functions | Variables
avalanche Namespace Reference

Classes

class  CompactProofs
 
struct  ConflictingProofComparator
 Compare conflicting proofs. More...
 
class  Delegation
 
class  DelegationBuilder
 
struct  DelegationId
 
class  DelegationState
 
class  Hello
 
struct  LimitedProofId
 
struct  next_request_time
 
struct  Node
 
struct  Peer
 
class  PeerManager
 
struct  PendingNode
 
class  Poll
 
struct  PrefilledProof
 
class  Processor
 
class  Proof
 
struct  proof_index
 
class  ProofBuilder
 
struct  ProofComparatorByScore
 Compare proofs by score, then by id in case of equality. More...
 
struct  ProofId
 
class  ProofPool
 Map a proof to each utxo. More...
 
struct  ProofPoolEntry
 
struct  ProofPoolEntryProofIdKeyExtractor
 
struct  ProofRadixTreeAdapter
 Radix tree adapter for storing a proof as a tree element. More...
 
struct  ProofRefComparatorByAddress
 Compare proof references by pointer address. More...
 
struct  ProofRefCompare
 
class  ProofRegistrationState
 
class  ProofsRequest
 
class  ProofValidationState
 
struct  query_timeout
 
class  Response
 
class  SaltedProofIdHasher
 
struct  score_index
 
struct  ShortIdProcessorPrefilledProofAdapter
 
class  SignedStake
 
struct  Slot
 
class  Stake
 
struct  StakeCommitment
 
struct  TestProofBuilder
 
class  Vote
 
class  VoteItemUpdate
 
struct  VoteRecord
 Vote history. More...
 

Typedefs

using ProofShortIdProcessor = ShortIdProcessor< PrefilledProof, ShortIdProcessorPrefilledProofAdapter, ProofRefCompare >
 
using BlockUpdate = VoteItemUpdate< CBlockIndex * >
 
using ProofUpdate = VoteItemUpdate< ProofRef >
 
using BlockVoteMap = std::map< const CBlockIndex *, VoteRecord, CBlockIndexWorkComparator >
 
using ProofVoteMap = std::map< const ProofRef, VoteRecord, ProofComparatorByScore >
 
using StakeId = uint256
 
using ProofRef = RCUPtr< const Proof >
 

Enumerations

enum  ProofRegistrationResult {
  ProofRegistrationResult::NONE = 0, ProofRegistrationResult::ALREADY_REGISTERED, ProofRegistrationResult::ORPHAN, ProofRegistrationResult::INVALID,
  ProofRegistrationResult::CONFLICTING, ProofRegistrationResult::REJECTED, ProofRegistrationResult::COOLDOWN_NOT_ELAPSED
}
 
enum  VoteStatus : uint8_t {
  VoteStatus::Invalid, VoteStatus::Rejected, VoteStatus::Accepted, VoteStatus::Finalized,
  VoteStatus::Stale
}
 
enum  ProofValidationResult {
  ProofValidationResult::NONE = 0, ProofValidationResult::NO_STAKE, ProofValidationResult::DUST_THRESOLD, ProofValidationResult::DUPLICATE_STAKE,
  ProofValidationResult::WRONG_STAKE_ORDERING, ProofValidationResult::INVALID_STAKE_SIGNATURE, ProofValidationResult::TOO_MANY_UTXOS, ProofValidationResult::INVALID_PAYOUT_SCRIPT,
  ProofValidationResult::INVALID_PROOF_SIGNATURE, ProofValidationResult::MISSING_UTXO, ProofValidationResult::COINBASE_MISMATCH, ProofValidationResult::HEIGHT_MISMATCH,
  ProofValidationResult::AMOUNT_MISMATCH, ProofValidationResult::NON_STANDARD_DESTINATION, ProofValidationResult::DESTINATION_NOT_SUPPORTED, ProofValidationResult::DESTINATION_MISMATCH,
  ProofValidationResult::IMMATURE_UTXO
}
 
enum  DelegationResult { DelegationResult::NONE = 0, DelegationResult::INVALID_SIGNATURE, DelegationResult::TOO_MANY_LEVELS }
 

Functions

template<typename L , typename F >
static bool reduceLevels (uint256 &hash, const std::vector< L > &levels, F f)
 
template<typename L >
static bool reduceLevels (uint256 &hash, const std::vector< L > &levels)
 
static bool isOrphanState (const ProofValidationState &state)
 
PeerId selectPeerImpl (const std::vector< Slot > &slots, const uint64_t slot, const uint64_t max)
 Internal methods that are exposed for testing purposes. More...
 
static bool VerifyProof (const Proof &proof, bilingual_str &error)
 
static bool VerifyDelegation (const Delegation &dg, const CPubKey &expectedPubKey, bilingual_str &error)
 
ProofRef buildRandomProof (uint32_t score, int height, const CKey &masterKey)
 
bool hasDustStake (const ProofRef &proof)
 

Variables

constexpr size_t MAX_DELEGATION_LEVELS {20}
 The maximum number of delegation levels we are willing to verify. More...
 
static constexpr uint32_t AVALANCHE_MAX_ORPHAN_PROOFS = 4000
 Maximum number of orphan proofs the peer manager will accept from the network. More...
 
static constexpr Amount PROOF_DUST_THRESHOLD = 1 * COIN
 Minimum amount per utxo. More...
 
constexpr uint32_t MIN_VALID_PROOF_SCORE = 100 * PROOF_DUST_THRESHOLD / COIN
 

Typedef Documentation

◆ BlockUpdate

Definition at line 80 of file processor.h.

◆ BlockVoteMap

Definition at line 84 of file processor.h.

◆ ProofRef

using avalanche::ProofRef = typedef RCUPtr<const Proof>

Definition at line 195 of file proof.h.

◆ ProofShortIdProcessor

Definition at line 52 of file compactproofs.h.

◆ ProofUpdate

Definition at line 81 of file processor.h.

◆ ProofVoteMap

Definition at line 86 of file processor.h.

◆ StakeId

using avalanche::StakeId = typedef uint256

Definition at line 48 of file proof.h.

Enumeration Type Documentation

◆ DelegationResult

Enumerator
NONE 
INVALID_SIGNATURE 
TOO_MANY_LEVELS 

Definition at line 36 of file validation.h.

◆ ProofRegistrationResult

Enumerator
NONE 
ALREADY_REGISTERED 
ORPHAN 
INVALID 
CONFLICTING 
REJECTED 
COOLDOWN_NOT_ELAPSED 

Definition at line 135 of file peermanager.h.

◆ ProofValidationResult

Enumerator
NONE 
NO_STAKE 
DUST_THRESOLD 
DUPLICATE_STAKE 
WRONG_STAKE_ORDERING 
INVALID_STAKE_SIGNATURE 
TOO_MANY_UTXOS 
INVALID_PAYOUT_SCRIPT 
INVALID_PROOF_SIGNATURE 
MISSING_UTXO 
COINBASE_MISMATCH 
HEIGHT_MISMATCH 
AMOUNT_MISMATCH 
NON_STANDARD_DESTINATION 
DESTINATION_NOT_SUPPORTED 
DESTINATION_MISMATCH 
IMMATURE_UTXO 

Definition at line 12 of file validation.h.

◆ VoteStatus

enum avalanche::VoteStatus : uint8_t
strong
Enumerator
Invalid 
Rejected 
Accepted 
Finalized 
Stale 

Definition at line 58 of file processor.h.

Function Documentation

◆ buildRandomProof()

ProofRef avalanche::buildRandomProof ( uint32_t  score,
int  height,
const CKey masterKey 
)

Definition at line 20 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasDustStake()

bool avalanche::hasDustStake ( const ProofRef proof)

Definition at line 40 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOrphanState()

static bool avalanche::isOrphanState ( const ProofValidationState state)
static

Definition at line 175 of file peermanager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduceLevels() [1/2]

template<typename L >
static bool avalanche::reduceLevels ( uint256 hash,
const std::vector< L > &  levels 
)
static

Definition at line 52 of file delegation.cpp.

Here is the call graph for this function:

◆ reduceLevels() [2/2]

template<typename L , typename F >
static bool avalanche::reduceLevels ( uint256 hash,
const std::vector< L > &  levels,
f 
)
static

Definition at line 36 of file delegation.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectPeerImpl()

PeerId avalanche::selectPeerImpl ( const std::vector< Slot > &  slots,
const uint64_t  slot,
const uint64_t  max 
)

Internal methods that are exposed for testing purposes.

Definition at line 729 of file peermanager.cpp.

Here is the caller graph for this function:

◆ VerifyDelegation()

static bool avalanche::VerifyDelegation ( const Delegation dg,
const CPubKey expectedPubKey,
bilingual_str error 
)
static

Definition at line 69 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyProof()

static bool avalanche::VerifyProof ( const Proof proof,
bilingual_str error 
)
static

Definition at line 38 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ AVALANCHE_MAX_ORPHAN_PROOFS

constexpr uint32_t avalanche::AVALANCHE_MAX_ORPHAN_PROOFS = 4000
staticconstexpr

Maximum number of orphan proofs the peer manager will accept from the network.

Under good conditions, this allows the node to collect relevant proofs during IBD. Note that reorgs can cause the orphan pool to temporarily exceed this limit. But a change in chaintip cause previously reorged proofs to be trimmed.

Definition at line 44 of file peermanager.h.

◆ MAX_DELEGATION_LEVELS

constexpr size_t avalanche::MAX_DELEGATION_LEVELS {20}
constexpr

The maximum number of delegation levels we are willing to verify.

A Schnorr signature verification takes about 35us on a 2022 average machine, so 20 levels will roughly take under 1ms (accounting some overhead) while being more than enough to cover all the real world usage.

Definition at line 26 of file delegation.h.

◆ MIN_VALID_PROOF_SCORE

constexpr uint32_t avalanche::MIN_VALID_PROOF_SCORE = 100 * PROOF_DUST_THRESHOLD / COIN
constexpr

Definition at line 16 of file util.h.

◆ PROOF_DUST_THRESHOLD

constexpr Amount avalanche::PROOF_DUST_THRESHOLD = 1 * COIN
staticconstexpr

Minimum amount per utxo.

Definition at line 44 of file proof.h.