-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(eth)!: add Eth APIs to /v2 + minor improvements & fixes #13026
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
base: master
Are you sure you want to change the base?
Conversation
Got it all wired up now. I've tried to improve the state of some of the things in here but it's quite tricky. The most interesting part of this as far as v2 is concerned is in the Misc things I've done in here that apply to v1 as well that I'll need to note in the changelog:
Still need to add more test coverage and I also need to exercise the behaviour of F3 for |
5036b50
to
88ee667
Compare
Making good progress here but the tests are getting tedious. Half of the impacted endpoints are being tested so far. |
Calling this Ready for Review although I still need to write the CHANGELOG entry (so I'm leaving that failing). I've expanded support for tags in the /v1 API in the process of doing this so I need to make clear what's changing, not just for /v2 additions. But the code and tests I think are good to go. |
1d699e9
to
3a4b1f7
Compare
Good to go now, lots of comments inline and some explainers left as comments here. The diff looks big but the changes are mostly around |
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.
No blockers. A lot of refactoring here which I probably would have separated into their own PR, nevertheless thank you for hammering through it all.
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, Masih caught things I would comment on
Addressed all of the feedback, and found some more things to deal with too. The major change now is wrt
i.e. when F3 is activated, both /v1 and /v2's I've also removed the |
node/impl/eth/tipsetresolver.go
Outdated
if err != nil && tsr.useF3ForFinality { | ||
return nil, err |
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.
IMO, "safe" should always fallback on EC even if we're using F3 for finality, but I don't have strong opinions on this.
This is not ready to be merged, latest discussion about what's needed here requires me to make the following changes:
|
Lets talk during 2025-04-22 standup on how we get this merged. My thoughts:
|
To refine this slightly: V2 APIs are F3 aware as long as F3 is enabled, regardless of F3 activation on mainnet. It really should be obvious that no-one can rely on F3 in mainnet until it is ...activated! |
I'm find with this and will adjust, although the process of getting here has made some improvements to both forms of the eth APIs which I'll document but I'll leave But, we should note the original reason we started touching them here and not lose track of this as a future area of work. The |
I was saying this on principle but hadn't looked at the PR. I looked at it more today and I see there is more nuance. Apologies if I'm causing whiplash here - my intent was to simplify the conversation so we could hopefully land something sooner without a lot of discussion. Going through the changelog:
👍
👍
👍
The rationale makes sense and maybe this is where we want to end eventually? If the code is easier to reason about if we have consistency between /v1 and /v2 then I'm more apt to leave what you have or at least just simplify to assuming F3 is active since it will be shortly. I can also see the mindset of "don't change the semantics of v1 and we potentially improve it later".
👍
👍
👍
👍
👍 |
Pushed changes that roll back the use of F3 in /v1 at all but note this may change in the future. I was going to roll back the Worked on the docs a bit too, but feel free to hack at that to make it clearer. |
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.
Thanks for scoping down the changes @rvagg .
I have one comment about if/when we fallback to EC.
I see /v2 also has support for
- Filecoin
- Net
- Web3
- Web3ClientVersion
I assume that's intentional. Do we need to document this?
- Web3ClientVersion
I can take a stab at documenting the /v2 APIs for https://www.notion.so/filecoindev/Filecoin-V2-APIs-1d0dc41950c1808b914de5966d501658 (sort like how started on this in #13051 for the safe tag). My approach would be to say soemthing along the lines that /v2 ETH APIs are basically the same to /v1 ETH APIs but that finalized
and safe
have different meaning. I'd explain what safe
and finalized
mean in /v2. I'd then link to https://github.com/filecoin-project/lotus/blob/master/documentation/en/api-v2-unstable-methods.md for the API listing rather than generating docs in Notion for all of them.
|
||
Lotus now offers two versions of its Ethereum-compatible APIs (`eth_`, `trace_`, etc.) with different finality handling: | ||
* **`/v2` APIs (New & Experimental):** These APIs consult the F3 subsystem (if enabled) for finality information. | ||
* `"finalized"` tag maps to the F3 finalized epoch. |
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.
What happens in these scenarios:
- F3 isn't enabled
- F3 isn't providing a finality certificate
- Last F3-finalized tipset is more than 900 tipsets behind
?
I assume we want to fall back to EC in all these cases.
(Some of these cases are covered in the diagram in https://www.notion.so/filecoindev/Filecoin-V2-APIs-1d0dc41950c1808b914de5966d501658?pvs=4#1d0dc41950c1802991aae0020b4d8e05 - but the diagram doesn't cover when the last F3-finalized tipset is more than 900 tipsets behind
Very draft for now, mainly focused on keeping /v1 working without molesting it too much. The beginnings of /v2 are in here already, it's just not wired up to the main struct yet .. or tested.