Documentation ¶
Index ¶
- Variables
- type Driver
- func (d *Driver) AddInstance(instance *Instance)
- func (d *Driver) DeliverAlarm() (bool, error)
- func (d *Driver) PeekLastBroadcastRequest() *gpbft.GMessage
- func (d *Driver) RequireCommit(round uint64, vote gpbft.ECChain, justification *gpbft.Justification)
- func (d *Driver) RequireCommitForBottom(round uint64)
- func (d *Driver) RequireConverge(round uint64, vote gpbft.ECChain, justification *gpbft.Justification)
- func (d *Driver) RequireDecide(vote gpbft.ECChain, justification *gpbft.Justification)
- func (d *Driver) RequireDecision(instanceID uint64, expect gpbft.ECChain)
- func (d *Driver) RequireDeliverAlarm()
- func (d *Driver) RequireDeliverMessage(message *gpbft.GMessage)
- func (d *Driver) RequireErrOnDeliverMessage(message *gpbft.GMessage, err error, contains string)
- func (d *Driver) RequireNoBroadcast()
- func (d *Driver) RequirePeekAtLastVote(phase gpbft.Phase, round uint64, vote gpbft.ECChain)
- func (d *Driver) RequirePrepare(value gpbft.ECChain)
- func (d *Driver) RequirePrepareAtRound(round uint64, value gpbft.ECChain, justification *gpbft.Justification)
- func (d *Driver) RequireQuality()
- func (d *Driver) RequireStartInstance(id uint64)
- func (d *Driver) SetSigning(signing Signing)
- func (d *Driver) StartInstance(id uint64) error
- type Instance
- func (i *Instance) GetDecision() *gpbft.Justification
- func (i *Instance) ID() uint64
- func (i *Instance) NewCommit(round uint64, proposal gpbft.ECChain) gpbft.Payload
- func (i *Instance) NewConverge(round uint64, proposal gpbft.ECChain) gpbft.Payload
- func (i *Instance) NewDecide(round uint64, proposal gpbft.ECChain) gpbft.Payload
- func (i *Instance) NewJustification(round uint64, phase gpbft.Phase, vote gpbft.ECChain, from ...gpbft.ActorID) *gpbft.Justification
- func (i *Instance) NewJustificationWithPayload(payload gpbft.Payload, from ...gpbft.ActorID) *gpbft.Justification
- func (i *Instance) NewMessageBuilder(payload gpbft.Payload, justification *gpbft.Justification, withTicket bool) *gpbft.MessageBuilder
- func (i *Instance) NewPayload(round uint64, phase gpbft.Phase, value gpbft.ECChain) gpbft.Payload
- func (i *Instance) NewPrepare(round uint64, proposal gpbft.ECChain) gpbft.Payload
- func (i *Instance) NewQuality(proposal gpbft.ECChain) gpbft.Payload
- func (i *Instance) PowerTable() *gpbft.PowerTable
- func (i *Instance) Proposal() gpbft.ECChain
- func (i *Instance) SetSigning(signing Signing)
- func (i *Instance) SupplementalData() gpbft.SupplementalData
- type MessageCache
- type Signing
Constants ¶
This section is empty.
Variables ¶
var ValidTicket gpbft.Ticket = []byte("filled in by driver")
ValidTicket is a sentinel value to generate and set a valid gpbft.Ticket when delivering messages via Driver.deliverMessage.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver drives the emulation of a GPBFT instance for one honest participant, and allows frame-by-frame control over progress of a GPBFT instance.
func NewDriver ¶
NewDriver instantiates a new Driver with the given GPBFT options. See Driver.RequireStartInstance.
func (*Driver) AddInstance ¶
AddInstance adds an instance to the list of instances known by the driver.
func (*Driver) DeliverAlarm ¶ added in v0.3.0
func (*Driver) PeekLastBroadcastRequest ¶ added in v0.3.0
PeekLastBroadcastRequest gets the last broadcast requested by the subject participant without removing it from the pending broadcasts.
func (*Driver) RequireCommit ¶
func (*Driver) RequireCommitForBottom ¶
func (*Driver) RequireConverge ¶
func (*Driver) RequireDecide ¶
func (d *Driver) RequireDecide(vote gpbft.ECChain, justification *gpbft.Justification)
func (*Driver) RequireDecision ¶
func (*Driver) RequireDeliverAlarm ¶
func (d *Driver) RequireDeliverAlarm()
func (*Driver) RequireDeliverMessage ¶
func (*Driver) RequireErrOnDeliverMessage ¶
func (*Driver) RequireNoBroadcast ¶
func (d *Driver) RequireNoBroadcast()
func (*Driver) RequirePeekAtLastVote ¶ added in v0.3.0
RequirePeekAtLastVote asserts that the last message broadcasted by the subject participant was for the given phase, round and vote.
func (*Driver) RequirePrepare ¶
func (*Driver) RequirePrepareAtRound ¶
func (*Driver) RequireQuality ¶
func (d *Driver) RequireQuality()
func (*Driver) RequireStartInstance ¶ added in v0.3.0
RequireStartInstance asserts that instance with the given ID is started. See StartInstance.
func (*Driver) SetSigning ¶ added in v0.3.0
func (*Driver) StartInstance ¶
StartInstance sets the current instances and starts emulation for it by signalling the start of instance to the emulated honest gpbft.Participant.
See NewInstance.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance represents a GPBFT instance capturing all the information necessary for GPBFT to function, along with the final decision reached if any.
func NewInstance ¶
func NewInstance(t *testing.T, id uint64, powerEntries gpbft.PowerEntries, proposal ...gpbft.TipSet) *Instance
NewInstance instantiates a new Instance for emulation. If absent, the constructor will implicitly generate any missing but required values such as public keys Power Table CID, etc. for the given params. The given proposal must contain at least one tipset.
See Driver.RequireStartInstance.
func (*Instance) GetDecision ¶
func (i *Instance) GetDecision() *gpbft.Justification
func (*Instance) NewConverge ¶
func (*Instance) NewJustification ¶
func (*Instance) NewJustificationWithPayload ¶ added in v0.3.0
func (*Instance) NewMessageBuilder ¶
func (i *Instance) NewMessageBuilder(payload gpbft.Payload, justification *gpbft.Justification, withTicket bool) *gpbft.MessageBuilder
func (*Instance) NewPayload ¶
func (*Instance) NewPrepare ¶
func (*Instance) PowerTable ¶ added in v0.0.4
func (i *Instance) PowerTable() *gpbft.PowerTable
func (*Instance) SetSigning ¶ added in v0.3.0
func (*Instance) SupplementalData ¶
func (i *Instance) SupplementalData() gpbft.SupplementalData
type MessageCache ¶ added in v0.5.0
MessageCache is a repository of messages keyed by their instance, round and phase. This cache is used for testing purposes only and has no eviction strategy. It is primarily used to store messages from self for rebroadcast.
func NewMessageCache ¶ added in v0.5.0
func NewMessageCache() MessageCache
func (MessageCache) PutIfAbsent ¶ added in v0.5.0
func (mc MessageCache) PutIfAbsent(msg *gpbft.GMessage) bool
type Signing ¶ added in v0.3.0
func AdhocSigning ¶ added in v0.3.0
func AdhocSigning() Signing
AdhocSigning marshals, signs and verifies messages on behalf of any given public key but uniquely and deterministically so using crc32 hash function for performance. This implementation is not secure nor collision resistant. A typical Instance power table is small enough to make the risk of collisions negligible.
func ErroneousSigning ¶ added in v0.3.0
func ErroneousSigning() Signing
ErroneousSigning returns an error for every Signing API that can return an error.
func PanicSigning ¶ added in v0.3.0
func PanicSigning() Signing
PanicSigning panics for every Signing API.