-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(f3): expose simple ChainGetFinalizedTipSet that just returns a tipset #13299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
04591c5
to
e9ce42b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually this seems good/right to me. I didn't notice any logic issues, but this needs @Kubuxu sign off.
I assume it'll be a separate PR to make /v1 ETH APIs F3 aware.
We'll want a changelog entry for this. I am happy to create it 2025-09-03.
Doh, my bad. I see #13298 |
e9ce42b
to
4522926
Compare
Can this just be called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM code wise, eshon's suggestion seems good as well
I am good with doing this instead. I can see reasons for it vs. the Note to self on followup actions I imagine taking after this and #13298 land:
|
It is either |
My understanding is there are two options:
What are you voting for @Kubuxu? |
Option two seems like better UX, but I don't have a strong opinion. If @eshon thinks that it will have better adoption, we should go for it unless there are implementation concerns. |
I'm good with option 2 as well. Are you @rvagg ? |
yep, option 2 it is, I like it, |
3c265a1
to
a5278af
Compare
Done, with comprehensive tests for the various states of F3 enablement or erroring. If there are any problems with F3, including it falling behind EC, then we revert to EC for finality, otherwise we return the F3 finalised tipset.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new user-focused F3 API to simplify finality access by exposing ChainGetFinalizedTipSet
in the v1 API. This method returns the latest F3 finalized tipset directly, eliminating the complexity of using F3GetLatestCertificate -> ECChain.TipSets[-1] pattern from v2 APIs. It falls back to Expected Consensus finality (head - 900 epochs) when F3 is not operational.
Key changes:
- Adds
ChainGetFinalizedTipSet
method to v1 and gateway APIs - Implements fallback logic from F3 finality to EC finality
- Includes comprehensive test coverage for various F3 states
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
node/impl/full/chain.go | Core implementation of ChainGetFinalizedTipSet with F3 and EC fallback logic |
node/impl/full/f3.go | Adds Chain dependency to F3API struct for finality operations |
api/api_full.go | Adds ChainGetFinalizedTipSet method definition to FullNode interface |
api/api_gateway.go | Adds ChainGetFinalizedTipSet method to Gateway interface |
itests/f3_test.go | Comprehensive test suite covering F3 disabled, nominal, error, and fallback scenarios |
itests/kit/stable.go | Helper utility for stable test execution across chain reorgs |
gateway/proxy_fil_v1.go | Proxy implementation for ChainGetFinalizedTipSet in gateway |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
d92d5f2
to
22cc545
Compare
…ipset Alias for F3GetLatestCertificate -> ECChain.TipSets[-1] -> TipSet but with fall-back to EC when F3 is not properly functioning or is behind EC.
22cc545
to
ca89516
Compare
if ts := m.tryF3Finality(ctx, ecFinalityHeight); ts != nil { | ||
return ts, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tryF3Finality
should bubble up "hard" errors, so that the highlighted block of code can distinguish between "F3 is not running/behind" vs "node is under some novel type of attack, with invalid F3 or unexpectedly divergent F3/EC"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree. This should continue working to reduce the impact on people who use it. 900 epochs is a totally valid fallback.
In cases of an attack on F3, this is a fallback we would recommend and use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While typing this I see that the PR was merged. So my comments are likely moot. Nevertheless leaving them here for posterity.
@Kubuxu notionally you are totally correct - the exposed finality should match the "internal finality", that is whatever the chainsync algorithm would do. The problem is that holistically ChainGetFinalizedTipSet
is not the only finality-aware API - there are literally hundreds of them. Given tryF3Finality
is a newly written function, which does not seem a copy of something that already exists - the likelihood of divergence is high
The more in-depth thing to point out in review would be
This looks fishy, the decision path should be unified, not unlike the internal
GetHeaviestTipSet
. Then all of the ETH v1/2 and this new API call would reliably return the same thing
I did not say this earlier, because it is untenable to implement a cleanup pass in the short window FilOz committed themselves to. So the second best thing was the practical "have the API error instead of potentially diverging under uncharted circumstances"
Alias for F3GetLatestCertificate -> ECChain.TipSets[-1] -> TipSet
As discussed with @BigLep here's what a user-focused F3 API in /v1 as opposed to the miner software or developer focused APIs and does away with the indirection complexity when trying to explain how to use F3 with /v2 APIs. An option on the table for us to consider in the range of possibilities for helping increase F3 adoption.
Edit: renamed and added EC fallback, see below.