lf3

package
v1.32.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0, MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// maxCheckProgressAttempts defines the maximum number of failed attempts
	// before we abandon the current lease and restart the participation process.
	//
	// The default backoff takes 12 attempts to reach a maximum delay of 1 minute.
	// Allowing for 13 failures results in approximately 2 minutes of backoff since
	// the lease was granted. Given a lease validity of up to 5 instances, this means
	// we would give up on checking the lease during its mid-validity period;
	// typically when we would try to renew the participation ticket. Hence, the value
	// to 13.
	ParticipationCheckProgressMaxAttempts = 13

	// ParticipationLeaseTerm is the number of instances the miner will attempt to lease from nodes.
	ParticipationLeaseTerm = 5
)

Variables

View Source
var MaxDynamicManifestChangesAllowed = 1000

Determines the max. number of configuration changes that are allowed for the dynamic manifest. If the manifest changes more than this number, the F3 message topic will be filtered

Functions

func NewManifest added in v1.30.0

func NewManifest(
	nn gpbft.NetworkName,
	finality, bootstrapEpoch abi.ChainEpoch,
	ecPeriod time.Duration,
	initialPowerTable cid.Cid,
) *manifest.Manifest

NewManifest constructs a sane F3 manifest based on the passed parameters. This function does not look at and/or depend on the nodes build params, etc.

func NewManifestProvider

func NewManifestProvider(mctx helpers.MetricsCtx, config *Config, cs *store.ChainStore, ps *pubsub.PubSub, mds dtypes.MetadataDS) (prov manifest.ManifestProvider, err error)

Types

type Config added in v1.30.0

type Config struct {
	// BaseNetworkName is the base from which dynamic network names are defined and is usually
	// the name of the network defined by the static manifest. This must be set correctly or,
	// e.g., pubsub topic filters won't work correctly.
	BaseNetworkName gpbft.NetworkName
	// StaticManifest this instance's default manifest absent any dynamic manifests. Also see
	// PrioritizeStaticManifest.
	StaticManifest *manifest.Manifest
	// DynamicManifestProvider is the peer ID of the peer authorized to send us dynamic manifest
	// updates. Dynamic manifest updates can be used for testing but will not be used to affect
	// finality.
	DynamicManifestProvider peer.ID
	// PrioritizeStaticManifest means that, once we get within one finality of the static
	// manifest's bootstrap epoch we'll switch to it and ignore any further dynamic manifest
	// updates. This exists to enable bootstrapping F3.
	PrioritizeStaticManifest bool
	// TESTINGAllowDynamicFinalize allow dynamic manifests to finalize tipsets. DO NOT ENABLE
	// THIS IN PRODUCTION!
	AllowDynamicFinalize bool
}

func NewConfig added in v1.30.0

func NewConfig(nn dtypes.NetworkName) *Config

NewConfig creates a new F3 config based on the node's build parameters and the passed network name.

type F3

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

func New

func New(mctx helpers.MetricsCtx, lc fx.Lifecycle, params F3Params) (*F3, error)

func (*F3) GetCert

func (fff *F3) GetCert(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error)

func (*F3) GetF3PowerTable

func (fff *F3) GetF3PowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error)

func (*F3) GetLatestCert

func (fff *F3) GetLatestCert(ctx context.Context) (*certs.FinalityCertificate, error)

func (*F3) GetManifest added in v1.30.0

func (fff *F3) GetManifest(ctx context.Context) *manifest.Manifest

func (*F3) GetOrRenewParticipationTicket added in v1.30.0

func (fff *F3) GetOrRenewParticipationTicket(_ context.Context, minerID uint64, previous api.F3ParticipationTicket, instances uint64) (api.F3ParticipationTicket, error)

func (*F3) GetPowerTable

func (fff *F3) GetPowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error)

func (*F3) IsRunning added in v1.30.0

func (fff *F3) IsRunning() bool

func (*F3) ListParticipants added in v1.30.0

func (fff *F3) ListParticipants() []api.F3Participant

func (*F3) Participate

func (fff *F3) Participate(_ context.Context, ticket api.F3ParticipationTicket) (api.F3ParticipationLease, error)

func (*F3) Progress added in v1.30.0

func (fff *F3) Progress() gpbft.Instant

type F3Params

type F3Params struct {
	fx.In

	ManifestProvider manifest.ManifestProvider
	PubSub           *pubsub.PubSub
	Host             host.Host
	ChainStore       *store.ChainStore
	Syncer           *chain.Syncer
	StateManager     *stmgr.StateManager
	Datastore        dtypes.MetadataDS
	Wallet           api.Wallet
	Config           *Config
	LockedRepo       repo.LockedRepo

	Net api.Net
}

type F3ParticipationAPI added in v1.30.0

type F3ParticipationAPI interface {
	F3GetOrRenewParticipationTicket(ctx context.Context, minerID address.Address, previous api.F3ParticipationTicket, instances uint64) (api.F3ParticipationTicket, error) //perm:sign
	F3Participate(ctx context.Context, ticket api.F3ParticipationTicket) (api.F3ParticipationLease, error)
	F3GetManifest(ctx context.Context) (*manifest.Manifest, error)
}

type Participant added in v1.30.0

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

func NewParticipant added in v1.30.0

func NewParticipant(ctx context.Context, node F3ParticipationAPI, participant dtypes.MinerAddress, backoff *backoff.Backoff, maxCheckProgress int, leaseTerm uint64) *Participant

func (*Participant) Start added in v1.30.0

func (p *Participant) Start(ctx context.Context) error

func (*Participant) Stop added in v1.30.0

func (p *Participant) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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