Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli: Update warning for new bootstrap node names
Lorenz Leutgeb committed 2 days ago
commit 06ff36ebc443f63b8b735003e0a355f50e53c5bc
parent 22287fd
3 files changed +36 -12
modified CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Following a domain move of the project, the names of the bootstrap nodes change:
`{iris,rosa}.radicle.{xyz → network}`.
+
Old names in the Radicle configuration will be detected and cause warnings to
+
be printed.

## New Features

modified crates/radicle-cli/examples/rad-warn-old-nodes.md
@@ -3,6 +3,12 @@ $ rad config push preferredSeeds z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm
z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@seed.radicle.garden:8776
$ rad config push node.connect z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@ash.radicle.garden:8776
z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@ash.radicle.garden:8776
+
$ rad config push node.connect z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.xyz:8776
+
z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@ash.radicle.garden:8776
+
z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.xyz:8776
+
$ rad config push preferredSeeds z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@rosa.radicle.xyz:8776
+
z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@seed.radicle.garden:8776
+
z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@rosa.radicle.xyz:8776
```

Note the warnings that the above configuration causes:
@@ -38,8 +44,10 @@ $ rad debug
    "RAD_RNG_SEED": "0"
  },
  "warnings": [
-
    "Value of configuration option `node.connect` at index 0 mentions node with address 'ash.radicle.garden:8776', which has been renamed to 'rosa.radicle.xyz:8776'. Please edit your configuration file to use the new address.",
-
    "Value of configuration option `preferredSeeds` at index 0 mentions node with address 'seed.radicle.garden:8776', which has been renamed to 'iris.radicle.xyz:8776'. Please edit your configuration file to use the new address."
+
    "Value of configuration option `node.connect` at index 0 mentions node with hostname 'ash.radicle.garden', which has been renamed to 'rosa.radicle.network'. Please edit your configuration file to use the new address.",
+
    "Value of configuration option `node.connect` at index 1 mentions node with hostname 'iris.radicle.xyz', which has been renamed to 'iris.radicle.network'. Please edit your configuration file to use the new address.",
+
    "Value of configuration option `preferredSeeds` at index 0 mentions node with hostname 'seed.radicle.garden', which has been renamed to 'iris.radicle.network'. Please edit your configuration file to use the new address.",
+
    "Value of configuration option `preferredSeeds` at index 1 mentions node with hostname 'rosa.radicle.xyz', which has been renamed to 'rosa.radicle.network'. Please edit your configuration file to use the new address."
  ]
}
```
@@ -48,8 +56,10 @@ Also, `rad node status` will warn us:

```
$ rad node status
-
! Warning: Value of configuration option `node.connect` at index 0 mentions node with address 'ash.radicle.garden:8776', which has been renamed to 'rosa.radicle.xyz:8776'. Please edit your configuration file to use the new address.
-
! Warning: Value of configuration option `preferredSeeds` at index 0 mentions node with address 'seed.radicle.garden:8776', which has been renamed to 'iris.radicle.xyz:8776'. Please edit your configuration file to use the new address.
+
! Warning: Value of configuration option `node.connect` at index 0 mentions node with hostname 'ash.radicle.garden', which has been renamed to 'rosa.radicle.network'. Please edit your configuration file to use the new address.
+
! Warning: Value of configuration option `node.connect` at index 1 mentions node with hostname 'iris.radicle.xyz', which has been renamed to 'iris.radicle.network'. Please edit your configuration file to use the new address.
+
! Warning: Value of configuration option `preferredSeeds` at index 0 mentions node with hostname 'seed.radicle.garden', which has been renamed to 'iris.radicle.network'. Please edit your configuration file to use the new address.
+
! Warning: Value of configuration option `preferredSeeds` at index 1 mentions node with hostname 'rosa.radicle.xyz', which has been renamed to 'rosa.radicle.network'. Please edit your configuration file to use the new address.
Node is stopped.
To start it, run `rad node start`.
```
modified crates/radicle-cli/src/warning.rs
@@ -1,19 +1,30 @@
use std::collections::HashMap;
use std::sync::LazyLock;

-
use radicle::node::Address;
use radicle::node::config::ConnectAddress;
+
use radicle::node::{Address, HostName};
use radicle::profile::Config;

-
static NODES_RENAMED: LazyLock<HashMap<Address, Address>> = LazyLock::new(|| {
+
const IRIS: &str = "iris.radicle.network";
+
const ROSA: &str = "rosa.radicle.network";
+

+
static NODES_RENAMED: LazyLock<HashMap<HostName, HostName>> = LazyLock::new(|| {
    HashMap::from([
        (
-
            "seed.radicle.garden:8776".parse().unwrap(),
-
            "iris.radicle.xyz:8776".parse().unwrap(),
+
            HostName::Dns("seed.radicle.garden".to_string()),
+
            HostName::Dns(IRIS.to_string()),
+
        ),
+
        (
+
            HostName::Dns("iris.radicle.xyz".to_string()),
+
            HostName::Dns(IRIS.to_string()),
+
        ),
+
        (
+
            HostName::Dns("ash.radicle.garden".to_string()),
+
            HostName::Dns(ROSA.to_string()),
        ),
        (
-
            "ash.radicle.garden:8776".parse().unwrap(),
-
            "rosa.radicle.xyz:8776".parse().unwrap(),
+
            HostName::Dns("rosa.radicle.xyz".to_string()),
+
            HostName::Dns(ROSA.to_string()),
        ),
    ])
});
@@ -24,9 +35,10 @@ fn nodes_renamed_for_option(
) -> Vec<String> {
    iter.into_iter().enumerate().fold(Vec::new(), |mut warnings, (i, value)| {
        let old: Address = value.into();
-
        if let Some(new) = NODES_RENAMED.get(&old) {
+
        let old = old.host();
+
        if let Some(new) = NODES_RENAMED.get(old) {
            warnings.push(format!(
-
                "Value of configuration option `{option}` at index {i} mentions node with address '{old}', which has been renamed to '{new}'. Please edit your configuration file to use the new address."
+
                "Value of configuration option `{option}` at index {i} mentions node with hostname '{old}', which has been renamed to '{new}'. Please edit your configuration file to use the new address."
            ));
        }
        warnings