From a5321ea39f0aff337d50327020848d9fbdbadf9f Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Wed, 7 Apr 2021 15:29:47 +0200 Subject: [PATCH] add networks stats to nodeinfo (#470) * add networks stats to nodeinfo * update bee dependencies --- bindings/nodejs/README.md | 27 +++++++++++++--------- bindings/nodejs/lib/types/models.d.ts | 4 ++++ bindings/python/README.md | 5 ++++ bindings/python/native/src/client/types.rs | 12 ++++++++-- iota-client/Cargo.toml | 6 ++--- specs/iota-rs-ENGINEERING-SPEC-0000.md | 4 ++++ 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/bindings/nodejs/README.md b/bindings/nodejs/README.md index 1ada60aa0..e7b6a8008 100644 --- a/bindings/nodejs/README.md +++ b/bindings/nodejs/README.md @@ -905,17 +905,22 @@ Gets the metadata of the given message. ### NodeInfo -| Field | Type | Description | -| ----------------------- | --------------------- | -------------------------------- | -| name | string | Node name | -| version | string | Node version | -| isHealthy | boolean | Node health status | -| networkId | string | Node network identifier | -| bech32HRP | string | Bech32 HRP for this network | -| latestMilestoneIndex | number | Index of the latest milestone | -| confirmedMilestoneIndex | number | Index of the confirmed milestone | -| pruningIndex | number | Pruning index | -| features | string[] | List of node features | +| Field | Type | Description | +| ------------------------------ | --------------------- | ------------------------------------------------- | +| name | string | Node name | +| version | string | Node version | +| isHealthy | boolean | Node health status | +| networkId | string | Node network identifier | +| bech32HRP | string | Bech32 HRP for this network | +| min_pow_score | number | Min PoW score | +| messages_per_second | number | Network stats: Messages per second in the network | +| referenced_messages_per_second | number | Network stats: Referenced messages per second | +| referenced_rate | number | Network stats: referenced rate | +| latest_milestone_timestamp | number | Timestamp of the latest milestone | +| latestMilestoneIndex | number | Index of the latest milestone | +| confirmedMilestoneIndex | number | Index of the confirmed milestone | +| pruningIndex | number | Pruning index | +| features | string[] | List of node features | ### OutputMetadata diff --git a/bindings/nodejs/lib/types/models.d.ts b/bindings/nodejs/lib/types/models.d.ts index 7ba0de908..86b660810 100644 --- a/bindings/nodejs/lib/types/models.d.ts +++ b/bindings/nodejs/lib/types/models.d.ts @@ -5,6 +5,10 @@ export declare interface NodeInfo { networkId: string bech32HRP: string minPoWScore: number + messagesPerSecond: number + referencedMessagesPerSecond: number + referencedRate: number + latestMilestoneTimestamp: number latestMilestoneIndex: number confirmedMilestoneIndex: number pruningIndex: number diff --git a/bindings/python/README.md b/bindings/python/README.md index a61e73d2a..f9cb409ae 100644 --- a/bindings/python/README.md +++ b/bindings/python/README.md @@ -913,6 +913,11 @@ info_response = { 'is_healthy': bool, 'network_id': str, 'bech32_hrp': str, + 'min_pow_score': float, + 'messages_per_second': float, + 'referenced_messages_per_second': float, + 'referenced_rate': float, + 'latest_milestone_timestamp': u64, 'latest_milestone_index': int, 'confirmed_milestone_index': int, 'pruning_index': int, diff --git a/bindings/python/native/src/client/types.rs b/bindings/python/native/src/client/types.rs index af6838bc0..8a9333cdc 100644 --- a/bindings/python/native/src/client/types.rs +++ b/bindings/python/native/src/client/types.rs @@ -283,11 +283,15 @@ pub struct InfoResponse { pub is_healthy: bool, pub network_id: String, pub bech32_hrp: String, + pub min_pow_score: f64, + pub messages_per_second: f64, + pub referenced_messages_per_second: f64, + pub referenced_rate: f64, + pub latest_milestone_timestamp: u64, pub latest_milestone_index: u32, pub confirmed_milestone_index: u32, pub pruning_index: u32, pub features: Vec, - pub min_pow_score: f64, } #[derive(Debug, DeriveFromPyObject, DeriveIntoPyObject)] @@ -515,11 +519,15 @@ impl From for InfoResponse { is_healthy: info.is_healthy, network_id: info.network_id, bech32_hrp: info.bech32_hrp, + min_pow_score: info.min_pow_score, + messages_per_second: info.messages_per_second, + referenced_messages_per_second: info.referenced_messages_per_second, + referenced_rate: info.referenced_rate, + latest_milestone_timestamp: info.latest_milestone_timestamp, latest_milestone_index: info.latest_milestone_index, confirmed_milestone_index: info.confirmed_milestone_index, pruning_index: info.pruning_index, features: info.features, - min_pow_score: info.min_pow_score, } } } diff --git a/iota-client/Cargo.toml b/iota-client/Cargo.toml index a575f318b..6807c3562 100644 --- a/iota-client/Cargo.toml +++ b/iota-client/Cargo.toml @@ -13,9 +13,9 @@ license = "Apache-2.0" name = "iota_client" [dependencies] -bee-rest-api = { git = "https://github.com/iotaledger/bee.git", rev = "cb4c6b5da08afc0b6d8eb1761b943fae6475f016", default-features = false } -bee-message = { git = "https://github.com/iotaledger/bee.git", rev = "cb4c6b5da08afc0b6d8eb1761b943fae6475f016", default-features = false } -bee-pow = { git = "https://github.com/iotaledger/bee.git", rev = "cb4c6b5da08afc0b6d8eb1761b943fae6475f016", default-features = false } +bee-rest-api = { git = "https://github.com/iotaledger/bee.git", rev = "e8cafb6591ec0c29f80705ae51fb8cb890fa98b0", default-features = false } +bee-message = { git = "https://github.com/iotaledger/bee.git", rev = "e8cafb6591ec0c29f80705ae51fb8cb890fa98b0", default-features = false } +bee-pow = { git = "https://github.com/iotaledger/bee.git", rev = "e8cafb6591ec0c29f80705ae51fb8cb890fa98b0", default-features = false } bee-common = { git = "https://github.com/iotaledger/bee.git", branch = "dev" } bee-crypto = { git = "https://github.com/iotaledger/bee.git", rev = "c42171ff33c80cc2efb183e244dc79b7f58d9ac4" } iota-crypto = { git = "https://github.com/iotaledger/crypto.rs.git", rev = "b849861b86c3f7357b7477de4253b7352b363627", features = ["std", "blake2b", "ed25519", "random", "slip10"]} diff --git a/specs/iota-rs-ENGINEERING-SPEC-0000.md b/specs/iota-rs-ENGINEERING-SPEC-0000.md index c8023fc2a..17532c35f 100644 --- a/specs/iota-rs-ENGINEERING-SPEC-0000.md +++ b/specs/iota-rs-ENGINEERING-SPEC-0000.md @@ -450,6 +450,10 @@ pub struct NodeInfo { pub network_id: String, pub latest_milestone_index: usize, pub min_pow_score: f64, + pub messages_per_second: f64, + pub referenced_messages_per_second: f64, + pub referenced_rate: f64, + pub latest_milestone_timestamp: u64, pub confirmed_milestone_index: usize, pub pruning_index: usize, pub features: Vec,