manifest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0, MIT Imports: 26 Imported by: 5

Documentation

Index

Constants

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

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,
	}

	DefaultGpbftConfig = GpbftConfig{
		Delta:                      3 * time.Second,
		DeltaBackOffExponent:       2.0,
		MaxLookaheadRounds:         5,
		RebroadcastBackoffBase:     3 * time.Second,
		RebroadcastBackoffExponent: 1.3,
		RebroadcastBackoffMax:      30 * time.Second,
	}

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

	// Default instance alignment when catching up. Set to zero for now to avoid breaking
	// things, we should probably bump the version compatibility when we set this to a non-zero
	// value (although that's not required).
	//DefaultCatchUpAlignment = 4 * DefaultGpbftConfig.Delta
	DefaultCatchUpAlignment time.Duration = 0
)

Functions

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 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(initialManifest *Manifest, ds datastore.Datastore,
	pubsub *pubsub.PubSub, manifestServerID peer.ID) *DynamicManifestProvider

func (*DynamicManifestProvider) ManifestUpdates

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

func (*DynamicManifestProvider) Start

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

func (*DynamicManifestProvider) Stop

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
}

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 GpbftConfig

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

	RebroadcastBackoffBase     time.Duration
	RebroadcastBackoffExponent 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 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 added in v0.0.5

func Unmarshal(r io.Reader) (*Manifest, 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
}

func NewStaticManifestProvider

func NewStaticManifestProvider(m *Manifest) ManifestProvider

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 OnManifestChange

type OnManifestChange func(ctx context.Context, prevManifest Manifest) 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 (*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