veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::AltChainParams Struct Referenceabstract

Base class for all Altchain-related configs. More...

Detailed Description

Definition at line 137 of file alt_chain_params.hpp.

#include <alt_chain_params.hpp>

+ Inheritance diagram for altintegration::AltChainParams:
+ Collaboration diagram for altintegration::AltChainParams:

Public Member Functions

size_t maxWorkerQueueSize () const noexcept
 
uint32_t getKeystoneInterval () const noexcept
 number of blocks in single keystone interval. More...
 
uint32_t getFinalityDelay () const noexcept
 number of blocks in VBK used for finalization More...
 
const std::vector< uint32_t > & getForkResolutionLookUpTable () const noexcept
 pop score lookup table for fork resolution More...
 
uint32_t getEndorsementSettlementInterval () const noexcept
 Validity window for ATVs. More...
 
const PopPayoutsParamsgetPayoutParams () const noexcept
 getter for reward parameters More...
 
size_t getMaxVbkBlocksInAltBlock () const noexcept
 total maximum number of VBK blocks per 1 ALT block More...
 
size_t getMaxVTBsInAltBlock () const noexcept
 total maximum number of VTBs per 1 ALT block More...
 
size_t getMaxATVsInAltBlock () const noexcept
 total maximum number of ATVs per 1 ALT block More...
 
size_t getMaxPopDataSize () const noexcept
 maximum size (in bytes) of single PopData per single ALT block More...
 
uint32_t maxAltchainFutureBlockTime () const noexcept
 Maximum future block time for altchain blocks. More...
 
int32_t getMaxReorgBlocks () const noexcept
 Max number of blocks that can be reorganized in altchain. More...
 
uint32_t preserveBlocksBehindFinal () const noexcept
 when finalizeBlockImpl is called, this many blocks behind final block will be preserved in RAM. More...
 
virtual int64_t getIdentifier () const noexcept=0
 unique POP ID for the chain; identifies altchain in VBK More...
 
virtual AltBlock getBootstrapBlock () const noexcept=0
 "genesis" block for POP mining. More...
 
virtual std::vector< uint8_t > getHash (const std::vector< uint8_t > &bytes) const noexcept=0
 Calculate hash from block header. More...
 
virtual bool checkBlockHeader (const std::vector< uint8_t > &bytes, const std::vector< uint8_t > &root, ValidationState &state) const noexcept=0
 Returns true if input bytes: More...
 

Public Attributes

std::shared_ptr< PopPayoutsParamsmPopPayoutsParams
 
int32_t mMaxReorgBlocks = ALT_MAX_REORG_BLOCKS_MIN_VALUE
 
uint32_t mMaxAltchainFutureBlockTime = 10 * 60
 
uint32_t mKeystoneInterval = 5
 
uint32_t mFinalityDelay = 100
 
uint32_t mEndorsementSettlementInterval = 50
 
uint32_t mPreserveBlocksBehindFinal = mEndorsementSettlementInterval
 
uint32_t mMaxPopDataSize = MAX_POPDATA_SIZE
 
size_t mMaxVbkBlocksInAltBlock = 200
 
size_t mMaxVTBsInAltBlock = 200
 
size_t mMaxATVsInAltBlock = 1000
 
std::vector< uint32_t > mForkResolutionLookUpTable
 

Member Function Documentation

◆ checkBlockHeader()

virtual bool altintegration::AltChainParams::checkBlockHeader ( const std::vector< uint8_t > &  bytes,
const std::vector< uint8_t > &  root,
ValidationState state 
) const
pure virtualnoexcept
  • can be deserialized to a header
  • statelessly valid (time, POW, version... etc)
  • top level merkle root is equal to 'root'
    Parameters
    [in]bytes
    [in]roottop level merkle root to validate
    [out]statevalidation state
    Returns
    false if any of checks fail
    Warning
    SHOULD NOT THROW

Implemented in altintegration::AltChainParamsRegTest.

◆ getBootstrapBlock()

virtual AltBlock altintegration::AltChainParams::getBootstrapBlock ( ) const
pure virtualnoexcept

This is first block that can be endorsed by POP miners. Can start at genesis block, or at any part of the active chain. This block is immediately finalized, so chain CAN NOT be reorganized past this block.

Implemented in altintegration::AltChainParamsRegTest.

◆ getEndorsementSettlementInterval()

