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

pallet-offences-benchmarking: Box events in verify#13151

Merged
bkchr merged 3 commits intomasterfrom
bkchr-offences-benchmarking-box
Jan 16, 2023
Merged

pallet-offences-benchmarking: Box events in verify#13151
bkchr merged 3 commits intomasterfrom
bkchr-offences-benchmarking-box

Conversation

@bkchr
Copy link
Copy Markdown
Member

@bkchr bkchr commented Jan 16, 2023

Events in frame are represented by an enum in the pallet and the runtime. The size of an enum in Rust depends on the size of biggest variant. This means we always need to allocate memory for the biggest variant when allocating memory for an event. The offences benchmarking is verifying the benchmarking results by checking the events. To check the events it is generating all the expected events. With the recent changes in Polkadot the events are too big and lead to issues when running this verify functions. The solution is to box each event, as the vector holding all the events will then only need to hold fat pointers * expected events, instead of size_of(event) * expected events. This issue isn't a problem in production, as we never read the events on chain. When we are reading the events, it is done in an offchain context and they are only decoded one by one.

Besides that this also enables the benchmarking verification for everyone running these benchmarks.

Loading
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. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants