consensuscontext

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: MIT Imports: 18 Imported by: 0

README

Consensus Context

This file explains non-trivial implementation details in the Consensus Context.

Committees

A committee is a subset of federation nodes, with size between some minimum (currently set at 4) and all of federation nodes. The committee nodes' purpose is to participate in a consensus round, that is to reach consensus for a specific block height.

After consensus is reached, a new committee is chosen.

Committee Selection

See RequestValidationCommittee in committee.go

Algorithm

A weighted random sort over the nodes is used for deciding which nodes become committee members. The random part is achieved by hashing the concatenation of the random seed and the node's public key. The weighted part is achieved by multiplying the node's resulting hash by its reputation, thus increasing its chance of inclusion in a committee. Note that at present, reputation is set to 1, so in effect it is not used by the calculation.

The actual committee is the committeeSize nodes with the highest weighted_grade. The descending weighted_grade ordering is important - the first node is the initial leader of this consensus round.

for each node
   hash = sha256(concat(random_seed, node.public_key))
   low_4_bytes_hash := hash[:4]
   weighted_grade := to_uint32(low_4_bytes_hash) * reputation

sort_nodes := sort(nodes, by descending weighted_grade)
committee = first [committeeSize] sort_nodes

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogTag = log.Service("consensus-context")

Functions

func NewConsensusContext

func NewConsensusContext(
	transactionPool services.TransactionPool,
	virtualMachine services.VirtualMachine,
	stateStorage services.StateStorage,
	config config.ConsensusContextConfig,
	logger log.BasicLogger,
	metricFactory metric.Factory,
) services.ConsensusContext

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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