uint32_t altintegration::AltChainParams::getEndorsementSettlementInterval ( ) const
inlinenoexcept

If difference between endorsed/containing blocks is more than this number, endorsement becomes invalid.

Definition at line 166 of file alt_chain_params.hpp.

166 {
167 return mEndorsementSettlementInterval;
168 }

◆ getFinalityDelay()

uint32_t altintegration::AltChainParams::getFinalityDelay ( ) const
inlinenoexcept

Definition at line 156 of file alt_chain_params.hpp.

156{ return mFinalityDelay; }

◆ getForkResolutionLookUpTable()

const std::vector< uint32_t > & altintegration::AltChainParams::getForkResolutionLookUpTable ( ) const
inlinenoexcept

Definition at line 159 of file alt_chain_params.hpp.

159 {
160 // TODO(warchant): this should be recalculated. see paper.
161 return mForkResolutionLookUpTable;
162 }

◆ getHash()

virtual std::vector< uint8_t > altintegration::AltChainParams::getHash ( const std::vector< uint8_t > &  bytes) const
pure virtualnoexcept
Parameters
bytesserialized block header
Returns
hash
Note
if input data is not valid block header, still calculate hash from input data.
Warning
SHOULD NOT THROW

Implemented in altintegration::AltChainParamsRegTest.

◆ getIdentifier()

virtual int64_t altintegration::AltChainParams::getIdentifier ( ) const
pure virtualnoexcept

◆ getKeystoneInterval()

uint32_t altintegration::AltChainParams::getKeystoneInterval ( ) const
inlinenoexcept

5 means that blocks with heights 5,6,7,8,9 are blocks within same keystone interval

Definition at line 153 of file alt_chain_params.hpp.

153{ return mKeystoneInterval; }

◆ getMaxATVsInAltBlock()

size_t altintegration::AltChainParams::getMaxATVsInAltBlock ( ) const
inlinenoexcept

Definition at line 188 of file alt_chain_params.hpp.

188 {
189 VBK_ASSERT(mMaxATVsInAltBlock <= MAX_POPDATA_ATV);
190 return mMaxATVsInAltBlock;
191 }
constexpr const auto MAX_POPDATA_ATV
absolute maximum number of ATV blocks per ALT block
Definition: consts.hpp:82

◆ getMaxPopDataSize()

size_t altintegration::AltChainParams::getMaxPopDataSize ( ) const
inlinenoexcept

Definition at line 194 of file alt_chain_params.hpp.

194{ return mMaxPopDataSize; }

◆ getMaxReorgBlocks()

int32_t altintegration::AltChainParams::getMaxReorgBlocks ( ) const
inlinenoexcept

As implication, we store last N blocks in RAM and effectively tip-maxReorgBlocks block is finalized.

Definition at line 205 of file alt_chain_params.hpp.

205 {
206 VBK_ASSERT(static_cast<int64_t>(mMaxReorgBlocks) >
207 static_cast<int64_t>(mEndorsementSettlementInterval));
208 return mMaxReorgBlocks;
209 }

◆ getMaxVbkBlocksInAltBlock()

size_t altintegration::AltChainParams::getMaxVbkBlocksInAltBlock ( ) const
inlinenoexcept

Definition at line 176 of file alt_chain_params.hpp.

176 {
177 VBK_ASSERT(mMaxVbkBlocksInAltBlock <= MAX_POPDATA_VBK);
178 return mMaxVbkBlocksInAltBlock;
179 }
constexpr const auto MAX_POPDATA_VBK
absolute maximum number of VBK blocks per ALT block
Definition: consts.hpp:78

◆ getMaxVTBsInAltBlock()

size_t altintegration::AltChainParams::getMaxVTBsInAltBlock ( ) const
inlinenoexcept

Definition at line 182 of file alt_chain_params.hpp.

182 {
183 VBK_ASSERT(mMaxVTBsInAltBlock <= MAX_POPDATA_VTB);
184 return mMaxVTBsInAltBlock;
185 }
constexpr const auto MAX_POPDATA_VTB
absolute maximum number of VTB blocks per ALT block
Definition: consts.hpp:80

◆ getPayoutParams()

const PopPayoutsParams & altintegration::AltChainParams::getPayoutParams ( ) const
inlinenoexcept

Definition at line 171 of file alt_chain_params.hpp.

