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

Error: NetworkKeyNotFound #5211

Closed
xlc opened this issue Aug 2, 2024 · 7 comments · Fixed by #5214
Closed

Error: NetworkKeyNotFound #5211

xlc opened this issue Aug 2, 2024 · 7 comments · Fixed by #5214
Assignees

Comments

@xlc
Copy link
Contributor

xlc commented Aug 2, 2024

using parity/polkadot-parachain:1.15.0

root@03d37361194a:/# polkadot-parachain --base-path=/acala/data/Collator2  --chain /mandala.json  --collator -- --chain /rococo-mandala.json
Error: NetworkKeyNotFound("/acala/data/Collator2/chains/mandala-tc9/network/secret_ed25519")

I was trying to purge the node and I simply deleted /acala/data/Collator2/chains/mandala-tc9 but now getting this error.
Looks like it errored when no collator key found but it shouldn't be a fatal issue?

@xlc
Copy link
Contributor Author

xlc commented Aug 2, 2024

ok found this

#[error(
"Starting an authorithy without network key in {0}.
\n This is not a safe operation because other authorities in the network may depend on your node having a stable identity.
\n Otherwise these other authorities may not being able to reach you.
\n If it is the first time running your node you could use one of the following methods:
\n 1. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --base-path <YOUR_BASE_PATH>
\n 2. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --file <YOUR_PATH_TO_NODE_KEY>
\n 3. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --default-base-path
\n 4. [Unsafe] Pass --unsafe-force-node-key-generation and make sure you remove it for subsequent node restarts"
)]

it should log those messages

it also runs fine when there is a session key present, which doesn't make a lot of sense. it should always log the warning when there isn't a network key?

@alexggh
Copy link
Contributor

alexggh commented Aug 2, 2024

It means that your node was missing the network key which is meant to be generated once and persisted across restarts, this was introduced for polkadot authorities to prevent accidental change of it, but we concurred here #4957 that is desirable for any type of authorities as well.

It is weird polkadot-parachain doesn't show you the full error, polkadot definitely shows it, so I'll look into fixing the error output.

@alexggh
Copy link
Contributor

alexggh commented Aug 2, 2024

It is weird polkadot-parachain doesn't show you the full error, polkadot definitely shows it, so I'll look into fix the error output.

Fix for this: #5214

github-merge-queue bot pushed a commit that referenced this issue Aug 5, 2024
The errors on polkadot-parachain are not printed with their full display
context(what is marked with `#[error(`) because main returns plain
Result and the error will be shown in its Debug format, that's not
consistent with how the polkadot binary behave and is not user friendly
since it does not tell them why they got the error.

Fix it by using `color_eyre` as polkadot already does it. 

Fixes: #5211

## Output before
```
Error: NetworkKeyNotFound("/acala/data/Collator2/chains/mandala-tc9/network/secret_ed25519")
```

## Output after
```
Error: 
   0: Starting an authorithy without network key in /home/alexggh/.local/share/polkadot-parachain/chains/asset-hub-kusama/network/secret_ed25519.
      
       This is not a safe operation because other authorities in the network may depend on your node having a stable identity.
      
       Otherwise these other authorities may not being able to reach you.
      
       If it is the first time running your node you could use one of the following methods:
      
       1. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --base-path <YOUR_BASE_PATH>
      
       2. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --file <YOUR_PATH_TO_NODE_KEY>
      
       3. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --default-base-path
      
       4. [Unsafe] Pass --unsafe-force-node-key-generation and make sure you remove it for subsequent node restarts

```

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this issue Aug 28, 2024
The errors on polkadot-parachain are not printed with their full display
context(what is marked with `#[error(`) because main returns plain
Result and the error will be shown in its Debug format, that's not
consistent with how the polkadot binary behave and is not user friendly
since it does not tell them why they got the error.

Fix it by using `color_eyre` as polkadot already does it. 

Fixes: paritytech#5211

## Output before
```
Error: NetworkKeyNotFound("/acala/data/Collator2/chains/mandala-tc9/network/secret_ed25519")
```

## Output after
```
Error: 
   0: Starting an authorithy without network key in /home/alexggh/.local/share/polkadot-parachain/chains/asset-hub-kusama/network/secret_ed25519.
      
       This is not a safe operation because other authorities in the network may depend on your node having a stable identity.
      
       Otherwise these other authorities may not being able to reach you.
      
       If it is the first time running your node you could use one of the following methods:
      
       1. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --base-path <YOUR_BASE_PATH>
      
       2. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --file <YOUR_PATH_TO_NODE_KEY>
      
       3. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --default-base-path
      
       4. [Unsafe] Pass --unsafe-force-node-key-generation and make sure you remove it for subsequent node restarts

```

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
@ozgunozerk
Copy link
Contributor

@alexggh

I encountered the same error, and tried the suggestions in the PR #5214 :

  • [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --default-base-path
    • error: unexpected argument 'key' found -> if key refers to a variable, it should have been <KEY> but I guess that's not the reason I'm getting the error.
  • [Unsafe] Pass --unsafe-force-node-key-generation and make sure you remove it for subsequent node restarts
    • has no effect and I'm still getting the original error of: Error: NetworkKeyNotFound

We are on polkadot-stable-2407-1 tag. Do you have any educated guess on the reasons for the errors I'm getting above?

@alexggh
Copy link
Contributor

alexggh commented Sep 25, 2024

We are on polkadot-stable-2407-1 tag. Do you have any educated guess on the reasons for the errors I'm getting above?

@ozgunozerk Can you copy paste the commandline your are using for generating the keys and starting the node ?

@ozgunozerk
Copy link
Contributor

@alexggh thanks a lot for the fast response!

This one for the --unsafe-force-node-key-generation:

./target/release/evm-template-node \
    --alice \
    --collator \
    --force-authoring \
    --chain raw-parachain-chainspec.json \
    --base-path storage/alice \
    --port 40333 \
    --rpc-port 8844 \
    -- \
    --execution wasm \
    --chain /var/folders/kl/404s241d4_93gz8mh4cg4cz80000gn/T/zombie-1b41a5961e22a4fcb9e3e5505a504b2e_-17088-eQJ75Xy4S8Jj/bob/cfg/rococo-local.json \
    --port 30343 \
    --rpc-port 9977 \
    --unsafe-force-node-key-generation

-> Error: NetworkKeyNotFound

And this one for the key:

./target/release/evm-template-node key generate-node-key --default-base-path

-> unexpected argument 'key' found

I also tried running the node executable by only providing key:

./target/release/evm-template-node key 

-> unexpected argument 'key' found

@alexggh
Copy link
Contributor

alexggh commented Sep 25, 2024

./target/release/evm-template-node \
    --alice \
    --collator \
    --force-authoring \
    --chain raw-parachain-chainspec.json \
    --base-path storage/alice \
    --port 40333 \
    --rpc-port 8844 \
    --unsafe-force-node-key-generation \   #### You just insert the unsafe here and you should be unblocked.
    -- \
    --execution wasm \
    --chain /var/folders/kl/404s241d4_93gz8mh4cg4cz80000gn/T/zombie-1b41a5961e22a4fcb9e3e5505a504b2e_-17088-eQJ75Xy4S8Jj/bob/cfg/rococo-local.json \
    --port 30343 \
    --rpc-port 9977 \
    --unsafe-force-node-key-generation

Left you an example with a command that should unblock you. Long story short you are starting with your command two things a parachain collator and stuff to connect to the relay-chain what comes after -- are arguments for the relay chain part not for the collator, you need to pass the --unsafe stuff for the collator as well.

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

Successfully merging a pull request may close this issue.

3 participants