Skip to content

make polkadot-parachain startup errors pretty#5214

Merged
alexggh merged 2 commits into
masterfrom
alexggh/polkadot_parachain_error
Aug 5, 2024
Merged

make polkadot-parachain startup errors pretty#5214
alexggh merged 2 commits into
masterfrom
alexggh/polkadot_parachain_error

Conversation

@alexggh

@alexggh alexggh commented Aug 2, 2024

Copy link
Copy Markdown
Contributor

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

The errors on polkadot-parachain are not printed with their full display
context because, fix that by using color_eyre in the binary to properly
show them.

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
@alexggh alexggh requested a review from bkchr August 2, 2024 08:46

@alindima alindima left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@alexggh alexggh added this pull request to the merge queue Aug 5, 2024
Merged via the queue into master with commit 0cc3e17 Aug 5, 2024
@alexggh alexggh deleted the alexggh/polkadot_parachain_error branch August 5, 2024 12:07
ordian added a commit that referenced this pull request Aug 6, 2024
* master: (51 commits)
  Remove unused feature gated code from the minimal template (#5237)
  make polkadot-parachain startup errors pretty (#5214)
  Coretime auto-renew (#4424)
  network/strategy: Backoff and ban overloaded peers to avoid submitting the same request multiple times (#5029)
  Fix frame crate usage doc (#5222)
  beefy: Tolerate pruned state on runtime API call (#5197)
  rpc: Enable ChainSpec for polkadot-parachain (#5205)
  Add an adapter for configuring AssetExchanger (#5130)
  Replace env_logger with sp_tracing (#5065)
  Adjust sync templates flow to use new release branch (#5182)
  litep2p/discovery: Publish authority records with external addresses only (#5176)
  Run UI tests in CI for some other crates (#5167)
  Remove `pallet::getter` usage from the pallet-balances (#4967)
  pallet-timestamp: `UnixTime::now` implementation logs error only if called at genesis (#5055)
  [CI] Cache try-runtime check (#5179)
  [Backport] version bumps and the prdocs reordering from stable2407 (#5178)
  [subsystem-benchmark] Update availability-distribution-regression-bench baseline after recent subsystem changes (#5180)
  Remove pallet::getter usage from proxy (#4963)
  Remove pallet::getter macro usage from pallet-election-provider-multi-phase (#4487)
  Review-bot@2.6.0 (#5177)
  ...
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request 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>
aurexav added a commit to darwinia-network/darwinia that referenced this pull request May 29, 2025
aurexav added a commit to darwinia-network/darwinia that referenced this pull request May 30, 2025
* Initialize

* Companion for paritytech/polkadot-sdk#4977

* Companion for paritytech/polkadot-sdk#5078

* Companion for paritytech/polkadot-sdk#5214

* Companion for paritytech/polkadot-sdk#5431

* Companion for paritytech/polkadot-sdk#4792

* Companion for paritytech/polkadot-sdk#5613

* Companion for paritytech/polkadot-sdk#7688

* Fixes

* Companion for paritytech/polkadot-sdk#5364

* Fixes

* Disable storage limit & fix format issue

* Benchmark only

* Patch evm

* Update patch info

* Fixes

---------

Co-authored-by: bear <boundless.forest@outlook.com>
Patrick8rz added a commit to Patrick8rz/darwinia that referenced this pull request Sep 6, 2025
* Initialize

* Companion for paritytech/polkadot-sdk#4977

* Companion for paritytech/polkadot-sdk#5078

* Companion for paritytech/polkadot-sdk#5214

* Companion for paritytech/polkadot-sdk#5431

* Companion for paritytech/polkadot-sdk#4792

* Companion for paritytech/polkadot-sdk#5613

* Companion for paritytech/polkadot-sdk#7688

* Fixes

* Companion for paritytech/polkadot-sdk#5364

* Fixes

* Disable storage limit & fix format issue

* Benchmark only

* Patch evm

* Update patch info

* Fixes

---------

Co-authored-by: bear <boundless.forest@outlook.com>
jacksonLewis88 added a commit to jacksonLewis88/darwinia that referenced this pull request Sep 25, 2025
* Initialize

* Companion for paritytech/polkadot-sdk#4977

* Companion for paritytech/polkadot-sdk#5078

* Companion for paritytech/polkadot-sdk#5214

* Companion for paritytech/polkadot-sdk#5431

* Companion for paritytech/polkadot-sdk#4792

* Companion for paritytech/polkadot-sdk#5613

* Companion for paritytech/polkadot-sdk#7688

* Fixes

* Companion for paritytech/polkadot-sdk#5364

* Fixes

* Disable storage limit & fix format issue

* Benchmark only

* Patch evm

* Update patch info

* Fixes

---------

Co-authored-by: bear <boundless.forest@outlook.com>
kinetic-smith803tr added a commit to kinetic-smith803tr/darwinia that referenced this pull request Sep 26, 2025
* Initialize

* Companion for paritytech/polkadot-sdk#4977

* Companion for paritytech/polkadot-sdk#5078

* Companion for paritytech/polkadot-sdk#5214

* Companion for paritytech/polkadot-sdk#5431

* Companion for paritytech/polkadot-sdk#4792

* Companion for paritytech/polkadot-sdk#5613

* Companion for paritytech/polkadot-sdk#7688

* Fixes

* Companion for paritytech/polkadot-sdk#5364

* Fixes

* Disable storage limit & fix format issue

* Benchmark only

* Patch evm

* Update patch info

* Fixes

---------

Co-authored-by: bear <boundless.forest@outlook.com>
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 this pull request may close these issues.

Error: NetworkKeyNotFound

4 participants