agreement

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2019 License: MIT Imports: 20 Imported by: 0

README

Agreement

During the conduction of a technical analysis of sortition based consensus algorithms, the team has discovered a vulnerability, which increases the probability of a the consensus forking, dubbed a timeout fork. As a result, the team has concluded that SBA requires an additional step in the inner loop to guarantee statistical finality under the basic assumptions of the protocol.

Block Agreement is an asynchronous algorithm running in parallel with the inner loop. Successful termination of the algorithm indicates that the relevant inner loop has been successfully executed and the protocol can proceed to the next loop. The algorithm provides a statistical guarantee that at least one honest node has received a set of votes exceeding the minimum threshold required to successfully terminate the respective phase of the protocol.

Values

Block Agreement Event
Field Type
round uint64
step uint64
blockhash uint256
blockhashaggregatesig uint256
publickeyset uint64

API

  • Launch(eventbus, committee, keys, round) - Launches a Block Agreement broker

Architecture

The Block Agreement component follows the event driven paradigm. It is connected to the node's EventBus through a broker, and it delegates event-specific operations to its EventHandler implementation.

Like all the other consensus components, collection of the events and their marshalling/unmarshalling is delegated to an EventFilter.

Block Agreement Diagram

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Launch

func Launch(eventBroker wire.EventBroker, c committee.Foldable, keys user.Keys)

Launch is a helper to minimize the wiring of TopicListeners, collector and channels. The agreement component notarizes the new blocks after having collected a quorum of votes

func MarshalStepVotes

func MarshalStepVotes(r *bytes.Buffer, vote *StepVotes) error

MarshalStepVotes marshals the aggregated form of the BLS PublicKey and Signature for an ordered set of votes

func MarshalVotes

func MarshalVotes(r *bytes.Buffer, votes []*StepVotes) error

MarshalVotes marshals an array of StepVotes

func MockAgreement

func MockAgreement(hash []byte, round uint64, step uint8, keys []user.Keys) *bytes.Buffer

MockAgreement mocks an Agreement event, and returns the marshalled representation of it as a `*bytes.Buffer`. NOTE: it does not include the topic

func MockCommittee

func MockCommittee(quorum int, isMember bool, membersNr int) (*mocks.Foldable, []user.Keys)

MockCommittee mocks a Foldable committee implementation, which can be used for testing the Agreement component.

func ReconstructApk

func ReconstructApk(subcommittee sortedset.Set) (*bls.Apk, error)

ReconstructApk reconstructs an aggregated BLS public key from a subcommittee.

func Sign

func Sign(a *Agreement, keys user.Keys) error

Sign signs an aggregated agreement event

func UnmarshalVotes

func UnmarshalVotes(r *bytes.Buffer, votes *[]*StepVotes) error

UnmarshalVotes unmarshals the array of StepVotes for a single Agreement

func VerifySignatures

func VerifySignatures(round uint64, step uint8, blockHash []byte, apk *bls.Apk, sig *bls.Signature) error

Types

type Agreement

type Agreement struct {
	*header.Header
	SignedVotes  []byte
	VotesPerStep []*StepVotes
}

Agreement is the Event created at the end of the Reduction process. It includes the aggregated compressed signatures of all voters

func MockAgreementEvent

func MockAgreementEvent(hash []byte, round uint64, step uint8, keys []user.Keys) *Agreement

MockAgreementEvent returns a mocked Agreement Event, to be used for testing purposes.

func New

func New() *Agreement

New returns an empty Agreement event.

type StepVotes

type StepVotes struct {
	Apk       *bls.Apk
	BitSet    uint64
	Signature *bls.Signature
	Step      uint8
}

StepVotes represents the aggregated votes for one reduction step. Normally an Agreement event includes two of these structures. They need to be kept separated since the BitSet representation of the Signees does not admit duplicates, whereas the same provisioner may very well be included in the committee for both Reduction steps

func GenVotes

func GenVotes(hash []byte, round uint64, step uint8, keys []user.Keys) []*StepVotes

func NewStepVotes

func NewStepVotes() *StepVotes

NewStepVotes returns a new StepVotes structure for a given round, step and block hash

func UnmarshalStepVotes

func UnmarshalStepVotes(r *bytes.Buffer) (*StepVotes, error)

UnmarshalStepVotes unmarshals a single StepVote

func (*StepVotes) Add

func (sv *StepVotes) Add(signature, sender []byte, step uint8) error

Add a vote to the StepVotes struct.

func (*StepVotes) Equal

func (sv *StepVotes) Equal(other *StepVotes) bool

Equal checks if two StepVotes structs are the same.

type UnMarshaller

UnMarshaller marshals and unmarshals Agreement events.

func NewUnMarshaller

func NewUnMarshaller() *UnMarshaller

NewUnMarshaller returns an initialized UnMarshaller.

func (*UnMarshaller) Deserialize

func (au *UnMarshaller) Deserialize(r *bytes.Buffer) (wire.Event, error)

Deserialize an Agreement event from a buffer to its struct representation.

func (*UnMarshaller) Marshal

func (au *UnMarshaller) Marshal(r *bytes.Buffer, ev wire.Event) error

Marshal an Agreement event into a buffer.

func (*UnMarshaller) Unmarshal

func (au *UnMarshaller) Unmarshal(r *bytes.Buffer, ev wire.Event) error

Unmarshal unmarshals the buffer into an Agreement Field order is the following: * Header [BLS Public Key; Round; Step] * Agreement [Signed Vote Set; Vote Set; BlockHash]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL