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) error
- 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) error
- func (t *Transitive) Get(vdr ids.ShortID, requestID uint32, blkID ids.ID) error
- func (t *Transitive) GetAncestors(vdr ids.ShortID, requestID uint32, blkID ids.ID) error
- func (b *Transitive) GetAncestorsFailed(vdr ids.ShortID, requestID uint32) error
- func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32) error
- func (t *Transitive) Gossip() error
- func (t *Transitive) Initialize(config Config) error
- func (b *Transitive) MultiPut(vdr ids.ShortID, requestID uint32, blks [][]byte) error
- func (t *Transitive) Notify(msg common.Message) error
- func (t *Transitive) PullQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID) error
- func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID, blkBytes []byte) error
- func (t *Transitive) Put(vdr ids.ShortID, requestID uint32, blkID ids.ID, blkBytes []byte) error
- func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32) error
- func (t *Transitive) Shutdown() error
- 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 returns the last accepted block
func (*Transitive) FilterAccepted ¶
FilterAccepted returns the blocks in [containerIDs] that we have accepted
func (*Transitive) ForceAccepted ¶
ForceAccepted ...
func (*Transitive) GetAncestors ¶ added in v0.5.3
GetAncestors implements the Engine interface
func (*Transitive) GetAncestorsFailed ¶ added in v0.5.3
GetAncestorsFailed is called when a GetAncestors message we sent fails
func (*Transitive) GetFailed ¶
func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32) error
GetFailed implements the Engine interface
func (*Transitive) Gossip ¶ added in v0.5.0
func (t *Transitive) Gossip() error
Gossip implements the Engine interface
func (*Transitive) Initialize ¶
func (t *Transitive) Initialize(config Config) error
Initialize implements the Engine interface
func (*Transitive) MultiPut ¶ added in v0.5.3
MultiPut handles the receipt of multiple containers. Should be received in response to a GetAncestors message to [vdr] with request ID [requestID]
func (*Transitive) Notify ¶
func (t *Transitive) Notify(msg common.Message) error
Notify implements the Engine interface
func (*Transitive) PushQuery ¶
func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID, blkBytes []byte) error
PushQuery implements the Engine interface
func (*Transitive) QueryFailed ¶
func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32) error
QueryFailed implements the Engine interface
func (*Transitive) Shutdown ¶
func (t *Transitive) Shutdown() error
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 ...