-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(api): v2 API integrating with F3 #12719
Conversation
I updated this to lean in to the
The first two take an optional parameter (their The others take a But you can see how the pattern would extend. You'd get to something like Basic itests are in place to exercise some of this. So far I haven't set it up to exercise F3 doing its thing (though it should be wired up to work when I get a mock F3 instance going in the itest). I've listed all of the "Common Node API" methods in a TODO in the v2 docs, but the best approach might be to pick off the most logical F3 APIs and push this out as an "experimental" feature you can turn on and then flesh it out further over time. I'm a little afraid of this PR getting too large to reasonably review. |
For the record: I continue to believe that the push style My recommendation would be to move to a pull model unless there is a very clear usecase that requires concretely defined "event delivery guarantees". This needs a deeper Product Research. If you are a user of this API/building atop it: please reach out. |
We can opt to not put some of these methods onto the gateway. Currently /v0/ and /v1/ both expose |
Done. Thanks for pointing out that FIP. |
Introduce the first API for Lotus v2, focusing on `ChainGetTipSet` within the `Chain` group. Define `TipSetSelector` for advanced tipset retrieval options, and create a compact JSON-RPC call format. Gracefully accommodate both EC and F3 finalized tipsets based on node configuration, where: * EC finalized tipset is returned when F3 is turned off, has no finalized tipset or F3 isn't ready. * F3 finalized is returned otherwise. Support three categories of selectors under `TipSetSelector`: * By tag: either "latest" or "finalized." * By height: epoch, plus optional fallback to previous non-null tipset. * By tipset key. The selection falls back to tag "latest" if the user specifies no selection criterion. The JSON-RPC format is designed to use JSON Object as the parameters passed to the RPC call to remain compact, and extensible. Examples include: * Latest Tipset: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","id":1} ``` * Finalized Tipset: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":{"tag":"finalized"},"id":1} ``` * Tipset at specific height: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":{"height":{"at":1413,"previous":true}},"id":1} ``` The open API spec and Markdown generation is excluded from this work to reduce the PR verbosity and will be included in a follow-up PR once the basic API primitives are reviewed. Note that all v2 APIs are experimental and may change with no notice. Relates to: #12719 Part of: #12990
Introduce the first API for Lotus v2, focusing on `ChainGetTipSet` within the `Chain` group. Define `TipSetSelector` for advanced tipset retrieval options, and create a compact JSON-RPC call format. Gracefully accommodate both EC and F3 finalized tipsets based on node configuration, where: * EC finalized tipset is returned when F3 is turned off, has no finalized tipset or F3 isn't ready. * F3 finalized is returned otherwise. Support three categories of selectors under `TipSetSelector`: * By tag: either "latest" or "finalized." * By height: epoch, plus optional fallback to previous non-null tipset. * By tipset key. The selection falls back to tag "latest" if the user specifies no selection criterion. The JSON-RPC format is designed to use JSON Object as the parameters passed to the RPC call to remain compact, and extensible. Examples include: * Latest Tipset: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","id":1} ``` * Finalized Tipset: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":{"tag":"finalized"},"id":1} ``` * Tipset at specific height: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":{"height":{"at":1413,"previous":true}},"id":1} ``` The open API spec and Markdown generation is excluded from this work to reduce the PR verbosity and will be included in a follow-up PR once the basic API primitives are reviewed. Note that all v2 APIs are experimental and may change with no notice. Relates to: #12719 Part of: #12990
Introduce the first API for Lotus v2, focusing on `ChainGetTipSet` within the `Chain` group. Define `TipSetSelector` for advanced tipset retrieval options, and create a compact JSON-RPC call format. Gracefully accommodate both EC and F3 finalized tipsets based on node configuration, where: * EC finalized tipset is returned when F3 is turned off, has no finalized tipset or F3 isn't ready. * F3 finalized is returned otherwise. Support three categories of selectors under `TipSetSelector`: * By tag: either "latest" or "finalized." * By height: epoch, plus optional fallback to previous non-null tipset. * By tipset key. The selection falls back to tag "latest" if the user specifies no selection criterion. The JSON-RPC format is designed to use JSON Object as the parameters passed to the RPC call to remain compact, and extensible. Examples include: * Latest Tipset: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","id":1} ``` * Finalized Tipset: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":{"tag":"finalized"},"id":1} ``` * Tipset at specific height: ```json {"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":{"height":{"at":1413,"previous":true}},"id":1} ``` The open API spec and Markdown generation is excluded from this work to reduce the PR verbosity and will be included in a follow-up PR once the basic API primitives are reviewed. Note that all v2 APIs are experimental and may change with no notice. Relates to: #12719 Part of: #12990
WIP but opening this for discussion purposes.
/v2
API set here, although I'm not committing to pursuing that as the solution, it just seems like an appropriate thing to do as long as we're messing with a bunch of standard methods. We could take a minimal approach of adding just the basics to begin with and then adding more as they prove to be necessary. The Common Node API seems like a good foundation to start with.EpochSelector
string type that's either"latest"
or"finalized"
and then in places it can either be:ChainHead()
orChainHead("finalized")
).TipSetKey
currently exists - so you can supply either a tsk or one of these strings in that position.ChainEpoch
currently exists - so you can supply an integer or one of these strings in that position."latest"
and"finalized"
to be JSON decoded into a valueTipSetKey
."latest"
comes out as anEmptyTSK
which is the same as providing[]
now."finalized"
comes out as a sentinelFinalizedTSK
, which is a special TSK comprising["bafkqaclgnfxgc3djpjswi"]
(raw identity CID with the string"finalized"
). This approach would allow us to leave the existing APIs unmolested and even work within/v1
transparently. Similar treatment could be done forabi.ChainEpoch
but that's a little bit trickier because of the need for a sentinel value, what would that be? Also the optional argument would be a breaking Go API change if we wanted to add something toChainHead
andChainNotify
.