emulator

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewDriver(t *testing.T, o ...gpbft.Option) *Driver

NewDriver instantiates a new Driver with the given GPBFT options. See Driver.StartInstance.

func (*Driver) AddInstance

func (d *Driver) AddInstance(instance *Instance)

AddInstance adds an instance to the list of instances known by the driver.

func (*Driver) RequireCommit

func (d *Driver) RequireCommit(round uint64, vote gpbft.ECChain, justification *gpbft.Justification)

func (*Driver) RequireCommitForBottom

func (d *Driver) RequireCommitForBottom(round uint64)

func (*Driver) RequireConverge

func (d *Driver) RequireConverge(round uint64, vote gpbft.ECChain, justification *gpbft.Justification)

func (*Driver) RequireDecide

func (d *Driver) RequireDecide(vote gpbft.ECChain, justification *gpbft.Justification)

func (*Driver) RequireDecision

func (d *Driver) RequireDecision(instanceID uint64, expect gpbft.ECChain)

func (*Driver) RequireDeliverAlarm

func (d *Driver) RequireDeliverAlarm()

func (*Driver) RequireDeliverMessage

func (d *Driver) RequireDeliverMessage(message *gpbft.GMessage)

func (*Driver) RequireErrOnDeliverMessage

func (d *Driver) RequireErrOnDeliverMessage(message *gpbft.GMessage, err error, contains string)

func (*Driver) RequireNoBroadcast

func (d *Driver) RequireNoBroadcast()

func (*Driver) RequirePrepare

func (d *Driver) RequirePrepare(value gpbft.ECChain)

func (*Driver) RequirePrepareAtRound

func (d *Driver) RequirePrepareAtRound(round uint64, value gpbft.ECChain, justification *gpbft.Justification)

func (*Driver) RequireQuality

func (d *Driver) RequireQuality()

func (*Driver) StartInstance

func (d *Driver) StartInstance(id uint64)

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.StartInstance.

func (*Instance) GetDecision

func (i *Instance) GetDecision() *gpbft.Justification

func (*Instance) ID

func (i *Instance) ID() uint64

func (*Instance) NewCommit

func (i *Instance) NewCommit(round uint64, proposal gpbft.ECChain) gpbft.Payload

func (*Instance) NewConverge

func (i *Instance) NewConverge(round uint64, proposal gpbft.ECChain) gpbft.Payload

func (*Instance) NewDecide

func (i *Instance) NewDecide(round uint64, proposal gpbft.ECChain) gpbft.Payload

func (*Instance) NewJustification

func (i *Instance) NewJustification(round uint64, step gpbft.Phase, vote gpbft.ECChain, from ...gpbft.ActorID) *gpbft.Justification

func (*Instance) NewMessageBuilder

func (i *Instance) NewMessageBuilder(payload gpbft.Payload, justification *gpbft.Justification, withTicket bool) *gpbft.MessageBuilder

func (*Instance) NewPayload

func (i *Instance) NewPayload(round uint64, step gpbft.Phase, value gpbft.ECChain) gpbft.Payload

func (*Instance) NewPrepare

func (i *Instance) NewPrepare(round uint64, proposal gpbft.ECChain) gpbft.Payload

func (*Instance) NewQuality

func (i *Instance) NewQuality(proposal gpbft.ECChain) gpbft.Payload

func (*Instance) PowerTable added in v0.0.4

func (i *Instance) PowerTable() *gpbft.PowerTable

func (*Instance) Proposal

func (i *Instance) Proposal() gpbft.ECChain

func (*Instance) SupplementalData

func (i *Instance) SupplementalData() gpbft.SupplementalData

Jump to

Keyboard shortcuts

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