flow-playground
flow-playground copied to clipboard
'panic' function on borrowed capability causes some resources not to show up in resources explorer in playground
The new Playground UI with expanded resources explorer functionality should display all account storage items for any given account. The new functionality works, but somehow when the 'panic' function is applied to a borrowed capability it causes some resources not to show up in account storage.
Steps to reproduce:
- fork the following playground: https://play.onflow.org/7c60f681-40c7-4a18-82de-b81b3b6c7915?type=account&id=0
- click on the storage icon next to account 0x01, notice storage is empty
- deploy the 'ExampleToken' contract
- notice that account 0x01's storage is still empty
Now, on a new fork of the playground link before step 2, remove line 146 (the panic), and then on line 145 add a force unwrap operator, ex let recipientRef = recipient.borrow()!. Deploy and watch how account storage shows the 'Minter', 'MainMinter' and 'MainVault' resources properly.
This one is a great issue, @hichana did you find out the reason ? If not I will debug this one.
Hi @bluesign I didn’t find out the reason unfortunately. @MaxStalker helped me uncover it as I was building the new resources explorer, so he might have some insights.
Seems problem with executeNonProgram which doesn't have access to builtins. I wrote about this before:
https://github.com/onflow/flow-playground/issues/158#issuecomment-881869616
I think same workaround although ugly can work here.
I think also can be fixed in cadence side, actually executeNonProgram should provide builtins I guess ( as Value depends on 'on demand contract loading' ) @turbolent
Appears to be fixed in the latest build: