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

Use CountedStorageMap instead of StorageValue to manage the Events in frame-system #22

Open
wants to merge 1 commit into
base: subspace-v8
Choose a base branch
from

Conversation

NingLin-P
Copy link
Member

With StorageValue the Events is a single array in the state that keep growing as more extrinsic is executed and more events append to this array, which makes execution and storage root calculation slower and slower as allocation/copying/hashing this array takes more and more time.

Similar to how we handle Pending state in frontier (see polkadot-evm/frontier#1575), this PR use CountedStorageMap to manage the event and so each event will present as a single value in the state.

NOTE: this PR also removes #[pallet::whitelist_storage] for the Events state because it is only supported for StorageValue, so if we re-run the benchmark with this PR the extrinsic will be charged weight for outputting event.

TODO: the Events state is cleared in the initialization of the next block, TBC we may need to add migration to ensure the StorageValue event is properly clear after the runtime upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant