diff --git a/Cargo.lock b/Cargo.lock index 3fa77171..83057ffd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,7 +327,16 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" dependencies = [ - "bit-vec", + "bit-vec 0.6.3", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec 0.8.0", ] [[package]] @@ -336,6 +345,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bitflags" version = "1.3.2" @@ -394,9 +409,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" +checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" dependencies = [ "memchr", "regex-automata 0.4.9", @@ -471,7 +486,7 @@ dependencies = [ [[package]] name = "casper-binary-port" version = "1.0.0" -source = "git+https://github.com/casper-network/casper-node.git?branch=feat-2.0#73b32058133b445e0a2a2485880ba07b9f0582b9" +source = "git+https://github.com/casper-network/casper-node.git?branch=feat-2.0#069bdaf5ce8477d2eb827edabdb3c90bacc1e466" dependencies = [ "bincode", "bytes", @@ -536,7 +551,7 @@ dependencies = [ "hex", "hex_fmt", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "indexmap 2.7.0", "itertools", "jsonschema", @@ -597,7 +612,7 @@ dependencies = [ "env_logger", "futures", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "itertools", "metrics", "serde", @@ -625,7 +640,7 @@ dependencies = [ "derive-new 0.6.0", "futures", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "juliet", "metrics", "num-traits", @@ -678,7 +693,7 @@ dependencies = [ [[package]] name = "casper-types" version = "5.0.0" -source = "git+https://github.com/casper-network/casper-node.git?branch=feat-2.0#73b32058133b445e0a2a2485880ba07b9f0582b9" +source = "git+https://github.com/casper-network/casper-node.git?branch=feat-2.0#069bdaf5ce8477d2eb827edabdb3c90bacc1e466" dependencies = [ "base16", "base64 0.13.1", @@ -721,9 +736,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ "jobserver", "libc", @@ -800,12 +815,12 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -877,18 +892,18 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -1316,7 +1331,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" dependencies = [ - "bit-set", + "bit-set 0.5.3", "regex", ] @@ -1619,7 +1634,7 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d48b897b4bbc881aea994b4a5bbb340a04979d7be9089791304e04a9fbc66b53" dependencies = [ - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -1628,7 +1643,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6ffbeb3a5c0b8b84c3fe4133a6f8c82fa962f4caefe8d0762eced025d3eb4f7" dependencies = [ - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -1676,7 +1691,7 @@ dependencies = [ "bstr", "gix-path", "libc", - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -1899,7 +1914,7 @@ dependencies = [ "gix-trace", "home", "once_cell", - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -1910,7 +1925,7 @@ checksum = "64a1e282216ec2ab2816cd57e6ed88f8009e634aec47562883c05ac8a7009a63" dependencies = [ "bstr", "gix-utils", - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -2231,11 +2246,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2314,9 +2329,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -2338,9 +2353,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -2365,9 +2380,9 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.2.0", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", - "rustls 0.23.19", + "rustls 0.23.20", "rustls-pki-types", "tokio", "tokio-rustls", @@ -2381,7 +2396,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.31", + "hyper 0.14.32", "native-tls", "tokio", "tokio-native-tls", @@ -2395,7 +2410,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "native-tls", "tokio", @@ -2414,7 +2429,7 @@ dependencies = [ "futures-util", "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.5.2", "pin-project-lite", "socket2", "tokio", @@ -2872,9 +2887,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", ] @@ -2930,7 +2945,7 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "log", "rand", @@ -3526,12 +3541,12 @@ dependencies = [ [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ - "bit-set", - "bit-vec", + "bit-set 0.8.0", + "bit-vec 0.8.0", "bitflags 2.6.0", "lazy_static", "num-traits", @@ -3635,9 +3650,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags 2.6.0", ] @@ -3711,7 +3726,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -3752,7 +3767,7 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-rustls", "hyper-tls 0.6.0", "hyper-util", @@ -3902,9 +3917,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "once_cell", "rustls-pki-types", @@ -3933,9 +3948,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" [[package]] name = "rustls-webpki" @@ -4109,15 +4124,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -4143,9 +4158,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", @@ -4783,11 +4798,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.7", ] [[package]] @@ -4803,9 +4818,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", @@ -4945,7 +4960,7 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "rustls 0.23.19", + "rustls 0.23.20", "tokio", ] @@ -5169,9 +5184,9 @@ checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-bom" @@ -5414,7 +5429,7 @@ dependencies = [ "futures-util", "headers", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "log", "mime", "mime_guess", diff --git a/event_sidecar/src/event_stream_server/sse_server.rs b/event_sidecar/src/event_stream_server/sse_server.rs index ce8b03f1..61ce8570 100644 --- a/event_sidecar/src/event_stream_server/sse_server.rs +++ b/event_sidecar/src/event_stream_server/sse_server.rs @@ -8,10 +8,13 @@ use casper_event_types::{ sse_data::{EventFilter, SseData}, Filter as SseFilter, }; -use casper_types::{ProtocolVersion, Transaction}; +use casper_types::ProtocolVersion; +#[cfg(test)] +use casper_types::Transaction; use futures::{future, Stream, StreamExt}; use http::StatusCode; use hyper::Body; +#[cfg(test)] use serde::Serialize; #[cfg(test)] use serde_json::Value; @@ -97,6 +100,7 @@ type UrlProps = ( IsLegacyFilter, ); +#[cfg(test)] #[derive(Serialize)] #[serde(rename_all = "PascalCase")] pub(super) struct TransactionAccepted { diff --git a/event_sidecar/src/event_stream_server/tests.rs b/event_sidecar/src/event_stream_server/tests.rs index 15527e72..6726ba54 100644 --- a/event_sidecar/src/event_stream_server/tests.rs +++ b/event_sidecar/src/event_stream_server/tests.rs @@ -598,11 +598,11 @@ async fn fetch_text( /// /// The expected order is: /// * data: (note, no ID line follows this first event) -/// then the following three repeated for as many events as are applicable to that stream: +/// then the following three repeated for as many events as are applicable to that stream: /// * data: /// * id: /// * empty line -/// then finally, repeated keepalive lines until the server is shut down. +/// then finally, repeated keepalive lines until the server is shut down. #[allow(clippy::too_many_lines)] fn parse_response(response_text: String, client_id: &str) -> Vec { let mut received_events = Vec::new(); diff --git a/event_sidecar/src/testing/simple_sse_server.rs b/event_sidecar/src/testing/simple_sse_server.rs index c455696e..2bf86cbb 100644 --- a/event_sidecar/src/testing/simple_sse_server.rs +++ b/event_sidecar/src/testing/simple_sse_server.rs @@ -28,10 +28,6 @@ pub(crate) mod tests { pub routes: HashMap, CacheAndData>, } - #[derive(Debug)] - struct Nope; - impl warp::reject::Reject for Nope {} - type ShutdownCallbacks = Arc, String)>>>>>; impl SimpleSseServer { diff --git a/event_sidecar/src/types/database.rs b/event_sidecar/src/types/database.rs index 4b1382b1..fe371531 100644 --- a/event_sidecar/src/types/database.rs +++ b/event_sidecar/src/types/database.rs @@ -284,9 +284,29 @@ pub enum DatabaseWriteError { Unhandled(anyhow::Error), } -impl ToString for DatabaseWriteError { - fn to_string(&self) -> String { - format!("{:?}", self) +impl Display for DatabaseWriteError { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + DatabaseWriteError::Serialisation(error) => { + write!(f, "DatabaseWriteError::Serialisation: {}", error) + } + DatabaseWriteError::SqlConstruction(error) => { + write!(f, "DatabaseWriteError::SqlConstruction: {}", error) + } + DatabaseWriteError::UniqueConstraint(unique_constraint_error) => { + write!( + f, + "DatabaseWriteError::UniqueConstraint: table: {}, error: {}", + unique_constraint_error.table, unique_constraint_error.error + ) + } + DatabaseWriteError::Database(error) => { + write!(f, "DatabaseWriteError::Database: {}", error) + } + DatabaseWriteError::Unhandled(error) => { + write!(f, "DatabaseWriteError::Unhandled: {}", error) + } + } } } diff --git a/event_sidecar/src/utils.rs b/event_sidecar/src/utils.rs index 46734304..22136e01 100644 --- a/event_sidecar/src/utils.rs +++ b/event_sidecar/src/utils.rs @@ -231,6 +231,8 @@ pub mod tests { let infix_str = infix.as_str(); data.iter().any(|x| x.contains(infix_str)) } + + #[allow(dead_code)] pub struct MockNodeTestProperties { pub testing_config: TestingConfig, pub temp_storage_dir: TempDir, diff --git a/json_rpc/src/request.rs b/json_rpc/src/request.rs index b0241603..13411a76 100644 --- a/json_rpc/src/request.rs +++ b/json_rpc/src/request.rs @@ -66,6 +66,7 @@ impl Request { /// * `allow_unknown_fields` is `false` and extra fields exist /// /// Returns a `Rejection` if the "id" field is `None`. + #[allow(clippy::result_large_err)] pub(super) fn new( mut request: Map, allow_unknown_fields: bool, diff --git a/json_rpc/src/request/params.rs b/json_rpc/src/request/params.rs index 4da0dfb2..facadfc4 100644 --- a/json_rpc/src/request/params.rs +++ b/json_rpc/src/request/params.rs @@ -24,6 +24,7 @@ pub enum Params { } impl Params { + #[allow(clippy::result_large_err)] pub(super) fn try_from(request_id: &Value, params: Value) -> Result { let err_invalid_request = |additional_info: &str| { let error = Error::new(ReservedErrorCode::InvalidRequest, additional_info); diff --git a/listener/src/connection_manager.rs b/listener/src/connection_manager.rs index 24c01135..ac7a38a5 100644 --- a/listener/src/connection_manager.rs +++ b/listener/src/connection_manager.rs @@ -140,7 +140,6 @@ impl DefaultConnectionManagerBuilder { impl DefaultConnectionManager { /// Start handling traffic from nodes endpoint. This function is blocking, it will return a /// ConnectionManagerError result if something went wrong while processing. - async fn connect( &mut self, ) -> Result + Send + 'static>>, ConnectionManagerError> diff --git a/listener/src/sse_connector.rs b/listener/src/sse_connector.rs index 24d5a655..9c8e2c5a 100644 --- a/listener/src/sse_connector.rs +++ b/listener/src/sse_connector.rs @@ -8,7 +8,7 @@ use eventsource_stream::{Event, EventStream, EventStreamError, Eventsource}; use futures::StreamExt; use reqwest::Client; use std::pin::Pin; -use std::{fmt::Debug, sync::Arc, time::Duration}; +use std::{fmt::Debug, time::Duration}; use tokio::select; use tokio_stream::Stream; use tracing::debug; @@ -17,7 +17,7 @@ use url::Url; #[derive(Clone, Debug)] pub enum SseDataStreamingError { NoDataTimeout(), - ConnectionError(Arc), + ConnectionError(), } pub type EventResult = Result>; @@ -84,8 +84,8 @@ impl SseConnection { monitor.tick().await; yield Ok(bytes); }, - Err(err) => { - yield Err(SseDataStreamingError::ConnectionError(Arc::new(Error::from(err)))); + Err(_) => { + yield Err(SseDataStreamingError::ConnectionError()); break; } } @@ -177,7 +177,6 @@ pub mod tests { use std::{ convert::Infallible, pin::Pin, - sync::Arc, time::{Duration, Instant}, }; use tokio::sync::mpsc::channel; @@ -225,9 +224,7 @@ pub mod tests { } pub fn build_failing_on_message() -> Self { - let e = SseDataStreamingError::ConnectionError(Arc::new(Error::msg( - "Some error on message", - ))); + let e = SseDataStreamingError::ConnectionError(); MockSseConnection { data: vec![], failure_on_connection: None, diff --git a/listener/src/version_fetcher.rs b/listener/src/version_fetcher.rs index 635dbfab..540ebf29 100644 --- a/listener/src/version_fetcher.rs +++ b/listener/src/version_fetcher.rs @@ -125,17 +125,11 @@ fn try_resolve_version(raw_response: &Value) -> Result { let raw = build_version_value .as_str() .context("build_version_value should be a string") - .map_err(|e| { - count_error("version_value_not_a_string"); - e - })? + .inspect_err(|_| count_error("version_value_not_a_string"))? .split('-') .next() .context("splitting build_version_value should always return at least one slice") - .map_err(|e| { - count_error("incomprehensible_build_version_form"); - e - })?; + .inspect_err(|_| count_error("incomprehensible_build_version_form"))?; ProtocolVersion::from_str(raw).map_err(|error| { count_error("failed_parsing_protocol_version"); anyhow!("failed parsing build version from '{}': {}", raw, error) diff --git a/metrics/src/metrics.rs b/metrics/src/metrics.rs index 2b83233f..694a3f93 100644 --- a/metrics/src/metrics.rs +++ b/metrics/src/metrics.rs @@ -1,3 +1,5 @@ +use std::fmt::{Display, Formatter}; + use once_cell::sync::Lazy; use prometheus::{IntCounterVec, Opts, Registry}; @@ -25,9 +27,9 @@ pub struct MetricCollectionError { reason: String, } -impl ToString for MetricCollectionError { - fn to_string(&self) -> String { - format!("MetricCollectionError: {}", self.reason) +impl Display for MetricCollectionError { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "MetricCollectionError: {}", self.reason) } } diff --git a/metrics/src/rpc.rs b/metrics/src/rpc.rs index 52c70699..f2334e38 100644 --- a/metrics/src/rpc.rs +++ b/metrics/src/rpc.rs @@ -90,7 +90,7 @@ pub fn inc_method_call(method: &str) { pub fn observe_response_time(method: &str, status: &str, response_time: Duration) { let response_time = response_time.as_secs_f64() * 1000.0; RESPONSE_TIMES_MS - .with_label_values(&[method, &status]) + .with_label_values(&[method, status]) .observe(response_time); } diff --git a/resources/test/rpc_schema.json b/resources/test/rpc_schema.json index 7a542f19..ccc38e33 100644 --- a/resources/test/rpc_schema.json +++ b/resources/test/rpc_schema.json @@ -5511,10 +5511,10 @@ "description": "A version 1 transfer.", "type": "object", "required": [ - "LegacyTransfer" + "Transfer" ], "properties": { - "LegacyTransfer": { + "Transfer": { "$ref": "#/components/schemas/TransferV1" } }, @@ -5683,14 +5683,14 @@ "additionalProperties": false }, { - "description": "A reservation record.", + "description": "A prepayment record.", "type": "object", "required": [ - "Prepaid" + "Prepayment" ], "properties": { - "Prepaid": { - "$ref": "#/components/schemas/PrepaidKind" + "Prepayment": { + "$ref": "#/components/schemas/PrepaymentKind" } }, "additionalProperties": false @@ -6560,7 +6560,7 @@ } } }, - "PrepaidKind": { + "PrepaymentKind": { "description": "Container for bytes recording location, type and data for a gas pre payment", "type": "object", "required": [ diff --git a/resources/test/speculative_rpc_schema.json b/resources/test/speculative_rpc_schema.json index 9928521c..6c348e82 100644 --- a/resources/test/speculative_rpc_schema.json +++ b/resources/test/speculative_rpc_schema.json @@ -1543,10 +1543,10 @@ "description": "A version 1 transfer.", "type": "object", "required": [ - "LegacyTransfer" + "Transfer" ], "properties": { - "LegacyTransfer": { + "Transfer": { "$ref": "#/components/schemas/TransferV1" } }, @@ -1715,14 +1715,14 @@ "additionalProperties": false }, { - "description": "A reservation record.", + "description": "A prepayment record.", "type": "object", "required": [ - "Prepaid" + "Prepayment" ], "properties": { - "Prepaid": { - "$ref": "#/components/schemas/PrepaidKind" + "Prepayment": { + "$ref": "#/components/schemas/PrepaymentKind" } }, "additionalProperties": false @@ -3529,7 +3529,7 @@ } } }, - "PrepaidKind": { + "PrepaymentKind": { "description": "Container for bytes recording location, type and data for a gas pre payment", "type": "object", "required": [ diff --git a/rpc_sidecar/src/node_client.rs b/rpc_sidecar/src/node_client.rs index b95f59c2..a05fc55b 100644 --- a/rpc_sidecar/src/node_client.rs +++ b/rpc_sidecar/src/node_client.rs @@ -520,9 +520,9 @@ pub enum InvalidTransactionOrDeploy { /// Entry point cannot be 'call' #[error("entry point cannot be 'call'")] InvalidTransactionEntryPointCannotBeCall, - /// Invalid transaction kind - #[error("invalid transaction kind")] - InvalidTransactionInvalidTransactionKind, + /// Invalid transaction lane + #[error("invalid transaction lane")] + InvalidTransactionInvalidTransactionLane, } impl From for InvalidTransactionOrDeploy { @@ -627,8 +627,8 @@ impl From for InvalidTransactionOrDeploy { ErrorCode::InvalidTransactionEntryPointCannotBeCall => { Self::InvalidTransactionEntryPointCannotBeCall } - ErrorCode::InvalidTransactionInvalidTransactionKind => { - Self::InvalidTransactionInvalidTransactionKind + ErrorCode::InvalidTransactionInvalidTransactionLane => { + Self::InvalidTransactionInvalidTransactionLane } ErrorCode::InvalidTransactionUnspecified => Self::TransactionUnspecified, ErrorCode::InvalidTransactionOrDeployUnspecified => { @@ -766,7 +766,7 @@ impl Error { | ErrorCode::DeployMissingTransferTarget | ErrorCode::DeployMissingModuleBytes | ErrorCode::InvalidTransactionEntryPointCannotBeCall - | ErrorCode::InvalidTransactionInvalidTransactionKind + | ErrorCode::InvalidTransactionInvalidTransactionLane | ErrorCode::InvalidTransactionUnspecified | ErrorCode::InvalidTransactionOrDeployUnspecified), ) => Self::InvalidTransaction(InvalidTransactionOrDeploy::from(err)), @@ -1206,7 +1206,7 @@ where #[derive(Clone, Copy, Debug)] pub(crate) struct ErrFormatter<'a, T>(pub &'a T); -impl<'a, T> Display for ErrFormatter<'a, T> +impl Display for ErrFormatter<'_, T> where T: std::error::Error, { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 38c87b26..4d7ea937 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.77.2" +channel = "1.83.0" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" \ No newline at end of file diff --git a/sidecar/src/main.rs b/sidecar/src/main.rs index 4442680e..3cb0b003 100644 --- a/sidecar/src/main.rs +++ b/sidecar/src/main.rs @@ -9,7 +9,7 @@ use config::{SidecarConfig, SidecarConfigTarget}; use run::run; use std::{ env, fmt, io, - panic::{self, PanicInfo}, + panic::{self, PanicHookInfo}, process::{self, ExitCode}, }; #[cfg(not(target_env = "msvc"))] @@ -68,7 +68,7 @@ pub fn read_config(config_path: &str) -> Result { toml::from_str(&toml_content).context("Error parsing config into TOML format") } -fn panic_hook(info: &PanicInfo) { +fn panic_hook(info: &PanicHookInfo) { let backtrace = Backtrace::new(); eprintln!("{:?}", backtrace); diff --git a/types/src/legacy_sse_data/translate_execution_result.rs b/types/src/legacy_sse_data/translate_execution_result.rs index d7abeb68..2091369c 100644 --- a/types/src/legacy_sse_data/translate_execution_result.rs +++ b/types/src/legacy_sse_data/translate_execution_result.rs @@ -133,7 +133,7 @@ fn maybe_tanslate_stored_value(stored_value: &StoredValue) -> Option Some(TransformKindV1::WriteContractWasm), StoredValue::Contract(_) => Some(TransformKindV1::WriteContract), StoredValue::ContractPackage(_) => Some(TransformKindV1::WriteContractPackage), - StoredValue::LegacyTransfer(transfer_v1) => { + StoredValue::Transfer(transfer_v1) => { Some(TransformKindV1::WriteTransfer(transfer_v1.clone())) } StoredValue::DeployInfo(deploy_info) => { @@ -162,7 +162,7 @@ fn maybe_tanslate_stored_value(stored_value: &StoredValue) -> Option None, StoredValue::MessageTopic(_) => None, StoredValue::Message(_) => None, - StoredValue::Prepaid(_) => None, + StoredValue::Prepayment(_) => None, StoredValue::EntryPoint(_) => None, StoredValue::RawBytes(_) => None, }