Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e7200a7c8 |
+7
-22
@@ -4,29 +4,14 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
## [v1.1.16] (2023-04-25)
|
- nym-network-statistics properly handles signals ([#3209])
|
||||||
|
- add socks5 support for Rust SDK ([#3226], [#3255])
|
||||||
|
- add coconut bandwidth credential support for Rust SDK ([#3273])
|
||||||
|
|
||||||
- Explorer - Fix sorting function on Stake Saturation. It is currently working per page and not globally ([#3320])
|
[#3209]: https://github.com/nymtech/nym/issues/3209
|
||||||
- Poisson process gets stuck at too slow rate. Rework to more aggressively up-regulate ([#3309])
|
[#3226]: https://github.com/nymtech/nym/pull/3226
|
||||||
- decrease the logging level of warnings associated with clients dropping packets due to gateway being overloaded (I'd say reduce it to debug/trace) - there are few sources of those, e.g. in real and cover traffic streams ([#3299])
|
[#3255]: https://github.com/nymtech/nym/pull/3255
|
||||||
- Make the buffer size in `AvailableReader` depend on packet sizes the client is using + introduce read timeouts ([#3213])
|
[#3273]: https://github.com/nymtech/nym/pull/3273
|
||||||
- Rust SDK - Support coconut, credential storage etc ([#2755])
|
|
||||||
- version bump for next release ([#3349])
|
|
||||||
- added coconut credential generation example ([#3339])
|
|
||||||
- update mix-node setup docs with node description ([#3325])
|
|
||||||
- exposed missing gateway commands in nym-cli ([#3324])
|
|
||||||
- make sure to clear inner 'ack_map' in 'GatewaysReader' ([#3300])
|
|
||||||
|
|
||||||
[#3320]: https://github.com/nymtech/nym/issues/3320
|
|
||||||
[#3309]: https://github.com/nymtech/nym/issues/3309
|
|
||||||
[#3299]: https://github.com/nymtech/nym/issues/3299
|
|
||||||
[#3213]: https://github.com/nymtech/nym/issues/3213
|
|
||||||
[#2755]: https://github.com/nymtech/nym/issues/2755
|
|
||||||
[#3349]: https://github.com/nymtech/nym/pull/3349
|
|
||||||
[#3339]: https://github.com/nymtech/nym/pull/3339
|
|
||||||
[#3325]: https://github.com/nymtech/nym/pull/3325
|
|
||||||
[#3324]: https://github.com/nymtech/nym/pull/3324
|
|
||||||
[#3300]: https://github.com/nymtech/nym/pull/3300
|
|
||||||
|
|
||||||
## [v1.1.15] (2023-04-18)
|
## [v1.1.15] (2023-04-18)
|
||||||
|
|
||||||
|
|||||||
Generated
+12
-12
@@ -1576,7 +1576,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "explorer-api"
|
name = "explorer-api"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap 4.1.11",
|
"clap 4.1.11",
|
||||||
@@ -3011,7 +3011,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-api"
|
name = "nym-api"
|
||||||
version = "1.1.17"
|
version = "1.1.16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -3142,7 +3142,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-cli"
|
name = "nym-cli"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.13.1",
|
"base64 0.13.1",
|
||||||
@@ -3203,7 +3203,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-client"
|
name = "nym-client"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap 4.1.11",
|
"clap 4.1.11",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -3471,7 +3471,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-gateway"
|
name = "nym-gateway"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -3600,7 +3600,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-mixnet-contract-common"
|
name = "nym-mixnet-contract-common"
|
||||||
version = "0.5.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -3619,7 +3619,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-mixnode"
|
name = "nym-mixnode"
|
||||||
version = "1.1.17"
|
version = "1.1.16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bs58",
|
"bs58",
|
||||||
@@ -3721,7 +3721,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-network-requester"
|
name = "nym-network-requester"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-file-watcher",
|
"async-file-watcher",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -3763,7 +3763,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-network-statistics"
|
name = "nym-network-statistics"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
"log",
|
"log",
|
||||||
@@ -3879,7 +3879,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-socks5-client"
|
name = "nym-socks5-client"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap 4.1.11",
|
"clap 4.1.11",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -4202,7 +4202,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract"
|
name = "nym-vesting-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-derive",
|
"cosmwasm-derive",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -4220,7 +4220,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract-common"
|
name = "nym-vesting-contract-common"
|
||||||
version = "0.6.0"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"nym-contracts-common",
|
"nym-contracts-common",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-client"
|
name = "nym-client"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||||
description = "Implementation of the Nym Client"
|
description = "Implementation of the Nym Client"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-socks5-client"
|
name = "nym-socks5-client"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
|
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
|
||||||
description = "A SOCKS5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address"
|
description = "A SOCKS5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-mixnet-contract-common"
|
name = "nym-mixnet-contract-common"
|
||||||
version = "0.5.0"
|
version = "0.4.0"
|
||||||
description = "Common library for the Nym mixnet contract"
|
description = "Common library for the Nym mixnet contract"
|
||||||
rust-version = "1.62"
|
rust-version = "1.62"
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-vesting-contract-common"
|
name = "nym-vesting-contract-common"
|
||||||
version = "0.6.0"
|
version = "0.5.0"
|
||||||
description = "Common library for the Nym vesting contract"
|
description = "Common library for the Nym vesting contract"
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
@@ -9,7 +9,7 @@ repository = { workspace = true }
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cosmwasm-std = { workspace = true }
|
cosmwasm-std = { workspace = true }
|
||||||
mixnet-contract-common = { path = "../mixnet-contract", package = "nym-mixnet-contract-common", version = "0.5.0" }
|
mixnet-contract-common = { path = "../mixnet-contract", package = "nym-mixnet-contract-common", version = "0.4.0" }
|
||||||
contracts-common = { path = "../contracts-common", package = "nym-contracts-common", version = "0.4.0" }
|
contracts-common = { path = "../contracts-common", package = "nym-contracts-common", version = "0.4.0" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
schemars = "0.8"
|
schemars = "0.8"
|
||||||
|
|||||||
@@ -7,10 +7,15 @@ use crate::socks::{
|
|||||||
authentication::{AuthenticationMethods, Authenticator, User},
|
authentication::{AuthenticationMethods, Authenticator, User},
|
||||||
server::SphinxSocksServer,
|
server::SphinxSocksServer,
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures::channel::mpsc;
|
use futures::channel::mpsc;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use log::*;
|
use log::*;
|
||||||
use nym_bandwidth_controller::BandwidthController;
|
use nym_bandwidth_controller::BandwidthController;
|
||||||
|
#[cfg(target_os = "android")]
|
||||||
|
use nym_client_core::client::base_client::helpers::setup_empty_reply_surb_backend;
|
||||||
|
#[cfg(not(target_os = "android"))]
|
||||||
|
use nym_client_core::client::base_client::non_wasm_helpers;
|
||||||
use nym_client_core::client::base_client::{
|
use nym_client_core::client::base_client::{
|
||||||
BaseClientBuilder, ClientInput, ClientOutput, ClientState,
|
BaseClientBuilder, ClientInput, ClientOutput, ClientState,
|
||||||
};
|
};
|
||||||
@@ -23,12 +28,6 @@ use nym_validator_client::nyxd::QueryNyxdClient;
|
|||||||
use nym_validator_client::Client;
|
use nym_validator_client::Client;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
use nym_client_core::client::base_client::helpers::setup_empty_reply_surb_backend;
|
|
||||||
#[cfg(not(target_os = "android"))]
|
|
||||||
use nym_client_core::client::base_client::non_wasm_helpers;
|
|
||||||
use nym_client_core::config::DebugConfig;
|
|
||||||
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod socks;
|
pub mod socks;
|
||||||
@@ -103,7 +102,6 @@ impl NymClient {
|
|||||||
|
|
||||||
pub fn start_socks5_listener(
|
pub fn start_socks5_listener(
|
||||||
socks5_config: &Socks5,
|
socks5_config: &Socks5,
|
||||||
debug_config: DebugConfig,
|
|
||||||
client_input: ClientInput,
|
client_input: ClientInput,
|
||||||
client_output: ClientOutput,
|
client_output: ClientOutput,
|
||||||
client_status: ClientState,
|
client_status: ClientState,
|
||||||
@@ -128,11 +126,6 @@ impl NymClient {
|
|||||||
..
|
..
|
||||||
} = client_status;
|
} = client_status;
|
||||||
|
|
||||||
let packet_size = debug_config
|
|
||||||
.traffic
|
|
||||||
.secondary_packet_size
|
|
||||||
.unwrap_or(debug_config.traffic.primary_packet_size);
|
|
||||||
|
|
||||||
let authenticator = Authenticator::new(auth_methods, allowed_users);
|
let authenticator = Authenticator::new(auth_methods, allowed_users);
|
||||||
let mut sphinx_socks = SphinxSocksServer::new(
|
let mut sphinx_socks = SphinxSocksServer::new(
|
||||||
socks5_config.get_listening_port(),
|
socks5_config.get_listening_port(),
|
||||||
@@ -141,7 +134,6 @@ impl NymClient {
|
|||||||
self_address,
|
self_address,
|
||||||
shared_lane_queue_lengths,
|
shared_lane_queue_lengths,
|
||||||
socks::client::Config::new(
|
socks::client::Config::new(
|
||||||
packet_size,
|
|
||||||
socks5_config.get_provider_interface_version(),
|
socks5_config.get_provider_interface_version(),
|
||||||
socks5_config.get_socks5_protocol_version(),
|
socks5_config.get_socks5_protocol_version(),
|
||||||
socks5_config.get_send_anonymously(),
|
socks5_config.get_send_anonymously(),
|
||||||
@@ -263,7 +255,6 @@ impl NymClient {
|
|||||||
|
|
||||||
Self::start_socks5_listener(
|
Self::start_socks5_listener(
|
||||||
self.config.get_socks5(),
|
self.config.get_socks5(),
|
||||||
*self.config.get_debug_settings(),
|
|
||||||
client_input,
|
client_input,
|
||||||
client_output,
|
client_output,
|
||||||
client_state,
|
client_state,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use nym_socks5_requests::{
|
|||||||
ConnectionId, RemoteAddress, Socks5ProtocolVersion, Socks5ProviderRequest, Socks5Request,
|
ConnectionId, RemoteAddress, Socks5ProtocolVersion, Socks5ProviderRequest, Socks5Request,
|
||||||
};
|
};
|
||||||
use nym_sphinx::addressing::clients::Recipient;
|
use nym_sphinx::addressing::clients::Recipient;
|
||||||
use nym_sphinx::params::PacketSize;
|
|
||||||
use nym_task::connections::{LaneQueueLengths, TransmissionLane};
|
use nym_task::connections::{LaneQueueLengths, TransmissionLane};
|
||||||
use nym_task::TaskClient;
|
use nym_task::TaskClient;
|
||||||
use pin_project::pin_project;
|
use pin_project::pin_project;
|
||||||
@@ -132,7 +131,6 @@ impl AsyncWrite for StreamState {
|
|||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub(crate) struct Config {
|
pub(crate) struct Config {
|
||||||
biggest_packet_size: PacketSize,
|
|
||||||
provider_interface_version: ProviderInterfaceVersion,
|
provider_interface_version: ProviderInterfaceVersion,
|
||||||
socks5_protocol_version: Socks5ProtocolVersion,
|
socks5_protocol_version: Socks5ProtocolVersion,
|
||||||
use_surbs_for_responses: bool,
|
use_surbs_for_responses: bool,
|
||||||
@@ -142,7 +140,6 @@ pub(crate) struct Config {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
biggest_packet_size: PacketSize,
|
|
||||||
provider_interface_version: ProviderInterfaceVersion,
|
provider_interface_version: ProviderInterfaceVersion,
|
||||||
socks5_protocol_version: Socks5ProtocolVersion,
|
socks5_protocol_version: Socks5ProtocolVersion,
|
||||||
use_surbs_for_responses: bool,
|
use_surbs_for_responses: bool,
|
||||||
@@ -150,7 +147,6 @@ impl Config {
|
|||||||
per_request_surbs: u32,
|
per_request_surbs: u32,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
biggest_packet_size,
|
|
||||||
provider_interface_version,
|
provider_interface_version,
|
||||||
socks5_protocol_version,
|
socks5_protocol_version,
|
||||||
use_surbs_for_responses,
|
use_surbs_for_responses,
|
||||||
@@ -414,9 +410,6 @@ impl SocksClient {
|
|||||||
remote_proxy_target,
|
remote_proxy_target,
|
||||||
conn_receiver,
|
conn_receiver,
|
||||||
input_sender,
|
input_sender,
|
||||||
// FIXME: this does NOT include overhead due to acks or chunking
|
|
||||||
// (so actual true plaintext is smaller)
|
|
||||||
self.config.biggest_packet_size.plaintext_size(),
|
|
||||||
connection_id,
|
connection_id,
|
||||||
Some(self.lane_queue_lengths.clone()),
|
Some(self.lane_queue_lengths.clone()),
|
||||||
self.shutdown_listener.clone(),
|
self.shutdown_listener.clone(),
|
||||||
|
|||||||
@@ -1,36 +1,208 @@
|
|||||||
// Copyright 2021-2023 - Nym Technologies SA <contact@nymtech.net>
|
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::{BufMut, Bytes, BytesMut};
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
use std::ops::DerefMut;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use tokio::io::AsyncRead;
|
use tokio::io::AsyncRead;
|
||||||
|
use tokio::time::{sleep, Duration, Instant, Sleep};
|
||||||
|
use tokio_util::io::poll_read_buf;
|
||||||
|
|
||||||
// note, min_capacity doesn't mean we're going to always read at least this amount of data,
|
const MAX_READ_AMOUNT: usize = 500 * 1000; // 0.5MB
|
||||||
// it defines the smallest allowed (by yours truly) upper bound
|
const GRACE_DURATION: Duration = Duration::from_millis(1);
|
||||||
const MIN_CAPACITY: usize = 16 * 1024;
|
|
||||||
const DEFAULT_CAPACITY: usize = 64 * 1024;
|
|
||||||
|
|
||||||
pub struct AvailableReader<R> {
|
pub struct AvailableReader<'a, R: AsyncRead + Unpin> {
|
||||||
inner: tokio_util::io::ReaderStream<R>,
|
// TODO: come up with a way to avoid using RefCell (not sure if possible though due to having to
|
||||||
|
// mutably borrow both inner reader and buffer at the same time)
|
||||||
|
buf: RefCell<BytesMut>,
|
||||||
|
inner: RefCell<&'a mut R>,
|
||||||
|
grace_period: Option<Pin<Box<Sleep>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: AsyncRead> AvailableReader<R> {
|
impl<'a, R> AvailableReader<'a, R>
|
||||||
pub fn new(reader: R, capacity: Option<usize>) -> Self {
|
where
|
||||||
let capacity = capacity.unwrap_or(DEFAULT_CAPACITY).max(MIN_CAPACITY);
|
R: AsyncRead + Unpin,
|
||||||
|
{
|
||||||
|
const BUF_INCREMENT: usize = 4096;
|
||||||
|
|
||||||
|
pub fn new(reader: &'a mut R) -> Self {
|
||||||
AvailableReader {
|
AvailableReader {
|
||||||
inner: tokio_util::io::ReaderStream::with_capacity(reader, capacity),
|
buf: RefCell::new(BytesMut::with_capacity(Self::BUF_INCREMENT)),
|
||||||
|
inner: RefCell::new(reader),
|
||||||
|
grace_period: Some(Box::pin(sleep(GRACE_DURATION))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: AsyncRead + Unpin> Stream for AvailableReader<R> {
|
impl<'a, R: AsyncRead + Unpin> Stream for AvailableReader<'a, R> {
|
||||||
type Item = io::Result<Bytes>;
|
type Item = io::Result<Bytes>;
|
||||||
|
|
||||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
Pin::new(&mut self.inner).poll_next(cx)
|
// if we have no space in buffer left - expand it
|
||||||
|
if !self.buf.borrow().has_remaining_mut() {
|
||||||
|
self.buf.borrow_mut().reserve(Self::BUF_INCREMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// note: poll_read_buf calls `buf.advance_mut(n)`
|
||||||
|
let poll_res = poll_read_buf(
|
||||||
|
Pin::new(self.inner.borrow_mut().deref_mut()),
|
||||||
|
cx,
|
||||||
|
self.buf.borrow_mut().deref_mut(),
|
||||||
|
);
|
||||||
|
|
||||||
|
match poll_res {
|
||||||
|
Poll::Pending => {
|
||||||
|
// there's nothing for us here, just return whatever we have (assuming we read anything!)
|
||||||
|
if self.buf.borrow().is_empty() {
|
||||||
|
Poll::Pending
|
||||||
|
} else {
|
||||||
|
// if exists - check grace period
|
||||||
|
if let Some(grace_period) = self.grace_period.as_mut() {
|
||||||
|
if Pin::new(grace_period).poll(cx).is_pending() {
|
||||||
|
return Poll::Pending;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let buf = self.buf.replace(BytesMut::new());
|
||||||
|
Poll::Ready(Some(Ok(buf.freeze())))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Poll::Ready(Err(err)) => Poll::Ready(Some(Err(err))),
|
||||||
|
Poll::Ready(Ok(n)) => {
|
||||||
|
// if exists - reset grace period
|
||||||
|
if let Some(grace_period) = self.grace_period.as_mut() {
|
||||||
|
let now = Instant::now();
|
||||||
|
grace_period.as_mut().reset(now + GRACE_DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we read a non-0 amount, we're not done yet!
|
||||||
|
if n == 0 {
|
||||||
|
let buf = self.buf.replace(BytesMut::new());
|
||||||
|
if !buf.is_empty() {
|
||||||
|
Poll::Ready(Some(Ok(buf.freeze())))
|
||||||
|
} else {
|
||||||
|
Poll::Ready(None)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// tell the waker we should be polled again!
|
||||||
|
cx.waker().wake_by_ref();
|
||||||
|
|
||||||
|
// if we reached our maximum amount - return it
|
||||||
|
let read_bytes_len = self.buf.borrow().len();
|
||||||
|
if read_bytes_len >= MAX_READ_AMOUNT {
|
||||||
|
let buf = self.buf.replace(BytesMut::new());
|
||||||
|
return Poll::Ready(Some(Ok(buf.freeze())));
|
||||||
|
}
|
||||||
|
Poll::Pending
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use futures::{poll, StreamExt};
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::time::Duration;
|
||||||
|
use tokio::io::AsyncReadExt;
|
||||||
|
use tokio_test::assert_pending;
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn available_reader_reads_all_available_data_smaller_than_its_buf() {
|
||||||
|
let data = vec![42u8; 100];
|
||||||
|
let mut reader = Cursor::new(data.clone());
|
||||||
|
|
||||||
|
let mut available_reader = AvailableReader::new(&mut reader);
|
||||||
|
let read_data = available_reader.next().await.unwrap().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(read_data, data);
|
||||||
|
assert!(available_reader.next().await.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn available_reader_reads_all_available_data_bigger_than_its_buf() {
|
||||||
|
let data = vec![42u8; AvailableReader::<Cursor<Vec<u8>>>::BUF_INCREMENT + 100];
|
||||||
|
let mut reader = Cursor::new(data.clone());
|
||||||
|
|
||||||
|
let mut available_reader = AvailableReader::new(&mut reader);
|
||||||
|
let read_data = available_reader.next().await.unwrap().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(read_data, data);
|
||||||
|
assert!(available_reader.next().await.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn available_reader_will_not_wait_for_more_data_if_it_already_has_some() {
|
||||||
|
let first_data_chunk = vec![42u8; 100];
|
||||||
|
let second_data_chunk = vec![123u8; 100];
|
||||||
|
|
||||||
|
let mut reader_mock = tokio_test::io::Builder::new()
|
||||||
|
.read(&first_data_chunk)
|
||||||
|
.wait(Duration::from_millis(100)) // delay is irrelevant, what matters is that we don't get everything immediately
|
||||||
|
.read(&second_data_chunk)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut available_reader = AvailableReader::new(&mut reader_mock);
|
||||||
|
let read_data = available_reader.next().await.unwrap().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(read_data, first_data_chunk);
|
||||||
|
assert_pending!(poll!(available_reader.next()));
|
||||||
|
|
||||||
|
// before dropping the mock, we need to empty it
|
||||||
|
let mut buf = vec![0u8; second_data_chunk.len()];
|
||||||
|
assert_eq!(reader_mock.read(&mut buf).await.unwrap(), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn available_reader_will_wait_for_more_data_if_it_doesnt_have_anything() {
|
||||||
|
let data = vec![42u8; 100];
|
||||||
|
|
||||||
|
let mut reader_mock = tokio_test::io::Builder::new()
|
||||||
|
.wait(Duration::from_millis(100))
|
||||||
|
.read(&data)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut available_reader = AvailableReader::new(&mut reader_mock);
|
||||||
|
let read_data = available_reader.next().await.unwrap().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(read_data, data);
|
||||||
|
assert!(available_reader.next().await.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
// perhaps the issue of tokio io builder will be resolved in tokio 0.3?
|
||||||
|
// #[tokio::test]
|
||||||
|
// async fn available_reader_will_wait_for_more_data_if_its_within_grace_period() {
|
||||||
|
// let first_data_chunk = vec![42u8; 100];
|
||||||
|
// let second_data_chunk = vec![123u8; 100];
|
||||||
|
//
|
||||||
|
// let combined_chunks: Vec<_> = first_data_chunk
|
||||||
|
// .iter()
|
||||||
|
// .cloned()
|
||||||
|
// .chain(second_data_chunk.iter().cloned())
|
||||||
|
// .collect();
|
||||||
|
//
|
||||||
|
// let mut reader_mock = tokio_test::io::Builder::new()
|
||||||
|
// .read(&first_data_chunk)
|
||||||
|
// .wait(Duration::from_millis(2))
|
||||||
|
// .read(&second_data_chunk)
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// let mut available_reader = AvailableReader {
|
||||||
|
// buf: RefCell::new(BytesMut::with_capacity(4096)),
|
||||||
|
// inner: RefCell::new(&mut reader_mock),
|
||||||
|
// grace_period: Some(delay_for(Duration::from_millis(5))),
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// let read_data = available_reader.next().await.unwrap().unwrap();
|
||||||
|
//
|
||||||
|
// assert_eq!(read_data, combined_chunks);
|
||||||
|
// assert!(available_reader.next().await.is_none())
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ pub(super) async fn run_inbound<F, S>(
|
|||||||
remote_source_address: String,
|
remote_source_address: String,
|
||||||
connection_id: ConnectionId,
|
connection_id: ConnectionId,
|
||||||
mix_sender: MixProxySender<S>,
|
mix_sender: MixProxySender<S>,
|
||||||
available_plaintext_per_mix_packet: usize,
|
|
||||||
adapter_fn: F,
|
adapter_fn: F,
|
||||||
shutdown_notify: Arc<Notify>,
|
shutdown_notify: Arc<Notify>,
|
||||||
lane_queue_lengths: Option<LaneQueueLengths>,
|
lane_queue_lengths: Option<LaneQueueLengths>,
|
||||||
@@ -177,9 +176,7 @@ where
|
|||||||
F: Fn(ConnectionId, Vec<u8>, bool) -> S + Send + 'static,
|
F: Fn(ConnectionId, Vec<u8>, bool) -> S + Send + 'static,
|
||||||
S: Debug,
|
S: Debug,
|
||||||
{
|
{
|
||||||
// TODO: this multiplication by 4 is completely arbitrary here
|
let mut available_reader = AvailableReader::new(&mut reader);
|
||||||
let mut available_reader =
|
|
||||||
AvailableReader::new(&mut reader, Some(available_plaintext_per_mix_packet * 4));
|
|
||||||
let mut message_sender = OrderedMessageSender::new();
|
let mut message_sender = OrderedMessageSender::new();
|
||||||
let shutdown_future = shutdown_notify.notified().then(|_| sleep(SHUTDOWN_TIMEOUT));
|
let shutdown_future = shutdown_notify.notified().then(|_| sleep(SHUTDOWN_TIMEOUT));
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021-2023 - Nym Technologies SA <contact@nymtech.net>
|
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
use crate::connection_controller::ConnectionReceiver;
|
use crate::connection_controller::ConnectionReceiver;
|
||||||
@@ -49,8 +49,6 @@ pub struct ProxyRunner<S> {
|
|||||||
connection_id: ConnectionId,
|
connection_id: ConnectionId,
|
||||||
lane_queue_lengths: Option<LaneQueueLengths>,
|
lane_queue_lengths: Option<LaneQueueLengths>,
|
||||||
|
|
||||||
available_plaintext_per_mix_packet: usize,
|
|
||||||
|
|
||||||
// Listens to shutdown commands from higher up
|
// Listens to shutdown commands from higher up
|
||||||
shutdown_listener: TaskClient,
|
shutdown_listener: TaskClient,
|
||||||
}
|
}
|
||||||
@@ -66,7 +64,6 @@ where
|
|||||||
remote_source_address: String,
|
remote_source_address: String,
|
||||||
mix_receiver: ConnectionReceiver,
|
mix_receiver: ConnectionReceiver,
|
||||||
mix_sender: MixProxySender<S>,
|
mix_sender: MixProxySender<S>,
|
||||||
available_plaintext_per_mix_packet: usize,
|
|
||||||
connection_id: ConnectionId,
|
connection_id: ConnectionId,
|
||||||
lane_queue_lengths: Option<LaneQueueLengths>,
|
lane_queue_lengths: Option<LaneQueueLengths>,
|
||||||
shutdown_listener: TaskClient,
|
shutdown_listener: TaskClient,
|
||||||
@@ -79,7 +76,6 @@ where
|
|||||||
remote_source_address,
|
remote_source_address,
|
||||||
connection_id,
|
connection_id,
|
||||||
lane_queue_lengths,
|
lane_queue_lengths,
|
||||||
available_plaintext_per_mix_packet,
|
|
||||||
shutdown_listener,
|
shutdown_listener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +96,6 @@ where
|
|||||||
self.remote_source_address.clone(),
|
self.remote_source_address.clone(),
|
||||||
self.connection_id,
|
self.connection_id,
|
||||||
self.mix_sender.clone(),
|
self.mix_sender.clone(),
|
||||||
self.available_plaintext_per_mix_packet,
|
|
||||||
adapter_fn,
|
adapter_fn,
|
||||||
Arc::clone(&shutdown_notify),
|
Arc::clone(&shutdown_notify),
|
||||||
self.lane_queue_lengths.clone(),
|
self.lane_queue_lengths.clone(),
|
||||||
|
|||||||
@@ -2,17 +2,6 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
## [v1.4.0] (2023-04-25)
|
|
||||||
- Allow mixnode operators to decrease their bond amount without having to rebond (will require a lot of testing EXACT reward values to make sure the "unit delegation" isn't broken afterwards) ([#3233])
|
|
||||||
- Fix a few clippy warnings in contract test code ([#3340])
|
|
||||||
- Add --all-targets to clippy for contracts ([#3337])
|
|
||||||
- A branch with all clippy warnings dealt with in contracts ([#3294])
|
|
||||||
|
|
||||||
[#3233]: https://github.com/nymtech/nym/issues/3233
|
|
||||||
[#3340]: https://github.com/nymtech/nym/pull/3340
|
|
||||||
[#3337]: https://github.com/nymtech/nym/pull/3337
|
|
||||||
[#3294]: https://github.com/nymtech/nym/pull/3294
|
|
||||||
|
|
||||||
## [v1.3.1] (2023-04-18)
|
## [v1.3.1] (2023-04-18)
|
||||||
- Add a query to the vesting contract for the amount of delegated tokens towards a particular `mix_id` (might be needed by NG) ([#3228])
|
- Add a query to the vesting contract for the amount of delegated tokens towards a particular `mix_id` (might be needed by NG) ([#3228])
|
||||||
|
|
||||||
|
|||||||
Generated
+4
-4
@@ -1068,7 +1068,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-mixnet-contract"
|
name = "nym-mixnet-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"cosmwasm-derive",
|
"cosmwasm-derive",
|
||||||
@@ -1092,7 +1092,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-mixnet-contract-common"
|
name = "nym-mixnet-contract-common"
|
||||||
version = "0.5.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -1164,7 +1164,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract"
|
name = "nym-vesting-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.0",
|
"base64 0.21.0",
|
||||||
"cosmwasm-crypto",
|
"cosmwasm-crypto",
|
||||||
@@ -1187,7 +1187,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract-common"
|
name = "nym-vesting-contract-common"
|
||||||
version = "0.6.0"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"nym-contracts-common",
|
"nym-contracts-common",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-mixnet-contract"
|
name = "nym-mixnet-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
description = "Nym mixnet contract"
|
description = "Nym mixnet contract"
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
@@ -22,8 +22,8 @@ name = "mixnet_contract"
|
|||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", package = "nym-mixnet-contract-common", version = "0.5.0" }
|
mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", package = "nym-mixnet-contract-common", version = "0.4.0" }
|
||||||
vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common", version = "0.6.0" }
|
vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common", version = "0.5.0" }
|
||||||
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", version = "0.4.0" }
|
nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", version = "0.4.0" }
|
||||||
|
|
||||||
cosmwasm-std = { workspace = true }
|
cosmwasm-std = { workspace = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-vesting-contract"
|
name = "nym-vesting-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
description = "Nym vesting contract"
|
description = "Nym vesting contract"
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
authors = { workspace = true }
|
authors = { workspace = true }
|
||||||
@@ -20,9 +20,9 @@ name = "vesting_contract"
|
|||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", package = "nym-mixnet-contract-common", version = "0.5.0" }
|
mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", package = "nym-mixnet-contract-common", version = "0.4.0" }
|
||||||
contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", package = "nym-contracts-common", version = "0.4.0" }
|
contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", package = "nym-contracts-common", version = "0.4.0" }
|
||||||
vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common", version = "0.6.0" }
|
vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract", package = "nym-vesting-contract-common", version = "0.5.0" }
|
||||||
|
|
||||||
cosmwasm-std = { workspace = true }
|
cosmwasm-std = { workspace = true }
|
||||||
cosmwasm-derive = { workspace = true }
|
cosmwasm-derive = { workspace = true }
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ assets_version = "2.0.0" # do not edit: managed by `mdbook-admonish install`
|
|||||||
[preprocessor.variables.variables]
|
[preprocessor.variables.variables]
|
||||||
# code prerequisites versions
|
# code prerequisites versions
|
||||||
minimum_rust_version = "1.66"
|
minimum_rust_version = "1.66"
|
||||||
platform_release_version = "v1.1.16"
|
# minimum_node_version = ""
|
||||||
upcoming_platform_release_version = "v1.1.17" # to use when adding 'edit on github' plugin
|
# nym platform code most recent release
|
||||||
mix_node_release_version = "v1.1.17"
|
platform_release_version = "v1.1.15"
|
||||||
#
|
|
||||||
[preprocessor.last-changed]
|
[preprocessor.last-changed]
|
||||||
command = "mdbook-last-changed"
|
command = "mdbook-last-changed"
|
||||||
renderer = ["html"]
|
renderer = ["html"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[book]
|
[book]
|
||||||
title = "Nym Docs v1.1.16"
|
title = "Nym Docs v1.1.15"
|
||||||
authors = ["Max Hampshire"]
|
authors = ["Max Hampshire"]
|
||||||
description = "Nym technical documentation"
|
description = "Nym technical documentation"
|
||||||
language = "en"
|
language = "en"
|
||||||
@@ -48,9 +48,8 @@ assets_version = "2.0.0" # do not edit: managed by `mdbook-admonish install`
|
|||||||
# https://gitlab.com/tglman/mdbook-variables/
|
# https://gitlab.com/tglman/mdbook-variables/
|
||||||
[preprocessor.variables.variables]
|
[preprocessor.variables.variables]
|
||||||
minimum_rust_version = "1.66"
|
minimum_rust_version = "1.66"
|
||||||
platform_release_version = "v1.1.16"
|
platform_release_version = "v1.1.15"
|
||||||
upcoming_platform_release_version = "v1.1.17" # to use in 'edit page on github' plugin (coming soon)
|
mix_node_release_version = "v1.1.16"
|
||||||
mix_node_release_version = "v1.1.17"
|
|
||||||
# used by the cmdrun preprocessor - relative path from inside src/<dir>
|
# used by the cmdrun preprocessor - relative path from inside src/<dir>
|
||||||
# binaries_path = '../../../../target/release/'
|
# binaries_path = '../../../../target/release/'
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,8 @@ Follow these steps to update the information about your mix node which is public
|
|||||||
You can either do this graphically via the Desktop Wallet, or the CLI.
|
You can either do this graphically via the Desktop Wallet, or the CLI.
|
||||||
|
|
||||||
#### Updating node information via the Desktop Wallet
|
#### Updating node information via the Desktop Wallet
|
||||||
|
Node operators can update node information and change node settings such as the amount of self-bond (increase or decrease) via the desktop wallet.
|
||||||
|
|
||||||
* Navigate to the `Bonding` page and click the `Node Settings` link in the top right corner:
|
* Navigate to the `Bonding` page and click the `Node Settings` link in the top right corner:
|
||||||

|

|
||||||
|
|
||||||
@@ -355,20 +357,6 @@ username soft nofile 4096
|
|||||||
|
|
||||||
Then reboot your server and restart your mixnode.
|
Then reboot your server and restart your mixnode.
|
||||||
|
|
||||||
## Node Description
|
|
||||||
Node description is a short text that describes your node. It is displayed in the `nym-mixnode list` command and in the `nym-mixnode node-details` command. it also shows up in the node explorer to let people know what your node is about and link to your website.
|
|
||||||
|
|
||||||
To set your node description, create a file called `description.toml` and put it in the same directory as your `config.toml` file. The file should look like this:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
name = "Winston Smith"
|
|
||||||
description = "I am the Sphinx"
|
|
||||||
link = "https://nymtech.net"
|
|
||||||
location = "Giza, Egypt"
|
|
||||||
```
|
|
||||||
|
|
||||||
you will need to restart your node for the changes to take effect.
|
|
||||||
|
|
||||||
## Node Families
|
## Node Families
|
||||||
|
|
||||||
Node family involves setting up a group of mix nodes that work together to provide greater privacy and security for network communications. This is achieved by having the nodes in the family share information and routes, creating a decentralized network that makes it difficult for third parties to monitor or track communication traffic.
|
Node family involves setting up a group of mix nodes that work together to provide greater privacy and security for network communications. This is achieved by having the nodes in the family share information and routes, creating a decentralized network that makes it difficult for third parties to monitor or track communication traffic.
|
||||||
|
|||||||
@@ -18,14 +18,12 @@ In the future the SDK will be made up of several components, each of which will
|
|||||||
|
|
||||||
| Component | Functionality | Released |
|
| Component | Functionality | Released |
|
||||||
| --------- | ------------------------------------------------------------------------------------- | -------- |
|
| --------- | ------------------------------------------------------------------------------------- | -------- |
|
||||||
| Mixnet | Create / load clients & keypairs, subscribe to Mixnet events, send & receive messages | ✔️ |
|
| Mixnet | Create / load clients & keypairs, subscribe to Mixnet events, send & receive messages | ✔️ |
|
||||||
| Coconut | Create & verify Coconut credentials | 🛠️ |
|
| Coconut | Create & verify Coconut credentials | ❌ |
|
||||||
| Validator | Sign & broadcast Nyx blockchain transactions, query the blockchain | ❌ |
|
| Validator | Sign & broadcast Nyx blockchain transactions, query the blockchain | ❌ |
|
||||||
|
|
||||||
The `mixnet` component currently exposes the logic of two clients: the websocket client, and the socks client.
|
The `mixnet` component currently exposes the logic of two clients: the websocket client, and the socks client.
|
||||||
|
|
||||||
The `coconut` component is currently being worked on. Right now it exposes logic allowing for the creation of coconut credentials on the Sandbox testnet.
|
|
||||||
|
|
||||||
## Websocket client examples
|
## Websocket client examples
|
||||||
> All the codeblocks below can be found in the `nym-sdk` [examples directory](https://github.com/nymtech/nym/tree/release/{{platform_release_version}}/sdk/rust/nym-sdk/examples) in the monorepo.
|
> All the codeblocks below can be found in the `nym-sdk` [examples directory](https://github.com/nymtech/nym/tree/release/{{platform_release_version}}/sdk/rust/nym-sdk/examples) in the monorepo.
|
||||||
|
|
||||||
@@ -85,21 +83,11 @@ If you aren't running a Validator and Nym API, and just want to import a specifi
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Socks client example
|
## Socks client example
|
||||||
|
|
||||||
There is also the option to embed the [`socks5-client`](../clients/socks5-client.md) into your app code (`examples/socks5.rs`):
|
There is also the option to embed the [`socks5-client`](../clients/socks5-client.md) into your app code (`examples/socks5.rs`):
|
||||||
|
|
||||||
```rust,noplayground
|
```rust,noplayground
|
||||||
{{#include ../../../../sdk/rust/nym-sdk/examples/socks5.rs}}
|
{{#include ../../../../sdk/rust/nym-sdk/examples/socks5.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
```admonish info
|
> If you are looking at implementing Nym as a transport layer for a crypto wallet or desktop app, this is probably the best place to start.
|
||||||
If you are looking at implementing Nym as a transport layer for a crypto wallet or desktop app, this is probably the best place to start.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Coconut credential generation
|
|
||||||
The following code shows how you can use the SDK to create and use a [credential](../bandwidth-credentials.md) representing paid bandwidth on the Sandbox testnet.
|
|
||||||
|
|
||||||
```rust,noplayground
|
|
||||||
{{#include ../../../../sdk/rust/nym-sdk/examples/bandwidth.rs}}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can read more about Coconut credentials (also referred to as `zk-Nym`) [here](../cococnut.md).
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "explorer-api"
|
name = "explorer-api"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "nym-gateway"
|
name = "nym-gateway"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
authors = [
|
authors = [
|
||||||
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
||||||
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "nym-mixnode"
|
name = "nym-mixnode"
|
||||||
version = "1.1.17"
|
version = "1.1.16"
|
||||||
authors = [
|
authors = [
|
||||||
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
||||||
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "nym-api"
|
name = "nym-api"
|
||||||
version = "1.1.17"
|
version = "1.1.16"
|
||||||
authors = [
|
authors = [
|
||||||
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
|
||||||
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
"Jędrzej Stuczyński <andrew@nymtech.net>",
|
||||||
|
|||||||
Generated
+3
-3
@@ -3494,7 +3494,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-mixnet-contract-common"
|
name = "nym-mixnet-contract-common"
|
||||||
version = "0.5.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -3841,7 +3841,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract"
|
name = "nym-vesting-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-derive",
|
"cosmwasm-derive",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -3859,7 +3859,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract-common"
|
name = "nym-vesting-contract-common"
|
||||||
version = "0.6.0"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"nym-contracts-common",
|
"nym-contracts-common",
|
||||||
|
|||||||
Generated
+3
-3
@@ -2916,7 +2916,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-mixnet-contract-common"
|
name = "nym-mixnet-contract-common"
|
||||||
version = "0.5.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -3040,7 +3040,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract"
|
name = "nym-vesting-contract"
|
||||||
version = "1.4.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-derive",
|
"cosmwasm-derive",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
@@ -3058,7 +3058,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-vesting-contract-common"
|
name = "nym-vesting-contract-common"
|
||||||
version = "0.6.0"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
"nym-contracts-common",
|
"nym-contracts-common",
|
||||||
|
|||||||
@@ -506,7 +506,6 @@ where
|
|||||||
.socks5_config
|
.socks5_config
|
||||||
.clone()
|
.clone()
|
||||||
.ok_or(Error::Socks5Config { set: false })?;
|
.ok_or(Error::Socks5Config { set: false })?;
|
||||||
let debug_config = self.config.debug_config;
|
|
||||||
let (mut started_client, nym_address) = self.connect_to_mixnet_common().await?;
|
let (mut started_client, nym_address) = self.connect_to_mixnet_common().await?;
|
||||||
let (socks5_status_tx, mut socks5_status_rx) = mpsc::channel(128);
|
let (socks5_status_tx, mut socks5_status_rx) = mpsc::channel(128);
|
||||||
|
|
||||||
@@ -516,7 +515,6 @@ where
|
|||||||
|
|
||||||
nym_socks5_client_core::NymClient::start_socks5_listener(
|
nym_socks5_client_core::NymClient::start_socks5_listener(
|
||||||
&socks5_config,
|
&socks5_config,
|
||||||
debug_config,
|
|
||||||
client_input,
|
client_input,
|
||||||
client_output,
|
client_output,
|
||||||
client_state.clone(),
|
client_state.clone(),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "nym-network-requester"
|
name = "nym-network-requester"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version = "1.65"
|
rust-version = "1.65"
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ use nym_socks5_requests::{
|
|||||||
};
|
};
|
||||||
use nym_sphinx::addressing::clients::Recipient;
|
use nym_sphinx::addressing::clients::Recipient;
|
||||||
use nym_sphinx::anonymous_replies::requests::AnonymousSenderTag;
|
use nym_sphinx::anonymous_replies::requests::AnonymousSenderTag;
|
||||||
use nym_sphinx::params::PacketSize;
|
|
||||||
use nym_statistics_common::collector::StatisticsSender;
|
use nym_statistics_common::collector::StatisticsSender;
|
||||||
use nym_task::connections::LaneQueueLengths;
|
use nym_task::connections::LaneQueueLengths;
|
||||||
use nym_task::{TaskClient, TaskManager};
|
use nym_task::{TaskClient, TaskManager};
|
||||||
@@ -58,8 +57,6 @@ pub struct NRServiceProviderBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct NRServiceProvider {
|
struct NRServiceProvider {
|
||||||
config: Config,
|
|
||||||
|
|
||||||
outbound_request_filter: OutboundRequestFilter,
|
outbound_request_filter: OutboundRequestFilter,
|
||||||
open_proxy: bool,
|
open_proxy: bool,
|
||||||
mixnet_client: nym_sdk::mixnet::MixnetClient,
|
mixnet_client: nym_sdk::mixnet::MixnetClient,
|
||||||
@@ -245,7 +242,6 @@ impl NRServiceProviderBuilder {
|
|||||||
start_allowed_list_reloader(self.allowed_hosts, shutdown.subscribe()).await;
|
start_allowed_list_reloader(self.allowed_hosts, shutdown.subscribe()).await;
|
||||||
|
|
||||||
let service_provider = NRServiceProvider {
|
let service_provider = NRServiceProvider {
|
||||||
config: self.config,
|
|
||||||
outbound_request_filter: self.outbound_request_filter,
|
outbound_request_filter: self.outbound_request_filter,
|
||||||
open_proxy: self.open_proxy,
|
open_proxy: self.open_proxy,
|
||||||
mixnet_client,
|
mixnet_client,
|
||||||
@@ -333,7 +329,6 @@ impl NRServiceProvider {
|
|||||||
connection_id: ConnectionId,
|
connection_id: ConnectionId,
|
||||||
remote_addr: String,
|
remote_addr: String,
|
||||||
return_address: reply::MixnetAddress,
|
return_address: reply::MixnetAddress,
|
||||||
biggest_packet_size: PacketSize,
|
|
||||||
controller_sender: ControllerSender,
|
controller_sender: ControllerSender,
|
||||||
mix_input_sender: MixProxySender<MixnetMessage>,
|
mix_input_sender: MixProxySender<MixnetMessage>,
|
||||||
lane_queue_lengths: LaneQueueLengths,
|
lane_queue_lengths: LaneQueueLengths,
|
||||||
@@ -390,7 +385,6 @@ impl NRServiceProvider {
|
|||||||
// run the proxy on the connection
|
// run the proxy on the connection
|
||||||
conn.run_proxy(
|
conn.run_proxy(
|
||||||
remote_version,
|
remote_version,
|
||||||
biggest_packet_size,
|
|
||||||
mix_receiver,
|
mix_receiver,
|
||||||
mix_input_sender,
|
mix_input_sender,
|
||||||
lane_queue_lengths,
|
lane_queue_lengths,
|
||||||
@@ -443,11 +437,6 @@ impl NRServiceProvider {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let traffic_config = self.config.get_base().get_debug_config().traffic;
|
|
||||||
let packet_size = traffic_config
|
|
||||||
.secondary_packet_size
|
|
||||||
.unwrap_or(traffic_config.primary_packet_size);
|
|
||||||
|
|
||||||
let controller_sender_clone = self.controller_sender.clone();
|
let controller_sender_clone = self.controller_sender.clone();
|
||||||
let mix_input_sender_clone = self.mix_input_sender.clone();
|
let mix_input_sender_clone = self.mix_input_sender.clone();
|
||||||
let lane_queue_lengths_clone = self.mixnet_client.shared_lane_queue_lengths();
|
let lane_queue_lengths_clone = self.mixnet_client.shared_lane_queue_lengths();
|
||||||
@@ -460,7 +449,6 @@ impl NRServiceProvider {
|
|||||||
conn_id,
|
conn_id,
|
||||||
remote_addr,
|
remote_addr,
|
||||||
return_address,
|
return_address,
|
||||||
packet_size,
|
|
||||||
controller_sender_clone,
|
controller_sender_clone,
|
||||||
mix_input_sender_clone,
|
mix_input_sender_clone,
|
||||||
lane_queue_lengths_clone,
|
lane_queue_lengths_clone,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use nym_service_providers_common::interface::RequestVersion;
|
|||||||
use nym_socks5_proxy_helpers::connection_controller::ConnectionReceiver;
|
use nym_socks5_proxy_helpers::connection_controller::ConnectionReceiver;
|
||||||
use nym_socks5_proxy_helpers::proxy_runner::{MixProxySender, ProxyRunner};
|
use nym_socks5_proxy_helpers::proxy_runner::{MixProxySender, ProxyRunner};
|
||||||
use nym_socks5_requests::{ConnectionId, RemoteAddress, Socks5Request};
|
use nym_socks5_requests::{ConnectionId, RemoteAddress, Socks5Request};
|
||||||
use nym_sphinx::params::PacketSize;
|
|
||||||
use nym_task::connections::LaneQueueLengths;
|
use nym_task::connections::LaneQueueLengths;
|
||||||
use nym_task::TaskClient;
|
use nym_task::TaskClient;
|
||||||
use std::io;
|
use std::io;
|
||||||
@@ -43,7 +42,6 @@ impl Connection {
|
|||||||
pub(crate) async fn run_proxy(
|
pub(crate) async fn run_proxy(
|
||||||
&mut self,
|
&mut self,
|
||||||
remote_version: RequestVersion<Socks5Request>,
|
remote_version: RequestVersion<Socks5Request>,
|
||||||
biggest_packet_size: PacketSize,
|
|
||||||
mix_receiver: ConnectionReceiver,
|
mix_receiver: ConnectionReceiver,
|
||||||
mix_sender: MixProxySender<MixnetMessage>,
|
mix_sender: MixProxySender<MixnetMessage>,
|
||||||
lane_queue_lengths: LaneQueueLengths,
|
lane_queue_lengths: LaneQueueLengths,
|
||||||
@@ -59,9 +57,6 @@ impl Connection {
|
|||||||
remote_source_address,
|
remote_source_address,
|
||||||
mix_receiver,
|
mix_receiver,
|
||||||
mix_sender,
|
mix_sender,
|
||||||
// FIXME: this does NOT include overhead due to acks or chunking
|
|
||||||
// (so actual true plaintext is smaller)
|
|
||||||
biggest_packet_size.plaintext_size(),
|
|
||||||
connection_id,
|
connection_id,
|
||||||
Some(lane_queue_lengths),
|
Some(lane_queue_lengths),
|
||||||
shutdown,
|
shutdown,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-network-statistics"
|
name = "nym-network-statistics"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-cli"
|
name = "nym-cli"
|
||||||
version = "1.1.16"
|
version = "1.1.15"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user