-
Notifications
You must be signed in to change notification settings - Fork 2.6k
reset cache when storage possibly change (fix init of tests). #9665
Conversation
Where is this function being used? |
On 'assimilate' (did hit that when adding content to test_externalities in another branch), via 'apply_transaction'. |
So we should reset the cache there? |
Yes, modifying the storage with the mutable access means you are changing the backend (in normal condition this never happen, storage of trie backend stay the same during the whole processing, but in tests this function can be use). (it is just the local cache of child trie roots) |
Hmm all of this feels very dirty. |
I can move the the clear_cache after calling |
I could also just remove |
I feel that it is more |
I use this code in #8931 , but with recent refactoring it may not be needed anymore, but in any case it is still a footgun. |
If we can remove it, perfect. |
@@ -94,6 +94,9 @@ where | |||
|
|||
/// Get backend storage reference. | |||
pub fn backend_storage_mut(&mut self) -> &mut S { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I did forget it , thanks.
bot merge |
Trying merge. |
Bot will approve on the behalf of @bkchr, since they are a team lead, in an attempt to reach the minimum approval count |
Very small pr to reset root cache when building state (in some other branch my tests did fail due to the root caching when using test externalities).