polkadot-spec icon indicating copy to clipboard operation
polkadot-spec copied to clipboard

Corner cases about child tries are unexplained

Open tomaka opened this issue 3 years ago • 4 comments

Some questions are in my opinion not really clear in the spec:

  • What happens if the runtime calls the ext_storage_get_version_1 or ext_storage_read_version_1 host function with a key K, where K is in fact a child trie? As far as I understand, this would return the trie root hash of the child trie, but this isn't really clear in the spec.
  • What happens if the runtime calls the ext_storage_set_version_1 host function with a key K, where K is in fact a child trie? I assume that it destroys the child trie, but this isn't really clear.
  • What happens if the runtime calls any of the ext_default_child_storage_* host functions with a child_storage_key that is in fact not a child trie? I assume that this is the equivalent of a runtime panic?

tomaka avatar Oct 04 '22 09:10 tomaka

Fixed in #554

lamafab avatar Oct 17 '22 12:10 lamafab

Test coverage in https://github.com/w3f/polkadot-tests/pull/241, should be merged, soon

lamafab avatar Oct 17 '22 12:10 lamafab

I don't see how https://github.com/w3f/polkadot-spec/pull/554 covers any of the questions that I've raised, and I don't see any answer to them in the spec.

For some reason I don't have a "reopen" button, but if I had one I'd reopen the issue.

tomaka avatar Oct 20 '22 11:10 tomaka

I would say that the first two points are now covered by https://github.com/w3f/polkadot-spec/issues/577 and https://github.com/w3f/polkadot-spec/issues/575

Only remains:

What happens if the runtime calls any of the ext_default_child_storage_* host functions with a child_storage_key that is in fact not a child trie? I assume that this is the equivalent of a runtime panic?

tomaka avatar Nov 07 '22 12:11 tomaka