Closed jsdw closed 1 year ago
In case it helps, this is how we are currently doing it.
Thanks! Yup, that looks like pretty much exactly what I'll be doing as things stand :)
I'll close this; It's not really too hard to track runtime updates in this way, and #97 ensures that there aren't any hairy edge cases to handle (may be worth a wee spec clarification to make this super clear). Anyway, we get a vec of finalized blocks back in the Finalized
event, and so which runtime would be reported there (presumably the latest, but yeah, things start getitng more debatable).
For what it's worth you can also take a look at this code: https://github.com/smol-dot/smoldot/blob/3ef35b9c364d4dd87d7786409d436113a785c9e8/full-node/src/json_rpc_service/legacy_api_subscriptions.rs
It's smoldot's implementation of the legacy API's subscription functions based on top of the chainHead_follow
functions. It's maybe a bit wonky, but that's because the legacy API doesn't properly define how these functions should behave.
It's not exactly based on top of chainHead_follow
but based on top of smoldot's "consensus service", but this consensus service has exactly the same logic of API as chainHead_follow
.
I'd like to keep track of the latest finalized runtime (since I'm mostly interested only in finalized blocks).
If I subscribe to
chainHead_follow
, I'm told about the current runtime/finalized block in theInitialized
event. But I'm not told about the runtime in subsequentFinalized
events, onlyNewBlock
ones. This means that, at present, I need to track any runtime info mentioned in new block events, and then when finalized events come through, associate the matching newblock runtime with it (if it exists).So, a couple of questions:
Finalized
events, to make this really easy to do?