onflow / flow-cli

The Flow CLI is a command-line interface that provides useful utilities for building Flow applications
https://onflow.org
Apache License 2.0
206 stars 62 forks source link

`flow-c1 migrate state` no longer reports errors #1625

Open NtTestAlert opened 1 month ago

NtTestAlert commented 1 month ago

The state migrator used to report errors (usually, but not always, with helpful information). It no longer does that. Also, it now silently hides errors - if a contract failed to update, nothing is printed to the console about it, and the process exits with non-error exit code

The state file (sqlite) is patched, and all contracts that succeeded to update are migrated. But those that failed do not cause emulator startup errors. You will only find out once you try to interact with said contracts in a transaction/script.

This is extremely frustrating, especially since the errors might be related to flow.json configuration, not cadence code problems (legacy/stable-cadence code might be perfectly fine)

NtTestAlert commented 1 month ago

In my case it was a problem where FungibleToken (that is a dependency of the updated contract) had incorrect address in flow.json That was the only problem - so re-reading .cdc files 10 times to find what might be improperly migrated was not helpful.

Sidenote: Since it is a built-in contract, and one the migrator is well aware of, it should not be required to be included in the deployments in flow.json, IMHO.

turbolent commented 1 month ago

Discord thread: https://discord.com/channels/613813861610684416/621847426201944074/1244502428091547669

turbolent commented 1 month ago

Mostly a UX problem:

NtTestAlert commented 1 month ago

Additional confusion may be due to the fact that some errors - such us "cannot read contract code" do cause an error - and a fatal one at that. But I suppose that is a cli (or flowkit) error not a state-migrator error.