-
Notifications
You must be signed in to change notification settings - Fork 12
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
Port updates from atree-internal #491
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently, Cadence interpreter.SomeValue is opaque to packages like Atree, so interpreter.SomeValue is treated as atomic value. This causes a container wrapped by interpreter.SomeValue to be treated as atomic value since it is opaque. Given this, the integration between Cadence and Atree does not establish parent-child relationship of a wrapped container since the inner values of interpreter.SomeValue are not visible to Atree. Resolving this issue requires modifying onflow/cadence to unwrap containers wrapped by interpreter.SomeValue. This commit simplifies and reduces the amount of changes needed by onflow/cadence by providing two new interfaces here: - WrapperValue - WrapperStorable When Cadence passes objects that implement these interfaces, Atree will call the interface functions (that implement unwrapping) when setting child-parent callbacks. This approach simplifies changes needed by integration in Cadence to allow Atree to support containers wrapped by interpreter.SomeValue.
This commit adds support for the new WrapperValue interface in Array.Set() and Array.Remove(). Overwritten and removed inlined slabs need to be uninlined and stored in storage before returning to the caller. Because of new interfaces of WrapperValue and WrapperStorable, this commit uninlines wrapped inlined slabs that are overwritten or removed.
This commit adds support for the new WrapperValue interface in Map.Set() and Map.Remove(). Overwritten and removed inlined slabs need to be uninlined and stored in storage before returning to the caller. Because of new interfaces of WrapperValue and WrapperStorable, this commit uninlines wrapped inlined slabs that are overwritten or removed.
This commit resolves an edge case detected by smoke testing, which isn't very likely to be encountered in practice. Currently composite type ID is the same ("composite_type,") for the same composite type: - with no fields or - with only 1 field and it has empty field name This commit changes composite type ID with no fields to "composite_type" to be different from composite type with 1 field of empty field name "composite_type,". NOTE: Composite type ID is only used to deduplicate composite types during encoding. It isn't serialized to underlying storage.
This commit adds smoke tests for the new interfaces being added in the upcoming v0.9.0 release: - atree.WrapperValue - atree.WrapperStorable Smoke tests has been running for over 24 hours using 40 processes without any problems detected as of Friday, January 10, 2025.
This commit fixes the SlabIterator() which is currently used only by test code. Changes in this commit do not affect mainnet, testnet, etc.
WrapperStorable is a new interface being added to the upcoming Atree v0.9.0, which hasn't been released yet. This commit updates LoadedValueIterator to check for the new interface.
SupunS
approved these changes
Jan 27, 2025
fxamacker
approved these changes
Jan 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Port internal updates https://github.com/onflow/atree-internal/compare/ea00755...acdb0e04ab01
Complete list of atree-internal PRs ported:
(+5,937 −174)
by @fxamacker(+4 −0)
by @fxamacker(+559 −35)
by @fxamacker(+148 −4)
by @fxamacker(+1,712 −1,462)
by @fxamacker
These ports add 2 new interfaces that client software can use (e.g. Cadence):
atree.WrapperValue
atree.WrapperStorable
Other changes from these ports are nits that don't affect mainnet (minor fixes to tests, update smoke tests, etc.)
NOTE: As mentioned by @SupunS on Jan 9, 2025, Create unique type ID with no fields fixes a scenario that cannot happen due to Cadence data types. So that PR is a "nice to have" that doesn't change behavior on mainnet.
main
branchFiles changed
in the Github PR explorer