manifest

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0, MIT Imports: 28 Imported by: 23

Documentation

Index

Constants

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

Variables

View Source
var (
	DefaultCommitteeLookback uint64 = 10

	// Default configuration for the EC Backend
	DefaultEcConfig = EcConfig{
		Finality:        900,
		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,
		QualityDeltaMultiplier:     1.0,
		MaxLookaheadRounds:         5,
		ChainProposedLength:        gpbft.ChainDefaultLen,
		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,
	}

	DefaultPubSubConfig = PubSubConfig{
		CompressionEnabled:             true,
		ChainCompressionEnabled:        true,
		GMessageSubscriptionBufferSize: 128,
		ValidatedMessageBufferSize:     128,
	}

	DefaultChainExchangeConfig = ChainExchangeConfig{
		SubscriptionBufferSize:         32,
		MaxChainLength:                 gpbft.ChainDefaultLen,
		MaxInstanceLookahead:           DefaultCommitteeLookback,
		MaxDiscoveredChainsPerInstance: 1_000,
		MaxWantedChainsPerInstance:     1_000,
		RebroadcastInterval:            2 * time.Second,
		MaxTimestampAge:                8 * time.Second,
	}

	DefaultPartialMessageManagerConfig = PartialMessageManagerConfig{
		PendingDiscoveredChainsBufferSize:     100,
		PendingPartialMessagesBufferSize:      100,
		PendingChainBroadcastsBufferSize:      100,
		PendingInstanceRemovalBufferSize:      10,
		CompletedMessagesBufferSize:           100,
		MaxBufferedMessagesPerInstance:        25_000,
		MaxCachedValidatedMessagesPerInstance: 25_000,
	}

	// Default instance alignment when catching up.
	DefaultCatchUpAlignment = DefaultEcConfig.Period / 2
)
View Source
var ErrNoManifest = errors.New("no known manifest")

ErrNoManifest is returned when no manifest is known.

Functions

func ChainExchangeTopicFromNetworkName added in v0.8.0

func ChainExchangeTopicFromNetworkName(nn gpbft.NetworkName) string

func DynamicManifestProviderWithDatastore added in v0.4.0

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 added in v0.4.0

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

DynamicManifestProviderWithFilter specifies a filter for incoming manifests.

func DynamicManifestProviderWithInitialManifest added in v0.4.0

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 ChainExchangeConfig added in v0.8.0

type ChainExchangeConfig struct {
	SubscriptionBufferSize         int
	MaxChainLength                 int
	MaxInstanceLookahead           uint64
	MaxDiscoveredChainsPerInstance int
	MaxWantedChainsPerInstance     int
	RebroadcastInterval            time.Duration
	MaxTimestampAge                time.Duration
}

func (*ChainExchangeConfig) Validate added in v0.8.0

func (cx *ChainExchangeConfig) Validate() error

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 added in v0.0.5

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 added in v0.4.0

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 F3 should finalize tipsets as F3 agrees on them.
	Finalize bool
}

func (*EcConfig) Equal added in v0.0.4

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

func (*EcConfig) Validate added in v0.0.5

func (e *EcConfig) Validate() error

type FusingManifestProvider added in v0.4.0

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

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

func NewFusingManifestProvider added in v0.4.0

func NewFusingManifestProvider(ctx context.Context, ec HeadGetter, secondary ManifestProvider, primary ManifestProvider) (*FusingManifestProvider, error)

NewFusingManifestProvider creates a provider that will lock into the primary manifest onces it reaches BootstrapEpoch-Finality of primary manifest the primary ManifestProvider needs to provide at least one manifest (or nil), a sign of life, to enable forwarding of secondary manifests.

func (*FusingManifestProvider) ManifestUpdates added in v0.4.0

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

func (*FusingManifestProvider) Start added in v0.4.0

func (*FusingManifestProvider) Stop added in v0.4.0

type GpbftConfig

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

	ChainProposedLength int

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

func (*GpbftConfig) ToOptions added in v0.1.0

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

func (*GpbftConfig) Validate added in v0.0.5

func (g *GpbftConfig) Validate() error

type HeadGetter added in v0.4.0

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
	// PubSubConfig specifies the pubsub related configuration.
	PubSub PubSubConfig
	// ChainExchange specifies the chain exchange configuration parameters.
	ChainExchange ChainExchangeConfig
	// PartialMessageManager specifies the configuration for the partial message manager.
	PartialMessageManager PartialMessageManagerConfig
}

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

func LocalDevnetManifest

func LocalDevnetManifest() *Manifest

func Unmarshal added in v0.0.5

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

func (*Manifest) Cid added in v0.8.0

func (m *Manifest) Cid() (cid.Cid, error)

func (*Manifest) DatastorePrefix

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

func (*Manifest) Equal added in v0.0.4

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 added in v0.0.5

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 added in v0.4.0

type NoopManifestProvider struct{}

func (NoopManifestProvider) ManifestUpdates added in v0.4.0

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

func (NoopManifestProvider) Start added in v0.4.0

func (NoopManifestProvider) Stop added in v0.4.0

type PartialMessageManagerConfig added in v0.8.3

type PartialMessageManagerConfig struct {
	PendingDiscoveredChainsBufferSize     int
	PendingPartialMessagesBufferSize      int
	PendingChainBroadcastsBufferSize      int
	PendingInstanceRemovalBufferSize      int
	CompletedMessagesBufferSize           int
	MaxBufferedMessagesPerInstance        int
	MaxCachedValidatedMessagesPerInstance int
}

func (*PartialMessageManagerConfig) Validate added in v0.8.3

func (pmm *PartialMessageManagerConfig) Validate() error

type PubSubConfig added in v0.8.0

type PubSubConfig struct {
	CompressionEnabled      bool
	ChainCompressionEnabled bool

	GMessageSubscriptionBufferSize int
	ValidatedMessageBufferSize     int
}

func (*PubSubConfig) Validate added in v0.8.0

func (p *PubSubConfig) Validate() error

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