-
Notifications
You must be signed in to change notification settings - Fork 16
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 feature to enable migrations to fix references to non-existent registers #387
Merged
fxamacker
merged 10 commits into
feature/stable-cadence
from
fxamacker/add-fix-broken-reference-function
Apr 16, 2024
Merged
Add feature to enable migrations to fix references to non-existent registers #387
fxamacker
merged 10 commits into
feature/stable-cadence
from
fxamacker/add-fix-broken-reference-function
Apr 16, 2024
Commits on Apr 11, 2024
-
Add feature to fix references to non-existent register
The intended use case is to enable migration programs in onflow/flow-go to fix broken references. As of April 2024, only 10 registers in testnet (not mainnet) were found to have broken references and they seem to have resulted from a bug that was fixed 2 years ago by onflow/cadence#1565. A broken reference is a StorageID referencing a non-existent slab. This commit adds FixLoadedBrokenReferences(), which traverses loaded slabs and fixes broken references in maps. To fix a map containing broken references, new function replaces broken map with empty map having the same StorageID and also removes all slabs in the old map. Limitations: - only fix broken references in map (this is intentional) - only traverse loaded slabs in deltas and cache IMPORTANT: This should not be used to silently fix unknown problems. It should only be used by migration programs to fix known problems which were determined to be appropriate to fix.
Configuration menu - View commit details
-
Copy full SHA for 479bc26 - Browse repository at this point
Copy the full SHA 479bc26View commit details -
Configuration menu - View commit details
-
Copy full SHA for e9b3a1b - Browse repository at this point
Copy the full SHA e9b3a1bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a0c061 - Browse repository at this point
Copy the full SHA 3a0c061View commit details -
Configuration menu - View commit details
-
Copy full SHA for b7a81a3 - Browse repository at this point
Copy the full SHA b7a81a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for d5cb164 - Browse repository at this point
Copy the full SHA d5cb164View commit details -
Configuration menu - View commit details
-
Copy full SHA for a887780 - Browse repository at this point
Copy the full SHA a887780View commit details
Commits on Apr 15, 2024
-
Co-authored-by: Bastian Müller <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3b05bb1 - Browse repository at this point
Copy the full SHA 3b05bb1View commit details
Commits on Apr 16, 2024
-
Allow callers to skip fixing a broken reference
Currently, calls to this function can be limited by migration programs by specifying the 9 testnet accounts affected by 10 registers with broken references on testnet. This commit allows callers to implement additional restrictions, so calling FixLoadedBrokenReferences for the affected 9 testnet accounts can be even more limited at the callers discretion. In practice, this change is not expected to produce different migration results because full migration tests before this change correctly fixed the 10 known registers in the 9 testnet accounts. This commit added predicate func(old Value) bool to PersistentSlabStorage.FixLoadedBrokenReferences() to control whether to fix a atree.Value containing broken references. Also modified PersistentSlabStorage.FixLoadedBrokenReferences() to return fixed storage IDs and skipped storage IDs. Both returned values are of type map[StorageID][]StorageID, with key as root slab ID and value as all slab IDs containing broken references connected to the root. Also added more tests and improved existing tests.
Configuration menu - View commit details
-
Copy full SHA for 40aea0d - Browse repository at this point
Copy the full SHA 40aea0dView commit details -
Add PersistentSlabStorage.GetAllChildReferences()
This commit adds GetAllChildReferences() which essentially wraps an existing internal function.
Configuration menu - View commit details
-
Copy full SHA for 3cead2a - Browse repository at this point
Copy the full SHA 3cead2aView commit details -
Merge pull request #391 from onflow/fxamacker/export-getAllChildRefer…
…ences Add PersistentSlabStorage.GetAllChildReferences()
Configuration menu - View commit details
-
Copy full SHA for 4b0f707 - Browse repository at this point
Copy the full SHA 4b0f707View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.