You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling clear_prefix with a limit multiple times in the same block it will always delete the same keys for the exact same input. The reason for this is that we don't check from the overlay on what we already have deleted. So, we always delete the same keys from the backend until the limit is reached. It was documented in #11182 to make this more clear to the FRAME users on how the internals are working.
@shawntabrizi and @kianenigma proposed that we make this more intuitive, aka calling it multiple times deletes always new keys and not always the same ones.
I'm personally not really convinced that we should do this, because:
If you want to delete more items, you can just directly pass a higher limit or just call a second time with a higher limit.
As the node side doesn't really know about the internals of the runtime, it would need to take into account the keys that are present in the overlay and make the implementation not count these towards the limit when we encounter them again in the backend. While this works, it also increases the complexity and may leads to a slower execution the more often clear_prefix is called.
We would need to introduce a new host function version for clear_prefix where only version 3 is using the new implementation. This needs to be done to ensure that we don't break any old blocks.
When calling
clear_prefixwith alimitmultiple times in the same block it will always delete the same keys for the exact same input. The reason for this is that we don't check from theoverlayon what we already have deleted. So, we always delete the same keys from the backend until thelimitis reached. It was documented in #11182 to make this more clear to the FRAME users on how the internals are working.@shawntabrizi and @kianenigma proposed that we make this more intuitive, aka calling it multiple times deletes always new keys and not always the same ones.
I'm personally not really convinced that we should do this, because:
limitor just call a second time with a higherlimit.overlayand make the implementation not count these towards the limit when we encounter them again in the backend. While this works, it also increases the complexity and may leads to a slower execution the more oftenclear_prefixis called.clear_prefixwhere only version3is using the new implementation. This needs to be done to ensure that we don't break any old blocks.