Documentation ¶
Index ¶
- Constants
- func GenLayers(g *Generator, seqs ...Sequence) []types.LayerID
- type Fraction
- type GenOpt
- type Generator
- type NextOpt
- func WithBlockTickHeights(heights ...uint64) NextOpt
- func WithCoin(coin bool) NextOpt
- func WithEmptyHareOutput() NextOpt
- func WithHareOutputIndex(i int) NextOpt
- func WithLayerSizeOverwrite(size int) NextOpt
- func WithNextReorder(delay uint32) NextOpt
- func WithNumBlocks(num int) NextOpt
- func WithVoteGenerator(gen VotesGenerator) NextOpt
- func WithoutHareOutput() NextOpt
- type Sequence
- type SetupOpt
- type SplitOpt
- type State
- func (s *State) OnActivationTx(atx *types.VerifiedActivationTx)
- func (s *State) OnBallot(ballot *types.Ballot)
- func (s *State) OnBeacon(eid types.EpochID, beacon types.Beacon)
- func (s *State) OnBlock(block *types.Block)
- func (s *State) OnCoinflip(lid types.LayerID, coinflip bool)
- func (s *State) OnHareOutput(lid types.LayerID, bid types.BlockID)
- type VotesGenerator
- type Voting
Constants ¶
const DefaultNumBlocks = 5
DefaultNumBlocks is a number of blocks in a layer by default.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fraction ¶
type Fraction struct {
Nominator, Denominator int
}
Fraction of something.
type GenOpt ¶
type GenOpt func(*Generator)
GenOpt for configuring Generator.
func WithLayerSize ¶
WithLayerSize configures average layer size.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator for layers of blocks.
type NextOpt ¶
type NextOpt func(*nextConf)
NextOpt is for configuring layer generator.
func WithBlockTickHeights ¶
WithBlockTickHeights updates height of the blocks.
func WithEmptyHareOutput ¶
func WithEmptyHareOutput() NextOpt
WithEmptyHareOutput will save an empty vector for hare output.
func WithHareOutputIndex ¶
WithHareOutputIndex sets the index of the block that will be stored as a hare output.
func WithLayerSizeOverwrite ¶
WithLayerSizeOverwrite overwrite expected layer size.
func WithNextReorder ¶
WithNextReorder configures when reordered layer should be returned. Examples: Next() Next(WithNextReorder(1)) Next() 1 3 2 Next() Next(WithNextReorder(2)) Next() Next() 1 3 4 2
So the Next layer with WithNextReorder will be delayed exactly by `delay` value.
func WithNumBlocks ¶
WithNumBlocks sets number of the generated blocks.
func WithVoteGenerator ¶
func WithVoteGenerator(gen VotesGenerator) NextOpt
WithVoteGenerator declares vote generator for a layer.
func WithoutHareOutput ¶
func WithoutHareOutput() NextOpt
WithoutHareOutput will prevent from saving hare output.
type Sequence ¶
Sequence of layers with same configuration.
func WithSequence ¶
WithSequence creates Sequence object.
type SetupOpt ¶
type SetupOpt func(g *setupConf)
SetupOpt configures setup.
func WithSetupMinerRange ¶
WithSetupMinerRange number of miners will be selected between low and high values.
func WithSetupTicks ¶
WithSetupTicks configures ticks for every atx.
func WithSetupTicksRange ¶
WithSetupTicksRange configures range of atxs, that will be randomly chosen by atxs.
func WithSetupUnitsRange ¶
WithSetupUnitsRange adjusts units of the ATXs, which will directly affect block weight.
type SplitOpt ¶
type SplitOpt func(*splitConf)
SplitOpt is for configuring partition.
func WithPartitions ¶
WithPartitions configures number of miners in each partition relative to original Generator.
type State ¶
type State struct { DB *datastore.CachedDB Atxdata *atxsdata.Data // contains filtered or unexported fields }
State of the node.
func (*State) OnActivationTx ¶
func (s *State) OnActivationTx(atx *types.VerifiedActivationTx)
OnActivationTx callback to store activation transaction.
func (*State) OnCoinflip ¶
OnCoinflip callback to store coinflip.
type VotesGenerator ¶
VotesGenerator allows to replace default votes generator. TODO(dshulyak) what is the best way to encapsulate all configuration that is required to generate votes?
func VaryingVoting ¶
func VaryingVoting(mid int, first, second VotesGenerator) VotesGenerator
VaryingVoting votes using first generator for ballots before mid, and with second generator after mid.
type Voting ¶
Voting contains blocks voting.
func ConsistentVoting ¶
ConsistentVoting selects same base ballot for ballot at a specific index.