Documentation ¶
Index ¶
- func MaxUint64(a, b uint64) uint64
- func MinUint64(a, b uint64) uint64
- func RandBool() bool
- func RandBytes(n int) []byte
- func RandFloat32() float32
- func RandFloat64() float64
- func RandInt() int
- func RandInt16() int16
- func RandInt31() int32
- func RandInt31n(n int32) int32
- func RandInt32() int32
- func RandInt63() int64
- func RandInt63n(n int64) int64
- func RandInt64() int64
- func RandIntn(n int) int
- func RandPerm(n int) []int
- func RandStr(length int) string
- func RandTime() time.Time
- func RandUint() uint
- func RandUint16() uint16
- func RandUint32() uint32
- func RandUint64() uint64
- func Seed(seed int64)
- type BitArray
- func (bA *BitArray) And(o *BitArray) *BitArray
- func (bA *BitArray) Bytes() []byte
- func (bA *BitArray) Copy() *BitArray
- func (bA *BitArray) GetIndex(i int) bool
- func (bA *BitArray) IsEmpty() bool
- func (bA *BitArray) IsFull() bool
- func (bA *BitArray) MarshalJSON() ([]byte, error)
- func (bA *BitArray) Not() *BitArray
- func (bA *BitArray) Or(o *BitArray) *BitArray
- func (bA *BitArray) PickRandom() (int, bool)
- func (bA *BitArray) SetIndex(i int, v bool) bool
- func (bA *BitArray) Size() uint64
- func (bA *BitArray) String() string
- func (bA *BitArray) StringIndented(indent string) string
- func (bA *BitArray) Sub(o *BitArray) *BitArray
- func (bA *BitArray) UnmarshalJSON(bz []byte) error
- func (bA *BitArray) Update(o *BitArray)
- type CsBftMsgType
- type FetchBlockReqDecodeMsg
- type FetchBlockRespDecodeMsg
- type NewRoundMsg
- type Proposal
- type Rand
- func (r *Rand) Bool() bool
- func (r *Rand) Bytes(n int) []byte
- func (r *Rand) Float32() float32
- func (r *Rand) Float64() float64
- func (r *Rand) Int() int
- func (r *Rand) Int16() int16
- func (r *Rand) Int31() int32
- func (r *Rand) Int31n(n int32) int32
- func (r *Rand) Int32() int32
- func (r *Rand) Int63() int64
- func (r *Rand) Int63n(n int64) int64
- func (r *Rand) Int64() int64
- func (r *Rand) Intn(n int) int
- func (r *Rand) Perm(n int) []int
- func (r *Rand) Seed(seed int64)
- func (r *Rand) Str(length int) string
- func (r *Rand) Time() time.Time
- func (r *Rand) Uint() uint
- func (r *Rand) Uint16() uint16
- func (r *Rand) Uint32() uint32
- func (r *Rand) Uint64() uint64
- type ReqRoundMsg
- type RoundStepType
- type SignHashFunc
- type VerifyResult
- type VerifyResultRlp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandFloat32 ¶
func RandFloat32() float32
func RandFloat64 ¶
func RandFloat64() float64
func RandInt31n ¶
func RandInt63n ¶
func RandUint16 ¶
func RandUint16() uint16
func RandUint32 ¶
func RandUint32() uint32
func RandUint64 ¶
func RandUint64() uint64
Types ¶
type BitArray ¶
type BitArray struct { Bits uint64 `json:"bits"` // NOTE: persisted via reflect, must be exported Elems []uint64 `json:"elems"` // NOTE: persisted via reflect, must be exported // contains filtered or unexported fields }
func NewBitArray ¶
There is no BitArray whose Size is 0. Use nil instead.
func (*BitArray) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface by marshaling bit array using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit.
func (*BitArray) PickRandom ¶
func (*BitArray) String ¶
String returns a string representation of BitArray: BA{<bit-string>}, where <bit-string> is a sequence of 'x' (1) and '_' (0). The <bit-string> includes spaces and newlines to help people. For a simple sequence of 'x' and '_' characters with no spaces or newlines, see the MarshalJSON() method. Example: "BA{_x_}" or "nil-BitArray" for nil.
func (*BitArray) StringIndented ¶
func (*BitArray) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface by unmarshaling a custom JSON description.
type CsBftMsgType ¶
type CsBftMsgType uint64
const ( TypeOfNewRoundMsg CsBftMsgType = 0x101 TypeOfProposalMsg CsBftMsgType = 0x102 TypeOfPreVoteMsg CsBftMsgType = 0x103 TypeOfVoteMsg CsBftMsgType = 0x104 TypeOfFetchBlockReqMsg CsBftMsgType = 0x110 TypeOfFetchBlockRespMsg CsBftMsgType = 0x111 TypeOfSyncBlockMsg CsBftMsgType = 0x112 TypeOfReqNewRoundMsg CsBftMsgType = 0x113 )
func (CsBftMsgType) String ¶
func (i CsBftMsgType) String() string
type FetchBlockReqDecodeMsg ¶
type FetchBlockRespDecodeMsg ¶
type NewRoundMsg ¶
func NewRoundMsgWithSign ¶
func NewRoundMsgWithSign(height uint64, round uint64, signer SignHashFunc, addr common.Address) *NewRoundMsg
func (NewRoundMsg) Hash ¶
func (r NewRoundMsg) Hash() common.Hash
func (NewRoundMsg) Valid ¶
func (r NewRoundMsg) Valid() error
type Proposal ¶
type Proposal struct { Height uint64 Round uint64 BlockID common.Hash Timestamp time.Time Witness *model.WitMsg }
func NewProposalWithSign ¶
func (Proposal) ValidBlock ¶
func (p Proposal) ValidBlock(b model.AbstractBlock) error
type Rand ¶
Rand is a prng, that is seeded with OS randomness. The OS randomness is obtained from crypto/rand, however none of the provided methods are suitable for cryptographic usage. They all utilize math/rand's prng internally.
All of the methods here are suitable for concurrent use. This is achieved by using a mutex lock on all of the provided methods.
func (*Rand) Intn ¶
Intn returns, as an int, a uniform pseudo-random number in the range [0, n). It panics if n <= 0.
type ReqRoundMsg ¶
type RoundStepType ¶
type RoundStepType int
const ( RoundStepNewHeight RoundStepType = iota RoundStepNewRound RoundStepPropose RoundStepPreVote RoundStepPreCommit )
func (RoundStepType) String ¶
func (i RoundStepType) String() string
type SignHashFunc ¶
type VerifyResult ¶
type VerifyResult struct { Block model.AbstractBlock SeenCommits []model.AbstractVerification }