cumulus
cumulus copied to clipboard
Parent search for Aura should draw upon real asynchronous backing parameters
We should read the storage of the relay chain at the relay parent, but if it's not present fall back to a default hardcoded value of 0. Adding a utility function for reading the asynchronous backing parameters from the host configuration would be helpful for writing collators in the future.
https://github.com/paritytech/cumulus/blob/89af9a6beeab877138a3719a1c83d22fddfd128b/client/consensus/aura/src/collators/lookahead.rs#L338-L350
I see 2 approaches we could follow there.
- Introduce
async_backing_paramsmethod toRelayChainInterfaceand attempt to call into runtime API, defaulting to { 0, 0 } in case it's not available. Unfortunately, the error in this case is
ApiError(Application(Execution(Other("Exported method ParachainHost_staging_async_backing_params is not found"))))
Doing String::contains is ugly and overall is a bad practice.
- Use existing
RelayChainInterface::get_storage_by_key, to readAbridgedHostConfiguration. Async backing parameters were placed directly under these fields (here), thus it should be safe, parameters were added in V6 migration on all chains. This diverges a little from what relay node does, but looks like a cleaner solution to me.
Yes, I recommend approach (2). It will be more future-proof.