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

Return number of keys removed when calling storage_kill on child trie #8166

Merged
8 commits merged into from
Feb 22, 2021

Conversation

shawntabrizi
Copy link
Contributor

@shawntabrizi shawntabrizi commented Feb 21, 2021

This PR extends the information provided when calling storage_kill on a child trie.

Now, in addition to returning a boolean on whether all the data in the child trie has been successfully removed, we also return a u32 value which conveys the actual number of keys that were removed in the process.

This is relevant for weight refunds. For example, a storage_kill call could have a limit of 100, but only 50 items are in the trie. We can charge up front for 100 storage removals, but then return that only 50 were actually removed, and refund any of the extra weight.

Relevant for Crowdloans in Polkadot: paritytech/polkadot#2294

polkadot companion: paritytech/polkadot#2488

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Feb 21, 2021
@shawntabrizi shawntabrizi added B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Feb 21, 2021
Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

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

I dropped two comments. Those need to be addressed (should be fairly easy). Otherwise it looks good to me.

primitives/state-machine/src/basic.rs Outdated Show resolved Hide resolved
primitives/io/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Some last nitpick.

primitives/externalities/src/lib.rs Show resolved Hide resolved
@shawntabrizi
Copy link
Contributor Author

bot merge

@ghost
Copy link

ghost commented Feb 22, 2021

Waiting for commit status.

@ghost
Copy link

ghost commented Feb 22, 2021

Checks failed; merge aborted.

@bkchr
Copy link
Member

bkchr commented Feb 22, 2021

bot merge force

@ghost
Copy link

ghost commented Feb 22, 2021

Trying merge.

@ghost ghost merged commit 528c14b into master Feb 22, 2021
@ghost ghost deleted the shawntabrizi-child-trie-kill-return branch February 22, 2021 19:24
This pull request was closed.
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. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants