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

When amount is zero do not update the balance #866

Open
xgreenx opened this issue Oct 31, 2024 · 3 comments
Open

When amount is zero do not update the balance #866

xgreenx opened this issue Oct 31, 2024 · 3 comments

Comments

@xgreenx
Copy link
Collaborator

xgreenx commented Oct 31, 2024

The current code always increases and decreases the balance even if we have no updates. It means storage read and write and spends a lot of resources for nothing.

image
@askwhyharsh
Copy link

Interesting,

when is the increase/decrease happening? I would love to know more. As I can see, it updates a particular asset Id balance of a contract. It looks like a function, so I think it should be called when it's needed. So how is it calling even if we have no updates? Do you mean that if it's 0, we are still attempting an increase/decrease?

@xgreenx
Copy link
Collaborator Author

xgreenx commented Dec 29, 2024

Yes, if value is zero, we still will update Merkel tree. So we need to do only update if values is not zero

@askwhyharsh
Copy link

i see, is it fine if i give it an attempt? can also try running the vm locally and play.

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

No branches or pull requests

2 participants