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

fix(core-processor): fix empty allocations #3894

Merged
merged 3 commits into from
Apr 17, 2024
Merged

Conversation

grishasobol
Copy link
Member

@grishasobol grishasobol commented Apr 16, 2024

Resolves #3853

The behaviour of syscalls alloc and free will be changed a little. Now it will works correctly, so that all freed pages are removed from storage with their data as well.
I don't think this is important change for gear programs already uploaded to our web3 networks, actually this bug could not be used for some kind of abuse and did not brings logical issues for gear programs.

@grishasobol grishasobol self-assigned this Apr 16, 2024
@grishasobol grishasobol added the A0-pleasereview PR is ready to be reviewed by the team label Apr 16, 2024
@grishasobol grishasobol requested review from breathx, gshep and ark0f and removed request for breathx April 16, 2024 18:17
pallets/gear/src/tests.rs Outdated Show resolved Hide resolved
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

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

Could you please provide more detailed explanation how and why it was before and how will be from now on? @grishasobol

@grishasobol
Copy link
Member Author

Could you please provide more detailed explanation how and why it was before and how will be from now on?

It was because there was no difference between empty allocations and completely freeing allocation. So, because core-processor updates allocation only in case they are not empty - we have a problem that after freeing all allocations we have no updates in storage after that. Now update will be.

This is not very important bug. Only in case some program allocates lots of pages in one executions and then frees all of them in another execution, then allocations won't be freed, so that can cause problems for programs who wants to be sure that freed allocations can be accessible to be allocated in next executions.

@grishasobol
Copy link
Member Author

Could you please provide more detailed explanation how and why it was before and how will be from now on?

Actually I do not why this bug was in our code. Very old bug I think

@grishasobol grishasobol merged commit 89f94fe into master Apr 17, 2024
10 checks passed
@grishasobol grishasobol deleted the gsobol-fix-allocations branch April 17, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No difference between empty allocations and not changed allocations
4 participants