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

Cannot set arrays of objects in genesis configuration #1155

Closed
zdave-parity opened this issue Jun 29, 2023 · 1 comment · Fixed by #1160
Closed

Cannot set arrays of objects in genesis configuration #1155

zdave-parity opened this issue Jun 29, 2023 · 1 comment · Fixed by #1160
Labels
bug Something isn't working

Comments

@zdave-parity
Copy link
Contributor

zdave-parity commented Jun 29, 2023

Issue Description

Take for example the following network definition:

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate"
chain = "local"

  [[relaychain.genesis.runtime.mixnet.mixnodes]]
  kx_public = [94, 54, 117, 145, 86, 22, 29, 138, 0, 199, 166, 22, 250, 241, 183, 220, 208, 104, 51, 42, 12, 155, 229, 246, 228, 114, 202, 82, 127, 19, 72, 41]
  peer_id = [152, 0, 36, 8, 1, 18, 32, 213, 191, 74, 63, 204, 231, 23, 176, 56, 139, 204, 39, 73, 235, 193, 72, 173, 153, 105, 178, 63, 69, 238, 27, 96, 95, 213, 135, 120, 87, 106, 196]
  external_addresses = []

  [[relaychain.nodes]]
  name = "alice"

This tries to set an array in the genesis configuration, runtime.mixnet.mixnodes. Currently this fails with the error TypeError: Cannot convert object to primitive value. The issue appears to be this line in chainSpec.ts:

debug(`[ ${key}: ${obj2[key]} ]`);

Commenting it out fixes things.

Steps to reproduce the issue

  1. Build the Substrate kitchen-sink node on my mixnet branch (sorry, I'm not aware of any existing pallets which have an array-of-objects in their genesis configuration).
  2. Create a network.toml file with the above contents.
  3. Run node packages/cli/dist/cli.js --provider native spawn network.toml.

Describe the results you received

Zombienet prints the following error:

Fail to customize genesis

 Unexpected error:  	 TypeError: Cannot convert object to primitive value

The final chain spec local-plain.json has an empty mixnodes array.

Describe the results you expected

Zombienet should successfully launch the network without printing any errors. The final chain spec local-plain.json should not have an empty mixnodes array.

Zombienet version

33a5f83

Provider

Native

Provider version

Substrate kitchen-sink node, built on my mixnet branch.

Upstream Latest Release

Yes

@pepoviola pepoviola added the bug Something isn't working label Jun 30, 2023
@pepoviola
Copy link
Collaborator

Hi @zdave-parity thanks for reporting, we will check and fix this bug asap.

Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants