Skip to content

Commit

Permalink
Fix outdated get_stake_table_from_sequencer implementation
Browse files Browse the repository at this point in the history
The `get_stake_table_from_sequencer` implementation currently reflects a
configuration that has the `known_nodes_with_stake` at the root level.  This has
since changed and `known_nodes_with_stake` is now at a deeper level, under
another key called `config`.
  • Loading branch information
Ayiga committed Jul 24, 2024
1 parent f72aab8 commit bf9be0c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion node-metrics/src/api/node_validator/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ pub struct PublishHotShotConfig {
pub known_nodes_with_stake: Vec<PeerConfig<BLSPubKey>>,
}

#[derive(Debug, Deserialize)]
pub struct SequencerConfig {
pub config: PublishHotShotConfig,
}

/// [get_stake_table_from_sequencer] retrieves the stake table from the
/// Sequencer. It expects a [surf_disco::Client] to be provided so that it can
/// make the request to the Hotshot Query Service. It will return a
Expand All @@ -308,14 +313,16 @@ pub async fn get_stake_table_from_sequencer(
.header("Accept", "application/json");
let stake_table_result = request.send().await;

let public_hot_shot_config: PublishHotShotConfig = match stake_table_result {
let sequencer_config: SequencerConfig = match stake_table_result {
Ok(public_hot_shot_config) => public_hot_shot_config,
Err(err) => {
tracing::info!("retrieve stake table request failed: {}", err);
return Err(err);
}
};

let public_hot_shot_config = sequencer_config.config;

let mut stake_table = StakeTable::<BLSPubKey, StateVerKey, CircuitField>::new(
public_hot_shot_config.known_nodes_with_stake.len(),
);
Expand Down

0 comments on commit bf9be0c

Please sign in to comment.