Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@shawntabrizi
Copy link
Member

@shawntabrizi shawntabrizi commented Jan 8, 2020

#2491 introduced light client friendly events.

It used a trick with the double_map api where it was able to clear a single map by removing a single prefix of the double_map.

See: paritytech/polkadot-sdk#371

Now that all storage items use StoragePrefixedMap, we can now access the remove_all API directly from a single map.

This updates the implementation of EventTopics to use a single map and the remove_all api rather than the double_map hack.

@shawntabrizi shawntabrizi requested a review from pepyakin January 8, 2020 07:33
@shawntabrizi shawntabrizi added A0-please_review Pull request needs code review. A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). labels 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)>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

bkchr commented Jan 8, 2020

CC @jacogr

@bkchr bkchr merged commit ae46db6 into paritytech:master Jan 8, 2020
@shawntabrizi shawntabrizi deleted the shawntabrizi-event-topics-map branch January 8, 2020 09:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants