Documentation ¶
Overview ¶
Package miner is responsible for creating valid blocks that contain valid activation transactions and transactions
Index ¶
Constants ¶
const AtxsPerBlockLimit = 100
AtxsPerBlockLimit indicates the maximum number of atxs a block can reference
const DefaultProofsEpoch = ^types.EpochID(0)
DefaultProofsEpoch is set such that it will never equal the current epoch
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockBuilder ¶
type BlockBuilder struct { log.Log AtxDb atxDb TransactionPool txPool // contains filtered or unexported fields }
BlockBuilder is the struct that orchestrates the building of blocks, it is responsible for receiving hare results. referencing txs and atxs from mem pool and referencing them in the created block it is also responsible for listening to the clock and querying when a block should be created according to the block oracle
func NewBlockBuilder ¶
func NewBlockBuilder(config Config, sgn signer, net p2p.Service, beginRoundEvent chan types.LayerID, weakCoin weakCoinProvider, orph meshProvider, hare hareResultProvider, blockOracle blockOracle, syncer syncer, projector projector, txPool txPool, atxDB atxDb, lg log.Log) *BlockBuilder
NewBlockBuilder creates a struct of block builder type.
func (*BlockBuilder) Close ¶
func (t *BlockBuilder) Close() error
Close stops listeners and stops trying to create block in layers
func (*BlockBuilder) Start ¶
func (t *BlockBuilder) Start(ctx context.Context) error
Start starts the process of creating a block, it listens for txs and atxs received by gossip, and starts querying block oracle when it should create a block. This function returns an error if Start was already called once
type BlockEligibilityValidator ¶ added in v0.1.15
type BlockEligibilityValidator struct {
// contains filtered or unexported fields
}
BlockEligibilityValidator holds all the dependencies for validating block eligibility.
func NewBlockEligibilityValidator ¶ added in v0.1.15
func NewBlockEligibilityValidator(committeeSize, genesisActiveSetSize uint32, layersPerEpoch uint16, activationDb activationDB, beaconProvider *EpochBeaconProvider, validateVRF VRFValidationFunction, blockDB blockDB, log log.Log) *BlockEligibilityValidator
NewBlockEligibilityValidator returns a new BlockEligibilityValidator.
func (BlockEligibilityValidator) BlockSignedAndEligible ¶ added in v0.1.15
func (v BlockEligibilityValidator) BlockSignedAndEligible(block *types.Block) (bool, error)
BlockSignedAndEligible checks that a given block is signed and eligible. It returns true with no error or false and an error that explains why validation failed.
type Config ¶ added in v0.1.15
type Config struct { MinerID types.NodeID Hdist int AtxsPerBlock int LayersPerEpoch uint16 TxsPerBlock int }
Config is the block builders configuration struct
type EpochBeaconProvider ¶ added in v0.1.15
type EpochBeaconProvider struct{}
EpochBeaconProvider holds all the dependencies for generating an epoch beacon. There are currently none.
type Oracle ¶ added in v0.1.15
type Oracle struct {
// contains filtered or unexported fields
}
Oracle is the oracle that provides block eligibility proofs for the miner.
func NewMinerBlockOracle ¶ added in v0.1.15
func NewMinerBlockOracle(committeeSize uint32, genesisActiveSetSize uint32, layersPerEpoch uint16, atxDB activationDB, beaconProvider *EpochBeaconProvider, vrfSigner vrfSigner, nodeID types.NodeID, isSynced func() bool, log log.Log) *Oracle
NewMinerBlockOracle returns a new Oracle.
func (*Oracle) BlockEligible ¶ added in v0.1.15
func (bo *Oracle) BlockEligible(layerID types.LayerID) (types.ATXID, []types.BlockEligibilityProof, []types.ATXID, error)
BlockEligible returns the ATXID and list of block eligibility proofs for the given layer. It caches proofs for a single epoch and only refreshes the cache if eligibility is queried for a different epoch.
func (*Oracle) GetEligibleLayers ¶ added in v0.1.15
GetEligibleLayers returns a list of layers in which the miner is eligible for at least one block. The list is returned in arbitrary order.
type VRFValidationFunction ¶ added in v0.1.15
VRFValidationFunction is the VRF validation function.