Documentation ¶
Overview ¶
Package base has the fundamental modules and libraries to support consensus.
Index ¶
- Constants
- Variables
- func CompareVoteproof(a, b Voteproof) int
- func CompareVoteproofSamePoint(a, b Voteproof) int
- func FindMajority(total, threshold uint, set ...uint) int
- func IsValidBallotFactSign(fact BallotFact, fs BallotFactSign, b []byte) error
- func IsValidFactSign(fact Fact, fs FactSign, b []byte) error
- func MarshalZerologFactSign(fs FactSign) *zerolog.Event
- func NewBytesForFactSignature(fact Fact, b []byte) []byte
- func NewFactSignature(signer key.Privatekey, fact Fact, b []byte) (key.Signature, error)
- func NumberOfFaultyNodes(n uint, threshold float64) int
- func SortAddresses(as []Address)
- type ACCEPTBallot
- type ACCEPTBallotFact
- type ActingSuffrage
- func (as ActingSuffrage) Exists(node Address) bool
- func (as ActingSuffrage) Height() Height
- func (as ActingSuffrage) MarshalBSON() ([]byte, error)
- func (as ActingSuffrage) MarshalJSON() ([]byte, error)
- func (as ActingSuffrage) MarshalZerologObject(e *zerolog.Event)
- func (as ActingSuffrage) Nodes() []Address
- func (as ActingSuffrage) Proposer() Address
- func (as ActingSuffrage) Round() Round
- type ActingSuffragePacker
- type Address
- type AddressDecoder
- type Ballot
- type BallotFact
- type BallotFactSign
- type BaseBallotFactSign
- func (fs BaseBallotFactSign) Bytes() []byte
- func (fs BaseBallotFactSign) IsValid([]byte) error
- func (fs BaseBallotFactSign) MarshalBSON() ([]byte, error)
- func (fs BaseBallotFactSign) MarshalJSON() ([]byte, error)
- func (fs BaseBallotFactSign) MarshalZerologObject(e *zerolog.Event)
- func (fs BaseBallotFactSign) Node() Address
- func (fs *BaseBallotFactSign) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (fs *BaseBallotFactSign) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type BaseBallotFactSignJSONPacker
- type BaseBallotFactSignNodeBSONUnpacker
- type BaseBallotFactSignNodeJSONPacker
- type BaseBallotFactSignNodeJSONUnpacker
- type BaseFactSign
- func (fs BaseFactSign) Bytes() []byte
- func (fs BaseFactSign) IsValid([]byte) error
- func (fs BaseFactSign) MarshalBSON() ([]byte, error)
- func (fs BaseFactSign) MarshalJSON() ([]byte, error)
- func (fs BaseFactSign) SetSignedAt(t time.Time) BaseFactSign
- func (fs BaseFactSign) Signature() key.Signature
- func (fs BaseFactSign) SignedAt() time.Time
- func (fs BaseFactSign) Signer() key.Publickey
- func (fs *BaseFactSign) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (fs *BaseFactSign) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type BaseFactSignBSONUnpacker
- type BaseFactSignJSONPacker
- type BaseFactSignJSONUnpacker
- type BaseSignedBallotFact
- func (sfs BaseSignedBallotFact) Bytes() []byte
- func (sfs BaseSignedBallotFact) Fact() BallotFact
- func (sfs BaseSignedBallotFact) FactSign() BallotFactSign
- func (sfs BaseSignedBallotFact) IsValid(networkID []byte) error
- func (sfs BaseSignedBallotFact) MarshalBSON() ([]byte, error)
- func (sfs BaseSignedBallotFact) MarshalJSON() ([]byte, error)
- func (sfs *BaseSignedBallotFact) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (sfs *BaseSignedBallotFact) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- type BaseSignedBallotFactPackerJSON
- type BaseSignedBallotFactUnpackBSON
- type BaseSignedBallotFactUnpackJSON
- type Fact
- type FactSign
- type FactSignUpdater
- type FixedSuffrage
- func (ff *FixedSuffrage) Acting(height Height, round Round) (ActingSuffrage, error)
- func (ff *FixedSuffrage) Initialize() error
- func (ff *FixedSuffrage) IsActing(_ Height, _ Round, node Address) (bool, error)
- func (ff *FixedSuffrage) IsInside(a Address) bool
- func (ff *FixedSuffrage) IsProposer(_ Height, _ Round, node Address) (bool, error)
- func (*FixedSuffrage) Name() string
- func (ff *FixedSuffrage) Nodes() []Address
- func (*FixedSuffrage) NumberOfActing() uint
- func (ff *FixedSuffrage) Verbose() string
- type Height
- type INITBallot
- type INITBallotFact
- type NetworkID
- type Node
- type Proposal
- type ProposalFact
- type Round
- type SignWithFacter
- type SignedBallotFact
- type Stage
- type State
- type StringAddress
- func (ad StringAddress) Bytes() []byte
- func (ad StringAddress) Equal(b Address) bool
- func (ad StringAddress) Hint() hint.Hint
- func (ad StringAddress) IsValid([]byte) error
- func (ad StringAddress) MarshalBSONValue() (bsontype.Type, []byte, error)
- func (ad StringAddress) MarshalText() ([]byte, error)
- func (ad StringAddress) SetHint(ht hint.Hint) hint.Hinter
- func (ad StringAddress) String() string
- func (ad *StringAddress) UnpackBSON(b []byte, _ *bsonenc.Encoder) error
- func (ad *StringAddress) UnpackJSON(b []byte, _ *jsonenc.Encoder) error
- type Suffrage
- type Threshold
- type ThresholdRatio
- type VoteResultType
- type Voteproof
- type VoteproofSet
- type VoteproofV0
- func (vp VoteproofV0) Bytes() []byte
- func (vp *VoteproofV0) Close() *VoteproofV0
- func (vp VoteproofV0) Facts() []BallotFact
- func (vp *VoteproofV0) Finish() *VoteproofV0
- func (vp VoteproofV0) FinishedAt() time.Time
- func (vp VoteproofV0) Height() Height
- func (vp VoteproofV0) ID() string
- func (vp VoteproofV0) IsClosed() bool
- func (vp VoteproofV0) IsFinished() bool
- func (vp VoteproofV0) IsValid(networkID []byte) error
- func (vp VoteproofV0) Majority() BallotFact
- func (vp VoteproofV0) MarshalBSON() ([]byte, error)
- func (vp VoteproofV0) MarshalJSON() ([]byte, error)
- func (vp VoteproofV0) MarshalZerologObject(e *zerolog.Event)
- func (vp VoteproofV0) Result() VoteResultType
- func (vp VoteproofV0) Round() Round
- func (vp *VoteproofV0) SetFacts(facts []BallotFact) *VoteproofV0
- func (vp *VoteproofV0) SetMajority(fact BallotFact) *VoteproofV0
- func (vp *VoteproofV0) SetResult(result VoteResultType) *VoteproofV0
- func (vp *VoteproofV0) SetVotes(votes []SignedBallotFact) *VoteproofV0
- func (vp VoteproofV0) Stage() Stage
- func (vp VoteproofV0) Suffrages() []Address
- func (vp VoteproofV0) ThresholdRatio() ThresholdRatio
- func (vp *VoteproofV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
- func (vp *VoteproofV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp VoteproofV0) Votes() []SignedBallotFact
- type VoteproofV0BallotBSONPacker
- type VoteproofV0BallotBSONUnpacker
- type VoteproofV0BallotJSONPacker
- type VoteproofV0BallotJSONUnpacker
- type VoteproofV0BallotUnpacker
- type VoteproofV0FactBSONPacker
- type VoteproofV0FactBSONUnpacker
- type VoteproofV0FactJSONPacker
- type VoteproofV0FactJSONUnpacker
- type VoteproofV0FactUnpacker
- type VoteproofV0PackJSON
- type VoteproofV0UnpackBSON
- type VoteproofV0UnpackJSON
Constants ¶
View Source
const AddressTypeSize = 3
View Source
const MaxNetworkIDLength = 300
Variables ¶
View Source
var ( INITBallotType = hint.Type("init-ballot") ProposalType = hint.Type("proposal") ACCEPTBallotType = hint.Type("accept-ballot") INITBallotFactType = hint.Type("init-ballot-fact") ProposalFactType = hint.Type("proposal-fact") ACCEPTBallotFactType = hint.Type("accept-ballot-fact") )
View Source
var ( BallotFactSignType = hint.Type("ballot-fact-sign") BallotFactSignHint = hint.NewHint(BallotFactSignType, "v0.0.1") BallotFactSignHinter = BaseBallotFactSign{BaseFactSign: BaseFactSign{ BaseHinter: hint.NewBaseHinter(BallotFactSignHint), }} SignedBallotFactType = hint.Type("signed-ballot-fact") SignedBallotFactHint = hint.NewHint(SignedBallotFactType, "v0.0.1") SignedBallotFactHinter = BaseSignedBallotFact{BaseHinter: hint.NewBaseHinter(SignedBallotFactHint)} )
View Source
var ( BaseFactSignType = hint.Type("base-fact-sign") BaseFactSignHint = hint.NewHint(BaseFactSignType, "v0.0.1") BaseFactSignHinter = BaseFactSign{BaseHinter: hint.NewBaseHinter(BaseFactSignHint)} )
View Source
var ( NilHeight = Height(-2) PreGenesisHeight = Height(-1) GenesisHeight = Height(0) )
View Source
var ( StringAddressType = hint.Type("sas") StringAddressHint = hint.NewHint(StringAddressType, "v0.0.1") StringAddressHinter = StringAddress{/* contains filtered or unexported fields */} )
View Source
var ( MaxAddressSize = 100 MinAddressSize = AddressTypeSize + 3 REStringAddressString = `[a-zA-Z0-9][\w\-\.\!\$\*\@]*[a-zA-Z0-9]` )
View Source
var ( VoteproofV0Type = hint.Type("voteproof") VoteproofV0Hint = hint.NewHint(VoteproofV0Type, "v0.0.1") VoteproofV0Hinter = VoteproofV0{BaseHinter: hint.NewBaseHinter(VoteproofV0Hint)} )
Functions ¶
func CompareVoteproof ¶
func FindMajority ¶
FindMajority finds the majority(over threshold) set between the given sets. The returned value means, 0-N: index number of set -1: not yet majority -2: draw
func IsValidBallotFactSign ¶
func IsValidBallotFactSign(fact BallotFact, fs BallotFactSign, b []byte) error
func MarshalZerologFactSign ¶
func NewFactSignature ¶
func NumberOfFaultyNodes ¶
func SortAddresses ¶
func SortAddresses(as []Address)
Types ¶
type ACCEPTBallot ¶
type ACCEPTBallot interface { Ballot Fact() ACCEPTBallotFact }
type ACCEPTBallotFact ¶
type ACCEPTBallotFact interface { BallotFact Proposal() valuehash.Hash // NOTE fact hash of proposal ballot NewBlock() valuehash.Hash }
type ActingSuffrage ¶
type ActingSuffrage struct {
// contains filtered or unexported fields
}
func NewActingSuffrage ¶
func NewActingSuffrage(height Height, round Round, proposer Address, selected []Address) ActingSuffrage
func (ActingSuffrage) Exists ¶
func (as ActingSuffrage) Exists(node Address) bool
func (ActingSuffrage) Height ¶
func (as ActingSuffrage) Height() Height
func (ActingSuffrage) MarshalBSON ¶
func (as ActingSuffrage) MarshalBSON() ([]byte, error)
func (ActingSuffrage) MarshalJSON ¶
func (as ActingSuffrage) MarshalJSON() ([]byte, error)
func (ActingSuffrage) MarshalZerologObject ¶
func (as ActingSuffrage) MarshalZerologObject(e *zerolog.Event)
func (ActingSuffrage) Nodes ¶
func (as ActingSuffrage) Nodes() []Address
func (ActingSuffrage) Proposer ¶
func (as ActingSuffrage) Proposer() Address
func (ActingSuffrage) Round ¶
func (as ActingSuffrage) Round() Round
type ActingSuffragePacker ¶
type Address ¶
type Address interface { fmt.Stringer // NOTE String() should be typed string isvalid.IsValider hint.Hinter util.Byter Equal(Address) bool }
Address represents the address of account.
type AddressDecoder ¶
type AddressDecoder struct {
// contains filtered or unexported fields
}
func (*AddressDecoder) Encode ¶
func (ad *AddressDecoder) Encode(enc encoder.Encoder) (Address, error)
func (*AddressDecoder) UnmarshalBSON ¶
func (ad *AddressDecoder) UnmarshalBSON(b []byte) error
func (*AddressDecoder) UnmarshalJSON ¶
func (ad *AddressDecoder) UnmarshalJSON(b []byte) error
type Ballot ¶
type Ballot interface { zerolog.LogObjectMarshaler seal.Seal RawFact() BallotFact FactSign() BallotFactSign SignedFact() SignedBallotFact BaseVoteproof() Voteproof ACCEPTVoteproof() Voteproof }
type BallotFactSign ¶
type BaseBallotFactSign ¶
type BaseBallotFactSign struct { BaseFactSign // contains filtered or unexported fields }
func NewBaseBallotFactSign ¶
func NewBaseBallotFactSignFromFact ¶
func NewBaseBallotFactSignFromFact( fact BallotFact, n Address, priv key.Privatekey, networkID NetworkID, ) (BaseBallotFactSign, error)
func (BaseBallotFactSign) Bytes ¶
func (fs BaseBallotFactSign) Bytes() []byte
func (BaseBallotFactSign) IsValid ¶
func (fs BaseBallotFactSign) IsValid([]byte) error
func (BaseBallotFactSign) MarshalBSON ¶
func (fs BaseBallotFactSign) MarshalBSON() ([]byte, error)
func (BaseBallotFactSign) MarshalJSON ¶
func (fs BaseBallotFactSign) MarshalJSON() ([]byte, error)
func (BaseBallotFactSign) MarshalZerologObject ¶
func (fs BaseBallotFactSign) MarshalZerologObject(e *zerolog.Event)
func (BaseBallotFactSign) Node ¶
func (fs BaseBallotFactSign) Node() Address
func (*BaseBallotFactSign) UnpackBSON ¶
func (fs *BaseBallotFactSign) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*BaseBallotFactSign) UnpackJSON ¶
func (fs *BaseBallotFactSign) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type BaseBallotFactSignJSONPacker ¶
type BaseBallotFactSignJSONPacker struct { jsonenc.HintedHead *BaseFactSignJSONPacker *BaseBallotFactSignNodeJSONPacker }
type BaseBallotFactSignNodeBSONUnpacker ¶
type BaseBallotFactSignNodeBSONUnpacker struct { B bson.Raw `bson:"base"` NO AddressDecoder `bson:"node"` }
type BaseBallotFactSignNodeJSONPacker ¶
type BaseBallotFactSignNodeJSONPacker struct {
NO Address `json:"node"`
}
type BaseBallotFactSignNodeJSONUnpacker ¶
type BaseBallotFactSignNodeJSONUnpacker struct {
NO AddressDecoder `json:"node"`
}
type BaseFactSign ¶
type BaseFactSign struct { hint.BaseHinter // contains filtered or unexported fields }
func NewBaseFactSign ¶
func NewBaseFactSign(signer key.Publickey, signature key.Signature) BaseFactSign
func NewBaseFactSignWithHint ¶
func RawBaseFactSign ¶
func (BaseFactSign) Bytes ¶
func (fs BaseFactSign) Bytes() []byte
func (BaseFactSign) IsValid ¶
func (fs BaseFactSign) IsValid([]byte) error
func (BaseFactSign) MarshalBSON ¶
func (fs BaseFactSign) MarshalBSON() ([]byte, error)
func (BaseFactSign) MarshalJSON ¶
func (fs BaseFactSign) MarshalJSON() ([]byte, error)
func (BaseFactSign) SetSignedAt ¶
func (fs BaseFactSign) SetSignedAt(t time.Time) BaseFactSign
func (BaseFactSign) Signature ¶
func (fs BaseFactSign) Signature() key.Signature
func (BaseFactSign) SignedAt ¶
func (fs BaseFactSign) SignedAt() time.Time
func (BaseFactSign) Signer ¶
func (fs BaseFactSign) Signer() key.Publickey
func (*BaseFactSign) UnpackBSON ¶
func (fs *BaseFactSign) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*BaseFactSign) UnpackJSON ¶
func (fs *BaseFactSign) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type BaseFactSignJSONPacker ¶
type BaseSignedBallotFact ¶
type BaseSignedBallotFact struct { hint.BaseHinter // contains filtered or unexported fields }
func NewBaseSignedBallotFact ¶
func NewBaseSignedBallotFact(fact BallotFact, factSign BallotFactSign) BaseSignedBallotFact
func NewBaseSignedBallotFactFromFact ¶
func NewBaseSignedBallotFactFromFact( fact BallotFact, n Address, priv key.Privatekey, networkID NetworkID, ) (BaseSignedBallotFact, error)
func (BaseSignedBallotFact) Bytes ¶
func (sfs BaseSignedBallotFact) Bytes() []byte
func (BaseSignedBallotFact) Fact ¶
func (sfs BaseSignedBallotFact) Fact() BallotFact
func (BaseSignedBallotFact) FactSign ¶
func (sfs BaseSignedBallotFact) FactSign() BallotFactSign
func (BaseSignedBallotFact) IsValid ¶
func (sfs BaseSignedBallotFact) IsValid(networkID []byte) error
func (BaseSignedBallotFact) MarshalBSON ¶
func (sfs BaseSignedBallotFact) MarshalBSON() ([]byte, error)
func (BaseSignedBallotFact) MarshalJSON ¶
func (sfs BaseSignedBallotFact) MarshalJSON() ([]byte, error)
func (*BaseSignedBallotFact) UnpackBSON ¶
func (sfs *BaseSignedBallotFact) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*BaseSignedBallotFact) UnpackJSON ¶
func (sfs *BaseSignedBallotFact) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
type BaseSignedBallotFactPackerJSON ¶
type BaseSignedBallotFactPackerJSON struct { jsonenc.HintedHead FC BallotFact `json:"fact"` FS FactSign `json:"fact_sign"` }
type BaseSignedBallotFactUnpackJSON ¶
type BaseSignedBallotFactUnpackJSON struct { FC json.RawMessage `json:"fact"` FS json.RawMessage `json:"fact_sign"` }
type FactSignUpdater ¶
type FactSignUpdater interface {
AddFactSigns(...FactSign) (FactSignUpdater, error)
}
type FixedSuffrage ¶
FixedSuffrage will be used for creating genesis block or testing.
func NewFixedSuffrage ¶
func NewFixedSuffrage(proposer Address, nodes []Address) *FixedSuffrage
func (*FixedSuffrage) Acting ¶
func (ff *FixedSuffrage) Acting(height Height, round Round) (ActingSuffrage, error)
func (*FixedSuffrage) Initialize ¶
func (ff *FixedSuffrage) Initialize() error
func (*FixedSuffrage) IsInside ¶
func (ff *FixedSuffrage) IsInside(a Address) bool
func (*FixedSuffrage) IsProposer ¶
func (*FixedSuffrage) Name ¶
func (*FixedSuffrage) Name() string
func (*FixedSuffrage) Nodes ¶
func (ff *FixedSuffrage) Nodes() []Address
func (*FixedSuffrage) NumberOfActing ¶
func (*FixedSuffrage) NumberOfActing() uint
func (*FixedSuffrage) Verbose ¶
func (ff *FixedSuffrage) Verbose() string
type Height ¶
type Height int64
Height stands for height of Block
func NewHeightFromBytes ¶
func NewHeightFromString ¶
type INITBallot ¶
type INITBallot interface { Ballot Fact() INITBallotFact }
type INITBallotFact ¶
type INITBallotFact interface { BallotFact PreviousBlock() valuehash.Hash }
type NetworkID ¶
type NetworkID []byte
NetworkID will be used to separate mitum network with the other network. For exampke, with different NetworkID, same Seal messsage will have different hash.
func (NetworkID) MarshalText ¶
func (*NetworkID) UnmarshalText ¶
type Proposal ¶
type Proposal interface { Ballot Fact() ProposalFact }
type ProposalFact ¶
type SignWithFacter ¶
type SignWithFacter interface { Sign(key.Privatekey, []byte) error SignWithFact(Address, key.Privatekey, []byte) error }
type SignedBallotFact ¶
type SignedBallotFact interface { hint.Hinter isvalid.IsValider util.Byter Fact() BallotFact FactSign() BallotFactSign }
type Stage ¶
type Stage uint8
const ( StageINIT Stage StageProposal StageACCEPT )
func (Stage) MarshalText ¶
func (*Stage) UnmarshalText ¶
type State ¶
type State uint8
const ( StateEmpty State = iota // StateStopped indicates node is in state, node process is // finished. StateStopped // StateBooting indicates node is in state, node checks it's state. StateBooting // StateJoining indicates node is in state, node is trying to // join consensus. StateJoining // StateConsensus indicates node is in state, node participates // consensus with the other nodes. StateConsensus // StateSyncing indicates node is in state, node is syncing block. StateSyncing // StateBroken indicates that node can not participates network // with various kind of reason. StateBroken // StateHandover indicates that node tries to replace the existing same node StateHandover )
func StateFromString ¶
func (State) MarshalText ¶
func (*State) UnmarshalText ¶
type StringAddress ¶
type StringAddress struct {
// contains filtered or unexported fields
}
func MustNewStringAddress ¶
func MustNewStringAddress(s string) StringAddress
func NewStringAddress ¶
func NewStringAddress(s string) StringAddress
func NewStringAddressWithHint ¶
func NewStringAddressWithHint(ht hint.Hint, s string) StringAddress
func ParseStringAddress ¶
func ParseStringAddress(s string) (StringAddress, error)
func (StringAddress) Bytes ¶
func (ad StringAddress) Bytes() []byte
func (StringAddress) Equal ¶
func (ad StringAddress) Equal(b Address) bool
func (StringAddress) Hint ¶
func (ad StringAddress) Hint() hint.Hint
func (StringAddress) IsValid ¶
func (ad StringAddress) IsValid([]byte) error
func (StringAddress) MarshalBSONValue ¶
func (ad StringAddress) MarshalBSONValue() (bsontype.Type, []byte, error)
func (StringAddress) MarshalText ¶
func (ad StringAddress) MarshalText() ([]byte, error)
func (StringAddress) String ¶
func (ad StringAddress) String() string
func (*StringAddress) UnpackBSON ¶
func (ad *StringAddress) UnpackBSON(b []byte, _ *bsonenc.Encoder) error
func (*StringAddress) UnpackJSON ¶
func (ad *StringAddress) UnpackJSON(b []byte, _ *jsonenc.Encoder) error
type Threshold ¶
type Threshold struct { Total uint `json:"total" bson:"total"` Threshold uint `json:"threshold" bson:"threshold"` Ratio ThresholdRatio `json:"ratio" bson:"ratio"` // NOTE 67.0 ~ 100.0 }
func MustNewThreshold ¶
func MustNewThreshold(total uint, ratio ThresholdRatio) Threshold
func NewThreshold ¶
func NewThreshold(total uint, ratio ThresholdRatio) (Threshold, error)
type ThresholdRatio ¶
type ThresholdRatio float64
func (ThresholdRatio) Float64 ¶
func (tr ThresholdRatio) Float64() float64
func (ThresholdRatio) IsValid ¶
func (tr ThresholdRatio) IsValid([]byte) error
type VoteResultType ¶
type VoteResultType uint8
const ( VoteResultNotYet VoteResultType = iota VoteResultDraw VoteResultMajority )
func FindMajorityFromSlice ¶
func FindMajorityFromSlice(total, threshold uint, s []string) (VoteResultType, string)
func (VoteResultType) Bytes ¶
func (vrt VoteResultType) Bytes() []byte
func (VoteResultType) IsValid ¶
func (vrt VoteResultType) IsValid([]byte) error
func (VoteResultType) MarshalText ¶
func (vrt VoteResultType) MarshalText() ([]byte, error)
func (VoteResultType) String ¶
func (vrt VoteResultType) String() string
func (*VoteResultType) UnmarshalText ¶
func (vrt *VoteResultType) UnmarshalText(b []byte) error
type Voteproof ¶
type Voteproof interface { hint.Hinter isvalid.IsValider util.Byter zerolog.LogObjectMarshaler ID() string // ID is only unique in local machine IsFinished() bool FinishedAt() time.Time IsClosed() bool Height() Height Round() Round Stage() Stage Result() VoteResultType Majority() BallotFact Facts() []BallotFact Votes() []SignedBallotFact ThresholdRatio() ThresholdRatio Suffrages() []Address }
type VoteproofSet ¶
type VoteproofSet struct { Voteproof // contains filtered or unexported fields }
VoteproofSet has voteproofs of Ballot, it will be used to deliver multiple voteproofs at once.
func NewVoteproofSet ¶
func NewVoteproofSet(bvp, avp Voteproof) VoteproofSet
func (VoteproofSet) ACCEPTVoteproof ¶
func (vp VoteproofSet) ACCEPTVoteproof() Voteproof
type VoteproofV0 ¶
type VoteproofV0 struct { hint.BaseHinter // contains filtered or unexported fields }
func EmptyVoteproofV0 ¶
func EmptyVoteproofV0() VoteproofV0
func NewVoteproofV0 ¶
func NewVoteproofV0( height Height, round Round, suffrages []Address, thresholdRatio ThresholdRatio, stage Stage, ) VoteproofV0
func (VoteproofV0) Bytes ¶
func (vp VoteproofV0) Bytes() []byte
func (*VoteproofV0) Close ¶
func (vp *VoteproofV0) Close() *VoteproofV0
func (VoteproofV0) Facts ¶
func (vp VoteproofV0) Facts() []BallotFact
func (*VoteproofV0) Finish ¶
func (vp *VoteproofV0) Finish() *VoteproofV0
func (VoteproofV0) FinishedAt ¶
func (vp VoteproofV0) FinishedAt() time.Time
func (VoteproofV0) Height ¶
func (vp VoteproofV0) Height() Height
func (VoteproofV0) ID ¶
func (vp VoteproofV0) ID() string
func (VoteproofV0) IsClosed ¶
func (vp VoteproofV0) IsClosed() bool
func (VoteproofV0) IsFinished ¶
func (vp VoteproofV0) IsFinished() bool
func (VoteproofV0) IsValid ¶
func (vp VoteproofV0) IsValid(networkID []byte) error
func (VoteproofV0) Majority ¶
func (vp VoteproofV0) Majority() BallotFact
func (VoteproofV0) MarshalBSON ¶
func (vp VoteproofV0) MarshalBSON() ([]byte, error)
func (VoteproofV0) MarshalJSON ¶
func (vp VoteproofV0) MarshalJSON() ([]byte, error)
func (VoteproofV0) MarshalZerologObject ¶
func (vp VoteproofV0) MarshalZerologObject(e *zerolog.Event)
func (VoteproofV0) Result ¶
func (vp VoteproofV0) Result() VoteResultType
func (VoteproofV0) Round ¶
func (vp VoteproofV0) Round() Round
func (*VoteproofV0) SetFacts ¶
func (vp *VoteproofV0) SetFacts(facts []BallotFact) *VoteproofV0
func (*VoteproofV0) SetMajority ¶
func (vp *VoteproofV0) SetMajority(fact BallotFact) *VoteproofV0
func (*VoteproofV0) SetResult ¶
func (vp *VoteproofV0) SetResult(result VoteResultType) *VoteproofV0
func (*VoteproofV0) SetVotes ¶
func (vp *VoteproofV0) SetVotes(votes []SignedBallotFact) *VoteproofV0
func (VoteproofV0) Stage ¶
func (vp VoteproofV0) Stage() Stage
func (VoteproofV0) Suffrages ¶
func (vp VoteproofV0) Suffrages() []Address
func (VoteproofV0) ThresholdRatio ¶
func (vp VoteproofV0) ThresholdRatio() ThresholdRatio
func (*VoteproofV0) UnpackBSON ¶
func (vp *VoteproofV0) UnpackBSON(b []byte, enc *bsonenc.Encoder) error
func (*VoteproofV0) UnpackJSON ¶
func (vp *VoteproofV0) UnpackJSON(b []byte, enc *jsonenc.Encoder) error
func (VoteproofV0) Votes ¶
func (vp VoteproofV0) Votes() []SignedBallotFact
type VoteproofV0BallotBSONUnpacker ¶
func (VoteproofV0BallotBSONUnpacker) Address ¶
func (vv VoteproofV0BallotBSONUnpacker) Address() []byte
func (VoteproofV0BallotBSONUnpacker) Hash ¶
func (vv VoteproofV0BallotBSONUnpacker) Hash() valuehash.Bytes
type VoteproofV0BallotJSONUnpacker ¶
type VoteproofV0BallotJSONUnpacker struct { H valuehash.Bytes A json.RawMessage }
func (VoteproofV0BallotJSONUnpacker) Address ¶
func (vv VoteproofV0BallotJSONUnpacker) Address() []byte
func (VoteproofV0BallotJSONUnpacker) Hash ¶
func (vv VoteproofV0BallotJSONUnpacker) Hash() valuehash.Bytes
type VoteproofV0FactBSONUnpacker ¶
func (VoteproofV0FactBSONUnpacker) Fact ¶
func (vv VoteproofV0FactBSONUnpacker) Fact() []byte
func (VoteproofV0FactBSONUnpacker) Hash ¶
func (vv VoteproofV0FactBSONUnpacker) Hash() valuehash.Bytes
type VoteproofV0FactJSONUnpacker ¶
type VoteproofV0FactJSONUnpacker struct { H valuehash.Bytes F json.RawMessage }
func (VoteproofV0FactJSONUnpacker) Fact ¶
func (vv VoteproofV0FactJSONUnpacker) Fact() []byte
func (VoteproofV0FactJSONUnpacker) Hash ¶
func (vv VoteproofV0FactJSONUnpacker) Hash() valuehash.Bytes
type VoteproofV0FactUnpacker ¶
type VoteproofV0PackJSON ¶
type VoteproofV0PackJSON struct { jsonenc.HintedHead HT Height `json:"height"` RD Round `json:"round"` SS []Address `json:"suffrages"` TH ThresholdRatio `json:"threshold"` RS VoteResultType `json:"result"` ST Stage `json:"stage"` MJ BallotFact `json:"majority"` FS []BallotFact `json:"facts"` VS []SignedBallotFact `json:"votes"` FA localtime.Time `json:"finished_at"` CL string `json:"is_closed"` }
type VoteproofV0UnpackBSON ¶
type VoteproofV0UnpackBSON struct { HT Height `bson:"height"` RD Round `bson:"round"` SS []AddressDecoder `bson:"suffrages"` TH ThresholdRatio `bson:"threshold"` RS VoteResultType `bson:"result"` ST Stage `bson:"stage"` MJ bson.Raw `bson:"majority"` FS bson.Raw `bson:"facts"` VS bson.Raw `bson:"votes"` FA time.Time `bson:"finished_at"` CL bool `bson:"is_closed"` }
type VoteproofV0UnpackJSON ¶
type VoteproofV0UnpackJSON struct { HT Height `json:"height"` RD Round `json:"round"` SS []AddressDecoder `json:"suffrages"` TH ThresholdRatio `json:"threshold"` RS VoteResultType `json:"result"` ST Stage `json:"stage"` MJ json.RawMessage `json:"majority"` FS json.RawMessage `json:"facts"` VS json.RawMessage `json:"votes"` FA localtime.Time `json:"finished_at"` CL string `json:"is_closed"` }
Source Files ¶
- address.go
- address_decoder.go
- address_decoder_bson.go
- address_decoder_json.go
- ballot.go
- ballot_fact_sign.go
- ballot_fact_sign_bson.go
- ballot_fact_sign_encode.go
- ballot_fact_sign_json.go
- ballot_fact_sign_log.go
- doc.go
- fact.go
- fact_sign.go
- fact_sign_bson.go
- fact_sign_encode.go
- fact_sign_json.go
- fact_sign_log.go
- height.go
- network_id.go
- node.go
- round.go
- state.go
- string_address.go
- string_address_bson.go
- string_address_json.go
- suffrage.go
- suffrage_bson.go
- suffrage_fixed.go
- suffrage_json.go
- suffrage_log.go
- threshold.go
- vote.go
- votecount.go
- voteproof.go
- voteproof_set.go
- voteproof_v0.go
- voteproof_v0_bson.go
- voteproof_v0_encode.go
- voteproof_v0_json.go
- voteproof_v0_log.go
- votestage.go
Directories ¶
Path | Synopsis |
---|---|
Package ballot contains ballot seals for consensus
|
Package ballot contains ballot seals for consensus |
Package block defines Block and it's relatives.
|
Package block defines Block and it's relatives. |
Package key provides keypairs.
|
Package key provides keypairs. |
Package node provides several Node types.
|
Package node provides several Node types. |
Package operation is the collection of Operations.
|
Package operation is the collection of Operations. |
Package prprocessor provides the processor of operations
|
Package prprocessor provides the processor of operations |
Package seal is the basic form of message.
|
Package seal is the basic form of message. |
Package state holds data and it's state
|
Package state holds data and it's state |
Click to show internal directories.
Click to hide internal directories.