diff --git a/Cargo.toml b/Cargo.toml index fdb52666b8..fd8d74c083 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,9 +89,9 @@ redb = "=2.4.0" snap = "1.1.1" k256 = { version = "0.13.3", features = ["ecdh"] } secp256k1 = { version = "0.29.1", default-features = false, features = [ - "global-context", - "recovery", - "rand", + "global-context", + "recovery", + "rand", ] } keccak-hash = "0.11.0" axum = "0.8.1" diff --git a/crates/l2/tee/quote-gen/Cargo.lock b/crates/l2/tee/quote-gen/Cargo.lock index b2fba67a70..60bebf94aa 100644 --- a/crates/l2/tee/quote-gen/Cargo.lock +++ b/crates/l2/tee/quote-gen/Cargo.lock @@ -1007,18 +1007,18 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "castaway" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" dependencies = [ "rustversion", ] [[package]] name = "cc" -version = "1.2.27" +version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" +checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ "jobserver", "libc", @@ -1091,9 +1091,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" +checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" dependencies = [ "clap_builder", "clap_derive", @@ -1101,9 +1101,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" dependencies = [ "anstream", "anstyle", @@ -1113,9 +1113,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" dependencies = [ "heck", "proc-macro2", @@ -1367,9 +1367,9 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if 1.0.1", ] @@ -1499,7 +1499,7 @@ dependencies = [ "document-features", "mio", "parking_lot", - "rustix 1.0.7", + "rustix 1.0.8", "signal-hook", "signal-hook-mio", "winapi", @@ -3091,9 +3091,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" dependencies = [ "bytes", "fnv", @@ -3314,7 +3314,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", + "h2 0.3.27", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -3372,7 +3372,7 @@ dependencies = [ "http 1.3.1", "hyper 1.6.0", "hyper-util", - "rustls 0.23.28", + "rustls 0.23.29", "rustls-pki-types", "tokio", "tokio-rustls 0.26.2", @@ -3397,9 +3397,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" +checksum = "7f66d5bd4c6f02bf0542fad85d626775bab9258cf795a4256dcaf3161114d1df" dependencies = [ "base64 0.22.1", "bytes", @@ -3688,6 +3688,17 @@ dependencies = [ "cfg-if 1.0.1", ] +[[package]] +name = "io-uring" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" +dependencies = [ + "bitflags 2.9.1", + "cfg-if 1.0.1", + "libc", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -5211,7 +5222,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.26", + "h2 0.3.27", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.32", @@ -5556,15 +5567,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -5581,13 +5592,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.28" +version = "0.23.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7160e3e10bf4535308537f3c4e1641468cd0e485175d6163087c0393c7d46643" +checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" dependencies = [ "once_cell", "rustls-pki-types", - "rustls-webpki 0.103.3", + "rustls-webpki 0.103.4", "subtle", "zeroize", ] @@ -5622,9 +5633,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.3" +version = "0.103.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" +checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" dependencies = [ "ring 0.17.14", "rustls-pki-types", @@ -5720,9 +5731,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1375ba8ef45a6f15d83fa8748f1079428295d403d6ea991d09ab100155fbc06d" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" dependencies = [ "dyn-clone", "ref-cast", @@ -5949,7 +5960,7 @@ dependencies = [ "indexmap 1.9.3", "indexmap 2.10.0", "schemars 0.9.0", - "schemars 1.0.3", + "schemars 1.0.4", "serde", "serde_derive", "serde_json", @@ -6137,9 +6148,9 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "5.0.5" +version = "5.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0fd8bc101e5603ccf2dc1836ea06410f25ce2298755b2dac626add9be2424b4" +checksum = "7fbb6e3d8741c0fcdaa37e74d2dd9a2bdcbf958d192e438eec59e8071e08124c" dependencies = [ "bincode", "serde", @@ -6148,9 +6159,9 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "5.0.5" +version = "5.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699935774a5131c1a8b371108d0666c0c80c43611045fb77fae43f2f242676d5" +checksum = "a4d2be9803acce74985f8861b6d5eb375ad1c5f176a68c2c735755937248f25e" dependencies = [ "bincode", "blake3", @@ -6446,7 +6457,7 @@ dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", - "rustix 1.0.7", + "rustix 1.0.8", "windows-sys 0.59.0", ] @@ -6588,17 +6599,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.45.1" +version = "1.46.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", + "slab", "socket2", "tokio-macros", "windows-sys 0.52.0", @@ -6641,7 +6654,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "rustls 0.23.28", + "rustls 0.23.29", "tokio", ] @@ -7600,9 +7613,9 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" dependencies = [ "memchr", ] diff --git a/crates/l2/tee/quote-gen/service.nix b/crates/l2/tee/quote-gen/service.nix index fc6d4da0cf..8f1d5a8470 100644 --- a/crates/l2/tee/quote-gen/service.nix +++ b/crates/l2/tee/quote-gen/service.nix @@ -18,7 +18,7 @@ let cargo = toolchain; rustc = toolchain; }; - gitignoreSrc = pkgs.fetchFromGitHub { + gitignoreSrc = pkgs.fetchFromGitHub { owner = "hercules-ci"; repo = "gitignore.nix"; rev = "637db329424fd7e46cf4185293b9cc8c88c95394"; diff --git a/crates/networking/p2p/rlpx/connection/server.rs b/crates/networking/p2p/rlpx/connection/server.rs index 938f710e8d..db232b33e2 100644 --- a/crates/networking/p2p/rlpx/connection/server.rs +++ b/crates/networking/p2p/rlpx/connection/server.rs @@ -16,12 +16,13 @@ use k256::{PublicKey, ecdsa::SigningKey}; use rand::random; use spawned_concurrency::{ messages::Unused, - tasks::{CastResponse, GenServer, GenServerHandle, send_interval}, + tasks::{CastResponse, GenServer, GenServerHandle, send_interval, spawn_listener}, }; +use spawned_rt::tasks::BroadcastStream; use tokio::{ net::TcpStream, sync::{Mutex, broadcast, mpsc::Sender}, - task, + task::{self, Id}, }; use tokio_stream::StreamExt; use tokio_util::codec::Framed; @@ -321,9 +322,18 @@ where CastMessage::BlockRangeUpdate, ); - spawn_listener(handle.clone(), &state.node, stream); + spawn_listener( + handle.clone(), + |msg: Message| CastMessage::PeerMessage(msg), + stream, + ); - spawn_broadcast_listener(handle.clone(), state); + if state.negotiated_eth_capability.is_some() { + let stream = BroadcastStream::new(state.connection_broadcast_send.subscribe()); + let message_builder = + |(id, msg): (Id, Arc)| CastMessage::BroadcastMessage(id, msg); + spawn_listener(handle.clone(), message_builder, stream); + } Ok(()) } @@ -599,56 +609,6 @@ where stream.next().await } -// TODO replace this spawn, once it's implemented in spawned -// See https://github.com/lambdaclass/ethrex/issues/3387 and -// https://github.com/lambdaclass/spawned/issues/17 -fn spawn_listener(mut conn: RLPxConnectionHandle, node: &Node, mut stream: S) -where - S: Unpin + Send + Stream> + 'static, -{ - let node = node.clone(); - spawned_rt::tasks::spawn(async move { - loop { - match stream.next().await { - Some(Ok(message)) => { - let _ = conn.cast(CastMessage::PeerMessage(message)).await; - } - Some(Err(e)) => { - log_peer_debug(&node, &format!("Received RLPX Error in msg {e}")); - break; - } - // `None` does not neccessary means EOF, so we will keep the loop running - // (See Framed::new) - None => (), - } - } - }); -} - -// TODO Maybe provide a similar mechanism for this listener, or remove it when -// Broadcast is handled in a spawned GenServer -// See https://github.com/lambdaclass/ethrex/issues/3387 and -// https://github.com/lambdaclass/spawned/issues/17 and -// https://github.com/lambdaclass/ethrex/issues/3388 -fn spawn_broadcast_listener(mut handle: RLPxConnectionHandle, state: &mut Established) { - // Subscribe this connection to the broadcasting channel. - // TODO currently spawning a listener task that will suscribe to a broadcast channel and - // create RLPxConnection Broadcast messages to send the Genserver - // We have to improve this mechanism to avoid manual creation of channels and subscriptions - // (That is, we should have a spawned-based broadcaster or maybe the backend should handle the - // transactions propagation) - if state.negotiated_eth_capability.is_some() { - let mut receiver = state.connection_broadcast_send.subscribe(); - spawned_rt::tasks::spawn(async move { - loop { - if let Ok((id, msg)) = receiver.recv().await { - let _ = handle.cast(CastMessage::BroadcastMessage(id, msg)).await; - }; - } - }); - }; -} - async fn handle_peer_message(state: &mut Established, message: Message) -> Result<(), RLPxError> { let peer_supports_eth = state.negotiated_eth_capability.is_some(); match message {