Skip to content

Commit

Permalink
fixup! feat(f3): resolve finality for eth APIs according to F3
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Dec 11, 2024
1 parent a46832f commit f55cd57
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions chain/tsresolver/tipset_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,24 @@ func (tsr *tipSetResolver) loadFinalizedTipSet(ctx context.Context, fallbackDela
// certificate with a finalized tipset, it returns nil. This method will only return errors that
// arise from dealing with the chain store, not from F3.
func (tsr *tipSetResolver) maybeF3FinalizedTipSet(ctx context.Context) (*types.TipSet, error) {
if manifest, err := tsr.f3.GetManifest(ctx); err != nil {
// TODO: switch the order of GetManifest and GetLatestCert the former won't panic on
// a fresh F3 instance: https://github.com/filecoin-project/lotus/issues/12772
cert, err := tsr.f3.GetLatestCert(ctx)
if err != nil {
if !errors.Is(err, api.ErrF3Disabled) {
log.Warnf("loading F3 manifest: %s", err)
log.Warnf("loading latest F3 certificate: %s", err)
}
return nil, nil
} else if !manifest.EC.Finalize {
// F3 is not finalizing tipsets on top of EC, ignore it
}
if cert == nil {
return nil, nil
}

cert, err := tsr.f3.GetLatestCert(ctx)
if err != nil {
log.Warnf("loading latest F3 certificate: %s", err)
if manifest, err := tsr.f3.GetManifest(ctx); err != nil {
log.Warnf("loading F3 manifest: %s", err)
return nil, nil
}
if cert == nil {
} else if !manifest.EC.Finalize {
// F3 is not finalizing tipsets on top of EC, ignore it
return nil, nil
}

Expand Down

0 comments on commit f55cd57

Please sign in to comment.