Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions itests/kit/node_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)),
)
}

Expand Down
6 changes: 4 additions & 2 deletions node/builder_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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),
Expand Down
13 changes: 8 additions & 5 deletions node/impl/eth/tipsetresolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,31 @@ 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 F3CertificateProvider interface {
F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error)
}

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
f3 F3CertificateProvider // can be nil if disabled
useF3ForFinality bool // if true, attempt to use F3 to determine "finalized" tipset
}

func NewTipSetResolver(cs ChainStore, f3 lf3.F3Backend, useF3ForFinality bool) TipSetResolver {
func NewTipSetResolver(cs ChainStore, f3 F3CertificateProvider, useF3ForFinality bool) TipSetResolver {
return &tipSetResolver{cs: cs, f3: f3, useF3ForFinality: useF3ForFinality}
}

func (tsr *tipSetResolver) getLatestF3Cert(ctx context.Context) (*certs.FinalityCertificate, error) {
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.
Expand Down
27 changes: 20 additions & 7 deletions node/impl/full/f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
if f3api.F3Certs != nil {
return f3api.F3Certs.F3GetCertificate(ctx, instance)
}
return f3api.F3.GetCert(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)
}
if f3api.F3Certs != nil {
return f3api.F3Certs.F3GetLatestCertificate(ctx)
}
return f3api.F3.GetLatestCert(ctx)
return nil, api.ErrF3Disabled
}

func (f3api *F3API) F3GetManifest(ctx context.Context) (*manifest.Manifest, error) {
Expand Down
3 changes: 1 addition & 2 deletions node/modules/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
Loading