diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bef4d3b8..81a0bbe46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - feat(f3): remove dynnamic manifest functionality and use static manifest ([filecoin-project/lotus#13074](https://github.com/filecoin-project/lotus/pull/13074)) - chore(deps): bump filecoin-ffi for fvm@v4.7 which adds Logs and IpldOps to debug FVM execution traces ([filecoin-project/lotus#13029](https://github.com/filecoin-project/lotus/pull/13029)) - chore: return `method not supported` via Gateway when /v2 isn't supported by the backend ([filecoin-project/lotus#13121](https://github.com/filecoin-project/lotus/pull/13121) +- chore: disable F3 participation via gateway ([filecoin-project/lotus#13123](https://github.com/filecoin-project/lotus/pull/13123) See https://github.com/filecoin-project/lotus/blob/release/v1.33.0/CHANGELOG.md diff --git a/itests/kit/node_opts.go b/itests/kit/node_opts.go index d2b0d984c..12c35aaa1 100644 --- a/itests/kit/node_opts.go +++ b/itests/kit/node_opts.go @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/lotus/chain/wallet/key" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/config" + "github.com/filecoin-project/lotus/node/impl/full" "github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo" @@ -267,6 +268,7 @@ func F3Disabled() NodeOpt { node.Unset(new(*lf3.Config)), node.Unset(new(manifest.ManifestProvider)), node.Unset(new(lf3.F3Backend)), + node.Unset(new(full.F3CertificateProvider)), ) } diff --git a/node/builder_chain.go b/node/builder_chain.go index 8174bf630..29be0edb2 100644 --- a/node/builder_chain.go +++ b/node/builder_chain.go @@ -154,6 +154,7 @@ var ChainNode = Options( Override(new(full.EthTraceAPIV2), From(new(v2api.Gateway))), Override(new(full.EthGasAPIV1), From(new(api.Gateway))), Override(new(full.EthGasAPIV2), From(new(v2api.Gateway))), + If(build.IsF3Enabled(), Override(new(full.F3CertificateProvider), From(new(api.Gateway)))), // EthSendAPI is a special case, we block the Untrusted method via GatewayEthSend even though it // shouldn't be exposed on the Gateway API. Override(new(eth.EthSendAPI), new(modules.GatewayEthSend)), @@ -185,8 +186,9 @@ var ChainNode = Options( Override(HandleIncomingMessagesKey, modules.HandleIncomingMessages), Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks), ), - - If(build.IsF3Enabled(), + ApplyIf(func(s *Settings) bool { + return build.IsF3Enabled() && !isLiteNode(s) + }, Override(new(*lf3.Config), lf3.NewConfig), Override(new(manifest.ManifestProvider), lf3.NewManifestProvider), Override(new(lf3.F3Backend), lf3.New), diff --git a/node/impl/eth/tipsetresolver.go b/node/impl/eth/tipsetresolver.go index 67edfb50b..e911a1981 100644 --- a/node/impl/eth/tipsetresolver.go +++ b/node/impl/eth/tipsetresolver.go @@ -13,20 +13,23 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build/buildconstants" "github.com/filecoin-project/lotus/chain/actors/policy" - "github.com/filecoin-project/lotus/chain/lf3" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types/ethtypes" ) var _ TipSetResolver = (*tipSetResolver)(nil) -type tipSetResolver struct { - cs ChainStore - f3 lf3.F3Backend // can be nil if disabled - useF3ForFinality bool // if true, attempt to use F3 to determine "finalized" tipset +type F3CertificateProvider interface { + F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error) } -func NewTipSetResolver(cs ChainStore, f3 lf3.F3Backend, useF3ForFinality bool) TipSetResolver { +type tipSetResolver struct { + cs ChainStore + f3 F3CertificateProvider // can be nil if disabled + useF3ForFinality bool // if true, attempt to use F3 to determine "finalized" tipset +} + +func NewTipSetResolver(cs ChainStore, f3 F3CertificateProvider, useF3ForFinality bool) TipSetResolver { return &tipSetResolver{cs: cs, f3: f3, useF3ForFinality: useF3ForFinality} } @@ -34,7 +37,7 @@ func (tsr *tipSetResolver) getLatestF3Cert(ctx context.Context) (*certs.Finality if tsr.f3 == nil { return nil, nil } - cert, err := tsr.f3.GetLatestCert(ctx) + cert, err := tsr.f3.F3GetLatestCertificate(ctx) if err != nil { if errors.Is(err, f3.ErrF3NotRunning) || errors.Is(err, api.ErrF3NotReady) { // Only fall back to EC finality if F3 isn't running or not ready. diff --git a/node/impl/full/f3.go b/node/impl/full/f3.go index 64dc1bef5..31de3c137 100644 --- a/node/impl/full/f3.go +++ b/node/impl/full/f3.go @@ -16,10 +16,16 @@ import ( "github.com/filecoin-project/lotus/chain/types" ) +type F3CertificateProvider interface { + F3GetCertificate(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error) + F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error) +} + type F3API struct { fx.In - F3 lf3.F3Backend `optional:"true"` + F3 lf3.F3Backend `optional:"true"` + F3Certs F3CertificateProvider `optional:"true"` } func (f3api *F3API) F3GetOrRenewParticipationTicket(ctx context.Context, miner address.Address, previous api.F3ParticipationTicket, instances uint64) (api.F3ParticipationTicket, error) { @@ -44,17 +50,24 @@ func (f3api *F3API) F3Participate(ctx context.Context, ticket api.F3Participatio } func (f3api *F3API) F3GetCertificate(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error) { - if f3api.F3 == nil { - return nil, api.ErrF3Disabled + if f3api.F3 != nil { + return f3api.F3.GetCert(ctx, instance) } - return f3api.F3.GetCert(ctx, instance) + if f3api.F3Certs != nil { + return f3api.F3Certs.F3GetCertificate(ctx, instance) + } + + return nil, api.ErrF3Disabled } func (f3api *F3API) F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error) { - if f3api.F3 == nil { - return nil, api.ErrF3Disabled + if f3api.F3 != nil { + return f3api.F3.GetLatestCert(ctx) } - return f3api.F3.GetLatestCert(ctx) + if f3api.F3Certs != nil { + return f3api.F3Certs.F3GetLatestCertificate(ctx) + } + return nil, api.ErrF3Disabled } func (f3api *F3API) F3GetManifest(ctx context.Context) (*manifest.Manifest, error) { diff --git a/node/modules/eth.go b/node/modules/eth.go index cfd75e911..c29e8f88c 100644 --- a/node/modules/eth.go +++ b/node/modules/eth.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events/filter" "github.com/filecoin-project/lotus/chain/index" - "github.com/filecoin-project/lotus/chain/lf3" "github.com/filecoin-project/lotus/chain/messagepool" "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/store" @@ -29,7 +28,7 @@ import ( type TipSetResolverParams struct { fx.In ChainStore eth.ChainStore - F3 lf3.F3Backend `optional:"true"` + F3 full.F3CertificateProvider `optional:"true"` } func MakeV1TipSetResolver(params TipSetResolverParams) full.EthTipSetResolverV2 {