When a request entails a state change (e.g. link_identity, set_shielding_key), the client must make sure that the block containing the extrinsic is finalized in order to guarantee that the request was completed.
However, blocks are not finalized one by one but rather in chunks. This leads to, e.g. API methods like subscribeFinalizedHeads skipping blocks (i.e. only yielding the current block each time the chain is finalized, so the client would need to "catch up").
Our tests currently get away with checking all new blocks and assuming that the block of interest will not get discarded upon finalization; this is (possibly) good enough for a controlled environment, but not for a client in the wild (for whom the tests are supposed to serve as reference).
Polkadot.js has a solution via a plugin, but it may not be trivial to integrate into our parachain-api package.
Task
[ ] Evaluate if feasible to use @polkadot/api-derive in parachain-api
[ ] If not, implement an alternative solution to allow clients to scan all finalized blocks without manual catch-up
Context
When a request entails a state change (e.g.
link_identity
,set_shielding_key
), the client must make sure that the block containing the extrinsic is finalized in order to guarantee that the request was completed.However, blocks are not finalized one by one but rather in chunks. This leads to, e.g. API methods like
subscribeFinalizedHeads
skipping blocks (i.e. only yielding the current block each time the chain is finalized, so the client would need to "catch up").Our tests currently get away with checking all new blocks and assuming that the block of interest will not get discarded upon finalization; this is (possibly) good enough for a controlled environment, but not for a client in the wild (for whom the tests are supposed to serve as reference).
Polkadot.js has a solution via a plugin, but it may not be trivial to integrate into our
parachain-api
package.Task
@polkadot/api-derive
inparachain-api