isaac

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: GPL-3.0 Imports: 27 Imported by: 28

Documentation

Overview

Package isaac runs consensus process

Index

Constants

This section is empty.

Variables

View Source
var (
	INITBallotHint   = hint.MustNewHint("init-ballot-v0.0.1")
	ACCEPTBallotHint = hint.MustNewHint("accept-ballot-v0.0.1")
)
View Source
var (
	INITBallotFactHint            = hint.MustNewHint("init-ballot-fact-v0.0.1")
	ACCEPTBallotFactHint          = hint.MustNewHint("accept-ballot-fact-v0.0.1")
	SuffrageConfirmBallotFactHint = hint.MustNewHint("suffrage-confirm-ballot-fact-v0.0.1")
)
View Source
var (
	INITBallotSignFactHint   = hint.MustNewHint("init-ballot-sign-fact-v0.0.1")
	ACCEPTBallotSignFactHint = hint.MustNewHint("accept-ballot-sign-fact-v0.0.1")
)
View Source
var (
	NetworkPolicyHint           = hint.MustNewHint("network-policy-v0.0.1")
	NetworkPolicyStateValueHint = hint.MustNewHint("network-policy-state-value-v0.0.1")

	DefaultMaxOperationsInProposal uint64 = 333
	DefaultMaxSuffrageSize         uint64 = 33

	// NOTE suffrage candidate can be approved within lifespan height; almost 15
	// days(based on 5 second for one block)
	DefaultSuffrageCandidateLifespan base.Height = 1 << 18
	DefaultSuffrageWithdrawLifespan              = base.Height(333) //nolint:gomnd //...
)
View Source
var (
	ProposalFactHint     = hint.MustNewHint("proposal-fact-v0.0.1")
	ProposalSignFactHint = hint.MustNewHint("proposal-sign-fact-v0.0.1")
)
View Source
var (
	ErrOperationInProcessorNotFound         = util.NewError("operation processor not found")
	ErrInvalidOperationInProcessor          = util.NewError("invalid operation")
	ErrOperationNotFoundInProcessor         = util.NewError("operation not found")
	ErrOperationAlreadyProcessedInProcessor = util.NewError("operation already processed")
	ErrStopProcessingRetry                  = util.NewError("stop processing retrying")
	ErrIgnoreStateValue                     = util.NewError("ignore state value")
	ErrSuspendOperation                     = util.NewError("suspend operation")
	ErrProcessorAlreadySaved                = util.NewError("processor already saved")
)
View Source
var (
	ErrIgnoreErrorProposalProcessor  = util.NewError("proposal processor somthing wrong; ignore")
	ErrNotProposalProcessorProcessed = util.NewError("proposal processor not processed")
)

ErrIgnoreErrorProposalProcessor ignores error from proposalProcessor, it means not ErrIgnoreErrorProposalProcessor from proposalProcessor will break consensus.

View Source
var (
	FixedSuffrageCandidateLimiterRuleHint    = hint.MustNewHint("fixed-suffrage-candidate-limiter-rule-v0.0.1")
	MajoritySuffrageCandidateLimiterRuleHint = hint.MustNewHint("majority-suffrage-candidate-limiter-rule-v0.0.1")
)
View Source
var (
	SuffrageWithdrawFactHint      = hint.MustNewHint("suffrage-withdraw-fact-v0.0.1")
	SuffrageWithdrawOperationHint = hint.MustNewHint("suffrage-withdraw-operation-v0.0.1")
)
View Source
var (
	SuffrageNodeStateValueHint       = hint.MustNewHint("suffrage-node-state-value-v0.0.1")
	SuffrageNodesStateValueHint      = hint.MustNewHint("suffrage-nodes-state-value-v0.0.1")
	SuffrageCandidateStateValueHint  = hint.MustNewHint("suffrage-candidate-state-value-v0.0.1")
	SuffrageCandidatesStateValueHint = hint.MustNewHint("suffrage-candidates-state-value-v0.0.1")
)
View Source
var (
	SuffrageStateKey          = "suffrage"
	SuffrageCandidateStateKey = "suffrage_candidate"
	NetworkPolicyStateKey     = "network_policy"
)
View Source
var (
	ErrEmptySyncSources = util.NewError("empty sync sources; will retry")
	ErrRetrySyncSources = util.NewError("sync sources problem; will retry")
)
View Source
var (
	INITVoteproofHint           = hint.MustNewHint("init-voteproof-v0.0.1")
	INITWithdrawVoteproofHint   = hint.MustNewHint("init-withdraw-voteproof-v0.0.1")
	INITStuckVoteproofHint      = hint.MustNewHint("init-stuck-voteproof-v0.0.1")
	ACCEPTVoteproofHint         = hint.MustNewHint("accept-voteproof-v0.0.1")
	ACCEPTWithdrawVoteproofHint = hint.MustNewHint("accept-withdraw-voteproof-v0.0.1")
	ACCEPTStuckVoteproofHint    = hint.MustNewHint("accept-stuck-voteproof-v0.0.1")
)
View Source
var (
	ErrEmptyAvailableNodes = util.NewError("empty available nodes for new proposal")
)
View Source
var LocalParamsHint = hint.MustNewHint("local-params-v0.0.1")
View Source
var ManifestHint = hint.MustNewHint("manifest-v0.0.1")
View Source
var NodeHint = hint.MustNewHint("node-v0.0.1")

Functions

func DistributeWorkerWithSyncSourcePool

func DistributeWorkerWithSyncSourcePool(
	ctx context.Context,
	pool *SyncSourcePool,
	picksize int,
	semsize uint64,
	errch chan error,
	f func(ctx context.Context, i, jobid uint64, nci NodeConnInfo) error,
) error

func ErrGroupWorkerWithSyncSourcePool

func ErrGroupWorkerWithSyncSourcePool(
	ctx context.Context,
	pool *SyncSourcePool,
	picksize int,
	semsize uint64,
	f func(ctx context.Context, i, jobid uint64, nci NodeConnInfo) error,
) error

func FilterCandidates

func FilterCandidates(
	height base.Height, candidates []base.SuffrageCandidateStateValue,
) []base.SuffrageCandidateStateValue

func GetSuffrageFromDatabase

func GetSuffrageFromDatabase(
	db Database,
	blockheight base.Height,
) (base.Suffrage, bool, error)

func InCandidates

func InCandidates(node base.Node, candidates []base.SuffrageCandidateStateValue) bool

func IsNodeInLastConsensusNodes

func IsNodeInLastConsensusNodes(node base.Node, proof base.SuffrageProof, st base.State) (base.Suffrage, bool, error)

func IsSuffrageConfirmBallotFact

func IsSuffrageConfirmBallotFact(fact base.Fact) bool

func IsValidVoteproofWithSuffrage

func IsValidVoteproofWithSuffrage(vp base.Voteproof, suf base.Suffrage) error

func IsValidWithdrawWithSuffrage

func IsValidWithdrawWithSuffrage(
	height base.Height,
	withdraw base.SuffrageWithdrawOperation,
	suf base.Suffrage,
) error

func IsValidWithdrawWithSuffrageLifespan

func IsValidWithdrawWithSuffrageLifespan(
	height base.Height,
	withdraw base.SuffrageWithdrawOperation,
	suf base.Suffrage,
	lifespan base.Height,
) error

IsValidWithdrawWithSuffrageLifespan checks withdraw operation itself with suffrage and lifespan.

func LastCandidatesFromState

func LastCandidatesFromState(
	height base.Height, getStateFunc base.GetStateFunc,
) (base.Height, []base.SuffrageCandidateStateValue, error)

func NewCandidatesOfMajoritySuffrageCandidateLimiterRule

func NewCandidatesOfMajoritySuffrageCandidateLimiterRule(
	ratio float64,
	getSuffrage func() (uint64, error),
) (uint64, error)

NewCandidatesOfMajoritySuffrageCandidateLimiterRule find the number of new candidates to prevent the current suffrage majority.

func NewMajoritySuffrageCandidateLimiter

func NewMajoritySuffrageCandidateLimiter(
	rule MajoritySuffrageCandidateLimiterRule,
	getSuffrage func() (uint64, error),
) base.SuffrageCandidateLimiter

func NewNode

func NewNode(pub base.Publickey, addr base.Address) base.BaseNode

func NewSuffrageFromState

func NewSuffrageFromState(st base.State) (suf base.Suffrage, _ error)

func NewSuffrageWithWithdraws

func NewSuffrageWithWithdraws(
	suf base.Suffrage,
	threshold base.Threshold,
	withdraws []base.SuffrageWithdrawOperation,
) (base.Suffrage, error)

Types

type ACCEPTBallot

type ACCEPTBallot struct {
	// contains filtered or unexported fields
}

func NewACCEPTBallot

func NewACCEPTBallot(
	ivp base.INITVoteproof,
	signfact ACCEPTBallotSignFact,
	withdraws []base.SuffrageWithdrawOperation,
) ACCEPTBallot

func (ACCEPTBallot) BallotSignFact

func (bl ACCEPTBallot) BallotSignFact() base.ACCEPTBallotSignFact

func (*ACCEPTBallot) DecodeJSON

func (bl *ACCEPTBallot) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (ACCEPTBallot) HashBytes

func (bl ACCEPTBallot) HashBytes() []byte

func (ACCEPTBallot) IsValid

func (bl ACCEPTBallot) IsValid(networkID []byte) error

func (ACCEPTBallot) MarshalJSON

