This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Use single map and remove_all for EventTopics#4566
Merged
bkchr merged 1 commit intoparitytech:masterfrom Jan 8, 2020
Merged
Conversation
shawntabrizi
commented
Jan 8, 2020
| /// no notification will be triggered thus the event might be lost. | ||
| EventTopics get(fn event_topics): double_map hasher(blake2_256) (), blake2_256(T::Hash) | ||
| => Vec<(T::BlockNumber, EventIndex)>; | ||
| EventTopics get(fn event_topics): map T::Hash => Vec<(T::BlockNumber, EventIndex)>; |
Member
Author
There was a problem hiding this comment.
We could reduce the complexity of the hasher used on the key here.
I don't quite understand if this is something worth changing.
bkchr
approved these changes
Jan 8, 2020
Member
|
CC @jacogr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2491 introduced light client friendly events.
It used a trick with the
double_mapapi where it was able to clear a single map by removing a single prefix of thedouble_map.See: paritytech/polkadot-sdk#371
Now that all storage items use
StoragePrefixedMap, we can now access theremove_allAPI directly from a single map.This updates the implementation of
EventTopicsto use a single map and theremove_allapi rather than thedouble_maphack.