Documentation ¶
Overview ¶
Package base provides the fundamental structures.
Index ¶
- Constants
- Variables
- func BatchValidateMaps(ctx context.Context, prev BlockMap, to Height, batchlimit uint64, ...) error
- func CheckFactSignsBySuffrage(suf Suffrage, threshold Threshold, signs []NodeSign) error
- func CountBallotSignFacts(sfs []BallotSignFact) (set []string, m map[string]BallotFact)
- func FindMajority(quorum, threshold uint, set ...uint) int
- func IsEqualNode(a, b Node) bool
- func IsEqualNodes(a, b []Node) bool
- func IsEqualState(a, b State) bool
- func IsEqualStateValue(a, b StateValue) bool
- func IsNetworkPolicyState(st State) bool
- func IsSuffrageNodesState(st State) bool
- func IsValidACCEPTBallot(bl ACCEPTBallot, _ []byte) error
- func IsValidACCEPTBallotFact(fact ACCEPTBallotFact) error
- func IsValidACCEPTBallotSignFact(sf BallotSignFact, networkID []byte) error
- func IsValidACCEPTVoteproof(vp ACCEPTVoteproof, _ NetworkID) error
- func IsValidBallot(bl Ballot, networkID []byte) error
- func IsValidBallotFact(fact BallotFact) error
- func IsValidBallotSignFact(sf BallotSignFact, networkID []byte) error
- func IsValidFact(fact Fact, b []byte) error
- func IsValidINITBallot(bl INITBallot, _ []byte) error
- func IsValidINITBallotFact(fact INITBallotFact) error
- func IsValidINITBallotSignFact(sf BallotSignFact, networkID []byte) error
- func IsValidINITVoteproof(vp INITVoteproof, _ NetworkID) error
- func IsValidProposalFact(fact ProposalFact) error
- func IsValidProposalSignFact(sf ProposalSignFact, networkID []byte) error
- func IsValidSignFact(sf SignFact, networkID []byte) error
- func IsValidVoteproof(vp Voteproof, networkID NetworkID) error
- func IsValidVoteproofWithSuffrage(vp Voteproof, suf Suffrage, th Threshold) error
- func ManifestLog(m Manifest) *zerolog.Event
- func NumberOfFaultyNodes(n uint, threshold Threshold) int
- func ParseTreeNodeOperationKey(s string) (util.Hash, bool)
- func ValidateGenesisOperation(op Operation, networkID NetworkID, signer Publickey) error
- func ValidateManifests(m Manifest, previous util.Hash) error
- func ValidateMaps(m BlockMap, maps []BlockMap, previous BlockMap) error
- func ValidateOperationsTreeWithManifest(tr fixedtree.Tree, ops []Operation, manifest Manifest) error
- func ValidateProposalWithManifest(proposal ProposalSignFact, manifest Manifest) error
- func ValidateStatesTreeWithManifest(tr fixedtree.Tree, sts []State, manifest Manifest) error
- func ValidateVoteproofsWithManifest(vps []Voteproof, manifest Manifest) error
- func VoteproofLog(vp Voteproof) *zerolog.Event
- type ACCEPTBallot
- type ACCEPTBallotFact
- type ACCEPTBallotSignFact
- type ACCEPTVoteproof
- type Address
- type Addresses
- type Ballot
- type BallotFact
- type BallotSignFact
- type BaseFact
- func (fact BaseFact) Hash() util.Hash
- func (fact BaseFact) IsValid([]byte) error
- func (fact BaseFact) JSONMarshaler() BaseFactJSONMarshaler
- func (fact *BaseFact) SetHash(h util.Hash)
- func (fact *BaseFact) SetJSONUnmarshaler(u BaseFactJSONUnmarshaler)
- func (fact *BaseFact) SetToken(t Token) error
- func (fact BaseFact) Token() Token
- type BaseFactJSONMarshaler
- type BaseFactJSONUnmarshaler
- type BaseNode
- type BaseNodeJSONMarshaler
- type BaseNodeJSONUnmarshaler
- type BaseNodeOperation
- func (op *BaseNodeOperation) AddNodeSigns(signs []NodeSign) (added bool, _ error)
- func (op *BaseNodeOperation) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (op BaseNodeOperation) IsValid(networkID []byte) error
- func (op BaseNodeOperation) MarshalJSON() ([]byte, error)
- func (op *BaseNodeOperation) NodeSign(priv Privatekey, networkID NetworkID, node Address) error
- func (op BaseNodeOperation) NodeSigns() []NodeSign
- func (op *BaseNodeOperation) SetNodeSigns(signs []NodeSign) error
- type BaseNodeSign
- func NewBaseNodeSign(node Address, signer Publickey, signature Signature, signedAt time.Time) BaseNodeSign
- func NewBaseNodeSignFromBytes(node Address, priv Privatekey, networkID NetworkID, b []byte) (BaseNodeSign, error)
- func NewBaseNodeSignFromFact(node Address, priv Privatekey, networkID NetworkID, fact Fact) (BaseNodeSign, error)
- func (si BaseNodeSign) Bytes() []byte
- func (si *BaseNodeSign) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (si BaseNodeSign) IsValid([]byte) error
- func (si BaseNodeSign) JSONMarshaler() BaseNodeSignJSONMarshaler
- func (si BaseNodeSign) MarshalJSON() ([]byte, error)
- func (si BaseNodeSign) Node() Address
- func (si BaseNodeSign) Verify(networkID NetworkID, b []byte) error
- type BaseNodeSignJSONMarshaler
- type BaseOperation
- func (op *BaseOperation) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (op BaseOperation) Fact() Fact
- func (op BaseOperation) Hash() util.Hash
- func (op BaseOperation) HashBytes() []byte
- func (op BaseOperation) IsValid(networkID []byte) error
- func (op BaseOperation) JSONMarshaler() BaseOperationJSONMarshaler
- func (op BaseOperation) MarshalJSON() ([]byte, error)
- func (BaseOperation) PreProcess(ctx context.Context, _ GetStateFunc) (context.Context, OperationProcessReasonError, error)
- func (BaseOperation) Process(context.Context, GetStateFunc) ([]StateMergeValue, OperationProcessReasonError, error)
- func (op *BaseOperation) SetFact(fact Fact)
- func (op *BaseOperation) Sign(priv Privatekey, networkID NetworkID) error
- func (op BaseOperation) Signs() []Sign
- type BaseOperationJSONMarshaler
- type BaseOperationJSONUnmarshaler
- type BaseOperationProcessReasonError
- func (e BaseOperationProcessReasonError) Error() string
- func (BaseOperationProcessReasonError) Hint() hint.Hint
- func (e BaseOperationProcessReasonError) Is(err error) bool
- func (e BaseOperationProcessReasonError) MarshalJSON() ([]byte, error)
- func (e BaseOperationProcessReasonError) Msg() string
- func (e *BaseOperationProcessReasonError) UnmarshalJSON(b []byte) error
- type BaseOperationProcessReasonErrorJSONMarshaler
- type BaseOperationProcessReasonErrorJSONUnmarshaler
- type BaseOperationProcessor
- type BaseSign
- func (si BaseSign) Bytes() []byte
- func (si *BaseSign) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (si BaseSign) IsValid([]byte) error
- func (si BaseSign) JSONMarshaler() BaseSignJSONMarshaler
- func (si BaseSign) MarshalJSON() ([]byte, error)
- func (si BaseSign) Signature() Signature
- func (si BaseSign) SignedAt() time.Time
- func (si BaseSign) Signer() Publickey
- func (si BaseSign) Verify(networkID NetworkID, b []byte) error
- type BaseSignJSONMarshaler
- type BaseState
- func (s *BaseState) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (s BaseState) Hash() util.Hash
- func (s BaseState) Height() Height
- func (s BaseState) IsValid([]byte) error
- func (s BaseState) Key() string
- func (s BaseState) MarshalJSON() ([]byte, error)
- func (s BaseState) Operations() []util.Hash
- func (s BaseState) Previous() util.Hash
- func (s BaseState) Value() StateValue
- type BaseStateMergeValue
- type BaseStateValueMerger
- func (s *BaseStateValueMerger) AddOperations(ops []util.Hash)
- func (s *BaseStateValueMerger) Close() error
- func (s *BaseStateValueMerger) Hash() util.Hash
- func (s *BaseStateValueMerger) Height() Height
- func (s *BaseStateValueMerger) Key() string
- func (s *BaseStateValueMerger) MarshalJSON() ([]byte, error)
- func (s *BaseStateValueMerger) Merge(value StateValue, ops []util.Hash) error
- func (s *BaseStateValueMerger) Operations() []util.Hash
- func (s *BaseStateValueMerger) Previous() util.Hash
- func (s *BaseStateValueMerger) SetValue(v StateValue)
- func (s *BaseStateValueMerger) Value() StateValue
- type BaseStringAddress
- type BlockMap
- type BlockMapItem
- type BlockMapItemType
- type Fact
- type Facter
- type GetStateFunc
- type HasWithdraws
- type Height
- type HeightDecoder
- type INITBallot
- type INITBallotFact
- type INITBallotSignFact
- type INITVoteproof
- type LocalNode
- type LocalParams
- type MPrivatekey
- func (k MPrivatekey) Bytes() []byte
- func (k MPrivatekey) Equal(b PKKey) bool
- func (k MPrivatekey) IsValid([]byte) error
- func (k MPrivatekey) MarshalText() ([]byte, error)
- func (k MPrivatekey) Publickey() Publickey
- func (k MPrivatekey) Sign(b []byte) (Signature, error)
- func (k MPrivatekey) String() string
- func (k *MPrivatekey) UnmarshalText(b []byte) error
- type MPublickey
- func (k MPublickey) Bytes() []byte
- func (k MPublickey) Equal(b PKKey) bool
- func (k MPublickey) IsValid([]byte) error
- func (k MPublickey) MarshalText() ([]byte, error)
- func (k MPublickey) String() string
- func (k *MPublickey) UnmarshalText(b []byte) error
- func (k MPublickey) Verify(input []byte, sig Signature) error
- type Manifest
- type NetworkID
- type NetworkPolicy
- type NetworkPolicyStateValue
- type NewOperationProcessorProcessFunc
- type Node
- type NodeSign
- type NodeSignFact
- type NodeSigner
- type Operation
- type OperationFixedtreeNode
- func (no *OperationFixedtreeNode) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (no OperationFixedtreeNode) InState() bool
- func (no OperationFixedtreeNode) MarshalJSON() ([]byte, error)
- func (no OperationFixedtreeNode) Operation() util.Hash
- func (no OperationFixedtreeNode) Reason() OperationProcessReasonError
- func (no OperationFixedtreeNode) SetHash(h util.Hash) fixedtree.Node
- type OperationProcessReasonError
- type OperationProcessor
- type OperationProcessorProcessFunc
- type PKKey
- type Point
- func (p Point) Bytes() []byte
- func (p Point) Compare(b Point) int
- func (p Point) Equal(b Point) bool
- func (p Point) Height() Height
- func (p Point) IsValid([]byte) error
- func (p Point) IsZero() bool
- func (p Point) MarshalJSON() ([]byte, error)
- func (p Point) MarshalZerologObject(e *zerolog.Event)
- func (p Point) NextHeight() Point
- func (p Point) NextRound() Point
- func (p Point) PrevHeight() Point
- func (p Point) PrevRound() Point
- func (p Point) Round() Round
- func (p Point) String() string
- func (p *Point) UnmarshalJSON(b []byte) error
- type Privatekey
- type ProposalFact
- type ProposalSignFact
- type Publickey
- type Round
- type Sign
- type SignFact
- type Signature
- type Signer
- type Stage
- type StagePoint
- func (p StagePoint) Bytes() []byte
- func (p StagePoint) Compare(b StagePoint) int
- func (p StagePoint) Decrease() StagePoint
- func (p StagePoint) Equal(b StagePoint) bool
- func (p StagePoint) IsValid([]byte) error
- func (p StagePoint) IsZero() bool
- func (p StagePoint) MarshalJSON() ([]byte, error)
- func (p StagePoint) MarshalZerologObject(e *zerolog.Event)
- func (p StagePoint) SetStage(s Stage) StagePoint
- func (p StagePoint) Stage() Stage
- func (p StagePoint) String() string
- func (p *StagePoint) UnmarshalJSON(b []byte) error
- type State
- type StateMergeValue
- type StateValue
- type StateValueMerger
- type StringAddress
- type StuckVoteproof
- type Suffrage
- type SuffrageCandidateLimiter
- type SuffrageCandidateLimiterFunc
- type SuffrageCandidateLimiterRule
- type SuffrageCandidateStateValue
- type SuffrageCandidatesStateValue
- type SuffrageNodeStateValue
- type SuffrageNodesStateValue
- type SuffrageProof
- type SuffrageWithdrawFact
- type SuffrageWithdrawOperation
- type Threshold
- func (t Threshold) Bytes() []byte
- func (t Threshold) Equal(b Threshold) bool
- func (t Threshold) Float64() float64
- func (t Threshold) IsValid([]byte) error
- func (t Threshold) MarshalText() ([]byte, error)
- func (t Threshold) String() string
- func (t Threshold) Threshold(quorum uint) uint
- func (t *Threshold) UnmarshalText(b []byte) error
- func (t Threshold) VoteResult(quorum uint, set []string) (result VoteResult, key string)
- type Token
- type TokenSetter
- type Tokener
- type VoteResult
- type Voteproof
- type WithdrawVoteproof
Constants ¶
const ( StageUnknown = Stage("UNKNOWN") StageINIT = Stage("INIT") StageACCEPT = Stage("ACCEPT") )
const ( VoteResultNotYet = VoteResult("NOT YET") VoteResultDraw = VoteResult("DRAW") VoteResultMajority = VoteResult("MAJORITY") )
const AddressTypeSize = 3
const MaxNetworkIDLength = 300
const MaxTokenSize = math.MaxUint16
const PKKeyTypeSize = 3
const PrivatekeyMinSeedSize = 36
Variables ¶
var ( MaxAddressSize = 100 MinAddressSize = AddressTypeSize + 3 REStringAddressString = `[a-zA-Z0-9][\w\-\.\!\$\*\@]*[a-zA-Z0-9]` )
var ( OperationFixedtreeHint = hint.MustNewHint("operation-fixedtree-v0.0.1") BaseOperationProcessReasonErrorHint = hint.MustNewHint("operation-fixedtree-node-process-reason-v0.0.1") )
var ( MPrivatekeyHint = hint.MustNewHint("mpr-v0.0.1") MPublickeyHint = hint.MustNewHint("mpu-v0.0.1") )
var ( NilHeight = Height(-1) GenesisHeight = Height(0) GenesisPoint = Point{/* contains filtered or unexported fields */} ZeroPoint = Point{/* contains filtered or unexported fields */} ZeroStagePoint = StagePoint{Point: ZeroPoint, /* contains filtered or unexported fields */} )
var BaseStateHint = hint.MustNewHint("base-state-v0.0.1")
var EmptyOperationProcessorProcessFunc = func(context.Context, Operation, GetStateFunc) ( OperationProcessReasonError, error, ) { return nil, nil }
var ErrNotChangedOperationProcessReason = NewBaseOperationProcessReasonError(
"states not changed")
var ErrSignatureVerification = util.NewError("signature verification failed")
var StateFixedtreeHint = hint.MustNewHint("state-fixedtree-v0.0.1")
var StringAddressHint = hint.MustNewHint("sas-v2")
Functions ¶
func BatchValidateMaps ¶
func CountBallotSignFacts ¶
func CountBallotSignFacts(sfs []BallotSignFact) (set []string, m map[string]BallotFact)
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 IsEqualNode ¶
func IsEqualNodes ¶
func IsEqualState ¶
func IsEqualStateValue ¶
func IsEqualStateValue(a, b StateValue) bool
func IsNetworkPolicyState ¶
func IsSuffrageNodesState ¶
func IsValidACCEPTBallot ¶
func IsValidACCEPTBallot(bl ACCEPTBallot, _ []byte) error
func IsValidACCEPTBallotFact ¶
func IsValidACCEPTBallotFact(fact ACCEPTBallotFact) error
func IsValidACCEPTBallotSignFact ¶
func IsValidACCEPTBallotSignFact(sf BallotSignFact, networkID []byte) error
func IsValidACCEPTVoteproof ¶
func IsValidACCEPTVoteproof(vp ACCEPTVoteproof, _ NetworkID) error
func IsValidBallot ¶
func IsValidBallotFact ¶
func IsValidBallotFact(fact BallotFact) error
func IsValidBallotSignFact ¶
func IsValidBallotSignFact(sf BallotSignFact, networkID []byte) error
func IsValidFact ¶
func IsValidINITBallot ¶
func IsValidINITBallot(bl INITBallot, _ []byte) error
func IsValidINITBallotFact ¶
func IsValidINITBallotFact(fact INITBallotFact) error
func IsValidINITBallotSignFact ¶
func IsValidINITBallotSignFact(sf BallotSignFact, networkID []byte) error
func IsValidINITVoteproof ¶
func IsValidINITVoteproof(vp INITVoteproof, _ NetworkID) error
func IsValidProposalFact ¶
func IsValidProposalFact(fact ProposalFact) error
func IsValidProposalSignFact ¶
func IsValidProposalSignFact(sf ProposalSignFact, networkID []byte) error
func IsValidSignFact ¶
func IsValidVoteproof ¶
func ManifestLog ¶
func NumberOfFaultyNodes ¶
func ValidateProposalWithManifest ¶
func ValidateProposalWithManifest(proposal ProposalSignFact, manifest Manifest) error
func VoteproofLog ¶
Types ¶
type ACCEPTBallot ¶
type ACCEPTBallot interface { Ballot BallotSignFact() ACCEPTBallotSignFact }
type ACCEPTBallotFact ¶
type ACCEPTBallotFact interface { BallotFact Proposal() util.Hash // NOTE proposal fact hash NewBlock() util.Hash }
type ACCEPTBallotSignFact ¶
type ACCEPTBallotSignFact interface { BallotSignFact BallotFact() ACCEPTBallotFact }
type ACCEPTVoteproof ¶
type ACCEPTVoteproof interface { Voteproof BallotMajority() ACCEPTBallotFact BallotSignFacts() []ACCEPTBallotSignFact }
func EnsureACCEPTVoteproof ¶
func EnsureACCEPTVoteproof(vp Voteproof) (ACCEPTVoteproof, error)
type Address ¶
type Address interface { fmt.Stringer // NOTE String() should be typed string util.Byter util.IsValider Equal(Address) bool }
Address represents the address of account.
type Ballot ¶
type Ballot interface { util.IsValider util.HashByter Point() StagePoint SignFact() BallotSignFact Voteproof() Voteproof }
type BallotFact ¶
type BallotFact interface { Fact Point() StagePoint }
type BallotSignFact ¶
type BallotSignFact interface { NodeSignFact Node() Address Signer() Publickey }
type BaseFact ¶
type BaseFact struct { hint.BaseHinter // contains filtered or unexported fields }
func (BaseFact) JSONMarshaler ¶
func (fact BaseFact) JSONMarshaler() BaseFactJSONMarshaler
func (*BaseFact) SetJSONUnmarshaler ¶
func (fact *BaseFact) SetJSONUnmarshaler(u BaseFactJSONUnmarshaler)
type BaseFactJSONMarshaler ¶
type BaseFactJSONMarshaler struct { Hash util.Hash `json:"hash"` Token Token `json:"token"` hint.BaseHinter }
type BaseFactJSONUnmarshaler ¶
type BaseFactJSONUnmarshaler struct { Hash valuehash.HashDecoder `json:"hash"` Token Token `json:"token"` }
type BaseNode ¶
type BaseNode struct { util.IsValider util.DefaultJSONMarshaled hint.BaseHinter // contains filtered or unexported fields }
func (BaseNode) MarshalJSON ¶
type BaseNodeJSONMarshaler ¶
type BaseNodeJSONUnmarshaler ¶
type BaseNodeOperation ¶
type BaseNodeOperation struct {
BaseOperation
}
func NewBaseNodeOperation ¶
func NewBaseNodeOperation(ht hint.Hint, fact Fact) BaseNodeOperation
func (*BaseNodeOperation) AddNodeSigns ¶
func (op *BaseNodeOperation) AddNodeSigns(signs []NodeSign) (added bool, _ error)
func (*BaseNodeOperation) DecodeJSON ¶
func (op *BaseNodeOperation) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (BaseNodeOperation) IsValid ¶
func (op BaseNodeOperation) IsValid(networkID []byte) error
func (BaseNodeOperation) MarshalJSON ¶
func (op BaseNodeOperation) MarshalJSON() ([]byte, error)
func (*BaseNodeOperation) NodeSign ¶
func (op *BaseNodeOperation) NodeSign(priv Privatekey, networkID NetworkID, node Address) error
func (BaseNodeOperation) NodeSigns ¶
func (op BaseNodeOperation) NodeSigns() []NodeSign
func (*BaseNodeOperation) SetNodeSigns ¶
func (op *BaseNodeOperation) SetNodeSigns(signs []NodeSign) error
type BaseNodeSign ¶
type BaseNodeSign struct { BaseSign // contains filtered or unexported fields }
func NewBaseNodeSign ¶
func NewBaseNodeSignFromBytes ¶
func NewBaseNodeSignFromBytes(node Address, priv Privatekey, networkID NetworkID, b []byte) (BaseNodeSign, error)
func NewBaseNodeSignFromFact ¶
func NewBaseNodeSignFromFact(node Address, priv Privatekey, networkID NetworkID, fact Fact) (BaseNodeSign, error)
func (BaseNodeSign) Bytes ¶
func (si BaseNodeSign) Bytes() []byte
func (*BaseNodeSign) DecodeJSON ¶
func (si *BaseNodeSign) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (BaseNodeSign) IsValid ¶
func (si BaseNodeSign) IsValid([]byte) error
func (BaseNodeSign) JSONMarshaler ¶
func (si BaseNodeSign) JSONMarshaler() BaseNodeSignJSONMarshaler
func (BaseNodeSign) MarshalJSON ¶
func (si BaseNodeSign) MarshalJSON() ([]byte, error)
func (BaseNodeSign) Node ¶
func (si BaseNodeSign) Node() Address
type BaseNodeSignJSONMarshaler ¶
type BaseNodeSignJSONMarshaler struct { Node Address `json:"node"` BaseSignJSONMarshaler }
type BaseOperation ¶
type BaseOperation struct { hint.BaseHinter // contains filtered or unexported fields }
BaseOperation is basic form to make new Operation.
func NewBaseOperation ¶
func NewBaseOperation(ht hint.Hint, fact Fact) BaseOperation
func (*BaseOperation) DecodeJSON ¶
func (op *BaseOperation) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (BaseOperation) Fact ¶
func (op BaseOperation) Fact() Fact
func (BaseOperation) Hash ¶
func (op BaseOperation) Hash() util.Hash
func (BaseOperation) HashBytes ¶
func (op BaseOperation) HashBytes() []byte
func (BaseOperation) IsValid ¶
func (op BaseOperation) IsValid(networkID []byte) error
func (BaseOperation) JSONMarshaler ¶
func (op BaseOperation) JSONMarshaler() BaseOperationJSONMarshaler
func (BaseOperation) MarshalJSON ¶
func (op BaseOperation) MarshalJSON() ([]byte, error)
func (BaseOperation) PreProcess ¶
func (BaseOperation) PreProcess(ctx context.Context, _ GetStateFunc) ( context.Context, OperationProcessReasonError, error, )
func (BaseOperation) Process ¶
func (BaseOperation) Process(context.Context, GetStateFunc) ([]StateMergeValue, OperationProcessReasonError, error)
func (*BaseOperation) SetFact ¶
func (op *BaseOperation) SetFact(fact Fact)
func (*BaseOperation) Sign ¶
func (op *BaseOperation) Sign(priv Privatekey, networkID NetworkID) error
func (BaseOperation) Signs ¶
func (op BaseOperation) Signs() []Sign
type BaseOperationJSONUnmarshaler ¶
type BaseOperationJSONUnmarshaler struct { Hash valuehash.HashDecoder `json:"hash"` Fact json.RawMessage `json:"fact"` Signs []json.RawMessage `json:"signs"` }
type BaseOperationProcessReasonError ¶
type BaseOperationProcessReasonError struct { hint.BaseHinter // contains filtered or unexported fields }
func NewBaseOperationProcessReasonError ¶
func NewBaseOperationProcessReasonError(s string, a ...interface{}) BaseOperationProcessReasonError
func (BaseOperationProcessReasonError) Error ¶
func (e BaseOperationProcessReasonError) Error() string
func (BaseOperationProcessReasonError) Hint ¶
func (BaseOperationProcessReasonError) Hint() hint.Hint
func (BaseOperationProcessReasonError) Is ¶
func (e BaseOperationProcessReasonError) Is(err error) bool
func (BaseOperationProcessReasonError) MarshalJSON ¶
func (e BaseOperationProcessReasonError) MarshalJSON() ([]byte, error)
func (BaseOperationProcessReasonError) Msg ¶
func (e BaseOperationProcessReasonError) Msg() string
func (*BaseOperationProcessReasonError) UnmarshalJSON ¶
func (e *BaseOperationProcessReasonError) UnmarshalJSON(b []byte) error
type BaseOperationProcessReasonErrorJSONMarshaler ¶
type BaseOperationProcessReasonErrorJSONMarshaler struct { Message string `json:"message"` hint.BaseHinter }
type BaseOperationProcessReasonErrorJSONUnmarshaler ¶
type BaseOperationProcessReasonErrorJSONUnmarshaler struct {
Message string `json:"message"`
}
type BaseOperationProcessor ¶
type BaseOperationProcessor struct { PreProcessConstraintFunc OperationProcessorProcessFunc ProcessConstraintFunc OperationProcessorProcessFunc // contains filtered or unexported fields }
func NewBaseOperationProcessor ¶
func NewBaseOperationProcessor( height Height, getStateFunc GetStateFunc, newPreProcessConstraintFunc NewOperationProcessorProcessFunc, newProcessConstraintFunc NewOperationProcessorProcessFunc, ) (*BaseOperationProcessor, error)
func (*BaseOperationProcessor) Close ¶
func (p *BaseOperationProcessor) Close() error
func (*BaseOperationProcessor) Height ¶
func (p *BaseOperationProcessor) Height() Height
type BaseSign ¶
type BaseSign struct {
// contains filtered or unexported fields
}
func NewBaseSign ¶
func NewBaseSignFromBytes ¶
func NewBaseSignFromBytes(priv Privatekey, networkID NetworkID, b []byte) (BaseSign, error)
func NewBaseSignFromFact ¶
func NewBaseSignFromFact(priv Privatekey, networkID NetworkID, fact Fact) (BaseSign, error)
func (BaseSign) JSONMarshaler ¶
func (si BaseSign) JSONMarshaler() BaseSignJSONMarshaler
func (BaseSign) MarshalJSON ¶
type BaseSignJSONMarshaler ¶
type BaseState ¶
type BaseState struct { util.DefaultJSONMarshaled hint.BaseHinter // contains filtered or unexported fields }
func NewBaseState ¶
func (BaseState) MarshalJSON ¶
func (BaseState) Operations ¶
func (BaseState) Value ¶
func (s BaseState) Value() StateValue
type BaseStateMergeValue ¶
type BaseStateMergeValue struct { StateValue // contains filtered or unexported fields }
func NewBaseStateMergeValue ¶
func NewBaseStateMergeValue( key string, value StateValue, merger func(Height, State) StateValueMerger, ) BaseStateMergeValue
func (BaseStateMergeValue) Key ¶
func (v BaseStateMergeValue) Key() string
func (BaseStateMergeValue) Merger ¶
func (v BaseStateMergeValue) Merger(height Height, st State) StateValueMerger
func (BaseStateMergeValue) Value ¶
func (v BaseStateMergeValue) Value() StateValue
type BaseStateValueMerger ¶
func NewBaseStateValueMerger ¶
func NewBaseStateValueMerger(height Height, key string, st State) *BaseStateValueMerger
func (*BaseStateValueMerger) AddOperations ¶
func (s *BaseStateValueMerger) AddOperations(ops []util.Hash)
func (*BaseStateValueMerger) Close ¶
func (s *BaseStateValueMerger) Close() error
func (*BaseStateValueMerger) Hash ¶
func (s *BaseStateValueMerger) Hash() util.Hash
func (*BaseStateValueMerger) Height ¶
func (s *BaseStateValueMerger) Height() Height
func (*BaseStateValueMerger) Key ¶
func (s *BaseStateValueMerger) Key() string
func (*BaseStateValueMerger) MarshalJSON ¶
func (s *BaseStateValueMerger) MarshalJSON() ([]byte, error)
func (*BaseStateValueMerger) Merge ¶
func (s *BaseStateValueMerger) Merge(value StateValue, ops []util.Hash) error
func (*BaseStateValueMerger) Operations ¶
func (s *BaseStateValueMerger) Operations() []util.Hash
func (*BaseStateValueMerger) Previous ¶
func (s *BaseStateValueMerger) Previous() util.Hash
func (*BaseStateValueMerger) SetValue ¶
func (s *BaseStateValueMerger) SetValue(v StateValue)
func (*BaseStateValueMerger) Value ¶
func (s *BaseStateValueMerger) Value() StateValue
type BaseStringAddress ¶
type BaseStringAddress struct { hint.BaseHinter // contains filtered or unexported fields }
func NewBaseStringAddressWithHint ¶
func NewBaseStringAddressWithHint(ht hint.Hint, s string) BaseStringAddress
func (BaseStringAddress) Bytes ¶
func (ad BaseStringAddress) Bytes() []byte
func (BaseStringAddress) Equal ¶
func (ad BaseStringAddress) Equal(b Address) bool
func (BaseStringAddress) IsValid ¶
func (ad BaseStringAddress) IsValid([]byte) error
func (BaseStringAddress) MarshalText ¶
func (ad BaseStringAddress) MarshalText() ([]byte, error)
func (BaseStringAddress) String ¶
func (ad BaseStringAddress) String() string
type BlockMap ¶
type BlockMap interface { NodeSign Manifest() Manifest Item(BlockMapItemType) (BlockMapItem, bool) Items(func(BlockMapItem) bool) Writer() hint.Hint Encoder() hint.Hint }
type BlockMapItem ¶
type BlockMapItemType ¶
type BlockMapItemType string
var ( BlockMapItemTypeProposal BlockMapItemType = "blockmapitem_proposal" BlockMapItemTypeOperations BlockMapItemType = "blockmapitem_operations" BlockMapItemTypeOperationsTree BlockMapItemType = "blockmapitem_operations_tree" BlockMapItemTypeStates BlockMapItemType = "blockmapitem_states" BlockMapItemTypeStatesTree BlockMapItemType = "blockmapitem_states_tree" BlockMapItemTypeVoteproofs BlockMapItemType = "blockmapitem_voteproofs" )
func (BlockMapItemType) IsValid ¶
func (t BlockMapItemType) IsValid([]byte) error
func (BlockMapItemType) String ¶
func (t BlockMapItemType) String() string
type HasWithdraws ¶
type HasWithdraws interface {
Withdraws() []SuffrageWithdrawOperation
}
type Height ¶
type Height int64
Height stands for height of Block
func ParseHeightBytes ¶
func ParseHeightString ¶
func (Height) FixedString ¶
type HeightDecoder ¶
type HeightDecoder struct {
// contains filtered or unexported fields
}
func (HeightDecoder) Height ¶
func (d HeightDecoder) Height() Height
func (*HeightDecoder) UnmarshalJSON ¶
func (d *HeightDecoder) UnmarshalJSON(b []byte) error
type INITBallot ¶
type INITBallot interface { Ballot BallotSignFact() INITBallotSignFact }
type INITBallotFact ¶
type INITBallotFact interface { BallotFact PreviousBlock() util.Hash Proposal() util.Hash }
type INITBallotSignFact ¶
type INITBallotSignFact interface { BallotSignFact BallotFact() INITBallotFact }
type INITVoteproof ¶
type INITVoteproof interface { Voteproof BallotMajority() INITBallotFact BallotSignFacts() []INITBallotSignFact }
func EnsureINITVoteproof ¶
func EnsureINITVoteproof(vp Voteproof) (INITVoteproof, error)
type LocalNode ¶
type LocalNode interface { Node Privatekey() Privatekey }
type LocalParams ¶
type MPrivatekey ¶
type MPrivatekey struct { hint.BaseHinter // contains filtered or unexported fields }
MPrivatekey is the default privatekey of mitum, it is based on BTC Privatekey.
func LoadMPrivatekey ¶
func LoadMPrivatekey(s string) (MPrivatekey, error)
func NewMPrivatekey ¶
func NewMPrivatekey() MPrivatekey
func NewMPrivatekeyFromSeed ¶
func NewMPrivatekeyFromSeed(s string) (MPrivatekey, error)
func ParseMPrivatekey ¶
func ParseMPrivatekey(s string) (MPrivatekey, error)
func (MPrivatekey) Bytes ¶
func (k MPrivatekey) Bytes() []byte
func (MPrivatekey) Equal ¶
func (k MPrivatekey) Equal(b PKKey) bool
func (MPrivatekey) IsValid ¶
func (k MPrivatekey) IsValid([]byte) error
func (MPrivatekey) MarshalText ¶
func (k MPrivatekey) MarshalText() ([]byte, error)
func (MPrivatekey) Publickey ¶
func (k MPrivatekey) Publickey() Publickey
func (MPrivatekey) String ¶
func (k MPrivatekey) String() string
func (*MPrivatekey) UnmarshalText ¶
func (k *MPrivatekey) UnmarshalText(b []byte) error
type MPublickey ¶
type MPublickey struct { hint.BaseHinter // contains filtered or unexported fields }
MPublickey is the default publickey of mitum, it is based on BTC Privatekey.
func LoadMPublickey ¶
func LoadMPublickey(s string) (MPublickey, error)
func NewMPublickey ¶
func NewMPublickey(k *btcec.PublicKey) MPublickey
func ParseMPublickey ¶
func ParseMPublickey(s string) (MPublickey, error)
func (MPublickey) Bytes ¶
func (k MPublickey) Bytes() []byte
func (MPublickey) Equal ¶
func (k MPublickey) Equal(b PKKey) bool
func (MPublickey) IsValid ¶
func (k MPublickey) IsValid([]byte) error
func (MPublickey) MarshalText ¶
func (k MPublickey) MarshalText() ([]byte, error)
func (MPublickey) String ¶
func (k MPublickey) String() string
func (*MPublickey) UnmarshalText ¶
func (k *MPublickey) UnmarshalText(b []byte) error
type Manifest ¶
type Manifest interface { util.Hasher util.IsValider Height() Height Previous() util.Hash Proposal() util.Hash // NOTE proposal fact hash OperationsTree() util.Hash // NOTE operations tree root hash StatesTree() util.Hash // NOTE states tree root hash Suffrage() util.Hash // NOTE state hash of newly updated SuffrageNodesStateValue ProposedAt() time.Time // NOTE Proposal proposed time }
type NetworkID ¶
type NetworkID []byte
NetworkID will be used to separate mitum network with the other mitum network. Generally it is used for hashing and making signature.
func (NetworkID) MarshalText ¶
func (*NetworkID) UnmarshalText ¶
type NetworkPolicy ¶
type NetworkPolicyStateValue ¶
type NetworkPolicyStateValue interface { StateValue Policy() NetworkPolicy }
type NewOperationProcessorProcessFunc ¶
type NewOperationProcessorProcessFunc func(Height, GetStateFunc) (OperationProcessorProcessFunc, error)
type NodeSignFact ¶
type NodeSigner ¶
type Operation ¶
type Operation interface { hint.Hinter util.IsValider util.Hasher SignFact PreProcess(context.Context, GetStateFunc) (context.Context, OperationProcessReasonError, error) Process(context.Context, GetStateFunc) ([]StateMergeValue, OperationProcessReasonError, error) }
type OperationFixedtreeNode ¶
func NewInStateOperationFixedtreeNode ¶
func NewInStateOperationFixedtreeNode(facthash util.Hash, reason string) OperationFixedtreeNode
func NewNotInStateOperationFixedtreeNode ¶
func NewNotInStateOperationFixedtreeNode(facthash util.Hash, reason string) OperationFixedtreeNode
func (*OperationFixedtreeNode) DecodeJSON ¶
func (no *OperationFixedtreeNode) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (OperationFixedtreeNode) InState ¶
func (no OperationFixedtreeNode) InState() bool
func (OperationFixedtreeNode) MarshalJSON ¶
func (no OperationFixedtreeNode) MarshalJSON() ([]byte, error)
func (OperationFixedtreeNode) Operation ¶
func (no OperationFixedtreeNode) Operation() util.Hash
func (OperationFixedtreeNode) Reason ¶
func (no OperationFixedtreeNode) Reason() OperationProcessReasonError
type OperationProcessor ¶
type OperationProcessor interface { PreProcess(context.Context, Operation, GetStateFunc) (context.Context, OperationProcessReasonError, error) Process(context.Context, Operation, GetStateFunc) ([]StateMergeValue, OperationProcessReasonError, error) Close() error }
type OperationProcessorProcessFunc ¶
type OperationProcessorProcessFunc func(context.Context, Operation, GetStateFunc) (OperationProcessReasonError, error)
type Point ¶
type Point struct { util.DefaultJSONMarshaled // contains filtered or unexported fields }
func (Point) MarshalJSON ¶
func (Point) MarshalZerologObject ¶
func (Point) NextHeight ¶
NextHeight returns next height with 0 round.
func (Point) PrevHeight ¶
PrevHeight returns previous height with 0 round
func (Point) PrevRound ¶
PrevRound returns previous round; if 0 round, returns previous height and zero round
func (*Point) UnmarshalJSON ¶
type Privatekey ¶
func DecodePrivatekeyFromString ¶
func DecodePrivatekeyFromString(s string, enc encoder.Encoder) (Privatekey, error)
type ProposalFact ¶
type ProposalSignFact ¶
type Signature ¶
type Signature []byte
func (Signature) MarshalText ¶
func (*Signature) UnmarshalText ¶
type Signer ¶
type Signer interface {
Sign(Privatekey, NetworkID) error
}
type StagePoint ¶
type StagePoint struct { util.DefaultJSONMarshaled Point // contains filtered or unexported fields }
func NewStagePoint ¶
func NewStagePoint(point Point, stage Stage) StagePoint
func (StagePoint) Bytes ¶
func (p StagePoint) Bytes() []byte
func (StagePoint) Compare ¶
func (p StagePoint) Compare(b StagePoint) int
func (StagePoint) Decrease ¶
func (p StagePoint) Decrease() StagePoint
func (StagePoint) Equal ¶
func (p StagePoint) Equal(b StagePoint) bool
func (StagePoint) IsValid ¶
func (p StagePoint) IsValid([]byte) error
func (StagePoint) IsZero ¶
func (p StagePoint) IsZero() bool
func (StagePoint) MarshalJSON ¶
func (p StagePoint) MarshalJSON() ([]byte, error)
func (StagePoint) MarshalZerologObject ¶
func (p StagePoint) MarshalZerologObject(e *zerolog.Event)
func (StagePoint) SetStage ¶
func (p StagePoint) SetStage(s Stage) StagePoint
func (StagePoint) Stage ¶
func (p StagePoint) Stage() Stage
func (StagePoint) String ¶
func (p StagePoint) String() string
func (*StagePoint) UnmarshalJSON ¶
func (p *StagePoint) UnmarshalJSON(b []byte) error
type State ¶
type State interface { util.Hasher // NOTE <key> + <value HashByte> + <height> util.IsValider Key() string Value() StateValue Height() Height // NOTE manifest height Previous() util.Hash // NOTE previous state hash Operations() []util.Hash // NOTE operation fact hash }
type StateMergeValue ¶
type StateMergeValue interface { StateValue Key() string Value() StateValue Merger(Height, State) StateValueMerger }
type StateValue ¶
func DecodeStateValue ¶
func DecodeStateValue(b []byte, enc encoder.Encoder) (StateValue, error)
type StateValueMerger ¶
type StringAddress ¶
type StringAddress struct {
BaseStringAddress
}
func NewStringAddress ¶
func NewStringAddress(s string) StringAddress
func ParseStringAddress ¶
func ParseStringAddress(s string) (StringAddress, error)
func (StringAddress) IsValid ¶
func (ad StringAddress) IsValid([]byte) error
func (*StringAddress) UnmarshalText ¶
func (ad *StringAddress) UnmarshalText(b []byte) error
type StuckVoteproof ¶
type StuckVoteproof interface { HasWithdraws IsStuckVoteproof() bool // NOTE should be true }
type SuffrageCandidateLimiterFunc ¶
type SuffrageCandidateLimiterFunc func(SuffrageCandidateLimiterRule) (SuffrageCandidateLimiter, error)
type SuffrageCandidateStateValue ¶
func LoadNodesFromSuffrageCandidatesState ¶
func LoadNodesFromSuffrageCandidatesState(st State) ([]SuffrageCandidateStateValue, error)
type SuffrageCandidatesStateValue ¶
type SuffrageCandidatesStateValue interface { StateValue Nodes() []SuffrageCandidateStateValue }
type SuffrageNodeStateValue ¶
type SuffrageNodesStateValue ¶
type SuffrageNodesStateValue interface { StateValue Height() Height // NOTE not manifest height Nodes() []SuffrageNodeStateValue Suffrage() (Suffrage, error) }
func LoadSuffrageNodesStateValue ¶
func LoadSuffrageNodesStateValue(st State) (SuffrageNodesStateValue, error)
type SuffrageProof ¶
type SuffrageWithdrawFact ¶
type SuffrageWithdrawOperation ¶
type SuffrageWithdrawOperation interface { Operation NodeSignFact WithdrawFact() SuffrageWithdrawFact }
type Threshold ¶
type Threshold float64
func (Threshold) MarshalText ¶
func (*Threshold) UnmarshalText ¶
func (Threshold) VoteResult ¶
func (t Threshold) VoteResult(quorum uint, set []string) (result VoteResult, key string)
type TokenSetter ¶
type VoteResult ¶
type VoteResult string
func FindVoteResult ¶
func FindVoteResult(quorum, threshold uint, s []string) (result VoteResult, key string)
func (VoteResult) Bytes ¶
func (v VoteResult) Bytes() []byte
func (VoteResult) IsValid ¶
func (VoteResult) IsValid([]byte) error
func (VoteResult) MarshalText ¶
func (v VoteResult) MarshalText() ([]byte, error)
func (VoteResult) String ¶
func (v VoteResult) String() string
func (*VoteResult) UnmarshalText ¶
func (v *VoteResult) UnmarshalText(b []byte) error
type Voteproof ¶
type Voteproof interface { util.IsValider util.HashByter FinishedAt() time.Time // NOTE if zero, not yet finished Point() StagePoint Result() VoteResult Threshold() Threshold Majority() BallotFact SignFacts() []BallotSignFact ID() string // NOTE ID is only unique in local machine }
type WithdrawVoteproof ¶
type WithdrawVoteproof interface { HasWithdraws IsWithdrawVoteproof() bool // NOTE should be true }
Source Files ¶
- address.go
- ballot.go
- ballot_isvalid.go
- base_fact.go
- base_node.go
- base_operation.go
- base_operation_json.go
- base_state.go
- base_string_address.go
- block.go
- block_log.go
- doc.go
- fact.go
- init.go
- local.go
- network_id.go
- node.go
- operation.go
- pk.go
- pk_priv.go
- pk_pub.go
- point.go
- point_json.go
- policy.go
- proposal.go
- sign.go
- sign_json.go
- stage.go
- state.go
- string_address.go
- suffrage.go
- threshold.go
- vote.go
- voteproof.go
- voteproof_isvalid.go
- voteproof_log.go