Documentation ¶
Overview ¶
Package validator is a generated protocol buffer package.
It is generated from these files:
validator.proto
It has these top-level messages:
Validator
Index ¶
- Variables
- func Add(vs ReaderWriter, vsOther Iterable) error
- func AddPower(vs ReaderWriter, id crypto.PublicKey, power *big.Int) error
- func Alter(vs Alterer, vsOther Iterable) error
- func Subtract(vs ReaderWriter, vsOther Iterable) error
- func SubtractPower(vs ReaderWriter, id crypto.PublicKey, power *big.Int) error
- func Write(vs Writer, vsOther Iterable) error
- type Alterer
- type Bucket
- func (vc *Bucket) AlterPower(id crypto.PublicKey, power *big.Int) (*big.Int, error)
- func (vc *Bucket) CurrentSet() *Set
- func (vc *Bucket) Equal(vwOther *Bucket) error
- func (vc *Bucket) Power(id crypto.Address) (*big.Int, error)
- func (vc *Bucket) SetPower(id crypto.PublicKey, power *big.Int) error
- func (vc *Bucket) String() string
- type Cache
- type History
- type Iterable
- type IterableReader
- type IterableReaderWriter
- type Reader
- type ReaderWriter
- type Ring
- func (vc *Ring) AlterPower(id crypto.PublicKey, power *big.Int) (*big.Int, error)
- func (vc *Ring) CumulativePower() *Set
- func (vc *Ring) CurrentSet() *Set
- func (vc *Ring) Equal(vcOther *Ring) error
- func (vc *Ring) GetPower(id crypto.Address) *big.Int
- func (vc *Ring) Head() *Bucket
- func (vc *Ring) Next() *Bucket
- func (vc *Ring) OrderedBuckets() []*Bucket
- func (vc *Ring) Power(id crypto.Address) (*big.Int, error)
- func (vc *Ring) PreviousDelta(delay int) *Set
- func (vc *Ring) PreviousSet(delay int) *Set
- func (vc *Ring) ReIndex(newHead int)
- func (vc *Ring) Rotate() (totalPowerChange *big.Int, totalFlow *big.Int, err error)
- func (vc *Ring) SetPower(id crypto.PublicKey, power *big.Int) error
- func (vc *Ring) Size() int
- func (vc *Ring) String() string
- func (vc *Ring) ValidatorChanges(blocksAgo int) IterableReader
- func (vc *Ring) Validators(blocksAgo int) IterableReader
- type Set
- func (vs *Set) ChangePower(id crypto.PublicKey, power *big.Int) *big.Int
- func (vs *Set) CountNonZero() int
- func (vs *Set) Equal(vsOther *Set) error
- func (vs *Set) Flow(id crypto.PublicKey, power *big.Int) *big.Int
- func (vs *Set) Flush(output Writer, backend Reader) error
- func (vs *Set) GetPower(id crypto.Address) *big.Int
- func (vs *Set) IterateValidators(iter func(id crypto.Addressable, power *big.Int) error) error
- func (vs *Set) MaxFlow() *big.Int
- func (vs *Set) MaybePower(id crypto.Address) *big.Int
- func (vs *Set) Power(id crypto.Address) (*big.Int, error)
- func (vs *Set) SetPower(id crypto.PublicKey, power *big.Int) error
- func (vs *Set) Size() int
- func (vs *Set) String() string
- func (vs *Set) Strings() string
- func (vs *Set) TotalPower() *big.Int
- func (vs *Set) Validators() []*Validator
- type Validator
- func (v *Validator) BigPower() *big.Int
- func (*Validator) Descriptor() ([]byte, []int)
- func (v *Validator) Encode() ([]byte, error)
- func (v *Validator) FillAddress()
- func (v *Validator) GetAddress() crypto.Address
- func (m *Validator) GetPower() uint64
- func (m *Validator) GetPublicKey() crypto.PublicKey
- func (m *Validator) Marshal() (dAtA []byte, err error)
- func (m *Validator) MarshalTo(dAtA []byte) (int, error)
- func (*Validator) ProtoMessage()
- func (m *Validator) Reset()
- func (m *Validator) Size() (n int)
- func (v *Validator) String() string
- func (m *Validator) Unmarshal(dAtA []byte) error
- func (*Validator) XXX_MessageName() string
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthValidator = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowValidator = fmt.Errorf("proto: integer overflow") )
Functions ¶
func SubtractPower ¶
Types ¶
type Alterer ¶ added in v0.24.0
type Alterer interface { // AlterPower ensures that validator power would not change too quickly in a single block (unlike SetPower) which // merely checks values are sane. It returns the flow induced by the change in power. AlterPower(id crypto.PublicKey, power *big.Int) (flow *big.Int, err error) }
type Bucket ¶ added in v0.24.0
type Bucket struct { // Delta tracks the changes to validator power made since the previous rotation Delta *Set // Previous the value for all validator powers at the point of the last rotation // (the sum of all the deltas over all rotations) - these are the history of the complete validator sets at each rotation Previous *Set // Tracks the current working version of the next set; Previous + Delta Next *Set // Flow tracks the absolute value of all flows (difference between previous cum bucket and current delta) towards and away from each validator (tracking each validator separately to avoid double counting flows made against the same validator Flow *Set }
func (*Bucket) AlterPower ¶ added in v0.24.0
Updates the current head bucket (accumulator) whilst
func (*Bucket) CurrentSet ¶ added in v0.24.0
type Cache ¶ added in v0.24.0
type Cache struct {
*Bucket
}
Cache is just a Ring with no memory
type History ¶ added in v0.24.0
type History interface { ValidatorChanges(blocksAgo int) IterableReader Validators(blocksAgo int) IterableReader }
type IterableReader ¶
type IterableReaderWriter ¶
type IterableReaderWriter interface { ReaderWriter Iterable }
type ReaderWriter ¶
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
func (*Ring) AlterPower ¶
Updates the current head bucket (accumulator) whilst
func (*Ring) CumulativePower ¶ added in v0.24.0
Get the sum of all powers added in any bucket
func (*Ring) CurrentSet ¶
func (*Ring) OrderedBuckets ¶
Returns buckets in order head, previous, ...
func (*Ring) Power ¶
Implement Reader Get power at index from the delta bucket then falling through to the cumulative
func (*Ring) PreviousDelta ¶ added in v0.24.0
func (*Ring) PreviousSet ¶
func (*Ring) Rotate ¶
Advance the current head bucket to the next bucket and returns the change in total power between the previous bucket and the current head, and the total flow which is the sum of absolute values of all changes each validator's power after rotation the next head is a copy of the current head
func (*Ring) Size ¶
Get the number of buckets in the ring (use Current().Count() to get the current number of validators)
func (*Ring) ValidatorChanges ¶ added in v0.24.0
func (vc *Ring) ValidatorChanges(blocksAgo int) IterableReader
func (*Ring) Validators ¶ added in v0.24.0
func (vc *Ring) Validators(blocksAgo int) IterableReader
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
A Validator multiset - can be used to capture the global state of validators or as an accumulator each block
func Copy ¶
Copy each of iterable in vss into a new Set - note any iterations errors thrown by the iterable itself will be swallowed Use Write instead if source iterables may error
func Diff ¶ added in v0.24.0
func Diff(before, after IterableReader) (*Set, error)
Returns the asymmetric difference, diff, between two Sets such that applying diff to before results in after
func NewSet ¶
func NewSet() *Set
Create a new Validators which can act as an accumulator for validator power changes
func NewTrimSet ¶
func NewTrimSet() *Set
Like Set but removes entries when power is set to 0 this make Count() == CountNonZero() and prevents a set from leaking but does mean that a zero will not be iterated over when performing an update which is necessary in Ring
func UnpersistSet ¶
func (*Set) ChangePower ¶
Add the power of a validator and returns the flow into that validator
func (*Set) CountNonZero ¶
func (*Set) Equal ¶
Returns an error if the Sets are not equal describing which part of their structures differ
func (*Set) Flow ¶ added in v0.24.0
Returns the flow that would be induced by a validator power change
func (*Set) IterateValidators ¶ added in v0.24.0
Iterates over validators sorted by address
func (*Set) MaxFlow ¶ added in v0.24.0
Returns the maximum allowable flow whilst ensuring the majority of validators are non-byzantine after the transition So need at most ceiling((Total Power)/3) - 1, in integer division we have ceiling(X*p/q) = (p(X+1)-1)/q For p = 1 just X/q so we want (Total Power)/3 - 1
func (*Set) MaybePower ¶
Returns the power of id but only if it is set
func (*Set) TotalPower ¶
func (*Set) Validators ¶
type Validator ¶
type Validator struct { Address *github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address,omitempty"` PublicKey crypto.PublicKey `protobuf:"bytes,2,opt,name=PublicKey" json:"PublicKey"` Power uint64 `protobuf:"varint,3,opt,name=Power,proto3" json:"Power,omitempty"` }
func (*Validator) Descriptor ¶
func (*Validator) FillAddress ¶
func (v *Validator) FillAddress()
func (*Validator) GetAddress ¶ added in v0.24.0
func (*Validator) GetPublicKey ¶
func (*Validator) ProtoMessage ¶
func (*Validator) ProtoMessage()