This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Get rid of junk in storage proofs. #9170
Labels
I9-optimisation
An enhancement to provide better overall performance in terms of time-to-completion for a task.
U2-some_time_soon
Issue is worth doing soon.
Currently block execution storage proofs contain nodes that are not actually necessary to validate the block.
There's a common pattern in the runtime that we use to store intermediate values. Values that need to be passed around between extrinsics. Such values are put in the storage and are removed at the end of block execution with
take
. Here's one example:substrate/frame/system/src/lib.rs
Line 1361 in df4a588
The problem here is that
take
attempts to delete the value from the trie, even if it is not there. This attempted deletion query ends up being part of the proof.A proposed solution would be to use
revert
rather thantake
.revert
would simply delete the key from the state overlay.Alternatively we could use static memory instead of storage API for intermediate values. This would also be a significant performance win, although some additional work would be needed to implement transactional semantics with this method.
The text was updated successfully, but these errors were encountered: