Documentation
¶
Index ¶
- Constants
- Variables
- func ChainExchangeTopicFromNetworkName(nn gpbft.NetworkName) string
- func DynamicManifestProviderWithDatastore(ds datastore.Datastore) func(cfg *dynamicManifestProviderConfig) error
- func DynamicManifestProviderWithFilter(filter func(*Manifest) error) func(cfg *dynamicManifestProviderConfig) error
- func DynamicManifestProviderWithInitialManifest(m *Manifest) func(cfg *dynamicManifestProviderConfig) error
- func PubSubTopicFromNetworkName(nn gpbft.NetworkName) string
- type ChainExchangeConfig
- type CxConfig
- type DynamicManifestProvider
- type DynamicManifestProviderOption
- type EcConfig
- type FusingManifestProvider
- type GpbftConfig
- type HeadGetter
- type Manifest
- func (m *Manifest) Cid() (cid.Cid, error)
- func (m *Manifest) DatastorePrefix() datastore.Key
- func (m *Manifest) Equal(o *Manifest) bool
- func (m *Manifest) GpbftOptions() []gpbft.Option
- func (m *Manifest) Marshal() ([]byte, error)
- func (m *Manifest) PubSubTopic() string
- func (m *Manifest) Validate() error
- type ManifestProvider
- type ManifestSender
- type ManifestUpdateMessage
- type NoopManifestProvider
- type PubSubConfig
- type StaticManifestProvider
Constants ¶
const ManifestPubSubTopicName = "/f3/manifests/0.0.2"
const VersionCapability = 5
Variables ¶
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: false, } DefaultChainExchangeConfig = ChainExchangeConfig{ SubscriptionBufferSize: 32, MaxChainLength: gpbft.ChainDefaultLen, MaxInstanceLookahead: DefaultCommitteeLookback, MaxDiscoveredChainsPerInstance: 1_000, MaxWantedChainsPerInstance: 1_000, RebroadcastInterval: 2 * time.Second, MaxTimestampAge: 8 * time.Second, } // Default instance alignment when catching up. DefaultCatchUpAlignment = DefaultEcConfig.Period / 2 )
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
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
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
}
type FusingManifestProvider ¶ added in v0.4.0
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 ¶ added in v0.4.0
func NewFusingManifestProvider(ctx context.Context, ec HeadGetter, dynamic ManifestProvider, static *Manifest) (*FusingManifestProvider, error)
func (*FusingManifestProvider) ManifestUpdates ¶ added in v0.4.0
func (m *FusingManifestProvider) ManifestUpdates() <-chan *Manifest
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
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
}
Manifest identifies the specific configuration for the F3 instance currently running.
func LocalDevnetManifest ¶
func LocalDevnetManifest() *Manifest
func (*Manifest) DatastorePrefix ¶
func (*Manifest) GpbftOptions ¶
func (*Manifest) Marshal ¶
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 ¶
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 (*ManifestSender) PeerInfo ¶
func (m *ManifestSender) PeerInfo() peer.AddrInfo
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)
type NoopManifestProvider ¶ added in v0.4.0
type NoopManifestProvider struct{}
func (NoopManifestProvider) ManifestUpdates ¶ added in v0.4.0
func (NoopManifestProvider) ManifestUpdates() <-chan *Manifest
type PubSubConfig ¶ added in v0.8.0
type PubSubConfig struct {
CompressionEnabled bool
}
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