casper_client/rpcs/v1_5_0/
get_node_status.rs

1pub(crate) use crate::rpcs::v1_4_5::get_node_status::GET_NODE_STATUS_METHOD;
2pub use crate::rpcs::v1_4_5::get_node_status::{ActivationPoint, MinimalBlockInfo, NextUpgrade};
3
4use serde::{Deserialize, Serialize};
5
6use casper_hashing::Digest;
7use casper_types::{ProtocolVersion, PublicKey};
8
9use super::get_peers::PeerEntry;
10use crate::types::{BlockHash, TimeDiff, Timestamp};
11
12/// The state of the reactor.
13#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
14pub enum ReactorState {
15    /// Get all components and reactor state set up on start.
16    Initialize,
17    /// Orient to the network and attempt to catch up to tip.
18    CatchUp,
19    /// Running commit upgrade and creating immediate switch block.
20    Upgrading,
21    /// Stay caught up with tip.
22    KeepUp,
23    /// Node is currently caught up and is an active validator.
24    Validate,
25    /// Node should be shut down for upgrade.
26    ShutdownForUpgrade,
27}
28
29/// An unbroken, inclusive range of blocks.
30#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
31#[serde(deny_unknown_fields)]
32pub struct AvailableBlockRange {
33    /// The inclusive lower bound of the range.
34    low: u64,
35    /// The inclusive upper bound of the range.
36    high: u64,
37}
38
39/// The status of syncing an individual block.
40#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
41#[serde(deny_unknown_fields)]
42pub(crate) struct BlockSyncStatus {
43    /// The block hash.
44    block_hash: BlockHash,
45    /// The height of the block, if known.
46    block_height: Option<u64>,
47    /// The state of acquisition of the data associated with the block.
48    acquisition_state: String,
49}
50
51/// The status of the block synchronizer.
52#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
53#[serde(deny_unknown_fields)]
54pub struct BlockSynchronizerStatus {
55    /// The status of syncing a historical block, if any.
56    historical: Option<BlockSyncStatus>,
57    /// The status of syncing a forward block, if any.
58    forward: Option<BlockSyncStatus>,
59}
60
61/// The `result` field of a successful JSON-RPC response to a `info_get_status` request.
62#[derive(Serialize, Deserialize, Debug)]
63#[serde(deny_unknown_fields)]
64pub struct GetNodeStatusResult {
65    /// The JSON-RPC server version.
66    pub api_version: ProtocolVersion,
67    /// The chainspec name.
68    pub chainspec_name: String,
69    /// The state root hash used at the start of the current session.
70    #[deprecated(since = "1.5.0")]
71    pub starting_state_root_hash: Digest,
72    /// The node ID and network address of each connected peer.
73    pub peers: Vec<PeerEntry>,
74    /// The minimal info of the last block from the linear chain.
75    pub last_added_block_info: Option<MinimalBlockInfo>,
76    /// The node's public signing key.
77    pub our_public_signing_key: Option<PublicKey>,
78    /// The next round length if this node is a validator.
79    pub round_length: Option<TimeDiff>,
80    /// Information about the next scheduled upgrade staged for this node.
81    pub next_upgrade: Option<NextUpgrade>,
82    /// The compiled node version.
83    pub build_version: String,
84    /// Time that passed since the node has started.
85    pub uptime: TimeDiff,
86    /// The current state of node reactor.
87    pub reactor_state: ReactorState,
88    /// Timestamp of the last recorded progress in the reactor.
89    pub last_progress: Timestamp,
90    /// The available block range in storage.
91    pub available_block_range: AvailableBlockRange,
92    /// The status of the block synchronizer builders.
93    pub block_sync: BlockSynchronizerStatus,
94}