From 4a86b24ff554d6b4ac04ddddcb62a73d7d4f290d Mon Sep 17 00:00:00 2001 From: Drazen Urch Date: Mon, 5 Jul 2021 18:07:18 +0200 Subject: [PATCH] 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 --- .github/workflows/build.yml | 2 +- Cargo.lock | 243 +++------------------------ mixnode/Cargo.toml | 51 +++--- mixnode/src/node/http/description.rs | 4 +- mixnode/src/node/http/stats.rs | 4 +- mixnode/src/node/http/verloc.rs | 4 +- 6 files changed, 60 insertions(+), 248 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 138a43a83a..072781741d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: ci: runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.rust == 'nightly' }} + continue-on-error: ${{ matrix.rust == 'nightly' || matrix.rust == 'beta' }} strategy: matrix: rust: [stable, beta, nightly] diff --git a/Cargo.lock b/Cargo.lock index 59569b112c..9820f3bd3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,35 +106,16 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" -[[package]] -name = "async-stream" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/async-stream.git?rev=c46ada9#c46ada948e0d4800393836f57eb2a3db516beb1e" -dependencies = [ - "async-stream-impl 0.3.0", - "futures-core", -] - [[package]] name = "async-stream" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" dependencies = [ - "async-stream-impl 0.3.2", + "async-stream-impl", "futures-core", ] -[[package]] -name = "async-stream-impl" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/async-stream.git?rev=c46ada9#c46ada948e0d4800393836f57eb2a3db516beb1e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-stream-impl" version = "0.3.2" @@ -682,17 +663,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "411cf45ac38f00df3679689616649dc12607b846db171780bb790b514a042832" dependencies = [ - "devise_codegen 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "devise_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "devise" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=df00b5#df00b5162edd53e8d496e7935774e69b5f7f6bdf" -dependencies = [ - "devise_codegen 0.3.0 (git+https://github.com/SergioBenitez/Devise.git?rev=df00b5)", - "devise_core 0.3.0 (git+https://github.com/SergioBenitez/Devise.git?rev=df00b5)", + "devise_codegen", + "devise_core", ] [[package]] @@ -701,16 +673,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cf7081f06822f1787e29359354426132cf832cc977d7a8ff747848631462ad1" dependencies = [ - "devise_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote", -] - -[[package]] -name = "devise_codegen" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=df00b5#df00b5162edd53e8d496e7935774e69b5f7f6bdf" -dependencies = [ - "devise_core 0.3.0 (git+https://github.com/SergioBenitez/Devise.git?rev=df00b5)", + "devise_core", "quote", ] @@ -727,18 +690,6 @@ dependencies = [ "syn", ] -[[package]] -name = "devise_core" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=df00b5#df00b5162edd53e8d496e7935774e69b5f7f6bdf" -dependencies = [ - "bitflags", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", -] - [[package]] name = "digest" version = "0.8.1" @@ -1112,19 +1063,6 @@ dependencies = [ "tungstenite", ] -[[package]] -name = "generator" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061d3be1afec479d56fa3bd182bf966c7999ec175fcfdb87ac14d417241366c6" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "winapi", -] - [[package]] name = "generator" version = "0.7.0" @@ -1544,25 +1482,12 @@ dependencies = [ [[package]] name = "loom" -version = "0.3.6" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e8460f2f2121162705187214720353c517b97bdfb3494c0b1e33d83ebe4bed" -dependencies = [ - "cfg-if 0.1.10", - "generator 0.6.25", - "scoped-tls", - "serde", - "serde_json", -] - -[[package]] -name = "loom" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aa5348dc45fa5f2419b6dd4ea20345e6b01b1fcc9d176a322eada1ac3f382ba" +checksum = "2111607c723d7857e0d8299d5ce7a0bf4b844d3e44f8de136b13da513eaf8fc4" dependencies = [ "cfg-if 1.0.0", - "generator 0.7.0", + "generator", "scoped-tls", "serde", "serde_json", @@ -1674,25 +1599,6 @@ dependencies = [ "version-checker", ] -[[package]] -name = "multer" -version = "1.2.2" -source = "git+https://github.com/rousan/multer-rs.git?rev=7e4f0c5f#7e4f0c5fe14e4c531f503922bfe04f68b32ddf17" -dependencies = [ - "bytes", - "derive_more", - "encoding_rs", - "futures-util", - "http", - "httparse", - "log", - "mime", - "tokio", - "tokio-util", - "twoway", - "version_check", -] - [[package]] name = "multer" version = "2.0.0" @@ -1872,8 +1778,7 @@ dependencies = [ "pemstore", "pretty_env_logger", "rand 0.7.3", - "rocket 0.5.0-dev", - "rocket_contrib", + "rocket", "serde", "serial_test", "tokio", @@ -1956,7 +1861,7 @@ dependencies = [ "pretty_env_logger", "rand 0.7.3", "reqwest", - "rocket 0.5.0-rc.1", + "rocket", "rocket_cors", "serde", "serde_json", @@ -2606,49 +2511,13 @@ dependencies = [ "winreg", ] -[[package]] -name = "rocket" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" -dependencies = [ - "async-stream 0.3.0", - "async-trait", - "atomic", - "atty", - "binascii", - "bytes", - "either", - "figment", - "futures", - "indexmap", - "log", - "memchr", - "multer 1.2.2", - "num_cpus", - "parking_lot", - "pin-project-lite", - "rand 0.8.4", - "ref-cast", - "rocket_codegen 0.5.0-dev", - "rocket_http 0.5.0-dev", - "serde", - "state 0.4.2", - "tempfile", - "time", - "tokio", - "tokio-util", - "ubyte", - "version_check", - "yansi", -] - [[package]] name = "rocket" version = "0.5.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a71c18c42a0eb15bf3816831caf0dad11e7966f2a41aaf486a701979c4dd1f2" dependencies = [ - "async-stream 0.3.2", + "async-stream", "async-trait", "atomic", "atty", @@ -2660,17 +2529,17 @@ dependencies = [ "indexmap", "log", "memchr", - "multer 2.0.0", + "multer", "num_cpus", "parking_lot", "pin-project-lite", "rand 0.8.4", "ref-cast", - "rocket_codegen 0.5.0-rc.1", - "rocket_http 0.5.0-rc.1", + "rocket_codegen", + "rocket_http", "serde", "serde_json", - "state 0.5.2", + "state", "tempfile", "time", "tokio", @@ -2681,47 +2550,22 @@ dependencies = [ "yansi", ] -[[package]] -name = "rocket_codegen" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" -dependencies = [ - "devise 0.3.0 (git+https://github.com/SergioBenitez/Devise.git?rev=df00b5)", - "glob", - "indexmap", - "quote", - "rocket_http 0.5.0-dev", - "unicode-xid", -] - [[package]] name = "rocket_codegen" version = "0.5.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66f5fa462f7eb958bba8710c17c5d774bbbd59809fa76fb1957af7e545aea8bb" dependencies = [ - "devise 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "devise", "glob", "indexmap", "proc-macro2", "quote", - "rocket_http 0.5.0-rc.1", + "rocket_http", "syn", "unicode-xid", ] -[[package]] -name = "rocket_contrib" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" -dependencies = [ - "log", - "rocket 0.5.0-dev", - "serde", - "serde_json", - "tokio", -] - [[package]] name = "rocket_cors" version = "0.5.2" @@ -2729,7 +2573,7 @@ source = "git+https://github.com/lawliet89/rocket_cors?branch=master#dfd3662c49e dependencies = [ "log", "regex", - "rocket 0.5.0-rc.1", + "rocket", "serde", "serde_derive", "unicase", @@ -2737,33 +2581,6 @@ dependencies = [ "url", ] -[[package]] -name = "rocket_http" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" -dependencies = [ - "cookie", - "either", - "http", - "hyper", - "indexmap", - "log", - "memchr", - "mime", - "parking_lot", - "pear", - "percent-encoding", - "pin-project-lite", - "ref-cast", - "serde", - "smallvec", - "stable-pattern", - "state 0.4.2", - "time", - "tokio", - "uncased", -] - [[package]] name = "rocket_http" version = "0.5.0-rc.1" @@ -2786,7 +2603,7 @@ dependencies = [ "serde", "smallvec", "stable-pattern", - "state 0.5.2", + "state", "time", "tokio", "uncased", @@ -3187,21 +3004,13 @@ dependencies = [ "version_check", ] -[[package]] -name = "state" -version = "0.4.2" -source = "git+https://github.com/SergioBenitez/state.git?rev=8f94dc#8f94dce673b7d4b0e7b96c808a84f5e2a4be4a60" -dependencies = [ - "loom 0.3.6", -] - [[package]] name = "state" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87cf4f5369e6d3044b5e365c9690f451516ac8f0954084622b49ea3fde2f6de5" dependencies = [ - "loom 0.5.0", + "loom", ] [[package]] @@ -3343,18 +3152,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ "proc-macro2", "quote", @@ -3416,9 +3225,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb2ed024293bb19f7a5dc54fe83bf86532a44c12a2bb8ba40d64a4509395ca2" +checksum = "570c2eb13b3ab38208130eccd41be92520388791207fde783bda7c1e8ace28d4" dependencies = [ "autocfg", "bytes", @@ -3471,7 +3280,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" dependencies = [ - "async-stream 0.3.2", + "async-stream", "bytes", "futures-core", "tokio", diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 4d7bf076e7..2de9fe4caf 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -4,40 +4,43 @@ [package] name = "nym-mixnode" version = "0.10.2" -authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] +authors = [ + "Dave Hrycyszyn ", + "Jędrzej Stuczyński ", + "Drazen Urch ", +] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] bs58 = "0.4.0" -clap = "2.33.0" -colored = "2" +clap = "2.3" +colored = "2.0" dirs = "3.0" dotenv = "0.15.0" -futures = "0.3" -humantime-serde = "1.0.1" -log = "0.4" -pretty_env_logger = "0.4" -rand = "0.7" -rocket = { git = "https://github.com/SergioBenitez/Rocket", rev="f442ad93cb2788bfd08aca5d94e509db20888101" } -rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket", rev="f442ad93cb2788bfd08aca5d94e509db20888101" } -serde = { version = "1.0", features = ["derive"] } -tokio = { version = "1.4", features = [ "rt-multi-thread", "net", "signal" ] } -tokio-util = { version = "0.6", features = ["codec"] } -toml = "0.5" +futures = "0.3.0" +humantime-serde = "1.0" +log = "0.4.0" +pretty_env_logger = "0.4.0" +rand = "0.7.3" +rocket = { version="0.5.0-rc.1", features=["json"] } +serde = { version="1.0", features=["derive"] } +tokio = { version="1.8", features=["rt-multi-thread", "net", "signal"] } +tokio-util = { version="0.6.7", features=["codec"] } +toml = "0.5.8" ## internal -config = { path = "../common/config" } -crypto = { path = "../common/crypto" } -mixnet-client = { path = "../common/client-libs/mixnet-client" } -mixnode-common = { path = "../common/mixnode-common" } -nonexhaustive-delayqueue = { path = "../common/nonexhaustive-delayqueue" } -nymsphinx = { path = "../common/nymsphinx" } -pemstore = { path = "../common/pemstore" } -topology = { path = "../common/topology" } -validator-client = { path = "../common/client-libs/validator-client" } -version-checker = { path = "../common/version-checker" } +config = { path="../common/config" } +crypto = { path="../common/crypto" } +mixnet-client = { path="../common/client-libs/mixnet-client" } +mixnode-common = { path="../common/mixnode-common" } +nonexhaustive-delayqueue = { path="../common/nonexhaustive-delayqueue" } +nymsphinx = { path="../common/nymsphinx" } +pemstore = { path="../common/pemstore" } +topology = { path="../common/topology" } +validator-client = { path="../common/client-libs/validator-client" } +version-checker = { path="../common/version-checker" } [dev-dependencies] serial_test = "0.5" diff --git a/mixnode/src/node/http/description.rs b/mixnode/src/node/http/description.rs index cf1fd72951..3c37014645 100644 --- a/mixnode/src/node/http/description.rs +++ b/mixnode/src/node/http/description.rs @@ -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) -> Json { +pub(crate) fn description(description: &State) -> Json { Json(description.inner().clone()) } diff --git a/mixnode/src/node/http/stats.rs b/mixnode/src/node/http/stats.rs index 6c03eb1f82..0c2cd82a15 100644 --- a/mixnode/src/node/http/stats.rs +++ b/mixnode/src/node/http/stats.rs @@ -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?")] pub(crate) async fn stats( - stats: State<'_, NodeStatsWrapper>, + stats: &State, debug: Option, ) -> Json { let snapshot_data = stats.clone_data().await; diff --git a/mixnode/src/node/http/verloc.rs b/mixnode/src/node/http/verloc.rs index 4a9643aa12..8a5c8346f7 100644 --- a/mixnode/src/node/http/verloc.rs +++ b/mixnode/src/node/http/verloc.rs @@ -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 { +pub(crate) async fn verloc(state: &State) -> Json { // 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) }