Skip to content
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

Closed
19 of 23 tasks
SupunS opened this issue May 4, 2021 · 4 comments · Fixed by #1125
Closed
19 of 23 tasks

Implement StaticType() for arrays and dictionaries #870

SupunS opened this issue May 4, 2021 · 4 comments · Fixed by #1125
Assignees
Labels
Feature Language Breaking Change Breaks Cadence contracts deployed on Mainnet Technical Debt

Comments

@SupunS
Copy link
Member

SupunS commented May 4, 2021

Issue To Be Solved

getType() function on containers (arrays. dictionaries), returns no type information.
e.g:

var array : [Int] = [1, 3]

log(array.getType())

Actual output: Type()

Expected Output: Type([Int])

Solution

Concerns

Related Issues

#748

@turbolent
Copy link
Member

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.
Still, I think we could add it for new values.

@turbolent turbolent assigned turbolent and SupunS and unassigned turbolent Jun 29, 2021
@turbolent turbolent added the Language Breaking Change Breaks Cadence contracts deployed on Mainnet label Jun 29, 2021
@turbolent
Copy link
Member

turbolent commented Jul 30, 2021

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.:

go run ./cmd/util execution-state-extract --execution-state-dir devnet23 --output-dir devnet23-out

@SupunS
Copy link
Member Author

SupunS commented Aug 25, 2021

Reopening because we still need to do the storage migration.

@SupunS SupunS reopened this Aug 25, 2021
bors bot added a commit to onflow/flow-go that referenced this issue Sep 8, 2021
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]>
@SupunS
Copy link
Member Author

SupunS commented Oct 7, 2021

Migration added: onflow/flow-go#1264

@SupunS SupunS closed this as completed Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Language Breaking Change Breaks Cadence contracts deployed on Mainnet Technical Debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants