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 66 forks source link

Flow Emulator Broken since version 2.0.5 #1781

Open damian-psiware opened 1 day ago

damian-psiware commented 1 day ago

Instructions

Update the flow emulator to version 2.0.5. Also for version 2.0.6. Then I go to my current Cadence project and run "flow emulator" and throws the error described below.

If I create a new flow project with "flow init" it works fine.

Problem

The emulator brokes, this is the error message:

❯ flow emulator
panic: unknown chain: 

goroutine 1 [running]:
github.com/onflow/flow-go/fvm/systemcontracts.SystemContractsForChain({0x0, 0x0})
        /root/go/pkg/mod/github.com/onflow/flow-go@v0.37.10/fvm/systemcontracts/system_contracts.go:260 +0x9d
github.com/onflow/flowkit/v2/config.isCoreContract({0xc0010ac540?, 0xc001366e20?}, {0xc0010ac55e, 0x6}, {0xc00198f1b8, 0x10})
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/config/contract.go:138 +0x76
github.com/onflow/flowkit/v2/config.(*Contracts).AddDependencyAsContract(0xc001c5fba8, {{0xc0013661d8, 0x6}, {{0xc0010ac540, 0xa}, {0xb6, 0x76, 0x3b, 0x43, 0x99, ...}, ...}, ...}, ...)
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/config/contract.go:166 +0xf0
github.com/onflow/flowkit/v2/config/json.(*jsonConfig).transformToConfig(0xc0013cba10)
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/config/json/config.go:80 +0x39b
github.com/onflow/flowkit/v2/config/json.(*Parser).Deserialize(0xc001300000?, {0xc0010ea000, 0x1b57, 0x2000})
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/config/json/config.go:149 +0xbd
github.com/onflow/flowkit/v2/config.(*Loader).loadConfig(0xc0013c0480, {0x285d632, 0x9})
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/config/loader.go:126 +0x295
github.com/onflow/flowkit/v2/config.(*Loader).Load(0xc0013c0480, {0x445ede0?, 0x2?, 0xb?})
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/config/loader.go:137 +0xc7
github.com/onflow/flowkit/v2.Load({0x445ede0, 0x2, 0x2}, {0x2f48f10, 0xc0014fe0f0})
        /root/go/pkg/mod/github.com/onflow/flowkit/v2@v2.0.0/state.go:297 +0x15f
github.com/onflow/flow-cli/internal/emulator.configuredServiceKey(0x0, 0x8?, 0x0?)
        /go/src/github.com/onflow/flow-cli/internal/emulator/start.go:75 +0xb4
github.com/onflow/flow-emulator/cmd/emulator/start.Cmd.func1(0xc001506800?, {0x2855097?, 0x4?, 0x285509b?})
        /root/go/pkg/mod/github.com/onflow/flow-emulator@v1.0.0/cmd/emulator/start/start.go:126 +0x205
github.com/spf13/cobra.(*Command).execute(0xc000b26608, {0xc000144010, 0x0, 0x0})
        /root/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:989 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xc000b26908)
        /root/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /root/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
main.main()
        /go/src/github.com/onflow/flow-cli/cmd/flow/main.go:131 +0xf74

Steps to Reproduce

Run the command:

sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)"

cd to my cadence project and run:

flow emulator

Context

<what are you currently working on that this is blocking?>

jribbink commented 1 day ago

Hey @damian-psiware , this may be related to references to previewnet remaining in your flow.json file - can you confirm that previewnet is not anywhere in this file?