-
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
Problems loading values and @AnyResource #3491
Comments
Was able to reproduce using the above transaction on migrationnet in transaction Transaction ID: 55ac88fd65ed289e67d5aa960a1f6f3d4e8ab9b702f2687e3cab65b916d3e3e0
Block ID d21c9f94745e2df7484862ebb3789159b15be1e1e70c9357186763cebf8e6e60
Block Height 204925860
❌ Transaction Error
[Error Code: 1101] error caused by: 1 error occurred:
* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:
error: invalid transfer of value: expected `<<invalid>>`, got `FlowToken.Vault`
--> 55ac88fd65ed289e67d5aa960a1f6f3d4e8ab9b702f2687e3cab65b916d3e3e0:9:22
|
9 | let loaded <- signer.storage.load<@AnyResource>(from: /storage/temp)
10 | ?? panic("no resource found in vault storage path")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Flow CLI v1.21.0-cadence-v1.0.0-preview.28 uses Cadence v1.0.0-preview.35 |
Maybe this is related to the nil-coalescing changes? #3423 |
Smaller reproducer resource R {}
fun f(): @AnyResource? { // specifically returning `@AnyResource?` fails. returning `@R?` works
return <-create R()
}
let y <- f() ?? panic("no R") |
@SupunS Any idea why this could happen? Maybe the new use of |
Pushed up a reproducer as a test case in https://github.com/onflow/cadence/pull/new/bastian/3491-fix-load-anyresource |
hmm, strange. I'll have a look. Thanks for the reproducer! |
I guess the problem is that for the LCS inputs The LCS function probably needs to somehow handle the case, or we specially handle the case in the nil-coalescing checking |
on a side note: It seems like the Invalid type somehow goes to interpreter. Should've been reported by the checker and terminate there. |
Good point! It looks like most, but not all calls of |
Current Behavior
Attempting to load a resource from account storage as
@AnyResource
failsExpected Behavior
Loading resources from storage as
AnyResource
should succeedSteps To Reproduce
Attempt to load a resource from storage using a transaction such as:
Which outputs the error:
Environment
The text was updated successfully, but these errors were encountered: