-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Garbage Collect empty storage keys (Neo 3) #824
Comments
This could also be useful for: #814, to prevent unnecessary |
Implementation is simple: every time we do a |
Then we can't do this neo-project/neo-vm#170 :) |
neo/neo/SmartContract/InteropService.cs Line 473 in fe3ab04
For So, for This seems quite reasonable. |
In fact, it's the opposite @shargon , we need that! I'll show you on the tests there... it's all connected ;) |
* Close #824 * optimize * remove redundancy * simplified * allow const empty array * Update InteropService.cs * Update InteropService.cs
* Close neo-project#824 * optimize * remove redundancy * simplified * allow const empty array * Update InteropService.cs * Update InteropService.cs
I think a very nice policy for Neo is to automatically garbage-collect empty keys.
Example:
This is used a lot on NEP-5 tokens, and usually we have to put an extra if, because if key is not empty (or zero-valued), we call
Storage.Delete
. It could be done automatically, which is more simple for users, and more efficient for the network (no empty keys recorded, and they take space).Note that, one slight change may be necessary (proposed on neo-vm project): we must ensure that BigInteger format is always expressed in its most compressed format... meaning that BigInteger(0) will now be expressed as an empty array (not "0x00"). This is easier to understand and more space efficient (and automatically help us with this garbage collection).
The text was updated successfully, but these errors were encountered: