manifest

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0, MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestPubSubTopicName = "/f3/manifests/0.0.2"
View Source
const VersionCapability = 4

Variables

View Source
var (
	DefaultCommitteeLookback uint64 = 10

	// Default configuration for the EC Backend
	DefaultEcConfig = EcConfig{
		Finality:        20,
		Period:          30 * time.Second,
		DelayMultiplier: 2.,

		BaseDecisionBackoffTable: []float64{1.3, 1.69, 2.2, 2.86, 3.71, 4.83, 6.27, 7.5},
		HeadLookback:             0,
		Finalize:                 true,
	}

	DefaultGpbftConfig = GpbftConfig{
		Delta:                      6 * time.Second,
		DeltaBackOffExponent:       2.0,
		MaxLookaheadRounds:         5,
		RebroadcastBackoffBase:     6 * time.Second,
		RebroadcastBackoffSpread:   0.1,
		RebroadcastBackoffExponent: 1.3,
		RebroadcastBackoffMax:      60 * time.Second,
	}

	DefaultCxConfig = CxConfig{
		ClientRequestTimeout: 10 * time.Second,
		ServerRequestTimeout: time.Minute,
		MinimumPollInterval:  DefaultEcConfig.Period,
		MaximumPollInterval:  4 * DefaultEcConfig.Period,
	}

	// Default instance alignment when catching up.
	DefaultCatchUpAlignment = DefaultEcConfig.Period / 2
)

Functions

func DynamicManifestProviderWithDatastore

func DynamicManifestProviderWithDatastore(ds datastore.Datastore) func(cfg *dynamicManifestProviderConfig) error

DynamicManifestProviderWithDatastore specifies the datastore in which to store/retrieve received dynamic manifest updates. If unspecified, no state is persisted.

func DynamicManifestProviderWithFilter

func DynamicManifestProviderWithFilter(filter func(*Manifest) error) func(cfg *dynamicManifestProviderConfig) error

DynamicManifestProviderWithFilter specifies a filter for incoming manifests.

func DynamicManifestProviderWithInitialManifest

func DynamicManifestProviderWithInitialManifest(m *Manifest) func(cfg *dynamicManifestProviderConfig) error

DynamicManifestProviderWithInitialManifest specifies the initial manifest to use (unless one is available in the datastore).

func PubSubTopicFromNetworkName

func PubSubTopicFromNetworkName(nn gpbft.NetworkName) string

Types

type CxConfig

type CxConfig struct {
	// Request timeout for the certificate exchange client.
	ClientRequestTimeout time.Duration
	// Request timeout for the certificate exchange server.
	ServerRequestTimeout time.Duration
	// Minimum CX polling interval.
	MinimumPollInterval time.Duration
	// Maximum CX polling interval.
	MaximumPollInterval time.Duration
}

Certificate Exchange config

func (*CxConfig) Validate

func (c *CxConfig) Validate() error

type DynamicManifestProvider

type DynamicManifestProvider struct {
	// contains filtered or unexported fields
}

DynamicManifestProvider is a manifest provider that allows the manifest to be changed at runtime.

func NewDynamicManifestProvider

func NewDynamicManifestProvider(pubsub *pubsub.PubSub, manifestServerID peer.ID,
	options ...DynamicManifestProviderOption) (*DynamicManifestProvider, error)

func (*DynamicManifestProvider) ManifestUpdates

func (m *DynamicManifestProvider) ManifestUpdates() <-chan *Manifest

func (*DynamicManifestProvider) Start

func (m *DynamicManifestProvider) Start(startCtx context.Context) error

func (*DynamicManifestProvider) Stop

type DynamicManifestProviderOption

type DynamicManifestProviderOption func(cfg *dynamicManifestProviderConfig) error

type EcConfig

type EcConfig struct {
	// The delay between tipsets.
	Period time.Duration
	// Number of epochs required to reach EC defined finality
	Finality int64
	// The multiplier on top of the Period of the time we will wait before starting a new instance,
	// referencing the timestamp of the latest finalized tipset.
	DelayMultiplier float64
	// Table of incremental multipliers to backoff in units of Delay in case of base decisions
	BaseDecisionBackoffTable []float64
	// HeadLookback number of unfinalized tipsets to remove from the head
	HeadLookback int
	// Finalize indicates whether or not F3 should finalize tipsets as F3 agrees on them.
	Finalize bool
}

func (*EcConfig) Equal

func (e *EcConfig) Equal(o *EcConfig) bool

func (*EcConfig) Validate

func (e *EcConfig) Validate() error

type FusingManifestProvider

type FusingManifestProvider struct {
	// contains filtered or unexported fields
}

FusingManifestProvider is a ManifestProvider that starts by providing dynamic manifest updates then switches to a static manifest when we get within finality of said manifest's bootstrap epoch.

func NewFusingManifestProvider

func NewFusingManifestProvider(ctx context.Context, ec HeadGetter, dynamic ManifestProvider, static *Manifest) (*FusingManifestProvider, error)

func (*FusingManifestProvider) ManifestUpdates

func (m *FusingManifestProvider) ManifestUpdates() <-chan *Manifest

func (*FusingManifestProvider) Start

func (*FusingManifestProvider) Stop

type GpbftConfig

type GpbftConfig struct {
	Delta                time.Duration
	DeltaBackOffExponent float64
	MaxLookaheadRounds   uint64

	RebroadcastBackoffBase     time.Duration
	RebroadcastBackoffExponent float64
	RebroadcastBackoffSpread   float64
	RebroadcastBackoffMax      time.Duration
}

func (*GpbftConfig) ToOptions

func (g *GpbftConfig) ToOptions() []gpbft.Option

func (*GpbftConfig) Validate

func (g *GpbftConfig) Validate() error

type HeadGetter

type HeadGetter interface {
	GetHead(context.Context) (ec.TipSet, error)
}

HeadGetter is the minimal subset of ec.Backend required by the FusingManifestProvider.

type Manifest

type Manifest struct {
	// Pause stops the participation in F3.
	Pause bool
	// ProtocolVersion specifies protocol version to be used
	ProtocolVersion uint64
	// Initial instance to used for the f3 instance
	InitialInstance uint64
	// BootstrapEpoch from which the manifest should be applied
	BootstrapEpoch int64
	// Network name to apply for this manifest.
	NetworkName gpbft.NetworkName
	// Updates to perform over the power table from EC (by replacement). Any entries with 0
	// power will disable the participant.
	ExplicitPower gpbft.PowerEntries
	// Ignore the power table from EC.
	IgnoreECPower bool
	// InitialPowerTable specifies the optional CID of the initial power table
	InitialPowerTable cid.Cid // !Defined() if nil
	// We take the current power table from the head tipset this many instances ago.
	CommitteeLookback uint64
	// The alignment of instances while catching up. This should be slightly larger than the
	// expected time to complete an instance.
	//
	// A good default is `4 * Manifest.Gpbft.Delta` (the expected time for a single-round
	// instance).
	CatchUpAlignment time.Duration
	// Config parameters for gpbft
	Gpbft GpbftConfig
	// EC-specific parameters
	EC EcConfig
	// Certificate Exchange specific parameters
	CertificateExchange CxConfig
}

Manifest identifies the specific configuration for the F3 instance currently running.

func LocalDevnetManifest

func LocalDevnetManifest() *Manifest

func Unmarshal

func Unmarshal(r io.Reader) (*Manifest, error)

func (*Manifest) DatastorePrefix

func (m *Manifest) DatastorePrefix() datastore.Key

func (*Manifest) Equal

func (m *Manifest) Equal(o *Manifest) bool

func (*Manifest) GpbftOptions

func (m *Manifest) GpbftOptions() []gpbft.Option

func (*Manifest) Marshal

func (m *Manifest) Marshal() ([]byte, error)

Marshal the manifest into JSON We use JSON because we need to serialize a float and time.Duration and the cbor serializer we use do not support these types yet.

func (*Manifest) PubSubTopic

func (m *Manifest) PubSubTopic() string

func (*Manifest) Validate

func (m *Manifest) Validate() error

type ManifestProvider

type ManifestProvider interface {
	// Start any background tasks required for the operation of the manifest provider.
	Start(context.Context) error
	// Stop stops a running manifest provider.
	Stop(context.Context) error
	// The channel on which manifest updates are returned.
	ManifestUpdates() <-chan *Manifest
}

type ManifestSender

type ManifestSender struct {
	// contains filtered or unexported fields
}

ManifestSender is responsible for periodically broadcasting the current manifest for the network through the corresponding pubsub

func NewManifestSender

func NewManifestSender(ctx context.Context, h host.Host, ps *pubsub.PubSub, firstManifest *Manifest, publishInterval time.Duration) (*ManifestSender, error)

func (*ManifestSender) PeerInfo

func (m *ManifestSender) PeerInfo() peer.AddrInfo

func (*ManifestSender) Run

func (m *ManifestSender) Run(ctx context.Context) error

func (*ManifestSender) SenderID

func (m *ManifestSender) SenderID() peer.ID

func (*ManifestSender) UpdateManifest

func (m *ManifestSender) UpdateManifest(manifest *Manifest)

type ManifestUpdateMessage

type ManifestUpdateMessage struct {
	// An increasing sequence number for ordering manifest updates received over the network.
	MessageSequence uint64
	// The manifest to apply or nil to pause the network.
	Manifest Manifest
}

ManifestUpdateMessage updates the GPBFT manifest.

func (ManifestUpdateMessage) Marshal

func (m ManifestUpdateMessage) Marshal() ([]byte, error)

func (*ManifestUpdateMessage) Unmarshal

func (m *ManifestUpdateMessage) Unmarshal(r io.Reader) error

type NoopManifestProvider

type NoopManifestProvider struct{}

func (NoopManifestProvider) ManifestUpdates

func (NoopManifestProvider) ManifestUpdates() <-chan *Manifest

func (NoopManifestProvider) Start

func (NoopManifestProvider) Stop

type StaticManifestProvider

type StaticManifestProvider struct {
	// contains filtered or unexported fields
}

Static manifest provider that doesn't allow any changes in runtime to the initial manifest set in the provider

func NewStaticManifestProvider

func NewStaticManifestProvider(m *Manifest) (*StaticManifestProvider, error)

func (*StaticManifestProvider) ManifestUpdates

func (m *StaticManifestProvider) ManifestUpdates() <-chan *Manifest

func (*StaticManifestProvider) Start

func (*StaticManifestProvider) Stop

Jump to

Keyboard shortcuts

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