Documentation ¶
Index ¶
- type BootstrapConfig
- type ChainVM
- type Config
- type Engine
- type OracleBlock
- type Transitive
- func (t *Transitive) Chits(vdr ids.ShortID, requestID uint32, votes ids.Set)
- func (t *Transitive) Context() *snow.Context
- func (b *Transitive) CurrentAcceptedFrontier() ids.Set
- func (b *Transitive) FilterAccepted(containerIDs ids.Set) ids.Set
- func (b *Transitive) ForceAccepted(acceptedContainerIDs ids.Set)
- func (t *Transitive) Get(vdr ids.ShortID, requestID uint32, blkID ids.ID)
- func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32, blkID ids.ID)
- func (t *Transitive) Initialize(config Config)
- func (t *Transitive) Notify(msg common.Message)
- func (t *Transitive) PullQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID)
- func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID, blk []byte)
- func (t *Transitive) Put(vdr ids.ShortID, requestID uint32, blkID ids.ID, blkBytes []byte)
- func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32)
- func (t *Transitive) Shutdown()
- type VMTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootstrapConfig ¶
type BootstrapConfig struct { common.Config // Blocked tracks operations that are blocked on blocks Blocked *queue.Jobs VM ChainVM Bootstrapped func() }
BootstrapConfig ...
type ChainVM ¶
type ChainVM interface { common.VM // Attempt to create a new block from data contained in the VM. // // If the VM doesn't want to issue a new block, an error should be // returned. BuildBlock() (snowman.Block, error) // Attempt to create a block from a stream of bytes. // // The block should be represented by the full byte array, without extra // bytes. ParseBlock([]byte) (snowman.Block, error) // Attempt to load a block. // // If the block does not exist, then an error should be returned. GetBlock(ids.ID) (snowman.Block, error) // Notify the VM of the currently preferred block. // // This should always be a block that has no children known to consensus. SetPreference(ids.ID) // LastAccepted returns the ID of the last accepted block. // // If no blocks have been accepted by consensus yet, it is assumed there is // a definitionally accepted block, the Genesis block, that will be // returned. LastAccepted() ids.ID }
ChainVM defines the required functionality of a Snowman VM.
A Snowman VM is responsible for defining the representation of state, the representation of operations on that state, the application of operations on that state, and the creation of the operations. Consensus will decide on if the operation is executed and the order operations are executed in.
For example, suppose we have a VM that tracks an increasing number that is agreed upon by the network. The state is a single number. The operation is setting the number to a new, larger value. Applying the operation will save to the database the new value. The VM can attempt to issue a new number, of larger value, at any time. Consensus will ensure the network agrees on the number at every block height.
type Config ¶
type Config struct { BootstrapConfig Params snowball.Parameters Consensus snowman.Consensus }
Config wraps all the parameters needed for a snowman engine
type Engine ¶
Engine describes the events that can occur to a Snowman instance.
The engine is used to fetch, order, and decide on the fate of blocks. This engine runs the leaderless version of the Snowman consensus protocol. Therefore, the liveness of this protocol tolerant to O(sqrt(n)) Byzantine Nodes where n is the number of nodes in the network. Therefore, this protocol should only be run in a Crash Fault Tolerant environment, or in an environment where lose of liveness and manual intervention is tolerable.
type OracleBlock ¶
type OracleBlock interface { snowman.Block // Options returns the possible children of this block in the order this // validator prefers the blocks. Options() [2]snowman.Block }
OracleBlock is a block that only has two valid children. The children should be returned in preferential order.
This ordering does not need to be deterministically created from the chain state.
type Transitive ¶
type Transitive struct { Config // contains filtered or unexported fields }
Transitive implements the Engine interface by attempting to fetch all transitive dependencies.
func (*Transitive) Context ¶
func (t *Transitive) Context() *snow.Context
Context implements the Engine interface
func (*Transitive) CurrentAcceptedFrontier ¶
CurrentAcceptedFrontier ...
func (*Transitive) FilterAccepted ¶
FilterAccepted ...
func (*Transitive) ForceAccepted ¶
ForceAccepted ...
func (*Transitive) Initialize ¶
func (t *Transitive) Initialize(config Config)
Initialize implements the Engine interface
func (*Transitive) Notify ¶
func (t *Transitive) Notify(msg common.Message)
Notify implements the Engine interface
func (*Transitive) QueryFailed ¶
func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32)
QueryFailed implements the Engine interface
func (*Transitive) Shutdown ¶
func (t *Transitive) Shutdown()
Shutdown implements the Engine interface
type VMTest ¶
type VMTest struct { common.VMTest CantBuildBlock, CantParseBlock, CantGetBlock, CantSetPreference, CantLastAccepted bool BuildBlockF func() (snowman.Block, error) ParseBlockF func([]byte) (snowman.Block, error) GetBlockF func(ids.ID) (snowman.Block, error) SetPreferenceF func(ids.ID) LastAcceptedF func() ids.ID }
VMTest ...
func (*VMTest) ParseBlock ¶
ParseBlock ...