-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add ChildTriePrefixIterator and methods #8478
Conversation
Pinging @thiolliere for review. |
c6c0400
to
191ed71
Compare
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.
needs some test but looks good
@KiChjang thanks for opening this! It would be great to get this in ASAP since I want to use it on Polkadot ;) |
@thiolliere I'll need some help in trying to setup the test infrastructure to test my changes. I'm not even sure how I could begin testing this. Could you please provide some pointers? |
you can take a look at this test: substrate/frame/support/src/storage/mod.rs Lines 695 to 767 in f3b3e62
And instead of StoragePrefixedMap you use the ChildTriePrefixIterator |
sorry to go back and forth about the API, I don't have a clear idea how to design it, I hope my suggestion make sense to you. The ChildTriePrefixIterator should ideally be able to handle all usecase, thus being able to be created for an usage like What do you think ? |
@thiolliere Honestly, I don't have much of an opinion because I'm not even sure how a child trie is accessed. Which also makes me a bit confused about how to write the tests, because e.g. |
API looks very good to me now. to create a ChildInfo in tests you can use https://crates.parity.io/frame_support/storage/child/enum.ChildInfo.html#method.new_default For the test we need to test that within a child trie (i.e. for one specific child info):
Those are basic tests to double check the implementation |
I pushed a test for the child trie stuff. I think a similar test should be written for the newly introduced function |
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.
looks good to me
master needs to be merged to make CI happy
d6390a8
to
416be4b
Compare
@KiChjang can you respond with your Polkadot or Kusama address? Thanks! |
@KiChjang also try to avoid force pushing. |
bot merge |
Trying merge. |
Sure! My Polkadot address is
14gKczWKAcEB8n6P9FeGttQhnTWvxFvxZr7RN4K63tKCfggR
…On Thu, Apr 1, 2021, 7:21 AM parity-processbot[bot] < ***@***.***> wrote:
Merged #8478 <#8478> into
master.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8478 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYZDS5MNK2WRDQX6DTJ3VDTGR6MXANCNFSM4Z6XUAIA>
.
|
Thanks @KiChjang . I have opened a tip for you on the network. |
Dumb question: how does that work? Do I need to claim it somehow? |
@KiChjang no. the DOTs will appear in your account once the council is finished voting for the tip. You can keep track on the Polkadot JS UI: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/treasury/tips |
Got it, thanks! |
* Make use of PrefixIterator underneath Storage[Key]Iterator * Add ChildTriePrefixIterator and methods * Add documentation on ChilTriePrefixIterator fields * Deprecate Storage[Key]Iterator API instead of removing them * Allow fetching for the prefix as an option for ChildTriePrefixIterator * Rename prefix_fetch to fetch_previous_key * fix implementation + test * make gitdiff better * Add test for storage_iter and storage_key_iter Co-authored-by: thiolliere <[email protected]>
Fixes #8462.
This is my first substrate PR and I'm not sure if I've implemented everything correctly, reviewers please let me know of any changes I need to make. Thanks!