Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic while full syncing #628

Open
tomaka opened this issue Mar 5, 2021 · 2 comments
Open

Panic while full syncing #628

tomaka opened this issue Mar 5, 2021 · 2 comments
Labels
priority-high Should be tackled with high priority

Comments

@tomaka
Copy link
Contributor

tomaka commented Mar 5, 2021

thread 'tasks-pool-0' panicked at 'assertion failed: stored_value.is_some()', /home/user/git-clones/smoldot/src/trie/calculate_root.rs:455:9

A bit above Polkadot block 2719744

@tomaka tomaka added the priority-high Should be tackled with high priority label Mar 5, 2021
@tomaka
Copy link
Contributor Author

tomaka commented Mar 5, 2021

Problem likely caused by the fact that a storage transaction rollback doesn't revert the trie cache.

@tomaka
Copy link
Contributor Author

tomaka commented Mar 5, 2021

diff --git a/src/executor/runtime_host.rs b/src/executor/runtime_host.rs
index 8f483b25..324d1419 100644
--- a/src/executor/runtime_host.rs
+++ b/src/executor/runtime_host.rs
@@ -725,8 +725,16 @@ impl Inner {
                     if rollback {
                         for (key, value) in self.top_trie_transaction_revert.take().unwrap() {
                             if let Some(value) = value {
+                                self.top_trie_root_calculation_cache
+                                    .as_mut()
+                                    .unwrap()
+                                    .storage_value_update(&key, value.is_some());
                                 let _ = self.top_trie_changes.insert(key, value);
                             } else {
+                                self.top_trie_root_calculation_cache
+                                    .as_mut()
+                                    .unwrap()
+                                    .storage_value_update(&key, false); // TODO: `false` is wrong!
                                 let _ = self.top_trie_changes.remove(&key);
                             }
                         }

This false requires much deeper changes to the trie cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-high Should be tackled with high priority
Projects
None yet
Development

No branches or pull requests

1 participant