Skip to content

Commit

Permalink
Adds protobuf-compiler to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mango-dee committed Dec 9, 2024
1 parent f88ac48 commit 23ba2a0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clippy_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 5 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ 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::{SocketAddr, UdpSocket};

use itertools::Itertools;
use solana_streamer::tls_certificates::new_dummy_x509_certificate;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, RwLock};
Expand Down Expand Up @@ -423,20 +423,19 @@ 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,
staked_nodes,
10,
10,
9999, // max_streams_per_ms
10,
Duration::from_millis(1000),
Duration::from_millis(1000),
)
Expand Down Expand Up @@ -467,11 +466,7 @@ async fn start_literpc_client_direct_mode(
// (String, Vec<u8>) (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;
Expand Down Expand Up @@ -568,11 +563,7 @@ async fn start_literpc_client_proxy_mode(
// (String, Vec<u8>) (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;
Expand Down Expand Up @@ -707,21 +698,20 @@ 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,
staked_nodes,
10,
10,
9999, // max_streams_per_ms
10,
Duration::from_millis(1000),
Duration::from_millis(1000),
)
Expand Down
9 changes: 3 additions & 6 deletions quic-forward-proxy/src/outbound/tx_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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)
}
Expand Down
20 changes: 12 additions & 8 deletions quic-forward-proxy/tests/proxy_request_format.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
use solana_lite_rpc_quic_forward_proxy::proxy_request_format::TpuForwardingRequest;
use std::str::FromStr;

use solana_sdk::address_lookup_table::program::id;
use solana_sdk::instruction::{AccountMeta, Instruction};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, Signer};
use solana_sdk::transaction::Transaction;
use std::str::FromStr;

use solana_lite_rpc_quic_forward_proxy::proxy_request_format::TpuForwardingRequest;

#[test]
fn roundtrip() {
let payer = Keypair::from_base58_string(
"rKiJ7H5UUp3JR18kNyTF1XPuwPKHEM7gMLWHZPWP5djrW1vSjfwjhvJrevxF9MPmUmN9gJMLHZdLMgc9ao78eKr",
);
let payer_pubkey = payer.pubkey();
let payer_pubkey = Pubkey::from_str("Bm8rtweCQ19ksNebrLY92H7x4bCaeDJSSmEeWqkdCeop").unwrap();

let memo_ix = spl_memo::build_memo("Hello world".as_bytes(), &[&payer_pubkey]);
let memo_ix = Instruction {
program_id: id(),
accounts: vec![AccountMeta::new_readonly(payer_pubkey, true)],
data: Vec::new(),
};

let tx = Transaction::new_with_payer(&[memo_ix], Some(&payer_pubkey));

Expand Down

0 comments on commit 23ba2a0

Please sign in to comment.