Documentation ¶
Index ¶
- Constants
- type Block
- type Committee
- type CommitteeMember
- type CommitteeProvider
- type ConsensusAccount
- type ConsensusAccountProvider
- type ConsensusSigner
- type ConsensusState
- type ContentProposal
- func (z *ContentProposal) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ContentProposal) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ContentProposal) FromBytes(bts []byte) error
- func (z *ContentProposal) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ContentProposal) Msgsize() (s int)
- func (z *ContentProposal) SignatureTarget() []byte
- func (z *ContentProposal) String() string
- func (z *ContentProposal) ToBytes() []byte
- func (z *ContentProposal) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ContentString
- func (z *ContentString) DecodeMsg(dc *msgp.Reader) (err error)
- func (z ContentString) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ContentString) FromBytes(bts []byte) error
- func (z ContentString) MarshalMsg(b []byte) (o []byte, err error)
- func (z ContentString) Msgsize() (s int)
- func (z *ContentString) SignatureTarget() []byte
- func (z *ContentString) String() string
- func (z *ContentString) ToBytes() []byte
- func (z *ContentString) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ContentTimeout
- func (z *ContentTimeout) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ContentTimeout) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ContentTimeout) FromBytes(bts []byte) error
- func (z *ContentTimeout) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ContentTimeout) Msgsize() (s int)
- func (z *ContentTimeout) SignatureTarget() []byte
- func (z *ContentTimeout) String() string
- func (z *ContentTimeout) ToBytes() []byte
- func (z *ContentTimeout) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ContentVote
- func (z *ContentVote) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ContentVote) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ContentVote) FromBytes(bts []byte) error
- func (z *ContentVote) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ContentVote) Msgsize() (s int)
- func (z *ContentVote) SignatureTarget() []byte
- func (z *ContentVote) String() string
- func (z *ContentVote) ToBytes() []byte
- func (z *ContentVote) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ExecutionResult
- type Hasher
- type HotStuffMessageType
- func (z *HotStuffMessageType) DecodeMsg(dc *msgp.Reader) (err error)
- func (z HotStuffMessageType) EncodeMsg(en *msgp.Writer) (err error)
- func (z HotStuffMessageType) MarshalMsg(b []byte) (o []byte, err error)
- func (z HotStuffMessageType) Msgsize() (s int)
- func (m HotStuffMessageType) String() string
- func (z *HotStuffMessageType) UnmarshalMsg(bts []byte) (o []byte, err error)
- type HotStuffSignedMessage
- func (z *HotStuffSignedMessage) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *HotStuffSignedMessage) EncodeMsg(en *msgp.Writer) (err error)
- func (z *HotStuffSignedMessage) FromBytes(bts []byte) error
- func (z *HotStuffSignedMessage) GetTypeValue() int
- func (z *HotStuffSignedMessage) MarshalMsg(b []byte) (o []byte, err error)
- func (z *HotStuffSignedMessage) Msgsize() (s int)
- func (z *HotStuffSignedMessage) String() string
- func (z *HotStuffSignedMessage) ToBytes() []byte
- func (z *HotStuffSignedMessage) UnmarshalMsg(bts []byte) (o []byte, err error)
- type JointSignature
- func (z *JointSignature) DecodeMsg(dc *msgp.Reader) (err error)
- func (z JointSignature) EncodeMsg(en *msgp.Writer) (err error)
- func (z JointSignature) MarshalMsg(b []byte) (o []byte, err error)
- func (z JointSignature) Msgsize() (s int)
- func (z *JointSignature) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Ledger
- type LedgerCommitInfo
- func (z *LedgerCommitInfo) DecodeMsg(dc *msgp.Reader) (err error)
- func (z LedgerCommitInfo) EncodeMsg(en *msgp.Writer) (err error)
- func (l LedgerCommitInfo) GetHashContent() string
- func (z LedgerCommitInfo) MarshalMsg(b []byte) (o []byte, err error)
- func (z LedgerCommitInfo) Msgsize() (s int)
- func (l LedgerCommitInfo) String() string
- func (z *LedgerCommitInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ProposalContext
- type ProposalContextProvider
- type ProposalExecutor
- type ProposalGenerator
- type ProposalVerifier
- type QC
- type Signature
- type SignatureCollector
- type TC
- type VerifyResult
- type VoteInfo
- func (z *VoteInfo) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *VoteInfo) EncodeMsg(en *msgp.Writer) (err error)
- func (i VoteInfo) GetHashContent() string
- func (z *VoteInfo) MarshalMsg(b []byte) (o []byte, err error)
- func (z *VoteInfo) Msgsize() (s int)
- func (i VoteInfo) String() string
- func (z *VoteInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
Constants ¶
const HotStuffMessageTypeRoot = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Round int64 // the round that generated this proposal Payload string // proposed transactions ParentQC *QC // qc for parent block Id string // unique digest of round, payload and parent_qc.id }
msgp Block
func (*Block) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Committee ¶
type Committee struct { Peers []*CommitteeMember Version int }
type CommitteeMember ¶
type CommitteeMember struct { PeerIndex int // order of peer in the committee MemberId string // peer identifier. current use address TransportPeerId string // for transport only. In the future this should not be revealed. ConsensusAccount ConsensusAccount // account public key to verify messages }
type CommitteeProvider ¶
type CommitteeProvider interface { InitCommittee(version int, peers []CommitteeMember, myAccount ConsensusAccount) GetVersion() int GetAllMemberTransportIds() []string GetAllMemberPeedIds() []string GetAllMembers() []CommitteeMember GetMyPeerId() string GetMyPeerIndex() int GetLeader(round int64) CommitteeMember GetPeerIndex(id string) (index int, err error) GetThreshold() int AmILeader(round int64) bool AmIIn() bool IsIn(id string) bool }
type ConsensusAccount ¶
type ConsensusAccount interface {
Id() string
}
OgLedgerAccount represents a full account of a user.
type ConsensusAccountProvider ¶
type ConsensusAccountProvider interface { ProvideAccount() (ConsensusAccount, error) Generate() (account ConsensusAccount, err error) Load() (account ConsensusAccount, err error) Save() (err error) }
type ConsensusSigner ¶
type ConsensusSigner interface {
Sign(msg []byte, account ConsensusAccount) Signature
}
type ConsensusState ¶
func (ConsensusState) String ¶
func (c ConsensusState) String() string
type ContentProposal ¶
msgp ContentProposal
func (*ContentProposal) DecodeMsg ¶
func (z *ContentProposal) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ContentProposal) EncodeMsg ¶
func (z *ContentProposal) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ContentProposal) FromBytes ¶
func (z *ContentProposal) FromBytes(bts []byte) error
func (*ContentProposal) MarshalMsg ¶
func (z *ContentProposal) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ContentProposal) Msgsize ¶
func (z *ContentProposal) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ContentProposal) SignatureTarget ¶
func (z *ContentProposal) SignatureTarget() []byte
func (*ContentProposal) String ¶
func (z *ContentProposal) String() string
func (*ContentProposal) ToBytes ¶
func (z *ContentProposal) ToBytes() []byte
func (*ContentProposal) UnmarshalMsg ¶
func (z *ContentProposal) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ContentString ¶
type ContentString struct {
Content string
}
msgp ContentString it is a dummy content type for debugging
func (*ContentString) DecodeMsg ¶
func (z *ContentString) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (ContentString) EncodeMsg ¶
func (z ContentString) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ContentString) FromBytes ¶
func (z *ContentString) FromBytes(bts []byte) error
func (ContentString) MarshalMsg ¶
func (z ContentString) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (ContentString) Msgsize ¶
func (z ContentString) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ContentString) SignatureTarget ¶
func (z *ContentString) SignatureTarget() []byte
func (*ContentString) String ¶
func (z *ContentString) String() string
func (*ContentString) ToBytes ¶
func (z *ContentString) ToBytes() []byte
func (*ContentString) UnmarshalMsg ¶
func (z *ContentString) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ContentTimeout ¶
msgp ContentTimeout
func (*ContentTimeout) DecodeMsg ¶
func (z *ContentTimeout) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ContentTimeout) EncodeMsg ¶
func (z *ContentTimeout) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ContentTimeout) FromBytes ¶
func (z *ContentTimeout) FromBytes(bts []byte) error
func (*ContentTimeout) MarshalMsg ¶
func (z *ContentTimeout) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ContentTimeout) Msgsize ¶
func (z *ContentTimeout) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ContentTimeout) SignatureTarget ¶
func (z *ContentTimeout) SignatureTarget() []byte
func (*ContentTimeout) String ¶
func (z *ContentTimeout) String() string
func (*ContentTimeout) ToBytes ¶
func (z *ContentTimeout) ToBytes() []byte
func (*ContentTimeout) UnmarshalMsg ¶
func (z *ContentTimeout) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ContentVote ¶
type ContentVote struct { VoteInfo VoteInfo LedgerCommitInfo LedgerCommitInfo QC *QC TC *TC }
msgp ContentVote
func (*ContentVote) DecodeMsg ¶
func (z *ContentVote) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ContentVote) EncodeMsg ¶
func (z *ContentVote) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ContentVote) FromBytes ¶
func (z *ContentVote) FromBytes(bts []byte) error
func (*ContentVote) MarshalMsg ¶
func (z *ContentVote) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ContentVote) Msgsize ¶
func (z *ContentVote) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ContentVote) SignatureTarget ¶
func (z *ContentVote) SignatureTarget() []byte
func (*ContentVote) String ¶
func (z *ContentVote) String() string
func (*ContentVote) ToBytes ¶
func (z *ContentVote) ToBytes() []byte
func (*ContentVote) UnmarshalMsg ¶
func (z *ContentVote) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ExecutionResult ¶
func (*ExecutionResult) String ¶
func (e *ExecutionResult) String() string
type HotStuffMessageType ¶
type HotStuffMessageType int
const ( HotStuffMessageTypeProposal HotStuffMessageType = iota + 100 HotStuffMessageTypeVote HotStuffMessageTypeTimeout HotStuffMessageTypeString )
func (*HotStuffMessageType) DecodeMsg ¶
func (z *HotStuffMessageType) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (HotStuffMessageType) EncodeMsg ¶
func (z HotStuffMessageType) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (HotStuffMessageType) MarshalMsg ¶
func (z HotStuffMessageType) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (HotStuffMessageType) Msgsize ¶
func (z HotStuffMessageType) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (HotStuffMessageType) String ¶
func (m HotStuffMessageType) String() string
func (*HotStuffMessageType) UnmarshalMsg ¶
func (z *HotStuffMessageType) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type HotStuffSignedMessage ¶
type HotStuffSignedMessage struct { HotStuffMessageType int // what ContentByte is (one of HotStuffMessageType). ContentBytes []byte // this Byte will be recovered to implementation of Content interface SenderMemberId string // member id of the sender Signature []byte }
HotStuffSignedMessage is for transportation. msgp HotStuffSignedMessage
func (*HotStuffSignedMessage) DecodeMsg ¶
func (z *HotStuffSignedMessage) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*HotStuffSignedMessage) EncodeMsg ¶
func (z *HotStuffSignedMessage) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*HotStuffSignedMessage) FromBytes ¶
func (z *HotStuffSignedMessage) FromBytes(bts []byte) error
func (*HotStuffSignedMessage) GetTypeValue ¶
func (z *HotStuffSignedMessage) GetTypeValue() int
func (*HotStuffSignedMessage) MarshalMsg ¶
func (z *HotStuffSignedMessage) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*HotStuffSignedMessage) Msgsize ¶
func (z *HotStuffSignedMessage) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*HotStuffSignedMessage) String ¶
func (z *HotStuffSignedMessage) String() string
func (*HotStuffSignedMessage) ToBytes ¶
func (z *HotStuffSignedMessage) ToBytes() []byte
func (*HotStuffSignedMessage) UnmarshalMsg ¶
func (z *HotStuffSignedMessage) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type JointSignature ¶
type JointSignature []byte
msgp JointSignature
func (*JointSignature) DecodeMsg ¶
func (z *JointSignature) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (JointSignature) EncodeMsg ¶
func (z JointSignature) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (JointSignature) MarshalMsg ¶
func (z JointSignature) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (JointSignature) Msgsize ¶
func (z JointSignature) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*JointSignature) UnmarshalMsg ¶
func (z *JointSignature) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Ledger ¶
type Ledger interface { // Speculate applies cmds speculatively Speculate(prevBlockId string, block *Block) (executionResult ExecutionResult) // GetState finds the pending state for the given BlockId or nil if not present GetState(blockId string) (stateId string) // Commit commits the pending prefix of the given BlockId and prune other branches Commit(blockId string) SaveConsensusState(*ConsensusState) GetConsensusState() *ConsensusState CurrentHeight() int64 CurrentCommittee() *Committee }
type LedgerCommitInfo ¶
type LedgerCommitInfo struct { CommitStateId string // nil if no commit happens when this vote is aggregated to QC. Usually the merkle root VoteInfoHash string // hash of VoteMsg.voteInfo }
msgp LedgerCommitInfo
func (*LedgerCommitInfo) DecodeMsg ¶
func (z *LedgerCommitInfo) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (LedgerCommitInfo) EncodeMsg ¶
func (z LedgerCommitInfo) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (LedgerCommitInfo) GetHashContent ¶
func (l LedgerCommitInfo) GetHashContent() string
func (LedgerCommitInfo) MarshalMsg ¶
func (z LedgerCommitInfo) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (LedgerCommitInfo) Msgsize ¶
func (z LedgerCommitInfo) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (LedgerCommitInfo) String ¶
func (l LedgerCommitInfo) String() string
func (*LedgerCommitInfo) UnmarshalMsg ¶
func (z *LedgerCommitInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ProposalContext ¶
func (ProposalContext) String ¶
func (p ProposalContext) String() string
type ProposalContextProvider ¶
type ProposalContextProvider interface {
GetProposalContext() *ProposalContext
}
type ProposalExecutor ¶
type ProposalExecutor interface { ExecuteProposal(block *Block) (executionResult ExecutionResult) ExecuteProposalAsync(block *Block) }
type ProposalGenerator ¶
type ProposalGenerator interface { GenerateProposal(context *ProposalContext) *ContentProposal GenerateProposalAsync(context *ProposalContext, callback func(*ContentProposal)) }
ProposalGenerator provides a proposal whenever needed
type ProposalVerifier ¶
type ProposalVerifier interface { VerifyProposal(proposal *ContentProposal) *VerifyResult VerifyProposalAsync(proposal *ContentProposal) }
type QC ¶
type QC struct { VoteData VoteInfo JointSignature JointSignature }
msgp QC
func (*QC) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Signature ¶
type Signature []byte
msgp Signature
func (Signature) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SignatureCollector ¶
type TC ¶
type TC struct { Round int64 // round of the block JointSignature JointSignature }
msgp TC
func (*TC) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type VerifyResult ¶
type VerifyResult struct {
Ok bool
}
type VoteInfo ¶
type VoteInfo struct { Id string // Id of the block Round int64 // round of the block ParentId string // Id of the parent ParentRound int64 // round of the parent GrandParentId string // Id of the grandParent GrandParentRound int64 // round of the grandParent ExecStateId string // speculated execution state }
msgp VoteInfo
func (VoteInfo) GetHashContent ¶
func (*VoteInfo) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler