-
Notifications
You must be signed in to change notification settings - Fork 140
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
Implement StaticType()
for arrays and dictionaries
#870
Comments
Thank you for creating this issue @SupunS. This was a known limitation of the initial implementation, see the discussion here: #195 (comment). Container values currently don't have knowledge about their static type. This could be added, but is still missing in already stored values and could not easily be added for old values. |
Storage migration in flow-go is here: https://github.com/onflow/flow-go/compare/bastian/cadence-storage-v5 It can be run using e.g.:
|
Reopening because we still need to do the storage migration. |
1264: Add storage migration to inject static types to cadence values r=Kay-Zee a=SupunS ## Description: This migration adds static types info to cadence values with missing type info. This is required for onflow/cadence#870 **Depends on:** #1265 ## Steps to run: - Build the binary with: ``` GOOS=linux GOARCH=amd64 go build ./cmd/util ``` - Run with the following command. Here `<checkpoint-dir>` is the directory where the checkpoint file is located. `<output-dir>` is the directory where outputs will be generated (assumes `<output-dir>` exists). ``` ./util execution-state-extract --execution-state-dir <checkpoint-dir> --output-dir <output-dir> ``` - To remove broken contracts and clean up the storage, add ` --cleanup-storage` flag. e.g: ``` ./util execution-state-extract --execution-state-dir <checkpoint-dir> --output-dir <output-dir> --cleanup-storage ``` Co-authored-by: Bastian Müller <[email protected]>
Migration added: onflow/flow-go#1264 |
Issue To Be Solved
getType()
function on containers (arrays. dictionaries), returns no type information.e.g:
Actual output:
Type()
Expected Output:
Type([Int])
Solution
@turbolent
Add static types to array values and dictionary values #1034
@turbolent
Add static types to array values and dictionary values #1034
StaticType()
for arrays and dictionaries@turbolent
Add walker for values #1037
@SupunS
Add encoder/decoder v5 #1039
@SupunS
Add encoding/decoding for array value static type #1035
@SupunS
Add encoding/decoding dictionary static type info #1036
@SupunS
Finish storage format changes #1042
Add tests for decoding from old format and encoding in new format #1046
@turbolent
@turbolent
Add static types to array values and dictionary values #1034
@turbolent
Infer array and dictionary static types from expected type during import #1038
AnyStruct
and the value is[3, 5, 2]
). Could make use of: Find least common super-type #1025, by getting static type of each element -> convert to sema type -> find super type -> convert back to static type.@SupunS
Short-term solution: Infer static-type from imported array/dictionary values #1052
Long-term solution: Infer static type from the value itself for imported arrays/dictionaries #1049
@turbolent
Include and consider static types of arrays and dictionaries #1043
@turbolent
Include and consider static types of arrays and dictionaries #1043
ConformsToDynamicType
: Consider dynamic array type's / dynamic dictionary type's static type@SupunS
Seems redundant. Added tests: Add more tests for imported array/dictionary value type conformance #1045
Concerns
A: We will infer static types for existing stored data and migrate it
Related Issues
#748
The text was updated successfully, but these errors were encountered: