Replies: 3 comments 13 replies
-
Thank you @brusherru for the immense clarity of purpose and proposal here. In summery - the most important data for a SMAPPer is:
|
Beta Was this translation helpful? Give feedback.
-
Great summary!
IMO it should be:
Past epochs should be specifically query-able, but not returned by default since they're not interesting for the smeshing status screen.
I think we should add I'm pretty sure all of this information is available to the node, so exposing this API only requires looking up data. However, it might be possible/needed to cache some data to make answering this more efficient - I'll let @dshulyak or @countvonzero answer that. Only exception to this is the estimated PoET time / layer which I don't think the node currently knows, but I guess we can live without it for v1. |
Beta Was this translation helpful? Give feedback.
-
ideally queries for activations should use smesher id, as activations are already indexed by it |
Beta Was this translation helpful? Give feedback.
-
Rationale
We want to make clear to Smeshers what is going on at every moment in the time:
Let's refresh our memory on how it works, assign some statuses to each "step" and clarify which additional data we may require.
Status: Not smeshing
Status: Generating PoS data
Status: Waiting for PoET challenge
Extra: estimated time / layer
Status: Generating Proof-of-Space
Extra: time estimation
Status: Waiting for the next epoch
Extra: time estimation
Status: Smeshing on epoch 23 (current)
Status: Smeshing on epoch 23 (current)
Here is a good illustration by @noamnelke:
We already had some related discussion, so you can check it out: spacemeshos/smapp#721
Problem
Some of the steps, mentioned above, take a long time.
Some of them may finish with failure, which means that time from the 2nd step to the 6th (getting rewards) may take much more time. So we need to notify Smesher about the current status.
We already have some API endpoints, but they have a narrow scope and do not cover all the steps from the list above:
SmesherService.IsSmeshing -> bool
— true if PoS creation complete and "ready to send ATXs". But actually, if the node does not sync, it is still true. So from my point of view, it seems almost useless (the same asPostSetupStatus === complete
). Fix me if I miss something.SmesherService.PostSetupStatus
— enum (not_started | in_progress | complete | error). Related only to the PoS creating process.So we need some API endpoints that will provide other statuses. Or, I think it will be much better, one API endpoint that will answer all these questions.
Proposal
Let's make a brand-new
SmesherService.SmeshingStatus
endpoint, that will return any of the statuses mentioned above with required extra data.Such a solution will encapsulate some logic on the Node side, like requesting/listening for ATXs, rewards, PoET, etc.
Actually, I've already created one issue for it some time ago: #3222
So I think it might be a nullary endpoint, which returns something like:
Multiple statuses at once
Actually, Smesher can have more than one status at a time, regarding different epochs.
For example:
Or even:
So probably this endpoint should return a list of
SmeshingStatusResponse
.But in this case, we have an open question, which epochs should be on the list. Putting all previous epochs is a bad idea.
Can we implement only streaming API endpoint, but with one requirement: can it send "current status" to the new client on connection?
What's next
Please, share your thoughts about the problem and my proposal.
If you found that such implementation will be complicated / not optimal / etc — tell us about it, please.
If I miss something — feel free to fix me. If you have other ideas — share them.
P.S.
We also had a discussion about API for retrieving ATXs. But from my point of view, it is not required for Smapp/Smrepl, in case all this "smeshing status logic" will be encapsulated on the Node side, as proposed above.
However, most likely we will require such an API for Explorer. And I think we should not make Smapp/Smrepl more complicated, and just put a link to explorer where it is needed (aka on Smesher screen).
So I propose to leave API for retrieving ATXs is out of scope, and open another discussion/issue in the context of Explorer.
cc: @oriya @lrettig @noamnelke @dshulyak @countvonzero
Beta Was this translation helpful? Give feedback.
All reactions