replica

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	Dispatch(shardHash sig.Hash, action state.Action)
}

type Replica

type Replica interface {
	Init()
	Sync(commit block.Commit) bool
	Transition(transition state.Transition)
}

func New

func New(dispatcher Dispatcher, signer sig.SignerVerifier, stateMachine state.Machine, transitionBuffer state.TransitionBuffer, shard, previousShard shard.Shard) Replica

type Validator

type Validator interface {
	// ValidatePropose validates a state.Propose and returns true if
	// the block is valid.
	// For a SignedBlock to be valid:
	// 1. must not be nil
	// 2. have valid blockTime, Round, and Height
	// 3. have a valid signature
	// 4. signatory belongs to the same shard
	// 5. parent header maps to the block at head of the shard's blockchain
	ValidatePropose(propose block.SignedPropose) bool

	ValidatePreVote(preVote block.SignedPreVote) bool

	// ValidatePolka validates a polka and its signatures and returns true if
	// the polka is valid.
	// For a Polka to be valid:
	// 1. must not be nil
	// 2. have a non-negative Round and Height
	// 3. all the signatures inside the polka must be valid and
	//    belong to signatories within the same shard
	// 4. have a valid block (if block is not nil)
	//
	// validatePolka assumes that `polka.Signatures` are ordered to match
	// the order of `polka.Signatories`.
	ValidatePolka(polka block.Polka) bool

	ValidatePreCommit(preCommit block.SignedPreCommit) bool

	ValidateCommit(commit block.Commit) bool
}

Validator is responsible for handling validation of blocks.

func NewValidator

func NewValidator(signer sig.Verifier, shard shard.Shard) Validator

NewValidator returns a Validator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL