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

Trouble adding NodeAuthorization to genesis config #2158

Open
2 tasks done
cbonaco1 opened this issue Jun 7, 2024 · 0 comments
Open
2 tasks done

Trouble adding NodeAuthorization to genesis config #2158

cbonaco1 opened this issue Jun 7, 2024 · 0 comments
Labels
bug 🐛 Something isn't working.

Comments

@cbonaco1
Copy link

cbonaco1 commented Jun 7, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Bug report for compiling, code snippets, templates, etc.

Hello,
I am going through the Build a Blockchain -> Authorize specific nodes tutorial and am having some issues with two steps.

Implement the Config Trait

Step 4 - Adding the NodeAuthorization to the construct_runtime! macro. This macro does not seem to be used anymore, instead I added it to the mod runtime as follows:

mod runtime {
 //...existing code
 //...
  #[runtime::pallet_index(9)]
  pub type NodeAuthorization = pallet_node_authorization;
}

The cargo check command works after adding it this way, so it seems to be fine; however, making this more clear in the tutorial steps would be very helpful, especially for folks (like myself) who are new to Rust and Substrate 🙏 🙏

The bigger issue I am experiencing is under Add genesis storage for authorized nodes step 6 & 7 where we need to add NodeAuthorization to the testnet_genesis function in node/src/chain_spec.rs. The body of the function in the current codebase is different than what's in the tutorial. instead of adding to the GenesisConfig struct, it's returning a JSON object by using serde_json::json!. tried adding a JSON object with key nodeAuthorization with a few different schemas, but cannot get the node to run. for example:

		"nodeAuthorization": [
			{
				"opaquePeerId": bs58::decode("12D3KooWBmAwcd4PJNJvfV89HwE48nwkRmAgo8Vy3uQEyNNHBox2").into_vec().unwrap(),
				"accountId": endowed_accounts[0].clone(),
			},
			{
				"opaquePeerId": bs58::decode("12D3KooWQYV9dGMFoRzNStwpXztXaBUjtPqi6aU76ZgUriHhKust").into_vec().unwrap(),
				"accountId": endowed_accounts[1].clone(),
			}
		],

however I am getting an error when starting the node - Invalid JSON blob: invalid type: map, expected a sequence at line 1 column 1189

any guidance on what the expected JSON structure is here would be greatly appreciated!

Steps to reproduce the problem

No response

@cbonaco1 cbonaco1 added the bug 🐛 Something isn't working. label Jun 7, 2024
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

No branches or pull requests

1 participant