kernel

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: GPL-3.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CosiActionSelfEmpty = iota
	CosiActionSelfCommitment
	CosiActionSelfResponse
	CosiActionExternalAnnouncement
	CosiActionExternalChallenge
	CosiActionFinalization
)
View Source
const (
	MempoolSize = 8192
)
View Source
const (
	MinimumNodeCount = 7
)

Variables

View Source
var (
	MintPool        common.Integer
	MintLiquidity   common.Integer
	MintYearShares  int
	MintYearBatches int
	MintNodeMaximum int
)

Functions

func ComputeRoundHash added in v0.2.10

func ComputeRoundHash(nodeId crypto.Hash, number uint64, snapshots []*common.Snapshot) (uint64, uint64, crypto.Hash)

func TestMockDiff added in v0.6.2

func TestMockDiff(at time.Duration)

Types

type CacheRound

type CacheRound struct {
	NodeId     crypto.Hash
	Number     uint64
	Timestamp  uint64
	References *common.RoundLink
	Snapshots  []*common.Snapshot `msgpack:"-"`
}

func (*CacheRound) Copy

func (c *CacheRound) Copy() *CacheRound

func (*CacheRound) Gap

func (c *CacheRound) Gap() (uint64, uint64)

func (*CacheRound) ValidateSnapshot

func (c *CacheRound) ValidateSnapshot(s *common.Snapshot, add bool) bool

type CosiAction added in v0.5.0

type CosiAction struct {
	Action       int
	PeerId       crypto.Hash
	SnapshotHash crypto.Hash
	Snapshot     *common.Snapshot
	Commitment   *crypto.Key
	Signature    *crypto.CosiSignature
	Response     *[32]byte
	Transaction  *common.VersionedTransaction
	WantTx       bool
}

type CosiAggregator added in v0.5.0

type CosiAggregator struct {
	Snapshot    *common.Snapshot
	Transaction *common.VersionedTransaction
	WantTxs     map[crypto.Hash]bool
	Commitments map[int]*crypto.Key
	Responses   map[int]*[32]byte
	// contains filtered or unexported fields
}

type CosiVerifier added in v0.5.0

type CosiVerifier struct {
	Snapshot *common.Snapshot
	// contains filtered or unexported fields
}

type FinalRound

type FinalRound struct {
	NodeId crypto.Hash
	Number uint64
	Start  uint64
	End    uint64
	Hash   crypto.Hash
}

func (*FinalRound) Copy

func (f *FinalRound) Copy() *FinalRound

type Genesis

type Genesis struct {
	Epoch int64 `json:"epoch"`
	Nodes []struct {
		Signer  common.Address `json:"signer"`
		Payee   common.Address `json:"payee"`
		Balance common.Integer `json:"balance"`
	} `json:"nodes"`
	Domains []struct {
		Signer  common.Address `json:"signer"`
		Balance common.Integer `json:"balance"`
	} `json:"domains"`
}

type Node

type Node struct {
	IdForNetwork crypto.Hash
	Signer       common.Address
	Graph        *RoundGraph
	TopoCounter  *TopologicalSequence

	Peer       *network.Peer
	SyncPoints *syncMap
	Listener   string

	ActiveNodes          []*common.Node
	ConsensusNodes       map[crypto.Hash]*common.Node
	SortedConsensusNodes []crypto.Hash
	ConsensusIndex       int
	ConsensusPledging    *common.Node
	ConsensusRemoved     *common.Node

	CosiAggregators *aggregatorMap
	CosiVerifiers   map[crypto.Hash]*CosiVerifier

	Epoch uint64
	// contains filtered or unexported fields
}

func SetupNode

func SetupNode(persistStore storage.Store, cacheStore *fastcache.Cache, addr string, dir string) (*Node, error)

func (*Node) AddNeighborsFromConfig

func (node *Node) AddNeighborsFromConfig() error

func (*Node) Authenticate

func (node *Node) Authenticate(msg []byte) (crypto.Hash, string, error)

func (*Node) BuildAuthenticationMessage

func (node *Node) BuildAuthenticationMessage() []byte

func (*Node) BuildGraph

func (node *Node) BuildGraph() []*network.SyncPoint

func (*Node) CachePutTransaction

func (node *Node) CachePutTransaction(peerId crypto.Hash, tx *common.VersionedTransaction) error

func (*Node) CacheVerify

func (node *Node) CacheVerify(snap crypto.Hash, sig crypto.Signature, pub crypto.Key) bool

func (*Node) CacheVerifyCosi added in v0.5.0

func (node *Node) CacheVerifyCosi(snap crypto.Hash, sig *crypto.CosiSignature, publics []*crypto.Key, threshold int) bool

func (*Node) CheckBroadcastedToPeers added in v0.2.12

func (node *Node) CheckBroadcastedToPeers() bool

func (*Node) CheckCatchUpWithPeers added in v0.2.12

func (node *Node) CheckCatchUpWithPeers() bool

func (*Node) ConsensusKeys added in v0.5.0

func (node *Node) ConsensusKeys(timestamp uint64) []*crypto.Key

func (*Node) ConsensusRemovedRecently added in v0.6.3

func (node *Node) ConsensusRemovedRecently(timestamp uint64) *common.Node

func (*Node) ConsensusThreshold added in v0.5.0

func (node *Node) ConsensusThreshold(timestamp uint64) int

func (*Node) ConsumeQueue

func (node *Node) ConsumeQueue() error

func (*Node) CosiAggregateSelfCommitments added in v0.5.0

func (node *Node) CosiAggregateSelfCommitments(peerId crypto.Hash, snap crypto.Hash, commitment *crypto.Key, wantTx bool) error

func (*Node) CosiAggregateSelfResponses added in v0.5.0

func (node *Node) CosiAggregateSelfResponses(peerId crypto.Hash, snap crypto.Hash, response *[32]byte) error

func (*Node) CosiLoop added in v0.5.0

func (node *Node) CosiLoop() error

func (*Node) CosiQueueExternalAnnouncement added in v0.5.0

func (node *Node) CosiQueueExternalAnnouncement(peerId crypto.Hash, s *common.Snapshot, commitment *crypto.Key) error

func (*Node) CosiQueueExternalChallenge added in v0.5.0

func (node *Node) CosiQueueExternalChallenge(peerId crypto.Hash, snap crypto.Hash, cosi *crypto.CosiSignature, ver *common.VersionedTransaction) error

func (*Node) ElectionLoop added in v0.3.5

func (node *Node) ElectionLoop() error

func (*Node) GetCacheStore added in v0.2.18

func (node *Node) GetCacheStore() *fastcache.Cache

func (*Node) ListenNeighbors

func (node *Node) ListenNeighbors() error

func (*Node) LoadCacheToQueue

func (node *Node) LoadCacheToQueue() error

func (*Node) LoadConsensusNodes

func (node *Node) LoadConsensusNodes() error

func (*Node) LoadGenesis

func (node *Node) LoadGenesis(configDir string) error

func (*Node) LoadNodeConfig added in v0.2.15

func (node *Node) LoadNodeConfig()

func (*Node) Loop added in v0.1.2

func (node *Node) Loop() error

func (*Node) MintLoop added in v0.1.1

func (node *Node) MintLoop() error

func (*Node) NetworkId

func (node *Node) NetworkId() crypto.Hash

func (*Node) PoolSize added in v0.6.0

func (node *Node) PoolSize() (common.Integer, error)

func (*Node) QueueAppendSnapshot

func (node *Node) QueueAppendSnapshot(peerId crypto.Hash, s *common.Snapshot, final bool) error

func (*Node) QueueTransaction added in v0.1.2

func (node *Node) QueueTransaction(tx *common.VersionedTransaction) (string, error)

func (*Node) ReadAllNodes added in v0.5.6

func (node *Node) ReadAllNodes() []crypto.Hash

func (*Node) ReadSnapshotsForNodeRound

func (node *Node) ReadSnapshotsForNodeRound(nodeIdWithNetwork crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error)

func (*Node) ReadSnapshotsSinceTopology

func (node *Node) ReadSnapshotsSinceTopology(offset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error)

func (*Node) SendTransactionToPeer

func (node *Node) SendTransactionToPeer(peerId, hash crypto.Hash) error

func (*Node) SortAllNodesByTimestampAndId added in v0.6.1

func (node *Node) SortAllNodesByTimestampAndId() []*common.Node

func (*Node) TopologicalOrder added in v0.1.2

func (node *Node) TopologicalOrder() uint64

func (*Node) UpdateSyncPoint

func (node *Node) UpdateSyncPoint(peerId crypto.Hash, points []*network.SyncPoint)

func (*Node) Uptime added in v0.1.14

func (node *Node) Uptime() time.Duration

func (*Node) VerifyAndQueueAppendSnapshotFinalization added in v0.5.0

func (node *Node) VerifyAndQueueAppendSnapshotFinalization(peerId crypto.Hash, s *common.Snapshot) error

type RoundGraph

type RoundGraph struct {
	Nodes      []*crypto.Hash
	CacheRound map[crypto.Hash]*CacheRound
	FinalRound map[crypto.Hash]*FinalRound

	RoundHistory      map[crypto.Hash][]*FinalRound
	ReverseRoundLinks map[crypto.Hash]uint64

	GraphTimestamp uint64
	FinalCache     []*network.SyncPoint
	MyCacheRound   *CacheRound
	MyFinalNumber  uint64
}

func LoadRoundGraph

func LoadRoundGraph(store storage.Store, networkId, idForNetwork crypto.Hash) (*RoundGraph, error)

func (*RoundGraph) Print

func (g *RoundGraph) Print() string

func (*RoundGraph) UpdateFinalCache

func (g *RoundGraph) UpdateFinalCache(idForNetwork crypto.Hash)

type TopologicalSequence

type TopologicalSequence struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*TopologicalSequence) Next

func (c *TopologicalSequence) Next() uint64

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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