ChainSafe / ChainSafe/gossamer
dot/state: load older canonical chain runtimes from storage where needed
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
Blocked by #2767 which now cleans up old runtimes from memory (on finalisation, removes all runtimes different from the finalised block runtime).
For certain RPC calls such as
https://github.com/ChainSafe/gossamer/blob/4ea0a703339ca06e617b06eeb7d56308e7b48093/dot/rpc/modules/payment.go#L40
And possibly babe:
https://github.com/ChainSafe/gossamer/blob/4ea0a703339ca06e617b06eeb7d56308e7b48093/lib/babe/babe.go#L506
There is a need to retrieve the runtime for an older block, that may have a runtime different from the finalised runtime we currently have in memory.
Runtimes are already stored in the `StorageState`, and can be retrieved already.
We should, for those uses above, check from memory first, and if it's not found, retrieve it from the storage state.
I would suggest we do NOT inject storage state to block state or block state to storage state, and just let the caller handle the not found error, to reduce dependency contention.
See #2781 which has some of the work already done (maybe not the last commit which inject storage state into block state, see the previous ones).
Contributor guide
Assessment
This issue has not been assessed yet.