From 2a4a3a6664be111a10691831fc6c51d6766ee632 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 14 May 2025 00:22:06 +1000 Subject: [PATCH] chore: stop using F3Backend directly in Eth modules --- node/impl/eth/tipsetresolver.go | 13 ++++++++----- node/modules/eth.go | 3 +-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/node/impl/eth/tipsetresolver.go b/node/impl/eth/tipsetresolver.go index 67edfb50b4f..e911a1981cd 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 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} } @@ -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/modules/eth.go b/node/modules/eth.go index cfd75e9118c..c29e8f88c47 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 {