Use rocket 0.5-rc1, remove rocket-contrib (#672)

* Use rocket 0.5-rc1, remove rocket-contrib

* Revert thread_rng

* Continue on error for beta as well

* Add Drazen to authors

* Remain paranoid for unstable crates

* fmt again :/

* Most paranoid versions
This commit is contained in:
Drazen Urch
2021-07-05 18:07:18 +02:00
committed by GitHub
parent 8f98de4abc
commit 4a86b24ff5
6 changed files with 60 additions and 248 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
use crate::node::node_description::NodeDescription;
use rocket::serde::json::Json;
use rocket::State;
use rocket_contrib::json::Json;
/// Returns a description of the node and why someone might want to delegate stake to it.
#[get("/description")]
pub(crate) fn description(description: State<NodeDescription>) -> Json<NodeDescription> {
pub(crate) fn description(description: &State<NodeDescription>) -> Json<NodeDescription> {
Json(description.inner().clone())
}
+2 -2
View File
@@ -1,6 +1,6 @@
use crate::node::node_statistics::{NodeStats, NodeStatsSimple, NodeStatsWrapper};
use rocket::serde::json::Json;
use rocket::State;
use rocket_contrib::json::Json;
use serde::Serialize;
#[derive(Serialize)]
@@ -13,7 +13,7 @@ pub(crate) enum NodeStatsResponse {
/// Returns a running stats of the node.
#[get("/stats?<debug>")]
pub(crate) async fn stats(
stats: State<'_, NodeStatsWrapper>,
stats: &State<NodeStatsWrapper>,
debug: Option<bool>,
) -> Json<NodeStatsResponse> {
let snapshot_data = stats.clone_data().await;
+2 -2
View File
@@ -1,6 +1,6 @@
use mixnode_common::verloc::{AtomicVerlocResult, VerlocResult};
use rocket::serde::json::Json;
use rocket::State;
use rocket_contrib::json::Json;
pub(crate) struct VerlocState {
shared: AtomicVerlocResult,
@@ -17,7 +17,7 @@ impl VerlocState {
/// Provides verifiable location (verloc) measurements for this mixnode - a list of the
/// round-trip times, in milliseconds, for all other mixnodes that this node knows about.
#[get("/verloc")]
pub(crate) async fn verloc(state: State<'_, VerlocState>) -> Json<VerlocResult> {
pub(crate) async fn verloc(state: &State<VerlocState>) -> Json<VerlocResult> {
// since it's impossible to get a mutable reference to the state, we can't cache any results outside the lock : (
Json(state.shared.clone_data().await)
}