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

Flow Emulator Broken since version 2.0.5 #1781

Closed
damian-psiware opened this issue Oct 4, 2024 · 5 comments
Closed

Flow Emulator Broken since version 2.0.5 #1781

damian-psiware opened this issue Oct 4, 2024 · 5 comments
Assignees

Comments

@damian-psiware
Copy link

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/[email protected]/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/[email protected]/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/[email protected]/config/contract.go:166 +0xf0
github.com/onflow/flowkit/v2/config/json.(*jsonConfig).transformToConfig(0xc0013cba10)
        /root/go/pkg/mod/github.com/onflow/flowkit/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/config/loader.go:137 +0xc7
github.com/onflow/flowkit/v2.Load({0x445ede0, 0x2, 0x2}, {0x2f48f10, 0xc0014fe0f0})
        /root/go/pkg/mod/github.com/onflow/flowkit/[email protected]/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/[email protected]/cmd/emulator/start/start.go:126 +0x205
github.com/spf13/cobra.(*Command).execute(0xc000b26608, {0xc000144010, 0x0, 0x0})
        /root/go/pkg/mod/github.com/spf13/[email protected]/command.go:989 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xc000b26908)
        /root/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /root/go/pkg/mod/github.com/spf13/[email protected]/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
Copy link
Contributor

jribbink commented Oct 4, 2024

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?

@damian-psiware
Copy link
Author

damian-psiware commented Oct 7, 2024

It's still present. What should I do?

I have core contracts pointing to previewnet like this:

		"ViewResolver": {
			"source": "previewnet://b6763b4399a888c8.ViewResolver",
			"hash": "eaa3214b0e178c5692cfc243a14c739150d5d57ef3f9204a252d70667a67db76",
			"aliases": {
				"emulator": "f8d6e0586b0a20c7",
				"mainnet": "1d7e57aa55817448",
				"previewnet": "b6763b4399a888c8",
				"testnet": "631e88ae7f1d7c20"
			}
		}

How do I replace that "source" field? I understand that for aliases I should remove the entry for previewnet.

I also tried to create a new project with flow init all core contracts as dependency, to see how they are generated. But have this error:

❯ flow init test206
✔ Yes
Select any core contracts you would like to install or skip to continue.
Use arrow keys to navigate, space to select, enter to confirm or skip, q to quit:

  [x] FlowEpoch
  [x] FlowIDTableStaking
  [x] FlowClusterQC
  [x] FlowDKG
  [x] FlowServiceAccount
  [x] NodeVersionBeacon
  [x] RandomBeaconHistory
  [x] FlowStorageFees
  [x] FlowFees
  [x] FlowToken
  [x] FungibleToken
  [x] FungibleTokenMetadataViews
  [x] FungibleTokenSwitchboard
  [x] NonFungibleToken
  [x] MetadataViews
  [x] ViewResolver
  [x] EVM
> [x] Burner

🔄 Installing selected core contracts and dependencies...
❌ Command Error: error processing dependency: contract Burner not found at address e467b9dd11fa00df

@jribbink
Copy link
Contributor

jribbink commented Oct 8, 2024

Hey @damian-psiware

Yeah, for the contracts whose source is previewnet, you will unfortunately have to replace these with another network instead (I would recommend using mainnet).

Here is a example flow.json with all of the correct dependency versions for convenience (you can copy and paste anything needed from here :) https://gist.github.com/jribbink/75a3792e7ad4000e775cd7159e183e4a)

Regarding the "Burner" issue, this issue is somewhat seperate and was resolved in Flow CLI v2.0.7. My apologies for any inconvenience this may have caused. Let my know if you have any more issues after updating your CLI.

@jribbink jribbink self-assigned this Oct 8, 2024
@jribbink
Copy link
Contributor

Closing as this should be resolved.

@damian-psiware
Copy link
Author

Hi! I corrected my flow.json and updated flow-cli to latest version and everything works! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants