Skip to content

Commit b413446

Browse files
authored
Merge pull request #1433 from plebhash/network_helpers_async_std_cleanup
cleanup `async_std` from `network_helpers_sv2`
2 parents 5496d8a + 0d00daa commit b413446

File tree

32 files changed

+31
-360
lines changed

32 files changed

+31
-360
lines changed

benches/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ num-traits = "0.2.15"
1919
bitcoin="0.28.1"
2020
codec_sv2 = { path = "../protocols/v2/codec-sv2", features=["noise_sv2"] }
2121
binary_sv2 = { path = "../protocols/v2/binary-sv2/binary-sv2" }
22-
network_helpers_sv2 = { path = "../roles/roles-utils/network-helpers", features=["async_std"] }
22+
network_helpers_sv2 = { path = "../roles/roles-utils/network-helpers" }
2323
rand = "0.8.4"
2424

2525
[[bench]]

examples/ping-pong-encrypted/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
1111
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = [ "noise_sv2" ] }
1212
noise_sv2 = { path = "../../protocols/v2/noise-sv2" }
1313
key-utils = { version = "^1.0.0", path = "../../utils/key-utils" }
14-
network_helpers_sv2 = { version = "2.0.0", path = "../../roles/roles-utils/network-helpers", features = [
15-
"with_tokio",
16-
] }
14+
network_helpers_sv2 = { version = "3.0.0", path = "../../roles/roles-utils/network-helpers" }
1715
rand = "0.8"
1816
tokio = { version = "1", features = [ "full" ] }
1917
async-channel = "1.5.1"

examples/ping-pong-encrypted/src/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::messages::{Message, Ping, Pong, PING_MSG_TYPE, PONG_MSG_TYPE};
22
use codec_sv2::{Frame, HandshakeRole, Initiator, StandardSv2Frame};
33
use key_utils::Secp256k1PublicKey;
4-
use network_helpers_sv2::noise_connection_tokio::Connection;
4+
use network_helpers_sv2::noise_connection::Connection;
55
use tokio::net::TcpStream;
66

77
use crate::error::Error;

examples/ping-pong-encrypted/src/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use codec_sv2::{Frame, StandardEitherFrame, StandardSv2Frame};
66

77
use codec_sv2::{HandshakeRole, Responder};
88
use key_utils::{Secp256k1PublicKey, Secp256k1SecretKey};
9-
use network_helpers_sv2::noise_connection_tokio::Connection;
9+
use network_helpers_sv2::noise_connection::Connection;
1010

1111
use async_channel::{Receiver, Sender};
1212
use tokio::net::TcpListener;

roles/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

roles/jd-client/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
2323
buffer_sv2 = { path = "../../utils/buffer" }
2424
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = ["noise_sv2", "with_buffer_pool"] }
2525
framing_sv2 = { path = "../../protocols/v2/framing-sv2" }
26-
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features=["with_tokio", "with_buffer_pool"] }
26+
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features=["with_buffer_pool"] }
2727
roles_logic_sv2 = { path = "../../protocols/v2/roles-logic-sv2" }
2828
serde = { version = "1.0.89", default-features = false, features = ["derive", "alloc"] }
2929
futures = "0.3.25"

roles/jd-client/src/lib/downstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ impl ParseDownstreamCommonMessages<roles_logic_sv2::routing_logic::NoRouting>
658658
}
659659
}
660660

661-
use network_helpers_sv2::noise_connection_tokio::Connection;
661+
use network_helpers_sv2::noise_connection::Connection;
662662
use std::net::SocketAddr;
663663
use tokio::{
664664
net::TcpListener,

roles/jd-client/src/lib/job_declarator/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod message_handler;
22
use async_channel::{Receiver, Sender};
33
use binary_sv2::{Seq0255, Seq064K, B016M, B064K, U256};
44
use codec_sv2::{HandshakeRole, Initiator, StandardEitherFrame, StandardSv2Frame};
5-
use network_helpers_sv2::noise_connection_tokio::Connection;
5+
use network_helpers_sv2::noise_connection::Connection;
66
use roles_logic_sv2::{
77
handlers::SendTo_,
88
job_declaration_sv2::{AllocateMiningJobTokenSuccess, SubmitSolutionJd},

roles/jd-client/src/lib/template_receiver/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use async_channel::{Receiver, Sender};
33
use codec_sv2::{HandshakeRole, Initiator, StandardEitherFrame, StandardSv2Frame};
44
use error_handling::handle_result;
55
use key_utils::Secp256k1PublicKey;
6-
use network_helpers_sv2::noise_connection_tokio::Connection;
6+
use network_helpers_sv2::noise_connection::Connection;
77
use roles_logic_sv2::{
88
handlers::{template_distribution::ParseServerTemplateDistributionMessages, SendTo_},
99
job_declaration_sv2::AllocateMiningJobTokenSuccess,

roles/jd-client/src/lib/upstream_sv2/upstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use binary_sv2::{Seq0255, U256};
1414
use codec_sv2::{HandshakeRole, Initiator};
1515
use error_handling::handle_result;
1616
use key_utils::Secp256k1PublicKey;
17-
use network_helpers_sv2::noise_connection_tokio::Connection;
17+
use network_helpers_sv2::noise_connection::Connection;
1818
use roles_logic_sv2::{
1919
channel_logic::channel_factory::PoolChannelFactory,
2020
common_messages_sv2::{Protocol, SetupConnection},

roles/jd-server/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
2323
buffer_sv2 = { path = "../../utils/buffer" }
2424
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = ["noise_sv2"] }
2525
const_sv2 = { path = "../../protocols/v2/const-sv2" }
26-
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features = ["with_tokio"] }
26+
network_helpers_sv2 = { path = "../roles-utils/network-helpers" }
2727
noise_sv2 = { path = "../../protocols/v2/noise-sv2" }
2828
rand = "0.8.4"
2929
roles_logic_sv2 = { path = "../../protocols/v2/roles-logic-sv2" }

roles/jd-server/src/lib/job_declarator/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use codec_sv2::{HandshakeRole, Responder};
66
use core::panic;
77
use error_handling::handle_result;
88
use key_utils::{Secp256k1PublicKey, Secp256k1SecretKey, SignatureService};
9-
use network_helpers_sv2::noise_connection_tokio::Connection;
9+
use network_helpers_sv2::noise_connection::Connection;
1010
use nohash_hasher::BuildNoHashHasher;
1111
use roles_logic_sv2::{
1212
common_messages_sv2::{

roles/mining-proxy/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ buffer_sv2 = { path = "../../utils/buffer" }
2525
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = ["noise_sv2", "with_buffer_pool"] }
2626
const_sv2 = { path = "../../protocols/v2/const-sv2" }
2727
futures = "0.3.19"
28-
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features = ["with_tokio","with_buffer_pool"] }
28+
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features = ["with_buffer_pool"] }
2929
once_cell = "1.12.0"
3030
roles_logic_sv2 = { path = "../../protocols/v2/roles-logic-sv2" }
3131
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false }

roles/mining-proxy/src/lib/downstream_mining.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use tokio::{net::TcpListener, sync::oneshot::Receiver as TokioReceiver};
55
use tracing::{info, warn};
66

77
use codec_sv2::{StandardEitherFrame, StandardSv2Frame};
8-
use network_helpers_sv2::plain_connection_tokio::PlainConnection;
8+
use network_helpers_sv2::plain_connection::PlainConnection;
99
use roles_logic_sv2::{
1010
common_messages_sv2::{SetupConnection, SetupConnectionSuccess},
1111
common_properties::{CommonDownstreamData, IsDownstream, IsMiningDownstream},

roles/mining-proxy/src/lib/upstream_mining.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use tokio::{net::TcpStream, task};
1010
use tracing::{debug, error, info};
1111

1212
use codec_sv2::{HandshakeRole, Initiator, StandardEitherFrame, StandardSv2Frame};
13-
use network_helpers_sv2::noise_connection_tokio::Connection;
13+
use network_helpers_sv2::noise_connection::Connection;
1414
use roles_logic_sv2::{
1515
channel_logic::{
1616
channel_factory::{ExtendedChannelKind, OnNewShare, ProxyExtendedChannelFactory, Share},

roles/pool/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
2323
buffer_sv2 = { path = "../../utils/buffer" }
2424
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = ["noise_sv2"] }
2525
const_sv2 = { path = "../../protocols/v2/const-sv2" }
26-
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features =["with_tokio","with_buffer_pool"] }
26+
network_helpers_sv2 = { path = "../roles-utils/network-helpers", features =["with_buffer_pool"] }
2727
noise_sv2 = { path = "../../protocols/v2/noise-sv2" }
2828
rand = "0.8.4"
2929
roles_logic_sv2 = { path = "../../protocols/v2/roles-logic-sv2" }

roles/pool/src/lib/mining_pool/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use binary_sv2::U256;
77
use codec_sv2::{HandshakeRole, Responder, StandardEitherFrame, StandardSv2Frame};
88
use error_handling::handle_result;
99
use key_utils::{Secp256k1PublicKey, Secp256k1SecretKey, SignatureService};
10-
use network_helpers_sv2::noise_connection_tokio::Connection;
10+
use network_helpers_sv2::noise_connection::Connection;
1111
use nohash_hasher::BuildNoHashHasher;
1212
use roles_logic_sv2::{
1313
channel_logic::channel_factory::PoolChannelFactory,

roles/pool/src/lib/template_receiver/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use async_channel::{Receiver, Sender};
77
use codec_sv2::{HandshakeRole, Initiator};
88
use error_handling::handle_result;
99
use key_utils::Secp256k1PublicKey;
10-
use network_helpers_sv2::noise_connection_tokio::Connection;
10+
use network_helpers_sv2::noise_connection::Connection;
1111
use roles_logic_sv2::{
1212
handlers::template_distribution::ParseServerTemplateDistributionMessages,
1313
parsers::{PoolMessages, TemplateDistribution},

roles/roles-utils/network-helpers/Cargo.toml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "network_helpers_sv2"
3-
version = "2.0.2"
3+
version = "3.0.0"
44
authors = ["The Stratum V2 Developers"]
55
edition = "2018"
66
description = "Networking utils for SV2 roles"
@@ -16,7 +16,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"]
1616
[dependencies]
1717
async-std = { version = "1.8.0", optional = true }
1818
async-channel = { version = "1.8.0", optional = true }
19-
tokio = { version = "1", features = ["full"], optional = true }
19+
tokio = { version = "1", features = ["full"] }
2020
binary_sv2 = { path = "../../../protocols/v2/binary-sv2/binary-sv2", optional = true }
2121
codec_sv2 = { path = "../../../protocols/v2/codec-sv2", features=["noise_sv2"], optional = true }
2222
const_sv2 = {path = "../../../protocols/v2/const-sv2"}
@@ -26,10 +26,8 @@ futures = "0.3.28"
2626

2727
[features]
2828
default = ["async-channel", "binary_sv2", "codec_sv2"]
29-
async_std = ["async-std", "async-channel", "binary_sv2", "codec_sv2"]
30-
with_tokio = ["tokio", "async-channel", "binary_sv2", "codec_sv2"]
3129
with_serde = ["binary_sv2/with_serde", "serde", "codec_sv2/with_serde"]
3230
with_buffer_pool = ["codec_sv2/with_buffer_pool"]
3331

3432
[package.metadata.docs.rs]
35-
features = ["with_buffer_pool", "with_tokio", "async_std"]
33+
features = ["with_buffer_pool"]

roles/roles-utils/network-helpers/src/lib.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
#[cfg(feature = "async_std")]
2-
mod noise_connection_async_std;
3-
#[cfg(feature = "async_std")]
4-
mod plain_connection_async_std;
51
use binary_sv2::{Deserialize, GetSize, Serialize};
6-
#[cfg(feature = "async_std")]
7-
pub use noise_connection_async_std::{connect, listen, Connection};
8-
#[cfg(feature = "async_std")]
9-
pub use plain_connection_async_std::{plain_connect, plain_listen, PlainConnection};
10-
11-
#[cfg(feature = "tokio")]
12-
pub mod noise_connection_tokio;
13-
#[cfg(feature = "tokio")]
14-
pub mod plain_connection_tokio;
2+
pub mod noise_connection;
3+
pub mod plain_connection;
154

165
use async_channel::{Receiver, RecvError, SendError, Sender};
176
use codec_sv2::{Error as CodecError, HandShakeFrame, HandshakeRole, StandardEitherFrame};

0 commit comments

Comments
 (0)