From 9dce552f65c9c1e53491077c39382b2596e5f80b Mon Sep 17 00:00:00 2001 From: mango-dee Date: Mon, 9 Dec 2024 08:52:57 +0800 Subject: [PATCH] Adds protobuf-compiler to workflow --- .github/workflows/build_test.yml | 2 +- .github/workflows/clippy_test.yml | 2 +- Cargo.lock | 21 ++++------------ Cargo.toml | 2 +- .../tests/quic_proxy_tpu_integrationtest.rs | 24 ++++++------------- quic-forward-proxy/src/outbound/tx_forward.rs | 9 +++---- 6 files changed, 18 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 1de7bb4d..7c096b23 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -20,7 +20,7 @@ jobs: - name: Install Linux Packages run: | sudo apt-get update -y - sudo apt-get install libssl-dev openssl -y + sudo apt-get install libssl-dev openssl protobuf-compiler -y - uses: actions/checkout@v4 diff --git a/.github/workflows/clippy_test.yml b/.github/workflows/clippy_test.yml index 625a9515..31617818 100644 --- a/.github/workflows/clippy_test.yml +++ b/.github/workflows/clippy_test.yml @@ -20,7 +20,7 @@ jobs: - name: Install Linux Packages run: | sudo apt-get update -y - sudo apt-get install libssl-dev openssl -y + sudo apt-get install libssl-dev openssl protobuf-compiler -y - uses: actions/checkout@v4 diff --git a/Cargo.lock b/Cargo.lock index 2dea1211..46d29ea2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3505,16 +3505,6 @@ dependencies = [ "base64 0.13.1", ] -[[package]] -name = "pem" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" -dependencies = [ - "base64 0.22.1", - "serde", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -4095,13 +4085,12 @@ dependencies = [ [[package]] name = "rcgen" -version = "0.13.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54077e1872c46788540de1ea3d7f4ccb1983d12f9aa909b234468676c1a36779" +checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ - "pem 3.0.4", - "ring 0.17.8", - "rustls-pki-types", + "pem", + "ring 0.16.20", "time", "yasna", ] @@ -6000,7 +5989,7 @@ dependencies = [ "libc", "log", "nix", - "pem 1.1.1", + "pem", "percentage", "quinn", "quinn-proto", diff --git a/Cargo.toml b/Cargo.toml index d2eaa551..cf669411 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ jemallocator = "0.5" quinn = "0.10.2" quinn-proto = "0.10.5" rustls = { version = "0.21.7", default-features = false, features = ["quic"] } -rcgen = "0.13.1" +rcgen = "0.9.3" solana-lite-rpc-services = {path = "services", version="0.2.4"} solana-lite-rpc-core = {path = "core", version="0.2.4"} diff --git a/quic-forward-proxy-integration-test/tests/quic_proxy_tpu_integrationtest.rs b/quic-forward-proxy-integration-test/tests/quic_proxy_tpu_integrationtest.rs index 5cdc6319..086f513d 100644 --- a/quic-forward-proxy-integration-test/tests/quic_proxy_tpu_integrationtest.rs +++ b/quic-forward-proxy-integration-test/tests/quic_proxy_tpu_integrationtest.rs @@ -19,9 +19,8 @@ use solana_streamer::nonblocking::quic::{ConnectionPeerType, SpawnNonBlockingSer use solana_streamer::packet::PacketBatch; use solana_streamer::quic::StreamStats; use solana_streamer::streamer::StakedNodes; -use solana_streamer::tls_certificates::new_self_signed_tls_certificate; use std::collections::{HashMap, HashSet}; -use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket}; +use std::net::{Ipv4Addr, SocketAddr, UdpSocket}; use itertools::Itertools; use std::str::FromStr; @@ -29,6 +28,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, RwLock}; use std::thread; use std::time::{Duration, Instant}; +use solana_streamer::tls_certificates::new_dummy_x509_certificate; use tokio::runtime::Builder; use tokio::task::{yield_now, JoinHandle}; @@ -423,13 +423,11 @@ async fn solana_quic_streamer_start() { // keypair to derive the server tls certificate let keypair = Keypair::new(); // gossip_host is used in the server certificate - let gossip_host = "127.0.0.1".parse().unwrap(); let SpawnNonBlockingServerResult { stats, thread, .. } = solana_streamer::nonblocking::quic::spawn_server( "test-quic-server", sock.try_clone().unwrap(), &keypair, - gossip_host, sender, exit.clone(), 1, @@ -437,6 +435,7 @@ async fn solana_quic_streamer_start() { 10, 10, 9999, // max_streams_per_ms + 10, Duration::from_millis(1000), Duration::from_millis(1000), ) @@ -467,11 +466,7 @@ async fn start_literpc_client_direct_mode( // (String, Vec) (signature, transaction) let (sender, _) = tokio::sync::broadcast::channel(MAXIMUM_TRANSACTIONS_IN_QUEUE); let broadcast_sender = Arc::new(sender); - let (certificate, key) = new_self_signed_tls_certificate( - literpc_validator_identity.as_ref(), - IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), - ) - .expect("Failed to initialize QUIC connection certificates"); + let (certificate, key) = new_dummy_x509_certificate(literpc_validator_identity.as_ref()); let tpu_connection_manager = TpuConnectionManager::new(certificate, key, fanout_slots as usize).await; @@ -568,11 +563,7 @@ async fn start_literpc_client_proxy_mode( // (String, Vec) (signature, transaction) let (sender, _) = tokio::sync::broadcast::channel(MAXIMUM_TRANSACTIONS_IN_QUEUE); let broadcast_sender = Arc::new(sender); - let (certificate, key) = new_self_signed_tls_certificate( - validator_identity.as_ref(), - IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), - ) - .expect("Failed to initialize QUIC connection certificates"); + let (certificate, key) = new_dummy_x509_certificate(validator_identity.as_ref()); let quic_proxy_connection_manager = QuicProxyConnectionManager::new(certificate, key, forward_proxy_address).await; @@ -707,14 +698,12 @@ impl SolanaQuicStreamer { let exit = Arc::new(AtomicBool::new(false)); // keypair to derive the server tls certificate let keypair = Keypair::new(); - // gossip_host is used in the server certificate - let gossip_host = "127.0.0.1".parse().unwrap(); + let SpawnNonBlockingServerResult { stats, thread, .. } = solana_streamer::nonblocking::quic::spawn_server( "test-quic-server", udp_socket.try_clone().unwrap(), &keypair, - gossip_host, sender, exit.clone(), MAX_QUIC_CONNECTIONS_PER_PEER, @@ -722,6 +711,7 @@ impl SolanaQuicStreamer { 10, 10, 9999, // max_streams_per_ms + 10, Duration::from_millis(1000), Duration::from_millis(1000), ) diff --git a/quic-forward-proxy/src/outbound/tx_forward.rs b/quic-forward-proxy/src/outbound/tx_forward.rs index 46b225f8..2648c352 100644 --- a/quic-forward-proxy/src/outbound/tx_forward.rs +++ b/quic-forward-proxy/src/outbound/tx_forward.rs @@ -14,7 +14,7 @@ use quinn::{ use solana_lite_rpc_core::network_utils::apply_gso_workaround; use solana_sdk::quic::QUIC_MAX_TIMEOUT; use solana_streamer::nonblocking::quic::ALPN_TPU_PROTOCOL_ID; -use solana_streamer::tls_certificates::new_self_signed_tls_certificate; +use solana_streamer::tls_certificates::new_dummy_x509_certificate; use std::collections::HashMap; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::atomic::{AtomicBool, Ordering}; @@ -267,11 +267,8 @@ async fn new_endpoint_with_validator_identity(validator_identity: ValidatorIdent validator_identity ); // the counterpart of this function is get_remote_pubkey+get_pubkey_from_tls_certificate - let (certificate, key) = new_self_signed_tls_certificate( - &validator_identity.get_keypair_for_tls(), - IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), - ) - .expect("Failed to initialize QUIC connection certificates"); + let (certificate, key) = + new_dummy_x509_certificate(validator_identity.get_keypair_for_tls().as_ref()); create_tpu_client_endpoint(certificate, key) }