-
Notifications
You must be signed in to change notification settings - Fork 166
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
Add Migration to Update Storage Used #1033
Conversation
…-used-update-migration
Codecov Report
@@ Coverage Diff @@
## master #1033 +/- ##
==========================================
+ Coverage 55.71% 55.76% +0.05%
==========================================
Files 481 482 +1
Lines 29387 29501 +114
==========================================
+ Hits 16373 16452 +79
- Misses 10781 10803 +22
- Partials 2233 2246 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks good!
In the future we should run this after each state migration. There are two upcoming state migrations: one state migration will add type information to all arrays and dictionaries, likely in the next spork; and the other state mogration will switch arrays, dictionaries, and composite values to the new optimized data structures (a few sporks from now)
if _, ok := storageUsed[payloadSize.Address]; !ok { | ||
storageUsed[payloadSize.Address] = 0 | ||
} | ||
storageUsed[payloadSize.Address] = storageUsed[payloadSize.Address] + payloadSize.StorageUsed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this assumes that an address exist that has two storage_used registers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
the storageUsedChan gets 1 input for every single register. That input is the address of a register and the storage used by that register. That is then just summed up to get the storage used per address.
This is basically just a way to prevent concurrent access to the storageUsed
dictionary.
bors merge |
If no other data migrations will be made the next spork, this line should be removed before the spork https://github.com/onflow/flow-go/pull/1033/files#diff-944cfc2e92587c43f3648956f2e94ed3b755acabfd1e39cbc08c2a503cde6a9eR64 |
ref: https://github.com/dapperlabs/flow-internal/issues/1539
Added a migration that updates accounts
storageUsed
to the actual value. A de-sync in accountsstorageUsed
and the actual storage it is using when a migration changes registers directly.a (minor) de-sync did happen in the past. Running this migration on a mainnet state from a month ago shows that no accounts are using more storage than their
storageUsed
and that on average accounts are using 7.2% less storage than theirstorageUsed
.