func (bl ACCEPTBallot) MarshalJSON() ([]byte, error)

func (ACCEPTBallot) Point

func (bl ACCEPTBallot) Point() base.StagePoint

func (ACCEPTBallot) SignFact

func (bl ACCEPTBallot) SignFact() base.BallotSignFact

func (ACCEPTBallot) Voteproof

func (bl ACCEPTBallot) Voteproof() base.Voteproof

func (ACCEPTBallot) Withdraws

func (bl ACCEPTBallot) Withdraws() []base.SuffrageWithdrawOperation

type ACCEPTBallotFact

type ACCEPTBallotFact struct {
	// contains filtered or unexported fields
}

func NewACCEPTBallotFact

func NewACCEPTBallotFact(
	point base.Point,
	proposal, newBlock util.Hash,
	withdrawfacts []util.Hash,
) ACCEPTBallotFact

func (*ACCEPTBallotFact) DecodeJSON

func (fact *ACCEPTBallotFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (ACCEPTBallotFact) IsValid

func (fact ACCEPTBallotFact) IsValid([]byte) error

func (ACCEPTBallotFact) MarshalJSON

func (fact ACCEPTBallotFact) MarshalJSON() ([]byte, error)

func (ACCEPTBallotFact) NewBlock

func (fact ACCEPTBallotFact) NewBlock() util.Hash

func (ACCEPTBallotFact) Point

func (fact ACCEPTBallotFact) Point() base.StagePoint

func (ACCEPTBallotFact) Proposal

func (fact ACCEPTBallotFact) Proposal() util.Hash

func (ACCEPTBallotFact) Stage

func (fact ACCEPTBallotFact) Stage() base.Stage

func (ACCEPTBallotFact) WithdrawFacts

func (fact ACCEPTBallotFact) WithdrawFacts() []util.Hash

type ACCEPTBallotFactJSONMarshaler

type ACCEPTBallotFactJSONMarshaler struct {
	Proposal util.Hash `json:"proposal"`
	NewBlock util.Hash `json:"new_block"`
	// contains filtered or unexported fields
}

type ACCEPTBallotFactJSONUnmarshaler

type ACCEPTBallotFactJSONUnmarshaler struct {
	Proposal valuehash.HashDecoder `json:"proposal"`
	NewBlock valuehash.HashDecoder `json:"new_block"`
	// contains filtered or unexported fields
}

type ACCEPTBallotSignFact

type ACCEPTBallotSignFact struct {
	// contains filtered or unexported fields
}

func NewACCEPTBallotSignFact

func NewACCEPTBallotSignFact(fact ACCEPTBallotFact) ACCEPTBallotSignFact

func (ACCEPTBallotSignFact) BallotFact

func (sf ACCEPTBallotSignFact) BallotFact() base.ACCEPTBallotFact

func (*ACCEPTBallotSignFact) DecodeJSON

func (sf *ACCEPTBallotSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (ACCEPTBallotSignFact) Fact

func (sf ACCEPTBallotSignFact) Fact() base.Fact

func (ACCEPTBallotSignFact) HashBytes

func (sf ACCEPTBallotSignFact) HashBytes() []byte

func (ACCEPTBallotSignFact) IsValid

func (sf ACCEPTBallotSignFact) IsValid(networkID []byte) error

func (ACCEPTBallotSignFact) MarshalJSON

func (sf ACCEPTBallotSignFact) MarshalJSON() ([]byte, error)

func (ACCEPTBallotSignFact) Node

func (sf ACCEPTBallotSignFact) Node() base.Address

func (*ACCEPTBallotSignFact) NodeSign

func (sf *ACCEPTBallotSignFact) NodeSign(priv base.Privatekey, networkID base.NetworkID, node base.Address) error

func (ACCEPTBallotSignFact) NodeSigns

func (sf ACCEPTBallotSignFact) NodeSigns() []base.NodeSign

func (ACCEPTBallotSignFact) Signer

func (sf ACCEPTBallotSignFact) Signer() base.Publickey

func (ACCEPTBallotSignFact) Signs

func (sf ACCEPTBallotSignFact) Signs() []base.Sign

type ACCEPTStuckVoteproof

type ACCEPTStuckVoteproof struct {
	ACCEPTVoteproof
	// contains filtered or unexported fields
}

func NewACCEPTStuckVoteproof

func NewACCEPTStuckVoteproof(point base.Point) ACCEPTStuckVoteproof

func (*ACCEPTStuckVoteproof) DecodeJSON

func (vp *ACCEPTStuckVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (*ACCEPTStuckVoteproof) Finish

func (ACCEPTStuckVoteproof) FinishedAt

func (vp ACCEPTStuckVoteproof) FinishedAt() time.Time

func (ACCEPTStuckVoteproof) HashBytes

func (vp ACCEPTStuckVoteproof) HashBytes() []byte

func (ACCEPTStuckVoteproof) ID

func (vp ACCEPTStuckVoteproof) ID() string

func (ACCEPTStuckVoteproof) IsStuckVoteproof

func (ACCEPTStuckVoteproof) IsStuckVoteproof() bool

func (ACCEPTStuckVoteproof) IsValid

func (vp ACCEPTStuckVoteproof) IsValid(networkID []byte) error

func (ACCEPTStuckVoteproof) Majority

func (vp ACCEPTStuckVoteproof) Majority() base.BallotFact

func (ACCEPTStuckVoteproof) MarshalJSON

func (vp ACCEPTStuckVoteproof) MarshalJSON() ([]byte, error)

func (ACCEPTStuckVoteproof) Point

func (vp ACCEPTStuckVoteproof) Point() base.StagePoint

func (ACCEPTStuckVoteproof) Result

func (vp ACCEPTStuckVoteproof) Result() base.VoteResult

func (*ACCEPTStuckVoteproof) SetMajority

func (vp *ACCEPTStuckVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof

func (*ACCEPTStuckVoteproof) SetPoint

func (vp *ACCEPTStuckVoteproof) SetPoint(p base.StagePoint) *baseVoteproof

func (*ACCEPTStuckVoteproof) SetSignFacts

func (vp *ACCEPTStuckVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof

func (*ACCEPTStuckVoteproof) SetThreshold

func (vp *ACCEPTStuckVoteproof) SetThreshold(s base.Threshold) *baseVoteproof

func (ACCEPTStuckVoteproof) SignFacts

func (vp ACCEPTStuckVoteproof) SignFacts() []base.BallotSignFact

func (ACCEPTStuckVoteproof) Threshold

func (vp ACCEPTStuckVoteproof) Threshold() base.Threshold

type ACCEPTVoteproof

type ACCEPTVoteproof struct {
	// contains filtered or unexported fields
}

func NewACCEPTVoteproof

func NewACCEPTVoteproof(point base.Point) ACCEPTVoteproof

func (ACCEPTVoteproof) BallotMajority

func (vp ACCEPTVoteproof) BallotMajority() base.ACCEPTBallotFact

func (ACCEPTVoteproof) BallotSignFacts

func (vp ACCEPTVoteproof) BallotSignFacts() []base.ACCEPTBallotSignFact

func (*ACCEPTVoteproof) DecodeJSON

func (vp *ACCEPTVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (*ACCEPTVoteproof) Finish

func (vp *ACCEPTVoteproof) Finish() baseVoteproof

func (ACCEPTVoteproof) FinishedAt

func (vp ACCEPTVoteproof) FinishedAt() time.Time

func (ACCEPTVoteproof) HashBytes

func (vp ACCEPTVoteproof) HashBytes() []byte

func (ACCEPTVoteproof) ID

func (vp ACCEPTVoteproof) ID() string

func (ACCEPTVoteproof) IsValid

func (vp ACCEPTVoteproof) IsValid(networkID []byte) error

func (ACCEPTVoteproof) Majority

func (vp ACCEPTVoteproof) Majority() base.BallotFact

func (ACCEPTVoteproof) MarshalJSON

func (vp ACCEPTVoteproof) MarshalJSON() ([]byte, error)

func (ACCEPTVoteproof) Point

func (vp ACCEPTVoteproof) Point() base.StagePoint

func (ACCEPTVoteproof) Result

func (vp ACCEPTVoteproof) Result() base.VoteResult

func (*ACCEPTVoteproof) SetMajority

func (vp *ACCEPTVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof

func (*ACCEPTVoteproof) SetPoint

func (vp *ACCEPTVoteproof) SetPoint(p base.StagePoint) *baseVoteproof

func (*ACCEPTVoteproof) SetSignFacts

func (vp *ACCEPTVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof

func (*ACCEPTVoteproof) SetThreshold

func (vp *ACCEPTVoteproof) SetThreshold(s base.Threshold) *baseVoteproof

func (ACCEPTVoteproof) SignFacts

func (vp ACCEPTVoteproof) SignFacts() []base.BallotSignFact

func (ACCEPTVoteproof) Threshold

func (vp ACCEPTVoteproof) Threshold() base.Threshold

type ACCEPTWithdrawVoteproof

type ACCEPTWithdrawVoteproof struct {
	ACCEPTVoteproof
	// contains filtered or unexported fields
}

func NewACCEPTWithdrawVoteproof

func NewACCEPTWithdrawVoteproof(point base.Point) ACCEPTWithdrawVoteproof

func (*ACCEPTWithdrawVoteproof) DecodeJSON

func (vp *ACCEPTWithdrawVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (*ACCEPTWithdrawVoteproof) Finish

func (vp *ACCEPTWithdrawVoteproof) Finish() baseVoteproof

func (ACCEPTWithdrawVoteproof) FinishedAt

func (vp ACCEPTWithdrawVoteproof) FinishedAt() time.Time

func (ACCEPTWithdrawVoteproof) HashBytes

func (vp ACCEPTWithdrawVoteproof) HashBytes() []byte

func (ACCEPTWithdrawVoteproof) ID

func (vp ACCEPTWithdrawVoteproof) ID() string

func (ACCEPTWithdrawVoteproof) IsValid

func (vp ACCEPTWithdrawVoteproof) IsValid(networkID []byte) error

func (ACCEPTWithdrawVoteproof) IsWithdrawVoteproof

func (ACCEPTWithdrawVoteproof) IsWithdrawVoteproof() bool

func (ACCEPTWithdrawVoteproof) Majority

func (vp ACCEPTWithdrawVoteproof) Majority() base.BallotFact

func (ACCEPTWithdrawVoteproof) MarshalJSON

func (vp ACCEPTWithdrawVoteproof) MarshalJSON() ([]byte, error)

func (ACCEPTWithdrawVoteproof) Point

func (vp ACCEPTWithdrawVoteproof) Point() base.StagePoint

func (ACCEPTWithdrawVoteproof) Result

func (vp ACCEPTWithdrawVoteproof) Result() base.VoteResult

func (*ACCEPTWithdrawVoteproof) SetMajority

func (vp *ACCEPTWithdrawVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof

func (*ACCEPTWithdrawVoteproof) SetPoint

func (vp *ACCEPTWithdrawVoteproof) SetPoint(p base.StagePoint) *baseVoteproof

func (*ACCEPTWithdrawVoteproof) SetSignFacts

func (vp *ACCEPTWithdrawVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof

func (*ACCEPTWithdrawVoteproof) SetThreshold

func (vp *ACCEPTWithdrawVoteproof) SetThreshold(s base.Threshold) *baseVoteproof

func (*ACCEPTWithdrawVoteproof) SetWithdraws

func (vp *ACCEPTWithdrawVoteproof) SetWithdraws(withdraws []base.SuffrageWithdrawOperation) *baseWithdrawVoteproof

func (ACCEPTWithdrawVoteproof) SignFacts

func (vp ACCEPTWithdrawVoteproof) SignFacts() []base.BallotSignFact

func (ACCEPTWithdrawVoteproof) Threshold

func (vp ACCEPTWithdrawVoteproof) Threshold() base.Threshold

func (ACCEPTWithdrawVoteproof) Withdraws

func (vp ACCEPTWithdrawVoteproof) Withdraws() []base.SuffrageWithdrawOperation

type BallotPool

type BallotPool interface {
	Ballot(_ base.Point, _ base.Stage, isSuffrageConfirm bool) (base.Ballot, bool, error)
	SetBallot(base.Ballot) (bool, error)
}

BallotPool stores latest ballots of local

type BaseDatabase

type BaseDatabase interface {
	State(key string) (base.State, bool, error)
	StateBytes(key string) (hint.Hint, []byte, []byte, bool, error)
	ExistsInStateOperation(operationFactHash util.Hash) (bool, error)
	ExistsKnownOperation(operationHash util.Hash) (bool, error)
}

type BaseProposalSelector

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

func NewBaseProposalSelector

func NewBaseProposalSelector(
	local base.LocalNode,
	params *LocalParams,
	proposerSelector ProposerSelector,
	maker *ProposalMaker,
	getAvailableNodes func(base.Height) ([]base.Node, bool, error),
	request func(context.Context, base.Point, base.Address) (base.ProposalSignFact, error),
	pool ProposalPool,
) *BaseProposalSelector

func (*BaseProposalSelector) Select

type BlockBasedProposerSelector

type BlockBasedProposerSelector struct {
	// contains filtered or unexported fields
}

func NewBlockBasedProposerSelector

func NewBlockBasedProposerSelector(
	getManifestHash func(base.Height) (util.Hash, error),
) BlockBasedProposerSelector

func (BlockBasedProposerSelector) Select

func (p BlockBasedProposerSelector) Select(_ context.Context, point base.Point, nodes []base.Node) (base.Node, error)

type BlockImporter

type BlockImporter interface {
	WriteMap(base.BlockMap) error
	WriteItem(base.BlockMapItemType, io.Reader) error
	Save(context.Context) (func(context.Context) error, error)
	CancelImport(context.Context) error
	Reader() (BlockReader, error)
}

type BlockReader

type BlockReader interface {
	BlockMap() (base.BlockMap, bool, error)
	Reader(base.BlockMapItemType) (io.ReadCloser, bool, error)
	ChecksumReader(base.BlockMapItemType) (util.ChecksumReader, bool, error)
	Item(base.BlockMapItemType) (interface{}, bool, error)
	Items(func(base.BlockMapItem, interface{}, bool, error) bool) error
}

type BlockWriteDatabase

type BlockWriteDatabase interface {
	Close() error
	Cancel() error
	BlockMap() (base.BlockMap, error)
	SetBlockMap(base.BlockMap) error
	SetStates(sts []base.State) error
	SetOperations(ops []util.Hash) error // NOTE operation hash, not operation fact hash
	SetSuffrageProof(base.SuffrageProof) error
	SuffrageState() base.State
	NetworkPolicy() base.NetworkPolicy
	Write() error
	TempDatabase() (TempDatabase, error)
}

type BlockWriter

type BlockWriter interface {
	SetOperationsSize(uint64)
	SetProcessResult(
		_ context.Context,
		index uint64,
		ophash, facthash util.Hash,
		instate bool,
		errorreason base.OperationProcessReasonError,
	) error
	SetStates(_ context.Context, index uint64, values []base.StateMergeValue, operation base.Operation) error
	Manifest(_ context.Context, previous base.Manifest) (base.Manifest, error)
	SetINITVoteproof(context.Context, base.INITVoteproof) error
	SetACCEPTVoteproof(context.Context, base.ACCEPTVoteproof) error
	Save(context.Context) (base.BlockMap, error)
	Cancel() error
}

type Database

type Database interface {
	util.Daemon
	Close() error
	BlockMap(height base.Height) (base.BlockMap, bool, error)
	BlockMapBytes(base.Height) (hint.Hint, []byte, []byte, bool, error)
	LastBlockMap() (base.BlockMap, bool, error)
	LastBlockMapBytes() (hint.Hint, []byte, []byte, bool, error)
	LastSuffrageProof() (base.SuffrageProof, bool, error)
	LastSuffrageProofBytes() (hint.Hint, []byte, []byte, bool, base.Height, error)
	SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error)
	SuffrageProofBytes(suffrageHeight base.Height) (hint.Hint, []byte, []byte, bool, error)
	SuffrageProofByBlockHeight(blockheight base.Height) (base.SuffrageProof, bool, error)
	LastNetworkPolicy() base.NetworkPolicy
	State(key string) (base.State, bool, error)
	StateBytes(key string) (hint.Hint, []byte, []byte, bool, error)
	// NOTE ExistsInStateOperation has only operation facts, which is in state
	ExistsInStateOperation(operationFactHash util.Hash) (bool, error)
	// NOTE ExistsKnownOperation has the known operation hashes
	ExistsKnownOperation(operationHash util.Hash) (bool, error)
	NewBlockWriteDatabase(height base.Height) (BlockWriteDatabase, error)
	MergeBlockWriteDatabase(BlockWriteDatabase) error
	MergeAllPermanent() error
	RemoveBlocks(base.Height) (bool, error)
}

Database serves BlockMapItem like blockmap, states and operations from TempDatabases and PermanentDatabase. It has several TempDatabases and one PermanentDatabase.

type DefaultProposalProcessor

type DefaultProposalProcessor struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewDefaultProposalProcessor

func NewDefaultProposalProcessor(
	proposal base.ProposalSignFact,
	previous base.Manifest,
	newWriter NewBlockWriterFunc,
	getStatef base.GetStateFunc,
	getOperationf OperationProcessorGetOperationFunction,
	newOperationProcessor NewOperationProcessorFunction,
) (*DefaultProposalProcessor, error)

func (*DefaultProposalProcessor) Cancel

func (p *DefaultProposalProcessor) Cancel() error

func (*DefaultProposalProcessor) Process

func (*DefaultProposalProcessor) Proposal

func (*DefaultProposalProcessor) Save

type FixedSuffrageCandidateLimiterRule

type FixedSuffrageCandidateLimiterRule struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewFixedSuffrageCandidateLimiterRule

func NewFixedSuffrageCandidateLimiterRule(limit uint64) FixedSuffrageCandidateLimiterRule

func (FixedSuffrageCandidateLimiterRule) HashBytes

func (l FixedSuffrageCandidateLimiterRule) HashBytes() []byte

func (FixedSuffrageCandidateLimiterRule) IsValid

func (FixedSuffrageCandidateLimiterRule) Limit

func (FixedSuffrageCandidateLimiterRule) MarshalJSON

func (l FixedSuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)

func (*FixedSuffrageCandidateLimiterRule) UnmarshalJSON

func (l *FixedSuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error

type FuncProposerSelector

type FuncProposerSelector struct {
	// contains filtered or unexported fields
}

func NewFixedProposerSelector

func NewFixedProposerSelector(
	selectfunc func(base.Point, []base.Node) (base.Node, error),
) FuncProposerSelector

func (FuncProposerSelector) Select

func (p FuncProposerSelector) Select(_ context.Context, point base.Point, nodes []base.Node) (base.Node, error)

type GetLastSuffrageCandidateStateRemoteFunc

type GetLastSuffrageCandidateStateRemoteFunc func(context.Context) (base.State, bool, error)

type GetLastSuffrageProofFromRemoteFunc

type GetLastSuffrageProofFromRemoteFunc func(context.Context) (base.Height, base.SuffrageProof, bool, error)

type GetSuffrageByBlockHeight

type GetSuffrageByBlockHeight func(nextheight base.Height) (base.Suffrage, bool, error)

type GetSuffrageProofFromRemoteFunc

type GetSuffrageProofFromRemoteFunc func(_ context.Context, suffrageheight base.Height) (
	base.SuffrageProof, bool, error)

type INITBallot

type INITBallot struct {
	// contains filtered or unexported fields
}

func NewINITBallot

func NewINITBallot(
	vp base.Voteproof,
	signfact INITBallotSignFact,
	withdraws []base.SuffrageWithdrawOperation,
) INITBallot

func (INITBallot) BallotSignFact

func (bl INITBallot) BallotSignFact() base.INITBallotSignFact

func (*INITBallot) DecodeJSON

func (bl *INITBallot) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (INITBallot) HashBytes

func (bl INITBallot) HashBytes() []byte

func (INITBallot) IsValid

func (bl INITBallot) IsValid(networkID []byte) error

func (INITBallot) MarshalJSON

func (bl INITBallot) MarshalJSON() ([]byte, error)

func (INITBallot) Point

func (bl INITBallot) Point() base.StagePoint

func (INITBallot) SignFact

func (bl INITBallot) SignFact() base.BallotSignFact

func (INITBallot) Voteproof

func (bl INITBallot) Voteproof() base.Voteproof

func (INITBallot) Withdraws

func (bl INITBallot) Withdraws() []base.SuffrageWithdrawOperation

type INITBallotFact

type INITBallotFact struct {
	// contains filtered or unexported fields
}

func NewINITBallotFact

func NewINITBallotFact(
	point base.Point,
	previousBlock, proposal util.Hash,
	withdrawfacts []util.Hash,
) INITBallotFact

func (*INITBallotFact) DecodeJSON

func (fact *INITBallotFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (INITBallotFact) IsValid

func (fact INITBallotFact) IsValid([]byte) error

func (INITBallotFact) MarshalJSON

func (fact INITBallotFact) MarshalJSON() ([]byte, error)

func (INITBallotFact) Point

func (fact INITBallotFact) Point() base.StagePoint

func (INITBallotFact) PreviousBlock

func (fact INITBallotFact) PreviousBlock() util.Hash

func (INITBallotFact) Proposal

func (fact INITBallotFact) Proposal() util.Hash

func (INITBallotFact) Stage

func (fact INITBallotFact) Stage() base.Stage

func (INITBallotFact) WithdrawFacts

func (fact INITBallotFact) WithdrawFacts() []util.Hash

type INITBallotFactJSONMarshaler

type INITBallotFactJSONMarshaler struct {
	PreviousBlock util.Hash `json:"previous_block"`
	Proposal      util.Hash `json:"proposal"`
	// contains filtered or unexported fields
}

type INITBallotFactJSONUnmarshaler

type INITBallotFactJSONUnmarshaler struct {
	PreviousBlock valuehash.HashDecoder `json:"previous_block"`
	Proposal      valuehash.HashDecoder `json:"proposal"`
	// contains filtered or unexported fields
}

type INITBallotSignFact

type INITBallotSignFact struct {
	// contains filtered or unexported fields
}

func NewINITBallotSignFact

func NewINITBallotSignFact(fact base.INITBallotFact) INITBallotSignFact

func (INITBallotSignFact) BallotFact

func (sf INITBallotSignFact) BallotFact() base.INITBallotFact

func (*INITBallotSignFact) DecodeJSON

func (sf *INITBallotSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (INITBallotSignFact) Fact

func (sf INITBallotSignFact) Fact() base.Fact

func (INITBallotSignFact) HashBytes

func (sf INITBallotSignFact) HashBytes() []byte

func (INITBallotSignFact) IsValid

func (sf INITBallotSignFact) IsValid(networkID []byte) error

func (INITBallotSignFact) MarshalJSON

func (sf INITBallotSignFact) MarshalJSON() ([]byte, error)

func (INITBallotSignFact) Node

func (sf INITBallotSignFact) Node() base.Address

func (*INITBallotSignFact) NodeSign

func (sf *INITBallotSignFact) NodeSign(priv base.Privatekey, networkID base.NetworkID, node base.Address) error

func (INITBallotSignFact) NodeSigns

func (sf INITBallotSignFact) NodeSigns() []base.NodeSign

func (INITBallotSignFact) Signer

func (sf INITBallotSignFact) Signer() base.Publickey

func (INITBallotSignFact) Signs

func (sf INITBallotSignFact) Signs() []base.Sign

type INITStuckVoteproof

type INITStuckVoteproof struct {
	INITVoteproof
	// contains filtered or unexported fields
}

func NewINITStuckVoteproof

func NewINITStuckVoteproof(point base.Point) INITStuckVoteproof

func (*INITStuckVoteproof) DecodeJSON

func (vp *INITStuckVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (*INITStuckVoteproof) Finish

func (vp *INITStuckVoteproof) Finish() *INITStuckVoteproof

func (INITStuckVoteproof) FinishedAt

func (vp INITStuckVoteproof) FinishedAt() time.Time

func (INITStuckVoteproof) HashBytes

func (vp INITStuckVoteproof) HashBytes() []byte

func (INITStuckVoteproof) ID

func (vp INITStuckVoteproof) ID() string

func (INITStuckVoteproof) IsStuckVoteproof

func (INITStuckVoteproof) IsStuckVoteproof() bool

func (INITStuckVoteproof) IsValid

func (vp INITStuckVoteproof) IsValid(networkID []byte) error

func (INITStuckVoteproof) Majority

func (vp INITStuckVoteproof) Majority() base.BallotFact

func (INITStuckVoteproof) MarshalJSON

func (vp INITStuckVoteproof) MarshalJSON() ([]byte, error)

func (INITStuckVoteproof) Point

func (vp INITStuckVoteproof) Point() base.StagePoint

func (INITStuckVoteproof) Result

func (vp INITStuckVoteproof) Result() base.VoteResult

func (*INITStuckVoteproof) SetMajority

func (vp *INITStuckVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof

func (*INITStuckVoteproof) SetPoint

func (vp *INITStuckVoteproof) SetPoint(p base.StagePoint) *baseVoteproof

func (*INITStuckVoteproof) SetSignFacts

func (vp *INITStuckVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof

func (*INITStuckVoteproof) SetThreshold

func (vp *INITStuckVoteproof) SetThreshold(s base.Threshold) *baseVoteproof

func (INITStuckVoteproof) SignFacts

func (vp INITStuckVoteproof) SignFacts() []base.BallotSignFact

func (INITStuckVoteproof) Threshold

func (vp INITStuckVoteproof) Threshold() base.Threshold

type INITVoteproof

type INITVoteproof struct {
	// contains filtered or unexported fields
}

func NewINITVoteproof

func NewINITVoteproof(point base.Point) INITVoteproof

func (INITVoteproof) BallotMajority

func (vp INITVoteproof) BallotMajority() base.INITBallotFact

func (INITVoteproof) BallotSignFacts

func (vp INITVoteproof) BallotSignFacts() []base.INITBallotSignFact

func (*INITVoteproof) DecodeJSON

func (vp *INITVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (*INITVoteproof) Finish

func (vp *INITVoteproof) Finish() baseVoteproof

func (INITVoteproof) FinishedAt

func (vp INITVoteproof) FinishedAt() time.Time

func (INITVoteproof) HashBytes

func (vp INITVoteproof) HashBytes() []byte

func (INITVoteproof) ID

func (vp INITVoteproof) ID() string

func (INITVoteproof) IsValid

func (vp INITVoteproof) IsValid(networkID []byte) error

func (INITVoteproof) Majority

func (vp INITVoteproof) Majority() base.BallotFact

func (INITVoteproof) MarshalJSON

func (vp INITVoteproof) MarshalJSON() ([]byte, error)

func (INITVoteproof) Point

func (vp INITVoteproof) Point() base.StagePoint

func (INITVoteproof) Result

func (vp INITVoteproof) Result() base.VoteResult

func (*INITVoteproof) SetMajority

func (vp *INITVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof

func (*INITVoteproof) SetPoint

func (vp *INITVoteproof) SetPoint(p base.StagePoint) *baseVoteproof

func (*INITVoteproof) SetSignFacts

func (vp *INITVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof

func (*INITVoteproof) SetThreshold

func (vp *INITVoteproof) SetThreshold(s base.Threshold) *baseVoteproof

func (INITVoteproof) SignFacts

func (vp INITVoteproof) SignFacts() []base.BallotSignFact

func (INITVoteproof) Threshold

func (vp INITVoteproof) Threshold() base.Threshold

type INITWithdrawVoteproof

type INITWithdrawVoteproof struct {
	INITVoteproof
	// contains filtered or unexported fields
}

func NewINITWithdrawVoteproof

func NewINITWithdrawVoteproof(point base.Point) INITWithdrawVoteproof

func (*INITWithdrawVoteproof) DecodeJSON

func (vp *INITWithdrawVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (*INITWithdrawVoteproof) Finish

func (vp *INITWithdrawVoteproof) Finish() baseVoteproof

func (INITWithdrawVoteproof) FinishedAt

func (vp INITWithdrawVoteproof) FinishedAt() time.Time

func (INITWithdrawVoteproof) HashBytes

func (vp INITWithdrawVoteproof) HashBytes() []byte

func (INITWithdrawVoteproof) ID

func (vp INITWithdrawVoteproof) ID() string

func (INITWithdrawVoteproof) IsValid

func (vp INITWithdrawVoteproof) IsValid(networkID []byte) error

func (INITWithdrawVoteproof) IsWithdrawVoteproof

func (INITWithdrawVoteproof) IsWithdrawVoteproof() bool

func (INITWithdrawVoteproof) Majority

func (vp INITWithdrawVoteproof) Majority() base.BallotFact

func (INITWithdrawVoteproof) MarshalJSON

func (vp INITWithdrawVoteproof) MarshalJSON() ([]byte, error)

func (INITWithdrawVoteproof) Point

func (vp INITWithdrawVoteproof) Point() base.StagePoint

func (INITWithdrawVoteproof) Result

func (vp INITWithdrawVoteproof) Result() base.VoteResult

func (*INITWithdrawVoteproof) SetMajority

func (vp *INITWithdrawVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof

func (*INITWithdrawVoteproof) SetPoint

func (vp *INITWithdrawVoteproof) SetPoint(p base.StagePoint) *baseVoteproof

func (*INITWithdrawVoteproof) SetSignFacts

func (vp *INITWithdrawVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof

func (*INITWithdrawVoteproof) SetThreshold

func (vp *INITWithdrawVoteproof) SetThreshold(s base.Threshold) *baseVoteproof

func (*INITWithdrawVoteproof) SetWithdraws

func (vp *INITWithdrawVoteproof) SetWithdraws(withdraws []base.SuffrageWithdrawOperation) *baseWithdrawVoteproof

func (INITWithdrawVoteproof) SignFacts

func (vp INITWithdrawVoteproof) SignFacts() []base.BallotSignFact

func (INITWithdrawVoteproof) Threshold

func (vp INITWithdrawVoteproof) Threshold() base.Threshold

func (INITWithdrawVoteproof) Withdraws

func (vp INITWithdrawVoteproof) Withdraws() []base.SuffrageWithdrawOperation

type LastConsensusNodesWatcher

type LastConsensusNodesWatcher struct {
	*util.ContextDaemon
	*logging.Logging
	// contains filtered or unexported fields
}

func NewLastConsensusNodesWatcher

func NewLastConsensusNodesWatcher(
	getFromLocal func() (base.Height, base.SuffrageProof, base.State, bool, error),
	getFromRemote func(context.Context, base.State) (base.Height, []base.SuffrageProof, base.State, error),
	whenUpdatedf func(context.Context, base.SuffrageProof, base.SuffrageProof, base.State),
	checkInterval time.Duration,
) (*LastConsensusNodesWatcher, error)

func (*LastConsensusNodesWatcher) Exists

func (*LastConsensusNodesWatcher) GetSuffrage

func (u *LastConsensusNodesWatcher) GetSuffrage(height base.Height) (base.Suffrage, bool, error)

func (*LastConsensusNodesWatcher) Last

func (*LastConsensusNodesWatcher) SetWhenUpdated

func (u *LastConsensusNodesWatcher) SetWhenUpdated(
	whenUpdated func(context.Context, base.SuffrageProof, base.SuffrageProof, base.State),
)

type LocalNode

type LocalNode struct {
	base.BaseNode
	// contains filtered or unexported fields
}

func NewLocalNode

func NewLocalNode(priv base.Privatekey, addr base.Address) LocalNode

func (LocalNode) Base

func (n LocalNode) Base() base.BaseNode

func (LocalNode) IsValid

func (n LocalNode) IsValid([]byte) error

func (LocalNode) Privatekey

func (n LocalNode) Privatekey() base.Privatekey

type LocalParams

type LocalParams struct {
	util.DefaultJSONMarshaled
	hint.BaseHinter

	sync.RWMutex
	// contains filtered or unexported fields
}

func DefaultLocalParams

func DefaultLocalParams(networkID base.NetworkID) *LocalParams

func NewLocalParams

func NewLocalParams(networkID base.NetworkID) *LocalParams

func (*LocalParams) BallotStuckResolveAfter

func (p *LocalParams) BallotStuckResolveAfter() time.Duration

func (*LocalParams) BallotStuckWait

func (p *LocalParams) BallotStuckWait() time.Duration

func (*LocalParams) ID

func (p *LocalParams) ID() string

func (*LocalParams) IntervalBroadcastBallot

func (p *LocalParams) IntervalBroadcastBallot() time.Duration

func (*LocalParams) IsValid

func (p *LocalParams) IsValid(networkID []byte) error

func (*LocalParams) MarshalJSON

func (p *LocalParams) MarshalJSON() ([]byte, error)

func (*LocalParams) MaxMessageSize

func (p *LocalParams) MaxMessageSize() uint64

func (*LocalParams) NetworkID

func (p *LocalParams) NetworkID() base.NetworkID

func (*LocalParams) SameMemberLimit

func (p *LocalParams) SameMemberLimit() uint64

func (*LocalParams) SetBallotStuckResolveAfter

func (p *LocalParams) SetBallotStuckResolveAfter(d time.Duration) *LocalParams

func (*LocalParams) SetBallotStuckWait

func (p *LocalParams) SetBallotStuckWait(d time.Duration) *LocalParams

func (*LocalParams) SetIntervalBroadcastBallot

func (p *LocalParams) SetIntervalBroadcastBallot(d time.Duration) *LocalParams

func (*LocalParams) SetMaxMessageSize

func (p *LocalParams) SetMaxMessageSize(s uint64) *LocalParams

func (*LocalParams) SetNetworkID

func (p *LocalParams) SetNetworkID(n base.NetworkID) *LocalParams

func (*LocalParams) SetSameMemberLimit

func (p *LocalParams) SetSameMemberLimit(s uint64) *LocalParams

func (*LocalParams) SetSyncSourceCheckerInterval

func (p *LocalParams) SetSyncSourceCheckerInterval(d time.Duration) *LocalParams

func (*LocalParams) SetThreshold

func (p *LocalParams) SetThreshold(t base.Threshold) *LocalParams

func (*LocalParams) SetTimeoutRequestProposal

func (p *LocalParams) SetTimeoutRequestProposal(d time.Duration) *LocalParams

func (*LocalParams) SetValidProposalOperationExpire

func (p *LocalParams) SetValidProposalOperationExpire(d time.Duration) *LocalParams

func (*LocalParams) SetValidProposalSuffrageOperationsExpire

func (p *LocalParams) SetValidProposalSuffrageOperationsExpire(d time.Duration) *LocalParams

func (*LocalParams) SetWaitPreparingINITBallot

func (p *LocalParams) SetWaitPreparingINITBallot(d time.Duration) *LocalParams

func (*LocalParams) SetWaitPreparingNextRoundINITBallot

func (p *LocalParams) SetWaitPreparingNextRoundINITBallot(d time.Duration) *LocalParams

func (*LocalParams) SyncSourceCheckerInterval

func (p *LocalParams) SyncSourceCheckerInterval() time.Duration

func (*LocalParams) Threshold

func (p *LocalParams) Threshold() base.Threshold

func (*LocalParams) TimeoutRequestProposal

func (p *LocalParams) TimeoutRequestProposal() time.Duration

func (*LocalParams) UnmarshalJSON

func (p *LocalParams) UnmarshalJSON(b []byte) error

func (*LocalParams) ValidProposalOperationExpire

func (p *LocalParams) ValidProposalOperationExpire() time.Duration

func (*LocalParams) ValidProposalSuffrageOperationsExpire

func (p *LocalParams) ValidProposalSuffrageOperationsExpire() time.Duration

func (*LocalParams) WaitPreparingINITBallot

func (p *LocalParams) WaitPreparingINITBallot() time.Duration

func (*LocalParams) WaitPreparingNextRoundINITBallot

func (p *LocalParams) WaitPreparingNextRoundINITBallot() time.Duration

type MajoritySuffrageCandidateLimiterRule

type MajoritySuffrageCandidateLimiterRule struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewMajoritySuffrageCandidateLimiterRule

func NewMajoritySuffrageCandidateLimiterRule(ratio float64, min, max uint64) MajoritySuffrageCandidateLimiterRule

func (MajoritySuffrageCandidateLimiterRule) HashBytes

func (MajoritySuffrageCandidateLimiterRule) IsValid

func (MajoritySuffrageCandidateLimiterRule) MarshalJSON

func (l MajoritySuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)

func (MajoritySuffrageCandidateLimiterRule) Max

func (MajoritySuffrageCandidateLimiterRule) Min

func (MajoritySuffrageCandidateLimiterRule) Ratio

func (*MajoritySuffrageCandidateLimiterRule) UnmarshalJSON

func (l *MajoritySuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error

type Manifest

type Manifest struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewManifest

func NewManifest(
	height base.Height,
	previous,
	proposal,
	operationsTree,
	statesTree,
	suffrage util.Hash,
	proposedAt time.Time,
) Manifest

func (Manifest) Hash

func (m Manifest) Hash() util.Hash

func (Manifest) Height

func (m Manifest) Height() base.Height

func (Manifest) IsValid

func (m Manifest) IsValid([]byte) error

func (Manifest) MarshalJSON

func (m Manifest) MarshalJSON() ([]byte, error)

func (Manifest) OperationsTree

func (m Manifest) OperationsTree() util.Hash

func (Manifest) Previous

func (m Manifest) Previous() util.Hash

func (Manifest) Proposal

func (m Manifest) Proposal() util.Hash

func (Manifest) ProposedAt

func (m Manifest) ProposedAt() time.Time

func (Manifest) StatesTree

func (m Manifest) StatesTree() util.Hash

func (Manifest) Suffrage

func (m Manifest) Suffrage() util.Hash

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(b []byte) error

type ManifestJSONMarshaler

type ManifestJSONMarshaler struct {
	ProposedAt     time.Time `json:"proposed_at"`
	StatesTree     util.Hash `json:"states_tree"`
	Hash           util.Hash `json:"hash"`
	Previous       util.Hash `json:"previous"`
	Proposal       util.Hash `json:"proposal"`
	OperationsTree util.Hash `json:"operations_tree"`
	Suffrage       util.Hash `json:"suffrage"`
	hint.BaseHinter
	Height base.Height `json:"height"`
}

type ManifestJSONUnmarshaler

type ManifestJSONUnmarshaler struct {
	ProposedAt     localtime.Time        `json:"proposed_at"`
	Hash           valuehash.HashDecoder `json:"hash"`
	Previous       valuehash.HashDecoder `json:"previous"`
	Proposal       valuehash.HashDecoder `json:"proposal"`
	OperationsTree valuehash.HashDecoder `json:"operations_tree"`
	StatesTree     valuehash.HashDecoder `json:"states_tree"`
	Suffrage       valuehash.HashDecoder `json:"suffrage"`
	Height         base.HeightDecoder    `json:"height"`
}

type NetworkClient

type NetworkClient interface {
	Request(context.Context, quicstream.UDPConnInfo, NetworkHeader, io.Reader) (NetworkResponseHeader, interface{}, func() error, error)
	Operation(_ context.Context, _ quicstream.UDPConnInfo, operationhash util.Hash) (base.Operation, bool, error)
	SendOperation(context.Context, quicstream.UDPConnInfo, base.Operation) (bool, error)
	RequestProposal(_ context.Context, connInfo quicstream.UDPConnInfo, point base.Point, propser base.Address) (base.ProposalSignFact, bool, error)
	Proposal(_ context.Context, connInfo quicstream.UDPConnInfo, facthash util.Hash) (base.ProposalSignFact, bool, error)
	LastSuffrageProof(_ context.Context, connInfo quicstream.UDPConnInfo, state util.Hash) (lastheight base.Height, _ base.SuffrageProof, updated bool, _ error)
	SuffrageProof(_ context.Context, connInfo quicstream.UDPConnInfo, suffrageheight base.Height) (_ base.SuffrageProof, found bool, _ error)
	LastBlockMap(_ context.Context, _ quicstream.UDPConnInfo, manifest util.Hash) (_ base.BlockMap, updated bool, _ error)
	BlockMap(context.Context, quicstream.UDPConnInfo, base.Height) (_ base.BlockMap, updated bool, _ error)
	BlockMapItem(context.Context, quicstream.UDPConnInfo, base.Height, base.BlockMapItemType) (io.ReadCloser, func() error, bool, error)
	NodeChallenge(_ context.Context, _ quicstream.UDPConnInfo, _ base.NetworkID, _ base.Address, _ base.Publickey, input []byte) (base.Signature, error)
	SuffrageNodeConnInfo(context.Context, quicstream.UDPConnInfo) ([]NodeConnInfo, error)
	SyncSourceConnInfo(context.Context, quicstream.UDPConnInfo) ([]NodeConnInfo, error)
	State(_ context.Context, _ quicstream.UDPConnInfo, key string, _ util.Hash) (base.State, bool, error)
	ExistsInStateOperation(_ context.Context, _ quicstream.UDPConnInfo, facthash util.Hash) (bool, error)
	SendBallots(context.Context, quicstream.UDPConnInfo, []base.BallotSignFact) error
}

revive:disable:line-length-limit

type NetworkHeader

type NetworkHeader interface {
	util.IsValider
	HandlerPrefix() string
}

type NetworkPolicy

type NetworkPolicy struct {
	util.DefaultJSONMarshaled
	hint.BaseHinter
	// contains filtered or unexported fields
}

func DefaultNetworkPolicy

func DefaultNetworkPolicy() NetworkPolicy

func (*NetworkPolicy) DecodeJSON

func (p *NetworkPolicy) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (NetworkPolicy) HashBytes

func (p NetworkPolicy) HashBytes() []byte

func (NetworkPolicy) IsValid

func (p NetworkPolicy) IsValid([]byte) error

func (NetworkPolicy) MarshalJSON

func (p NetworkPolicy) MarshalJSON() ([]byte, error)

func (NetworkPolicy) MaxOperationsInProposal

func (p NetworkPolicy) MaxOperationsInProposal() uint64

func (NetworkPolicy) MaxSuffrageSize

func (p NetworkPolicy) MaxSuffrageSize() uint64

func (NetworkPolicy) SuffrageCandidateLifespan

func (p NetworkPolicy) SuffrageCandidateLifespan() base.Height

func (NetworkPolicy) SuffrageCandidateLimiterRule

func (p NetworkPolicy) SuffrageCandidateLimiterRule() base.SuffrageCandidateLimiterRule

func (NetworkPolicy) SuffrageWithdrawLifespan

func (p NetworkPolicy) SuffrageWithdrawLifespan() base.Height

type NetworkPolicyStateValue

type NetworkPolicyStateValue struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewNetworkPolicyStateValue

func NewNetworkPolicyStateValue(policy base.NetworkPolicy) NetworkPolicyStateValue

func (*NetworkPolicyStateValue) DecodeJSON

func (s *NetworkPolicyStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (NetworkPolicyStateValue) HashBytes

func (s NetworkPolicyStateValue) HashBytes() []byte

func (NetworkPolicyStateValue) IsValid

func (s NetworkPolicyStateValue) IsValid([]byte) error

func (NetworkPolicyStateValue) MarshalJSON

func (s NetworkPolicyStateValue) MarshalJSON() ([]byte, error)

func (NetworkPolicyStateValue) Policy

type NetworkPolicyStateValueJSONMarshaler

type NetworkPolicyStateValueJSONMarshaler struct {
	Policy base.NetworkPolicy `json:"policy"`
	hint.BaseHinter
}

type NetworkPolicyStateValueJSONUnmarshaler

type NetworkPolicyStateValueJSONUnmarshaler struct {
	Policy json.RawMessage `json:"policy"`
}

type NetworkResponseContentType

type NetworkResponseContentType string
var (
	NetworkResponseHinterContentType NetworkResponseContentType
	NetworkResponseRawContentType    NetworkResponseContentType = "raw"
)

type NetworkResponseHeader

type NetworkResponseHeader interface {
	NetworkHeader
	Err() error
	OK() bool
	Type() NetworkResponseContentType
}

type NewBlockWriterFunc

type NewBlockWriterFunc func(base.ProposalSignFact, base.GetStateFunc) (BlockWriter, error)

type NewOperationPool

type NewOperationPool interface {
	NewOperation(_ context.Context, operationhash util.Hash) (base.Operation, bool, error)
	NewOperationBytes(_ context.Context, operationhash util.Hash) (hint.Hint, []byte, []byte, bool, error)
	NewOperationHashes(
		_ context.Context,
		_ base.Height,
		limit uint64,
		filter func(PoolOperationRecordMeta) (ok bool, err error),
	) ([]util.Hash, error)
	SetNewOperation(context.Context, base.Operation) (bool, error)
}

type NewOperationProcessorFunction

type NewOperationProcessorFunction func(base.Height, hint.Hint) (base.OperationProcessor, error)

type NodeConnInfo

type NodeConnInfo interface {
	base.Node
	network.ConnInfo
	UDPConnInfo() (quicstream.UDPConnInfo, error)
}

type NodeInConsensusNodesFunc

type NodeInConsensusNodesFunc func(base.Node, base.Height) (base.Suffrage, bool, error)

type OperationProcessHandler

type OperationProcessHandler interface {
	Hints() []hint.Hint
	PreProcess(operation base.Operation) (bool, error)
	Process(operation base.Operation) ([]base.State, error)
}

type OperationProcessorGetOperationFunction

type OperationProcessorGetOperationFunction func(_ context.Context, operationhash util.Hash) (base.Operation, error)

OperationProcessorGetOperationFunction works, - if operation is invalid, getOperation should return nil, InvalidOperationInProcessorError; it will be not processed and it's fact hash will be stored. - if operation is not found in remote, getOperation should return nil, OperationNotFoundInProcessorError; it will be ignored. - if operation is known, return nil, OperationAlreadyProcessedInProcessorError; it will be ignored.

type PermanentDatabase

type PermanentDatabase interface {
	BaseDatabase
	Close() error
	Clean() error
	LastBlockMap() (base.BlockMap, bool, error)
	LastBlockMapBytes() (hint.Hint, []byte, []byte, bool, error)
	LastSuffrageProof() (base.SuffrageProof, bool, error)
	LastSuffrageProofBytes() (hint.Hint, []byte, []byte, bool, error)
	SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error)
	SuffrageProofBytes(suffrageHeight base.Height) (hint.Hint, []byte, []byte, bool, error)
	SuffrageProofByBlockHeight(blockheight base.Height) (base.SuffrageProof, bool, error)
	BlockMap(base.Height) (base.BlockMap, bool, error)
	BlockMapBytes(base.Height) (hint.Hint, []byte, []byte, bool, error)
	LastNetworkPolicy() base.NetworkPolicy
	MergeTempDatabase(context.Context, TempDatabase) error
}

PermanentDatabase stores BlockMapItem permanently.

type PoolOperationRecordMeta

type PoolOperationRecordMeta interface {
	Version() byte
	AddedAt() time.Time
	Hint() hint.Hint
	Operation() util.Hash
	Fact() util.Hash
}

type ProcessorProcessFunc

type ProcessorProcessFunc func(context.Context) (base.Manifest, error)

type ProposalFact

type ProposalFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewProposalFact

func NewProposalFact(point base.Point, proposer base.Address, operations []util.Hash) ProposalFact

func (*ProposalFact) DecodeJSON

func (fact *ProposalFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (ProposalFact) IsValid

func (fact ProposalFact) IsValid([]byte) error

func (ProposalFact) MarshalJSON

func (fact ProposalFact) MarshalJSON() ([]byte, error)

func (ProposalFact) Operations

func (fact ProposalFact) Operations() []util.Hash

func (ProposalFact) Point

func (fact ProposalFact) Point() base.Point

func (ProposalFact) ProposedAt

func (fact ProposalFact) ProposedAt() time.Time

func (ProposalFact) Proposer

func (fact ProposalFact) Proposer() base.Address

type ProposalMaker

type ProposalMaker struct {
	*logging.Logging

	sync.Mutex
	// contains filtered or unexported fields
}

func NewProposalMaker

func NewProposalMaker(
	local base.LocalNode,
	params base.LocalParams,
	getOperations func(context.Context, base.Height) ([]util.Hash, error),
	pool ProposalPool,
) *ProposalMaker

func (*ProposalMaker) Empty

func (*ProposalMaker) New

type ProposalPool

type ProposalPool interface {
	Proposal(util.Hash) (base.ProposalSignFact, bool, error)
	ProposalBytes(util.Hash) (hint.Hint, []byte, []byte, bool, error)
	ProposalByPoint(base.Point, base.Address) (base.ProposalSignFact, bool, error)
	SetProposal(pr base.ProposalSignFact) (bool, error)
}

type ProposalProcessor

type ProposalProcessor interface {
	Proposal() base.ProposalSignFact
	Process(context.Context, base.INITVoteproof) (base.Manifest, error)
	Save(context.Context, base.ACCEPTVoteproof) error
	Cancel() error
}

type ProposalProcessors

type ProposalProcessors struct {
	*logging.Logging

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewProposalProcessors

func NewProposalProcessors(
	makenew func(base.ProposalSignFact, base.Manifest) (ProposalProcessor, error),
	getproposal func(context.Context, util.Hash) (base.ProposalSignFact, error),
) *ProposalProcessors

func (*ProposalProcessors) Cancel

func (pps *ProposalProcessors) Cancel() error

func (*ProposalProcessors) Process

func (pps *ProposalProcessors) Process(
	ctx context.Context,
	facthash util.Hash,
	previous base.Manifest,
	ivp base.INITVoteproof,
) (ProcessorProcessFunc, error)

func (*ProposalProcessors) Processor

func (pps *ProposalProcessors) Processor() ProposalProcessor

func (*ProposalProcessors) Save

func (pps *ProposalProcessors) Save(ctx context.Context, facthash util.Hash, avp base.ACCEPTVoteproof) error

func (*ProposalProcessors) SetRetryInterval

func (pps *ProposalProcessors) SetRetryInterval(i time.Duration) *ProposalProcessors

func (*ProposalProcessors) SetRetryLimit

func (pps *ProposalProcessors) SetRetryLimit(l int) *ProposalProcessors

type ProposalSelector

type ProposalSelector interface {
	Select(context.Context, base.Point) (base.ProposalSignFact, error)
}

ProposalSelector fetchs proposal from selected proposer

type ProposalSignFact

type ProposalSignFact struct {
	util.DefaultJSONMarshaled
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewProposalSignFact

func NewProposalSignFact(fact ProposalFact) ProposalSignFact

func (*ProposalSignFact) DecodeJSON

func (sf *ProposalSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (ProposalSignFact) Fact

func (sf ProposalSignFact) Fact() base.Fact

func (ProposalSignFact) HashBytes

func (sf ProposalSignFact) HashBytes() []byte

func (ProposalSignFact) IsValid

func (sf ProposalSignFact) IsValid(networkID []byte) error

func (ProposalSignFact) MarshalJSON

func (sf ProposalSignFact) MarshalJSON() ([]byte, error)

func (ProposalSignFact) Point

func (sf ProposalSignFact) Point() base.Point

func (ProposalSignFact) ProposalFact

func (sf ProposalSignFact) ProposalFact() base.ProposalFact

func (*ProposalSignFact) Sign

func (sf *ProposalSignFact) Sign(priv base.Privatekey, networkID base.NetworkID) error

func (ProposalSignFact) Signs

func (sf ProposalSignFact) Signs() []base.Sign

type ProposerSelector

type ProposerSelector interface {
	Select(context.Context, base.Point, []base.Node) (base.Node, error)
}

ProposerSelector selects proposer between suffrage nodes

type ReasonProcessedOperation

type ReasonProcessedOperation struct {
	base.Operation
	// contains filtered or unexported fields
}

func NewReasonProcessedOperation

func NewReasonProcessedOperation(
	op, facthash util.Hash, reason base.OperationProcessReasonError,
) ReasonProcessedOperation

func (ReasonProcessedOperation) FactHash

func (op ReasonProcessedOperation) FactHash() util.Hash

func (ReasonProcessedOperation) OperationHash

func (op ReasonProcessedOperation) OperationHash() util.Hash

func (ReasonProcessedOperation) Reason

type Suffrage

type Suffrage struct {
	// contains filtered or unexported fields
}

func NewSuffrage

func NewSuffrage(nodes []base.Node) (Suffrage, error)

func (Suffrage) Exists

func (suf Suffrage) Exists(node base.Address) bool

func (Suffrage) ExistsPublickey

func (suf Suffrage) ExistsPublickey(node base.Address, pub base.Publickey) bool

func (Suffrage) Len

func (suf Suffrage) Len() int

func (Suffrage) MarshalJSON

func (suf Suffrage) MarshalJSON() ([]byte, error)

func (Suffrage) Nodes

func (suf Suffrage) Nodes() []base.Node

type SuffrageCandidateJSONMarshaler

type SuffrageCandidateJSONMarshaler struct {
	Node base.Node `json:"node"`
	hint.BaseHinter
	Start    base.Height `json:"start"`
	Deadline base.Height `json:"deadline"`
}

type SuffrageCandidateJSONUnmarshaler

type SuffrageCandidateJSONUnmarshaler struct {
	Node     json.RawMessage    `json:"node"`
	Start    base.HeightDecoder `json:"start"`
	Deadline base.HeightDecoder `json:"deadline"`
}

type SuffrageCandidateStateValue

type SuffrageCandidateStateValue struct {
	base.Node
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewSuffrageCandidateStateValue

func NewSuffrageCandidateStateValue(node base.Node, start, deadline base.Height) SuffrageCandidateStateValue

func (SuffrageCandidateStateValue) Deadline

func (suf SuffrageCandidateStateValue) Deadline() base.Height

func (*SuffrageCandidateStateValue) DecodeJSON

func (suf *SuffrageCandidateStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (SuffrageCandidateStateValue) HashBytes

func (suf SuffrageCandidateStateValue) HashBytes() []byte

func (SuffrageCandidateStateValue) IsValid

func (suf SuffrageCandidateStateValue) IsValid([]byte) error

func (SuffrageCandidateStateValue) MarshalJSON

func (suf SuffrageCandidateStateValue) MarshalJSON() ([]byte, error)

func (SuffrageCandidateStateValue) Start

type SuffrageCandidatesStateValue

type SuffrageCandidatesStateValue struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func (*SuffrageCandidatesStateValue) DecodeJSON

func (s *SuffrageCandidatesStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (SuffrageCandidatesStateValue) HashBytes

func (s SuffrageCandidatesStateValue) HashBytes() []byte

func (SuffrageCandidatesStateValue) IsValid

func (SuffrageCandidatesStateValue) MarshalJSON

func (s SuffrageCandidatesStateValue) MarshalJSON() ([]byte, error)

func (SuffrageCandidatesStateValue) Nodes

type SuffrageConfirmBallotFact

type SuffrageConfirmBallotFact struct {
	INITBallotFact
}

func NewSuffrageConfirmBallotFact

func NewSuffrageConfirmBallotFact(
	point base.Point,
	previousBlock, proposal util.Hash,
	withdrawfacts []util.Hash,
) SuffrageConfirmBallotFact

func (SuffrageConfirmBallotFact) IsValid

func (fact SuffrageConfirmBallotFact) IsValid([]byte) error

func (SuffrageConfirmBallotFact) Point

func (fact SuffrageConfirmBallotFact) Point() base.StagePoint

func (SuffrageConfirmBallotFact) Stage

func (fact SuffrageConfirmBallotFact) Stage() base.Stage

func (SuffrageConfirmBallotFact) WithdrawFacts

func (fact SuffrageConfirmBallotFact) WithdrawFacts() []util.Hash

type SuffrageNodeStateValue

type SuffrageNodeStateValue struct {
	base.Node
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewSuffrageNodeStateValue

func NewSuffrageNodeStateValue(node base.Node, start base.Height) SuffrageNodeStateValue

func (*SuffrageNodeStateValue) DecodeJSON

func (s *SuffrageNodeStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (SuffrageNodeStateValue) HashBytes

func (s SuffrageNodeStateValue) HashBytes() []byte

func (SuffrageNodeStateValue) Hint

func (s SuffrageNodeStateValue) Hint() hint.Hint

func (SuffrageNodeStateValue) IsValid

func (s SuffrageNodeStateValue) IsValid([]byte) error

func (SuffrageNodeStateValue) MarshalJSON

func (s SuffrageNodeStateValue) MarshalJSON() ([]byte, error)

func (SuffrageNodeStateValue) Start

type SuffrageNodesStateValue

type SuffrageNodesStateValue struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewSuffrageNodesStateValue

func NewSuffrageNodesStateValue(
	suffrageheight base.Height, nodes []base.SuffrageNodeStateValue,
) SuffrageNodesStateValue

func (*SuffrageNodesStateValue) DecodeJSON

func (s *SuffrageNodesStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (SuffrageNodesStateValue) HashBytes

func (s SuffrageNodesStateValue) HashBytes() []byte

func (SuffrageNodesStateValue) Height

func (s SuffrageNodesStateValue) Height() base.Height

func (SuffrageNodesStateValue) IsValid

func (s SuffrageNodesStateValue) IsValid([]byte) error

func (SuffrageNodesStateValue) MarshalJSON

func (s SuffrageNodesStateValue) MarshalJSON() ([]byte, error)

func (SuffrageNodesStateValue) Nodes

func (SuffrageNodesStateValue) Suffrage

func (s SuffrageNodesStateValue) Suffrage() (base.Suffrage, error)

type SuffrageStateBuilder

type SuffrageStateBuilder struct {
	// contains filtered or unexported fields
}

SuffrageStateBuilder tries to sync suffrage states from remote nodes. It will rebuild the entire suffrage states history. SuffrageProof from getSuffrageProof should be valid(IsValid()).

func NewSuffrageStateBuilder

func NewSuffrageStateBuilder(
	networkID base.NetworkID,
	lastSuffrageProof GetLastSuffrageProofFromRemoteFunc,
	getSuffrageProof GetSuffrageProofFromRemoteFunc,
	lastSuffrageCandidateState GetLastSuffrageCandidateStateRemoteFunc,
) *SuffrageStateBuilder

func (*SuffrageStateBuilder) Build

func (s *SuffrageStateBuilder) Build(
	ctx context.Context, localstate base.State,
) (lastheight base.Height, proofs []base.SuffrageProof, candidates base.State, _ error)

Build builds latest suffrage states from localstate.

type SuffrageVoteFunc

type SuffrageVoteFunc func(base.SuffrageWithdrawOperation) (bool, error)

type SuffrageVoting

type SuffrageVoting struct {
	// contains filtered or unexported fields
}

func NewSuffrageVoting

func NewSuffrageVoting(
	local base.Address,
	db SuffrageWithdrawPool,
	existsInState func(util.Hash) (bool, error),
	votedCallback func(base.SuffrageWithdrawOperation) error,
) *SuffrageVoting

func (*SuffrageVoting) Find

func (*SuffrageVoting) Vote

type SuffrageWithdrawFact

type SuffrageWithdrawFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewSuffrageWithdrawFact

func NewSuffrageWithdrawFact(
	node base.Address,
	start base.Height,
	end base.Height,
	reason string,
) SuffrageWithdrawFact

func (*SuffrageWithdrawFact) DecodeJSON

func (fact *SuffrageWithdrawFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (SuffrageWithdrawFact) IsValid

func (fact SuffrageWithdrawFact) IsValid([]byte) error

func (SuffrageWithdrawFact) MarshalJSON

func (fact SuffrageWithdrawFact) MarshalJSON() ([]byte, error)

func (SuffrageWithdrawFact) Node

func (fact SuffrageWithdrawFact) Node() base.Address

func (SuffrageWithdrawFact) Reason

func (fact SuffrageWithdrawFact) Reason() string

func (SuffrageWithdrawFact) WithdrawEnd

func (fact SuffrageWithdrawFact) WithdrawEnd() base.Height

func (SuffrageWithdrawFact) WithdrawStart

func (fact SuffrageWithdrawFact) WithdrawStart() base.Height

type SuffrageWithdrawOperation

type SuffrageWithdrawOperation struct {
	base.BaseNodeOperation
}

func NewSuffrageWithdrawOperation

func NewSuffrageWithdrawOperation(fact SuffrageWithdrawFact) SuffrageWithdrawOperation

func (SuffrageWithdrawOperation) IsValid

func (op SuffrageWithdrawOperation) IsValid(networkID []byte) error

func (SuffrageWithdrawOperation) NodeSigns

func (op SuffrageWithdrawOperation) NodeSigns() []base.NodeSign

func (*SuffrageWithdrawOperation) SetToken

func (op *SuffrageWithdrawOperation) SetToken(base.Token) error

func (SuffrageWithdrawOperation) WithdrawFact

type SuffrageWithdrawPool

type SuffrageWithdrawPool interface {
	SuffrageWithdrawOperation(base.Height, base.Address) (base.SuffrageWithdrawOperation, bool, error)
	SetSuffrageWithdrawOperation(base.SuffrageWithdrawOperation) error
	TraverseSuffrageWithdrawOperations(
		context.Context,
		base.Height,
		SuffrageVoteFunc,
	) error
	RemoveSuffrageWithdrawOperationsByFact([]base.SuffrageWithdrawFact) error
	RemoveSuffrageWithdrawOperationsByHeight(base.Height) error
}

type SyncSourcePool

type SyncSourcePool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSyncSourcePool

func NewSyncSourcePool(fixed []NodeConnInfo) *SyncSourcePool

func (*SyncSourcePool) Actives

func (p *SyncSourcePool) Actives(f func(NodeConnInfo) bool)

func (*SyncSourcePool) AddNonFixed

func (p *SyncSourcePool) AddNonFixed(ncis ...NodeConnInfo) bool

func (*SyncSourcePool) IsInFixed

func (p *SyncSourcePool) IsInFixed(node base.Address) bool

func (*SyncSourcePool) IsInNonFixed

func (p *SyncSourcePool) IsInNonFixed(node base.Address) bool

func (*SyncSourcePool) Len

func (p *SyncSourcePool) Len() int

func (*SyncSourcePool) NodeConnInfo

func (p *SyncSourcePool) NodeConnInfo(node base.Address) []NodeConnInfo

func (*SyncSourcePool) NodeExists

func (p *SyncSourcePool) NodeExists(node base.Address) bool

func (*SyncSourcePool) Pick

func (p *SyncSourcePool) Pick() (NodeConnInfo, func(error), error)

func (*SyncSourcePool) PickMultiple

func (p *SyncSourcePool) PickMultiple(n int) ([]NodeConnInfo, []func(error), error)

func (*SyncSourcePool) RemoveNonFixed

func (p *SyncSourcePool) RemoveNonFixed(nci NodeConnInfo) bool

func (*SyncSourcePool) RemoveNonFixedNode

func (p *SyncSourcePool) RemoveNonFixedNode(nodes ...base.Address) bool

func (*SyncSourcePool) Retry

func (p *SyncSourcePool) Retry(
	ctx context.Context,
	f func(NodeConnInfo) (bool, error),
	limit int,
	interval time.Duration,
) error

func (*SyncSourcePool) Traverse

func (p *SyncSourcePool) Traverse(f func(NodeConnInfo) bool)

func (*SyncSourcePool) UpdateFixed

func (p *SyncSourcePool) UpdateFixed(fixed []NodeConnInfo) bool

type Syncer

type Syncer interface {
	util.Daemon
	Add(base.Height) bool
	Finished() <-chan base.Height
	Done() <-chan struct{} // revive:disable-line:nested-structs
	Err() error
	IsFinished() (base.Height, bool)
	Cancel() error
}

type TempDatabase

type TempDatabase interface {
	BaseDatabase
	Height() base.Height
	Close() error
	Remove() error
	Merge() error
	LastBlockMap() (base.BlockMap, bool, error)
	BlockMapBytes() (hint.Hint, []byte, []byte, error)
	SuffrageHeight() base.Height
	SuffrageProof() (base.SuffrageProof, bool, error)
	LastSuffrageProofBytes() (hint.Hint, []byte, []byte, bool, error)
	NetworkPolicy() base.NetworkPolicy
}

TempDatabase is the temporary database; it contains only blockmap and others of one block for storing BlockMapItem fast.

type TempSyncPool

type TempSyncPool interface {
	BlockMap(base.Height) (base.BlockMap, bool, error)
	SetBlockMap(base.BlockMap) error
	Cancel() error
	Close() error
}

type WithdrawBallotFact

type WithdrawBallotFact interface {
	WithdrawFacts() []util.Hash
}

Directories

Path Synopsis
Package isaacblock handles data of block.
Package isaacblock handles data of block.
Package isaacdatabase handles data for isaac
Package isaacdatabase handles data for isaac
Package isaacnetwork provides network.
Package isaacnetwork provides network.
Package isaacoperation provides the base operations.
Package isaacoperation provides the base operations.
Package isaacstates handles node states
Package isaacstates handles node states

Jump to

Keyboard shortcuts

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