Skip to content

Commit 4599402

Browse files
fix(node): IOTA-Names config defaults to chain ID (#9316)
# Description of change The IOTA-Names config was currently defaulting to Testnet if not provided, which made Devnet nodes to default to Testnet config. This PR changes to default to a config determined by the chain identifier. ## How the change has been tested - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [x] Patch-specific tests (correctness, functionality coverage) - [ ] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes ### Release Notes - [ ] Protocol: - [X] Nodes (Validators and Full nodes): IOTA-Names config defaults to the chain identifier instead of Testnet - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
1 parent 4bd19d4 commit 4599402

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/iota-names/src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ impl IotaNamesConfig {
6363

6464
pub fn from_chain(chain: &Chain) -> Self {
6565
match chain {
66-
Chain::Mainnet => todo!("https://github.com/iotaledger/iota/issues/6532"),
66+
// TODO switch to mainnet https://github.com/iotaledger/iota/issues/6532
67+
Chain::Mainnet => IotaNamesConfig::testnet(),
6768
Chain::Testnet => IotaNamesConfig::testnet(),
6869
Chain::Unknown => IotaNamesConfig::devnet(),
6970
}

crates/iota-node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ iota-json-rpc.workspace = true
4646
iota-json-rpc-api.workspace = true
4747
iota-macros.workspace = true
4848
iota-metrics.workspace = true
49+
iota-names.workspace = true
4950
iota-network.workspace = true
5051
iota-network-stack.workspace = true
5152
iota-protocol-config.workspace = true

crates/iota-node/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ use iota_metrics::{
9595
metrics_network::{MetricsMakeCallbackHandler, NetworkConnectionMetrics, NetworkMetrics},
9696
server_timing_middleware, spawn_monitored_task,
9797
};
98+
use iota_names::config::IotaNamesConfig;
9899
use iota_network::{
99100
api::ValidatorServer, discovery, discovery::TrustedPeerChangeEvent, randomness, state_sync,
100101
};
@@ -2521,9 +2522,10 @@ pub async fn build_http_server(
25212522
))?;
25222523
}
25232524

2524-
// TODO: Init from chain if config is not set once `IotaNamesConfig::from_chain`
2525-
// is implemented
2526-
let iota_names_config = config.iota_names_config.clone().unwrap_or_default();
2525+
let iota_names_config = config
2526+
.iota_names_config
2527+
.clone()
2528+
.unwrap_or_else(|| IotaNamesConfig::from_chain(&state.get_chain_identifier().chain()));
25272529

25282530
server.register_module(IndexerApi::new(
25292531
state.clone(),

0 commit comments

Comments
 (0)