Skip to content

Commit a7a710c

Browse files
authored
Merge pull request #156 from input-output-hk/whankinsiv/remove-state-rest-handlers
chore: remove remaining blockfrost REST endpoints from state modules
2 parents 260c00f + 6d846b7 commit a7a710c

File tree

9 files changed

+9
-157
lines changed

9 files changed

+9
-157
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/accounts_state/src/accounts_state.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use acropolis_common::{
55
messages::{CardanoMessage, Message, StateQuery, StateQueryResponse},
66
queries::accounts::{PoolsLiveStakes, DEFAULT_ACCOUNTS_QUERY_TOPIC},
7-
rest_helper::handle_rest,
87
state_history::{StateHistory, StateHistoryStore},
98
BlockInfo, BlockStatus,
109
};
@@ -24,13 +23,11 @@ use spo_rewards_publisher::SPORewardsPublisher;
2423
mod state;
2524
use state::State;
2625
mod monetary;
27-
mod rest;
2826
mod rewards;
2927
mod snapshot;
3028
use acropolis_common::queries::accounts::{
3129
AccountInfo, AccountsStateQuery, AccountsStateQueryResponse,
3230
};
33-
use rest::handle_pots;
3431

3532
const DEFAULT_SPO_STATE_TOPIC: &str = "cardano.spo.state";
3633
const DEFAULT_EPOCH_ACTIVITY_TOPIC: &str = "cardano.epoch.activity";
@@ -44,8 +41,6 @@ const DEFAULT_SPO_DISTRIBUTION_TOPIC: &str = "cardano.spo.distribution";
4441
const DEFAULT_SPO_REWARDS_TOPIC: &str = "cardano.spo.rewards";
4542
const DEFAULT_PROTOCOL_PARAMETERS_TOPIC: &str = "cardano.protocol.parameters";
4643

47-
const DEFAULT_HANDLE_POTS_TOPIC: (&str, &str) = ("handle-topic-pots", "rest.get.pots");
48-
4944
/// Accounts State module
5045
#[module(
5146
message_type(Message),
@@ -387,12 +382,6 @@ impl AccountsState {
387382
.get_string("publish-spo-rewards-topic")
388383
.unwrap_or(DEFAULT_SPO_REWARDS_TOPIC.to_string());
389384

390-
// REST handler topics
391-
let handle_pots_topic = config
392-
.get_string(DEFAULT_HANDLE_POTS_TOPIC.0)
393-
.unwrap_or(DEFAULT_HANDLE_POTS_TOPIC.1.to_string());
394-
info!("Creating request handler on '{}'", handle_pots_topic);
395-
396385
// Query topics
397386
let accounts_query_topic = config
398387
.get_string(DEFAULT_ACCOUNTS_QUERY_TOPIC.0)
@@ -405,7 +394,6 @@ impl AccountsState {
405394
StateHistoryStore::default_block_store(),
406395
)));
407396
let history_account_state = history.clone();
408-
let history_pots = history.clone();
409397
let history_tick = history.clone();
410398

411399
context.handle(&accounts_query_topic, move |message| {
@@ -488,10 +476,6 @@ impl AccountsState {
488476
}
489477
});
490478

491-
handle_rest(context.clone(), &handle_pots_topic, move || {
492-
handle_pots(history_pots.clone())
493-
});
494-
495479
// Ticker to log stats
496480
let mut tick_subscription = context.subscribe("clock.tick").await?;
497481
context.clone().run(async move {

modules/accounts_state/src/rest.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

modules/accounts_state/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl State {
110110
}
111111

112112
/// Get the current pot balances
113-
pub fn get_pots(&self) -> Pots {
113+
pub fn _get_pots(&self) -> Pots {
114114
self.pots.clone()
115115
}
116116

modules/epoch_activity_counter/src/epochs_history.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ mod tests {
6464
number: 42,
6565
hash: Vec::new(),
6666
epoch,
67+
epoch_slot: 99,
6768
new_epoch: false,
69+
timestamp: 99999,
6870
era: Era::Conway,
6971
}
7072
}

modules/epoch_activity_counter/src/state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ mod tests {
123123
number: epoch * 10,
124124
hash: Vec::new(),
125125
epoch,
126+
epoch_slot: 99,
126127
new_epoch: false,
128+
timestamp: 99999,
127129
era: Era::Conway,
128130
}
129131
}

modules/rest_blockfrost/src/utils.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use std::time::Duration;
22

33
use anyhow::Result;
4-
use blake2::{
5-
digest::{Update, VariableOutput},
6-
Digest,
7-
};
4+
use blake2::digest::{Update, VariableOutput};
85
use reqwest::Client;
96
use serde::{Deserialize, Serialize};
107

modules/spo_state/src/rest.rs

Lines changed: 0 additions & 106 deletions
This file was deleted.

modules/spo_state/src/spo_state.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use tracing::{error, info, info_span, Instrument};
2424
mod aggregated_state;
2525
mod epochs_history;
2626
mod historical_spo_state;
27-
mod rest;
2827
mod retired_pools_history;
2928
mod spo_state_publisher;
3029
mod state;

0 commit comments

Comments
 (0)