Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: add {node,validator}_public_key field to /status response; deprecated node_key #7828

Merged
merged 5 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
deprecated. If they are set in `config.json` the node will fail if migration
needs to be performed. Use `store.migration_snapshot` instead to configure
the behaviour [#7486](https://github.com/near/nearcore/pull/7486)
* `/status` response has now two more fields: `node_public_key` and
`validator_public_key`. The `node_key` field is now deprecated and should not
be used since it confusingly holds validator key.
* Added `near_peer_message_sent_by_type_bytes` and
`near_peer_message_sent_by_type_total` Prometheus metrics measuring
size and number of messages sent to peers.
Expand Down
14 changes: 10 additions & 4 deletions chain/client/src/client_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,12 @@ impl Handler<Status> for ClientActor {
let protocol_version =
self.client.runtime_adapter.get_epoch_protocol_version(&head.epoch_id)?;

let validator_and_key =
self.client.validator_signer.as_ref().map(|vs| (vs.validator_id(), vs.public_key()));
let node_public_key = self.node_id.public_key().clone();
let (validator_account_id, validator_public_key) = match &self.client.validator_signer {
Some(vs) => (Some(vs.validator_id().clone()), Some(vs.public_key().clone())),
None => (None, None),
};
let node_key = validator_public_key.clone();

let mut earliest_block_hash = None;
let mut earliest_block_height = None;
Expand Down Expand Up @@ -778,8 +782,10 @@ impl Handler<Status> for ClientActor {
epoch_id: Some(head.epoch_id),
epoch_start_height,
},
validator_account_id: validator_and_key.as_ref().map(|v| v.0.clone()),
node_key: validator_and_key.as_ref().map(|v| v.1.clone()),
validator_account_id,
validator_public_key,
node_public_key,
node_key,
uptime_sec,
detailed_debug_status,
})
Expand Down
4 changes: 4 additions & 0 deletions core/primitives/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,11 @@ pub struct StatusResponse {
pub sync_info: StatusSyncInfo,
/// Validator id of the node
pub validator_account_id: Option<AccountId>,
/// Public key of the validator.
pub validator_public_key: Option<PublicKey>,
/// Public key of the node.
pub node_public_key: PublicKey,
/// Deprecated; same as `validator_public_key` which you should use instead.
pub node_key: Option<PublicKey>,
/// Uptime of the node.
pub uptime_sec: i64,
Expand Down