protocol

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: Apache-2.0, BSD-2-Clause Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const DatabaseVersion database.Version = 1

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		InvalidBlockReceived:     event.New1[identity.ID](),
		CandidateEngineActivated: event.New1[*engine.Engine](),
		MainEngineSwitched:       event.New1[*engine.Engine](),
		Error:                    event.New1[error](),

		Network:           network.NewEvents(),
		Engine:            engine.NewEvents(),
		CongestionControl: congestioncontrol.NewEvents(),
		TipManager:        tipmanager.NewEvents(),
		ChainManager:      chainmanager.NewEvents(),
	}
})

Functions

func WithBaseDirectory

func WithBaseDirectory(baseDirectory string) options.Option[Protocol]

func WithChainManagerOptions

func WithChainManagerOptions(opts ...options.Option[chainmanager.Manager]) options.Option[Protocol]

func WithConsensusProvider

func WithConsensusProvider(consensusProvider module.Provider[*engine.Engine, consensus.Consensus]) options.Option[Protocol]

func WithEngineOptions

func WithEngineOptions(opts ...options.Option[engine.Engine]) options.Option[Protocol]

func WithFilterProvider

func WithFilterProvider(optsFilterProvider module.Provider[*engine.Engine, filter.Filter]) options.Option[Protocol]

func WithLedgerProvider

func WithLedgerProvider(optsLedgerProvider module.Provider[*engine.Engine, ledger.Ledger]) options.Option[Protocol]

func WithMeshProvider

func WithMeshProvider(meshProvider module.Provider[*engine.Engine, mesh.Mesh]) options.Option[Protocol]

func WithNotarizationProvider

func WithNotarizationProvider(notarizationProvider module.Provider[*engine.Engine, notarization.Notarization]) options.Option[Protocol]

func WithProtocolOptions

func WithProtocolOptions(opts ...options.Option[Protocol]) options.Option[TestFramework]

func WithPruningThreshold

func WithPruningThreshold(pruningThreshold uint64) options.Option[Protocol]

func WithSnapshotPath

func WithSnapshotPath(snapshot string) options.Option[Protocol]

func WithStorageDatabaseManagerOptions

func WithStorageDatabaseManagerOptions(opts ...options.Option[database.Manager]) options.Option[Protocol]

func WithSybilProtectionProvider

func WithSybilProtectionProvider(sybilProtectionProvider module.Provider[*engine.Engine, sybilprotection.SybilProtection]) options.Option[Protocol]

func WithThroughputQuotaProvider

func WithThroughputQuotaProvider(throughputQuotaProvider module.Provider[*engine.Engine, throughputquota.ThroughputQuota]) options.Option[Protocol]

func WithTipManagerOptions

func WithTipManagerOptions(opts ...options.Option[tipmanager.TipManager]) options.Option[Protocol]

Types

type Events

type Events struct {
	InvalidBlockReceived     *event.Event1[identity.ID]
	CandidateEngineActivated *event.Event1[*engine.Engine]
	MainEngineSwitched       *event.Event1[*engine.Engine]
	Error                    *event.Event1[error]

	Network           *network.Events
	Engine            *engine.Events
	CongestionControl *congestioncontrol.Events
	TipManager        *tipmanager.Events
	ChainManager      *chainmanager.Events

	event.Group[Events, *Events]
}

type Protocol

type Protocol struct {
	Events            *Events
	CongestionControl *congestioncontrol.CongestionControl
	TipManager        *tipmanager.TipManager

	Workers *workerpool.Group
	// contains filtered or unexported fields
}

func New

func New(workers *workerpool.Group, dispatcher network.Endpoint, opts ...options.Option[Protocol]) (protocol *Protocol)

func (*Protocol) CandidateEngineInstance

func (p *Protocol) CandidateEngineInstance() (instance *engine.Engine)

func (*Protocol) ChainManager

func (p *Protocol) ChainManager() (instance *chainmanager.Manager)

func (*Protocol) Engine

func (p *Protocol) Engine() *engine.Engine

func (*Protocol) MainEngineInstance

func (p *Protocol) MainEngineInstance() *engine.Engine

func (*Protocol) Network

func (p *Protocol) Network() *network.Protocol

func (*Protocol) ProcessAttestations

func (p *Protocol) ProcessAttestations(forkingPoint *commitment.Commitment, blockIDs models.BlockIDs, attestations *orderedmap.OrderedMap[slot.Index, *advancedset.AdvancedSet[*notarization.Attestation]], source identity.ID)

func (*Protocol) ProcessAttestationsRequest

func (p *Protocol) ProcessAttestationsRequest(forkingPoint *commitment.Commitment, endIndex slot.Index, src identity.ID)

func (*Protocol) ProcessBlock

func (p *Protocol) ProcessBlock(block *models.Block, src identity.ID) error

func (*Protocol) Run

func (p *Protocol) Run()

Run runs the protocol.

func (*Protocol) Shutdown

func (p *Protocol) Shutdown()

func (*Protocol) SlotTimeProvider

func (p *Protocol) SlotTimeProvider() *slot.TimeProvider

type TestFramework

type TestFramework struct {
	Network  *network.MockedNetwork
	Instance *Protocol
	Local    *identity.Identity

	Engine *engine.TestFramework
	// contains filtered or unexported fields
}

func NewTestFramework

func NewTestFramework(test *testing.T, workers *workerpool.Group, ledgerVM vm.VM, opts ...options.Option[TestFramework]) *TestFramework

Jump to

Keyboard shortcuts

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