package authority
import "go.dedis.ch/dela/core/ordering/cosipbft/authority"
Package authority defines the collective authority for cosipbft.
The package also contains an implementation of a roster and the related change set. A roster is a list of participants where each of them has an Mino address and a corresponding public key that supports aggregation for the collective signing.
Documentation Last Review: 13.10.2020
Index ¶
- func RegisterChangeSetFormat(c serde.Format, f serde.FormatEngine)
- func RegisterRosterFormat(c serde.Format, f serde.FormatEngine)
- type AddrKeyFac
- type Authority
- type ChangeSet
- type ChangeSetFactory
- type Factory
- type PubKeyFac
- type Roster
- func FromAuthority(authority crypto.CollectiveAuthority) Roster
- func New(addrs []mino.Address, pubkeys []crypto.PublicKey) Roster
- func (r Roster) AddressIterator() mino.AddressIterator
- func (r Roster) Apply(in ChangeSet) Authority
- func (r Roster) Diff(o Authority) ChangeSet
- func (r Roster) Fingerprint(w io.Writer) error
- func (r Roster) GetPublicKey(target mino.Address) (crypto.PublicKey, int)
- func (r Roster) Len() int
- func (r Roster) PublicKeyIterator() crypto.PublicKeyIterator
- func (r Roster) Serialize(ctx serde.Context) ([]byte, error)
- func (r Roster) Take(updaters ...mino.FilterUpdater) mino.Players
- type RosterChangeSet
- func NewChangeSet() *RosterChangeSet
- func (set *RosterChangeSet) Add(addr mino.Address, pubkey crypto.PublicKey)
- func (set *RosterChangeSet) GetNewAddresses() []mino.Address
- func (set *RosterChangeSet) GetPublicKeys() []crypto.PublicKey
- func (set *RosterChangeSet) GetRemoveIndices() []uint
- func (set *RosterChangeSet) NumChanges() int
- func (set *RosterChangeSet) Remove(index uint)
- func (set *RosterChangeSet) Serialize(ctx serde.Context) ([]byte, error)
- type SimpleChangeSetFactory
Functions ¶
func RegisterChangeSetFormat ¶
func RegisterChangeSetFormat(c serde.Format, f serde.FormatEngine)
RegisterChangeSetFormat registers the engine for the provided format.
func RegisterRosterFormat ¶
func RegisterRosterFormat(c serde.Format, f serde.FormatEngine)
RegisterRosterFormat registers the engine for the provided format.
Types ¶
type AddrKeyFac ¶
type AddrKeyFac struct{}
AddrKeyFac is the key for the address factory.
type Authority ¶
type Authority interface { serde.Message serde.Fingerprinter crypto.CollectiveAuthority // Apply must apply the change set to the collective authority. It should // first remove, then add the new players. Apply(ChangeSet) Authority // Diff should return the change set to apply to get the given authority. Diff(Authority) ChangeSet }
Authority is an extension of the collective authority to provide primitives to append new players to it.
type ChangeSet ¶
type ChangeSet interface { serde.Message // NumChanges returns the number of changes that will be applied with this // change set. NumChanges() int // GetNewAddresses returns the list of addresses for the new members. GetNewAddresses() []mino.Address }
ChangeSet is the return of a diff between two authorities.
type ChangeSetFactory ¶
type ChangeSetFactory interface { serde.Factory ChangeSetOf(serde.Context, []byte) (ChangeSet, error) }
ChangeSetFactory is the factory to deserialize change sets.
func NewChangeSetFactory ¶
func NewChangeSetFactory(af mino.AddressFactory, pkf crypto.PublicKeyFactory) ChangeSetFactory
NewChangeSetFactory returns a new change set factory.
type Factory ¶
Factory is the factory to deserialize authorities.
func NewFactory ¶
func NewFactory(af mino.AddressFactory, pf crypto.PublicKeyFactory) Factory
NewFactory creates a new instance of the authority factory.
type PubKeyFac ¶
type PubKeyFac struct{}
PubKeyFac is the key for the public key factory.
type Roster ¶
type Roster struct {
// contains filtered or unexported fields
}
Roster contains a list of participants with their addresses and public keys.
- implements authority.Authority
func FromAuthority ¶
func FromAuthority(authority crypto.CollectiveAuthority) Roster
FromAuthority returns a viewchange roster from a collective authority.
func New ¶
New creates a new roster from the list of addresses and public keys.
func (Roster) AddressIterator ¶
func (r Roster) AddressIterator() mino.AddressIterator
AddressIterator implements mino.Players. It returns an iterator of the addresses of the roster in a deterministic order.
func (Roster) Apply ¶
Apply implements authority.Authority. It returns a new authority after applying the change set. The removals must be sorted by descending order and unique or the behaviour will be undefined.
func (Roster) Diff ¶
Diff implements authority.Authority. It returns the change set that must be applied to the current authority to get the given one.
func (Roster) Fingerprint ¶
Fingerprint implements serde.Fingerprinter. It marshals the roster and writes the result in the given writer.
func (Roster) GetPublicKey ¶
GetPublicKey implements crypto.CollectiveAuthority. It returns the public key of the address if it exists, nil otherwise. The second return is the index of the public key in the authority.
func (Roster) Len ¶
Len implements mino.Players. It returns the length of the authority.
func (Roster) PublicKeyIterator ¶
func (r Roster) PublicKeyIterator() crypto.PublicKeyIterator
PublicKeyIterator implements crypto.CollectiveAuthority. It returns an iterator of the public keys of the roster in a deterministic order.
func (Roster) Serialize ¶
Serialize implements serde.Message. It returns the serialized data for this roster.
func (Roster) Take ¶
func (r Roster) Take(updaters ...mino.FilterUpdater) mino.Players
Take implements mino.Players. It returns a subset of the roster according to the filter.
type RosterChangeSet ¶
type RosterChangeSet struct {
// contains filtered or unexported fields
}
RosterChangeSet is the smallest data model to update an authority to another.
- implements authority.ChangeSet
func NewChangeSet ¶
func NewChangeSet() *RosterChangeSet
NewChangeSet creates a new empty change set.
func (*RosterChangeSet) Add ¶
func (set *RosterChangeSet) Add(addr mino.Address, pubkey crypto.PublicKey)
Add appends the address and the public key to the list of new participants.
func (*RosterChangeSet) GetNewAddresses ¶
func (set *RosterChangeSet) GetNewAddresses() []mino.Address
GetNewAddresses implements authority.ChangeSet. It returns the list of addresses of the new members.
func (*RosterChangeSet) GetPublicKeys ¶
func (set *RosterChangeSet) GetPublicKeys() []crypto.PublicKey
GetPublicKeys returns the list of public keys of the new participants.
func (*RosterChangeSet) GetRemoveIndices ¶
func (set *RosterChangeSet) GetRemoveIndices() []uint
GetRemoveIndices returns the list of indices to remove from the authority.
func (*RosterChangeSet) NumChanges ¶
func (set *RosterChangeSet) NumChanges() int
NumChanges implements authority.ChangeSet. It returns the number of changes that is applied with the change set.
func (*RosterChangeSet) Remove ¶
func (set *RosterChangeSet) Remove(index uint)
Remove appends the index to the list of removals.
func (*RosterChangeSet) Serialize ¶
func (set *RosterChangeSet) Serialize(ctx serde.Context) ([]byte, error)
Serialize implements serde.Message. It returns the serialized data for this change set.
type SimpleChangeSetFactory ¶
type SimpleChangeSetFactory struct {
// contains filtered or unexported fields
}
SimpleChangeSetFactory is a message factory to deserialize a change set.
- roster.ChangeSetFactory
func (SimpleChangeSetFactory) ChangeSetOf ¶
ChangeSetOf implements roster.ChangeSetFactory. It returns the change set from the data if appropriate, otherwise an error.
func (SimpleChangeSetFactory) Deserialize ¶
Deserialize implements serde.Factory. It returns the change set from the data if appropriate, otherwise an error.
Source Files ¶
authority.go changeset.go roster.go
Directories ¶
Path | Synopsis |
---|---|
core/ordering/cosipbft/authority/json |
- Version
- v0.1.0 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 1 month ago –
Tools for package owners.