171 {
172 return *mPopPayoutsParams;
173 }

◆ maxAltchainFutureBlockTime()

uint32_t altintegration::AltChainParams::maxAltchainFutureBlockTime ( ) const
inlinenoexcept

Definition at line 197 of file alt_chain_params.hpp.

197 {
198 return mMaxAltchainFutureBlockTime;
199 }

◆ maxWorkerQueueSize()

size_t altintegration::AltChainParams::maxWorkerQueueSize ( ) const
inlinenoexcept

Definition at line 140 of file alt_chain_params.hpp.

140 {
141 const auto ret = getMaxATVsInAltBlock() + getMaxVTBsInAltBlock() +
143 static const auto MAX = 400000;
144 VBK_ASSERT_MSG(ret < MAX,
145 "Worker size queue can not be more than %d, otherwise it "
146 "would take more than 50MB of RAM",
147 MAX);
148 return ret;
149 }
size_t getMaxVTBsInAltBlock() const noexcept
total maximum number of VTBs per 1 ALT block
size_t getMaxATVsInAltBlock() const noexcept
total maximum number of ATVs per 1 ALT block
size_t getMaxVbkBlocksInAltBlock() const noexcept
total maximum number of VBK blocks per 1 ALT block

◆ preserveBlocksBehindFinal()

uint32_t altintegration::AltChainParams::preserveBlocksBehindFinal ( ) const
inlinenoexcept

In ALT we should preserve at least last endorsementSettlementInterval blocks before finalized (not including finalized).

Definition at line 215 of file alt_chain_params.hpp.

215 {
216 VBK_ASSERT(mPreserveBlocksBehindFinal >= mEndorsementSettlementInterval);
217 return mPreserveBlocksBehindFinal;
218 }

Member Data Documentation

◆ mEndorsementSettlementInterval

uint32_t altintegration::AltChainParams::mEndorsementSettlementInterval = 50

Definition at line 268 of file alt_chain_params.hpp.

◆ mFinalityDelay

uint32_t altintegration::AltChainParams::mFinalityDelay = 100

Definition at line 267 of file alt_chain_params.hpp.

◆ mForkResolutionLookUpTable

std::vector<uint32_t> altintegration::AltChainParams::mForkResolutionLookUpTable
Initial value:
{
100, 100, 95, 89, 80, 69, 56, 40, 21}

Definition at line 276 of file alt_chain_params.hpp.

◆ mKeystoneInterval

uint32_t altintegration::AltChainParams::mKeystoneInterval = 5

Definition at line 266 of file alt_chain_params.hpp.

◆ mMaxAltchainFutureBlockTime

uint32_t altintegration::AltChainParams::mMaxAltchainFutureBlockTime = 10 * 60

Definition at line 265 of file alt_chain_params.hpp.

◆ mMaxATVsInAltBlock

size_t altintegration::AltChainParams::mMaxATVsInAltBlock = 1000

Definition at line 274 of file alt_chain_params.hpp.

◆ mMaxPopDataSize

uint32_t altintegration::AltChainParams::mMaxPopDataSize = MAX_POPDATA_SIZE

Definition at line 270 of file alt_chain_params.hpp.

◆ mMaxReorgBlocks

int32_t altintegration::AltChainParams::mMaxReorgBlocks = ALT_MAX_REORG_BLOCKS_MIN_VALUE

Definition at line 264 of file alt_chain_params.hpp.

◆ mMaxVbkBlocksInAltBlock

size_t altintegration::AltChainParams::mMaxVbkBlocksInAltBlock = 200

Definition at line 272 of file alt_chain_params.hpp.

◆ mMaxVTBsInAltBlock

size_t altintegration::AltChainParams::mMaxVTBsInAltBlock = 200

Definition at line 273 of file alt_chain_params.hpp.

◆ mPopPayoutsParams

std::shared_ptr<PopPayoutsParams> altintegration::AltChainParams::mPopPayoutsParams
Initial value:
=
std::make_shared<PopPayoutsParams>()

Definition at line 261 of file alt_chain_params.hpp.

◆ mPreserveBlocksBehindFinal

uint32_t altintegration::AltChainParams::mPreserveBlocksBehindFinal = mEndorsementSettlementInterval

Definition at line 269 of file alt_chain_params.hpp.


The documentation for this struct was generated from the following file: