Merge pull request #3811 from nymtech/jon/clippy

Fix clippy for latest rustc
This commit is contained in:
Jon Häggblad
2023-08-25 11:44:57 +02:00
committed by GitHub
45 changed files with 116 additions and 126 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: 1.71.0
override: true
components: rustfmt, clippy
Generated
+5 -5
View File
@@ -10563,9 +10563,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "ts-rs"
version = "6.2.1"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4added4070a4fdf9df03457206cd2e4b12417c8560a2954d91ffcbe60177a56a"
checksum = "e1ff1f8c90369bc172200013ac17ae86e7b5def580687df4e6127883454ff2b0"
dependencies = [
"thiserror",
"ts-rs-macros",
@@ -10588,14 +10588,14 @@ dependencies = [
[[package]]
name = "ts-rs-macros"
version = "6.2.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f807fdb3151fee75df7485b901a89624358cd07a67a8fb1a5831bf5a07681ff"
checksum = "a6f41cc0aeb7a4a55730188e147d3795a7349b501f8334697fd37629b896cdc2"
dependencies = [
"Inflector",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.28",
"termcolor",
]
+1
View File
@@ -150,6 +150,7 @@ tap = "1.0.1"
tendermint-rpc = "0.32" # same version as used by cosmrs
thiserror = "1.0.38"
tokio = "1.24.1"
ts-rs = "7.0.0"
url = "2.4"
zeroize = "1.6.0"
-3
View File
@@ -77,9 +77,6 @@ $(eval $(call add_cargo_workspace,contracts,contracts,--lib --target wasm32-unkn
$(eval $(call add_cargo_workspace,wasm-client,clients/webassembly,--target wasm32-unknown-unknown))
$(eval $(call add_cargo_workspace,wallet,nym-wallet,))
$(eval $(call add_cargo_workspace,connect,nym-connect/desktop))
ifdef NYM_MOBILE
$(eval $(call add_cargo_workspace,connect-mobile,nym-connect/mobile/src-tauri))
endif
# -----------------------------------------------------------------------------
# Convenience targets for crates that are already part of the main workspace
@@ -105,10 +105,10 @@ impl ClientRequest {
let conn_id_bytes = connection_id.unwrap_or(0).to_be_bytes();
std::iter::once(ClientRequestTag::Send as u8)
.chain(recipient.to_bytes().into_iter()) // will not be length prefixed because the length is constant
.chain(conn_id_bytes.into_iter())
.chain(data_len_bytes.into_iter())
.chain(data.into_iter())
.chain(recipient.to_bytes()) // will not be length prefixed because the length is constant
.chain(conn_id_bytes)
.chain(data_len_bytes)
.chain(data)
.collect()
}
@@ -180,11 +180,11 @@ impl ClientRequest {
let conn_id_bytes = connection_id.unwrap_or(0).to_be_bytes();
std::iter::once(ClientRequestTag::SendAnonymous as u8)
.chain(reply_surbs.to_be_bytes().into_iter())
.chain(recipient.to_bytes().into_iter()) // will not be length prefixed because the length is constant
.chain(conn_id_bytes.into_iter())
.chain(data_len_bytes.into_iter())
.chain(data.into_iter())
.chain(reply_surbs.to_be_bytes())
.chain(recipient.to_bytes()) // will not be length prefixed because the length is constant
.chain(conn_id_bytes)
.chain(data_len_bytes)
.chain(data)
.collect()
}
@@ -258,10 +258,10 @@ impl ClientRequest {
let conn_id_bytes = connection_id.unwrap_or(0).to_be_bytes();
std::iter::once(ClientRequestTag::Reply as u8)
.chain(sender_tag.to_bytes().into_iter())
.chain(conn_id_bytes.into_iter())
.chain(message_len_bytes.into_iter())
.chain(message.into_iter())
.chain(sender_tag.to_bytes())
.chain(conn_id_bytes)
.chain(message_len_bytes)
.chain(message)
.collect()
}
@@ -332,7 +332,7 @@ impl ClientRequest {
fn serialize_closed_connection(connection_id: u64) -> Vec<u8> {
let conn_id_bytes = connection_id.to_be_bytes();
std::iter::once(ClientRequestTag::ClosedConnection as u8)
.chain(conn_id_bytes.into_iter())
.chain(conn_id_bytes)
.collect()
}
@@ -359,7 +359,7 @@ impl ClientRequest {
fn serialize_get_lane_queue_lengths(connection_id: u64) -> Vec<u8> {
let conn_id_bytes = connection_id.to_be_bytes();
std::iter::once(ClientRequestTag::GetLaneQueueLength as u8)
.chain(conn_id_bytes.into_iter())
.chain(conn_id_bytes)
.collect()
}
@@ -67,15 +67,15 @@ impl ServerResponse {
if let Some(sender_tag) = reconstructed_message.sender_tag {
std::iter::once(ServerResponseTag::Received as u8)
.chain(std::iter::once(true as u8))
.chain(sender_tag.to_bytes().into_iter())
.chain(sender_tag.to_bytes())
.chain(message_len_bytes.iter().cloned())
.chain(reconstructed_message.message.into_iter())
.chain(reconstructed_message.message)
.collect()
} else {
std::iter::once(ServerResponseTag::Received as u8)
.chain(std::iter::once(false as u8))
.chain(message_len_bytes.iter().cloned())
.chain(reconstructed_message.message.into_iter())
.chain(reconstructed_message.message)
.collect()
}
}
@@ -149,7 +149,7 @@ impl ServerResponse {
// SELF_ADDRESS_RESPONSE_TAG || self_address
fn serialize_self_address(address: Recipient) -> Vec<u8> {
std::iter::once(ServerResponseTag::SelfAddress as u8)
.chain(address.to_bytes().into_iter())
.chain(address.to_bytes())
.collect()
}
@@ -211,8 +211,8 @@ impl ServerResponse {
let message_len_bytes = (error.message.len() as u64).to_be_bytes();
std::iter::once(ServerResponseTag::Error as u8)
.chain(std::iter::once(error.kind as u8))
.chain(message_len_bytes.into_iter())
.chain(error.message.into_bytes().into_iter())
.chain(message_len_bytes)
.chain(error.message.into_bytes())
.collect()
}
+2 -2
View File
@@ -114,7 +114,7 @@ impl WasmTopologyExt for Arc<ClientState> {
let this = Arc::clone(self);
future_to_promise(async move {
let Some(current_topology) = this.topology_accessor.current_topology().await else {
return Err(WasmClientError::UnavailableNetworkTopology.into())
return Err(WasmClientError::UnavailableNetworkTopology.into());
};
match current_topology.find_mix_by_identity(&mixnode_identity) {
@@ -135,7 +135,7 @@ impl WasmTopologyExt for Arc<ClientState> {
let this = Arc::clone(self);
future_to_promise(async move {
let Some(current_topology) = this.topology_accessor.current_topology().await else {
return Err(WasmClientError::UnavailableNetworkTopology.into())
return Err(WasmClientError::UnavailableNetworkTopology.into());
};
let Some(mix) = current_topology.find_mix_by_identity(&mixnode_identity) else {
@@ -52,7 +52,7 @@ pub fn encode_payload_with_headers(
Ok(metadata) => {
let metadata = metadata.as_bytes().to_vec();
let size = (metadata.len() as u64).to_be_bytes().to_vec();
Ok(vec![size, metadata, payload].concat())
Ok([size, metadata, payload].concat())
}
Err(e) => Err(JsValue::from(JsError::new(
format!("Could not encode message: {}", e).as_str(),
+4 -3
View File
@@ -1,6 +1,8 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use std::rc::Rc;
use crate::client::config::Config;
use crate::storage::error::ClientStorageError;
use js_sys::Promise;
@@ -8,7 +10,6 @@ use nym_client_core::client::base_client::storage::gateway_details::PersistedGat
use nym_crypto::asymmetric::{encryption, identity};
use nym_gateway_client::SharedKeys;
use nym_sphinx::acknowledgements::AckKey;
use std::sync::Arc;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::future_to_promise;
use wasm_utils::storage::{IdbVersionChangeEvent, WasmStorage};
@@ -43,7 +44,7 @@ mod v1 {
pub struct ClientStorage {
#[allow(dead_code)]
pub(crate) name: String,
pub(crate) inner: Arc<WasmStorage>,
pub(crate) inner: Rc<WasmStorage>,
}
#[wasm_bindgen]
@@ -88,7 +89,7 @@ impl ClientStorage {
.await?;
Ok(ClientStorage {
inner: Arc::new(inner),
inner: Rc::new(inner),
name,
})
}
@@ -58,7 +58,7 @@ impl<'a> EphemeralTestReceiver<'a> {
let Some(received_packet) = packet else {
// can't do anything more...
console_error!("packet receiver has stopped processing results!");
return true
return true;
};
match received_packet {
Received::Message(msg) => {
+4 -3
View File
@@ -29,6 +29,7 @@ use nym_validator_client::client::IdentityKey;
use nym_validator_client::QueryReqwestRpcNyxdClient;
use rand::rngs::OsRng;
use std::collections::HashSet;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::sync::{Arc, Mutex as SyncMutex};
use std::time::Duration;
@@ -42,7 +43,7 @@ pub(crate) mod helpers;
pub type NodeTestMessage = TestMessage<WasmTestMessageExt>;
type LockedGatewayClient =
Arc<AsyncMutex<GatewayClient<QueryReqwestRpcNyxdClient, EphemeralStorage>>>;
Rc<AsyncMutex<GatewayClient<QueryReqwestRpcNyxdClient, EphemeralStorage>>>;
pub(crate) const DEFAULT_TEST_TIMEOUT: Duration = Duration::from_secs(10);
pub(crate) const DEFAULT_TEST_PACKETS: u32 = 20;
@@ -210,7 +211,7 @@ impl NymNodeTesterBuilder {
test_in_progress: Arc::new(AtomicBool::new(false)),
current_test_nonce: Default::default(),
tester: Arc::new(SyncMutex::new(tester)),
gateway_client: Arc::new(AsyncMutex::new(gateway_client)),
gateway_client: Rc::new(AsyncMutex::new(gateway_client)),
processed_receiver: ReceivedReceiverWrapper::new(processed_receiver),
_task_manager: task_manager,
})
@@ -343,7 +344,7 @@ impl NymNodeTester {
));
let processed_receiver_clone = self.processed_receiver.clone();
let gateway_client_clone = Arc::clone(&self.gateway_client);
let gateway_client_clone = Rc::clone(&self.gateway_client);
let tester_marker = TestMarker::new(Arc::clone(&self.test_in_progress));
// start doing async things (send packets and watch for anything coming back)
@@ -65,7 +65,7 @@ features = ["tokio"]
[dev-dependencies]
bip39 = { workspace = true }
cosmrs = { workspace = true, features = ["bip32"] }
ts-rs = "6.1.2"
ts-rs = { workspace = true }
[[example]]
name = "offline_signing"
@@ -199,16 +199,14 @@ mod tests {
#[test]
fn generating_account_addresses() {
// test vectors produced from our js wallet
let mnemonics = vec![
"crush minute paddle tobacco message debate cabin peace bar jacket execute twenty winner view sure mask popular couch penalty fragile demise fresh pizza stove",
let mnemonics = ["crush minute paddle tobacco message debate cabin peace bar jacket execute twenty winner view sure mask popular couch penalty fragile demise fresh pizza stove",
"acquire rebel spot skin gun such erupt pull swear must define ill chief turtle today flower chunk truth battle claw rigid detail gym feel",
"step income throw wheat mobile ship wave drink pool sudden upset jaguar bar globe rifle spice frost bless glimpse size regular carry aspect ball"
];
"step income throw wheat mobile ship wave drink pool sudden upset jaguar bar globe rifle spice frost bless glimpse size regular carry aspect ball"];
let prefix = NymNetworkDetails::new_mainnet()
.chain_details
.bech32_account_prefix;
let addrs = vec![
let addrs = [
"n1jw6mp7d5xqc7w6xm79lha27glmd0vdt3l9artf",
"n1h5hgn94nsq4kh99rjj794hr5h5q6yfm2lr52es",
"n17n9flp6jflljg6fp05dsy07wcprf2uuu8g40rf",
+11 -2
View File
@@ -8,7 +8,14 @@ use serde::{Deserialize, Serialize};
use error::CoconutInterfaceError;
pub use nym_coconut::*;
// We list these explicity instead of glob export due to shadowing warnings with the pub tests
// module.
pub use nym_coconut::{
aggregate_signature_shares, aggregate_verification_keys, blind_sign, hash_to_scalar,
prepare_blind_sign, prove_bandwidth_credential, Attribute, Base58, BlindSignRequest,
BlindedSignature, Bytable, CoconutError, KeyPair, Parameters, PrivateAttribute,
PublicAttribute, Signature, SignatureShare, Theta, VerificationKey,
};
#[derive(Debug, Serialize, Deserialize, Getters, CopyGetters, Clone, PartialEq, Eq)]
pub struct Credential {
@@ -57,7 +64,7 @@ impl Credential {
pub fn verify(&self, verification_key: &VerificationKey) -> bool {
let params = Parameters::new(self.n_params).unwrap();
let public_attributes = vec![
let public_attributes = [
self.voucher_value.to_string().as_bytes(),
self.voucher_info.as_bytes(),
]
@@ -138,6 +145,8 @@ impl Base58 for Credential {}
#[cfg(test)]
mod tests {
use nym_coconut::{prove_bandwidth_credential, Signature};
use super::*;
#[test]
@@ -26,7 +26,7 @@ humantime-serde = "1.1.1"
# TO CHECK WHETHER STILL NEEDED:
log = { workspace = true }
time = { version = "0.3.6", features = ["parsing", "formatting"] }
ts-rs = { version = "6.1.2", optional = true }
ts-rs = { workspace = true, optional = true }
[dev-dependencies]
rand_chacha = "0.3"
@@ -15,7 +15,7 @@ mixnet-contract-common = { path = "../mixnet-contract", package = "nym-mixnet-co
contracts-common = { path = "../contracts-common", package = "nym-contracts-common", version = "0.5.0" }
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
ts-rs = {version = "6.1.2", optional = true}
ts-rs = { workspace = true, optional = true}
[features]
schema = ["cw2"]
+2 -2
View File
@@ -354,7 +354,7 @@ impl ProofKappaZeta {
let witness_blinder = params.random_scalar();
let witness_serial_number = params.random_scalar();
let witness_binding_number = params.random_scalar();
let witness_attributes = vec![witness_serial_number, witness_binding_number];
let witness_attributes = [witness_serial_number, witness_binding_number];
let beta_bytes = verification_key
.beta_g2
@@ -417,7 +417,7 @@ impl ProofKappaZeta {
.map(|beta_i| beta_i.to_bytes())
.collect::<Vec<_>>();
let response_attributes = vec![self.response_serial_number, self.response_binding_number];
let response_attributes = [self.response_serial_number, self.response_binding_number];
// re-compute witnesses commitments
// Aw = (c * kappa) + (rt * g2) + ((1 - c) * alpha) + (rm[0] * beta[0]) + ... + (rm[i] * beta[i])
let commitment_kappa = kappa * self.challenge
@@ -17,7 +17,7 @@ pub fn prepare_identifier<R: RngCore + CryptoRng>(
let id_ciphertext = encrypt::<AckEncryptionAlgorithm>(key.inner(), &iv, &serialized_id);
// IV || ID_CIPHERTEXT
iv.into_iter().chain(id_ciphertext.into_iter()).collect()
iv.into_iter().chain(id_ciphertext).collect()
}
pub fn recover_identifier(
@@ -122,7 +122,7 @@ impl SurbAck {
.first_hop_address
.as_zero_padded_bytes(MAX_NODE_ADDRESS_UNPADDED_LEN)
.into_iter()
.chain(self.surb_ack_packet.to_bytes()?.into_iter())
.chain(self.surb_ack_packet.to_bytes()?)
.collect();
Ok((self.expected_total_delay, surb_bytes))
}
@@ -130,7 +130,7 @@ impl ReplySurb {
self.encryption_key
.to_bytes()
.into_iter()
.chain(self.surb.to_bytes().into_iter())
.chain(self.surb.to_bytes())
.collect()
}
@@ -275,7 +275,7 @@ impl RepliableMessageContent {
.to_be_bytes()
.into_iter()
.chain(reply_surbs.into_iter().flat_map(|s| s.to_bytes()))
.chain(message.into_iter())
.chain(message)
.collect()
}
RepliableMessageContent::AdditionalSurbs { reply_surbs } => {
@@ -465,7 +465,7 @@ impl ReplyMessageContent {
ReplyMessageContent::SurbRequest { recipient, amount } => recipient
.to_bytes()
.into_iter()
.chain(amount.to_be_bytes().into_iter())
.chain(amount.to_be_bytes())
.collect(),
}
}
+1 -1
View File
@@ -204,7 +204,7 @@ impl Fragment {
self.header
.to_bytes()
.into_iter()
.chain(self.payload.into_iter())
.chain(self.payload)
.collect()
}
+1 -1
View File
@@ -115,7 +115,7 @@ where
let packet_payload: Vec<_> = ack_bytes
.into_iter()
.chain(ephemeral_keypair.public_key().to_bytes().iter().cloned())
.chain(cover_content.into_iter())
.chain(cover_content)
.collect();
let route =
+2 -2
View File
@@ -106,8 +106,8 @@ impl MixPacket {
pub fn into_bytes(self) -> Result<Vec<u8>, MixPacketFormattingError> {
Ok(std::iter::once(self.packet_type as u8)
.chain(self.next_hop.as_bytes().into_iter())
.chain(self.packet.to_bytes()?.into_iter())
.chain(self.next_hop.as_bytes())
.chain(self.packet.to_bytes()?)
.collect())
}
}
+3 -6
View File
@@ -50,8 +50,8 @@ impl NymPayloadBuilder {
Ok(NymPayload(
surb_ack_bytes
.into_iter()
.chain(variant_data.into_iter())
.chain(fragment_data.into_iter())
.chain(variant_data)
.chain(fragment_data)
.collect(),
))
}
@@ -61,10 +61,7 @@ impl NymPayloadBuilder {
packet_encryption_key: &SurbEncryptionKey,
) -> Result<NymPayload, SurbAckRecoveryError> {
let key_digest = packet_encryption_key.compute_digest();
self.build::<ReplySurbEncryptionAlgorithm>(
packet_encryption_key.inner(),
key_digest.into_iter(),
)
self.build::<ReplySurbEncryptionAlgorithm>(packet_encryption_key.inner(), key_digest)
}
pub fn build_regular<R>(
+5 -9
View File
@@ -73,7 +73,7 @@ impl SocketDataHeader {
.to_be_bytes()
.into_iter()
.chain(std::iter::once(self.local_socket_closed as u8))
.chain(self.seq.to_be_bytes().into_iter())
.chain(self.seq.to_be_bytes())
}
pub fn try_from_response_bytes(
@@ -107,8 +107,8 @@ impl SocketDataHeader {
pub fn into_response_bytes_iter(self) -> impl Iterator<Item = u8> {
std::iter::once(self.local_socket_closed as u8)
.chain(self.connection_id.to_be_bytes().into_iter())
.chain(self.seq.to_be_bytes().into_iter())
.chain(self.connection_id.to_be_bytes())
.chain(self.seq.to_be_bytes())
}
}
@@ -170,9 +170,7 @@ impl SocketData {
}
pub fn into_request_bytes_iter(self) -> impl Iterator<Item = u8> {
self.header
.into_request_bytes_iter()
.chain(self.data.into_iter())
self.header.into_request_bytes_iter().chain(self.data)
}
pub fn try_from_response_bytes(b: &[u8]) -> Result<SocketData, InsufficientSocketDataError> {
@@ -190,9 +188,7 @@ impl SocketData {
}
pub fn into_response_bytes_iter(self) -> impl Iterator<Item = u8> {
self.header
.into_response_bytes_iter()
.chain(self.data.into_iter())
self.header.into_response_bytes_iter().chain(self.data)
}
}
+9 -15
View File
@@ -113,7 +113,7 @@ impl Serializable for Socks5Request {
fn into_bytes(self) -> Vec<u8> {
if let Some(version) = self.protocol_version.as_u8() {
std::iter::once(version)
.chain(self.content.into_bytes().into_iter())
.chain(self.content.into_bytes())
.collect()
} else {
std::iter::once(Self::LEGACY_TYPE_TAG)
@@ -335,12 +335,12 @@ impl Socks5RequestContent {
let remote_address_bytes_len = remote_address_bytes.len() as u16;
let iter = std::iter::once(RequestFlag::Connect as u8)
.chain(req.conn_id.to_be_bytes().into_iter())
.chain(remote_address_bytes_len.to_be_bytes().into_iter())
.chain(remote_address_bytes.into_iter());
.chain(req.conn_id.to_be_bytes())
.chain(remote_address_bytes_len.to_be_bytes())
.chain(remote_address_bytes);
if let Some(return_address) = req.return_address {
iter.chain(return_address.to_bytes().into_iter()).collect()
iter.chain(return_address.to_bytes()).collect()
} else {
iter.collect()
}
@@ -358,7 +358,7 @@ impl Socks5RequestContent {
})
.unwrap_or_default();
std::iter::once(RequestFlag::Query as u8)
.chain(query_bytes.into_iter())
.chain(query_bytes)
.collect()
}
}
@@ -495,7 +495,7 @@ mod request_deserialization_tests {
let request_bytes: Vec<_> = request_bytes_prefix
.iter()
.cloned()
.chain(recipient_bytes.into_iter())
.chain(recipient_bytes)
.collect();
assert!(Socks5RequestContent::try_from_bytes(&request_bytes)
.unwrap_err()
@@ -530,10 +530,7 @@ mod request_deserialization_tests {
let recipient = Recipient::try_from_base58_string("CytBseW6yFXUMzz4SGAKdNLGR7q3sJLLYxyBGvutNEQV.4QXYyEVc5fUDjmmi8PrHN9tdUFV4PCvSJE1278cHyvoe@4sBbL1ngf1vtNqykydQKTFh26sQCw888GpUqvPvyNB4f").unwrap();
let recipient_bytes = recipient.to_bytes();
let request_bytes: Vec<_> = request_bytes
.into_iter()
.chain(recipient_bytes.into_iter())
.collect();
let request_bytes: Vec<_> = request_bytes.into_iter().chain(recipient_bytes).collect();
let request = Socks5RequestContent::try_from_bytes(&request_bytes).unwrap();
match request {
@@ -577,10 +574,7 @@ mod request_deserialization_tests {
let recipient = Recipient::try_from_base58_string("CytBseW6yFXUMzz4SGAKdNLGR7q3sJLLYxyBGvutNEQV.4QXYyEVc5fUDjmmi8PrHN9tdUFV4PCvSJE1278cHyvoe@4sBbL1ngf1vtNqykydQKTFh26sQCw888GpUqvPvyNB4f").unwrap();
let recipient_bytes = recipient.to_bytes();
let request_bytes: Vec<_> = request_bytes
.into_iter()
.chain(recipient_bytes.into_iter())
.collect();
let request_bytes: Vec<_> = request_bytes.into_iter().chain(recipient_bytes).collect();
let request = Socks5RequestContent::try_from_bytes(&request_bytes).unwrap();
match request {
+5 -5
View File
@@ -84,7 +84,7 @@ impl Serializable for Socks5Response {
fn into_bytes(self) -> Vec<u8> {
if let Some(version) = self.protocol_version.as_u8() {
std::iter::once(version)
.chain(self.content.into_bytes().into_iter())
.chain(self.content.into_bytes())
.collect()
} else {
self.content.into_bytes()
@@ -192,7 +192,7 @@ impl Socks5ResponseContent {
}
Socks5ResponseContent::ConnectionError(res) => {
std::iter::once(ResponseFlag::ConnectionError as u8)
.chain(res.into_bytes().into_iter())
.chain(res.into_bytes())
.collect()
}
Socks5ResponseContent::Query(query) => {
@@ -204,7 +204,7 @@ impl Socks5ResponseContent {
})
.unwrap_or_default();
std::iter::once(ResponseFlag::Query as u8)
.chain(query_bytes.into_iter())
.chain(query_bytes)
.collect()
}
}
@@ -290,7 +290,7 @@ impl ConnectionError {
.to_be_bytes()
.iter()
.copied()
.chain(self.network_requester_error.into_bytes().into_iter())
.chain(self.network_requester_error.into_bytes())
.collect()
}
}
@@ -339,7 +339,7 @@ mod tests {
let bytes: Vec<u8> = 42u64
.to_be_bytes()
.into_iter()
.chain([0, 159, 146, 150].into_iter())
.chain([0, 159, 146, 150])
.collect();
let err = ConnectionError::try_from_bytes(&bytes).err().unwrap();
assert!(matches!(
+1 -1
View File
@@ -131,7 +131,7 @@ impl NymTopology {
}
pub fn mixes_in_layer(&self, layer: MixLayer) -> Vec<mix::Node> {
assert!(vec![1, 2, 3].contains(&layer));
assert!([1, 2, 3].contains(&layer));
self.mixes.get(&layer).unwrap().to_owned()
}
+1 -1
View File
@@ -17,7 +17,7 @@ serde_json = { workspace = true }
strum = { version = "0.23", features = ["derive"] }
thiserror = { workspace = true }
url = { workspace = true }
ts-rs = "6.1.2"
ts-rs = { workspace = true }
cosmwasm-std = { workspace = true }
cosmrs = { workspace = true }
-1
View File
@@ -5,7 +5,6 @@ use crate::console_log;
use crate::storage::cipher_export::StoredExportedStoreCipher;
use crate::storage::error::StorageError;
use futures::TryFutureExt;
use indexed_db_futures::IdbDatabase;
use nym_store_cipher::{
Aes256Gcm, Algorithm, EncryptedData, KdfInfo, KeySizeUser, Params, StoreCipher, Unsigned,
Version,
@@ -9,4 +9,4 @@ nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mix
nym-api-requests = { path = "../../nym-api/nym-api-requests" }
schemars = { version = "0.8", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
ts-rs = { version = "6.1.2", optional = true }
ts-rs = { workspace = true, optional = true }
@@ -94,7 +94,7 @@ impl<'a> GatewayHandshake<'a> {
.to_bytes()
.iter()
.cloned()
.chain(material.into_iter())
.chain(material)
.collect()
}
@@ -85,10 +85,7 @@ impl SharedKeys {
let mac =
compute_keyed_hmac::<GatewayIntegrityHmacAlgorithm>(self.mac_key(), &encrypted_data);
mac.into_bytes()
.into_iter()
.chain(encrypted_data.into_iter())
.collect()
mac.into_bytes().into_iter().chain(encrypted_data).collect()
}
pub fn decrypt_tagged(
+1 -1
View File
@@ -47,7 +47,7 @@ tokio = { version = "1.24.1", features = [
tokio-stream = "0.1.11"
url = { workspace = true }
ts-rs = {version = "6.1", optional = true}
ts-rs = { workspace = true, optional = true}
anyhow = "1.0"
getset = "0.1.1"
+1 -1
View File
@@ -12,7 +12,7 @@ cosmwasm-std = { workspace = true, default-features = false }
getset = "0.1.1"
schemars = { version = "0.8", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
ts-rs = { version = "6.1.2", optional = true }
ts-rs = { workspace = true, optional = true }
nym-coconut-interface = { path = "../../common/coconut-interface" }
nym-mixnet-contract-common = { path= "../../common/cosmwasm-smart-contracts/mixnet-contract" }
+5 -5
View File
@@ -7557,9 +7557,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "ts-rs"
version = "6.2.1"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4added4070a4fdf9df03457206cd2e4b12417c8560a2954d91ffcbe60177a56a"
checksum = "e1ff1f8c90369bc172200013ac17ae86e7b5def580687df4e6127883454ff2b0"
dependencies = [
"thiserror",
"ts-rs-macros",
@@ -7567,14 +7567,14 @@ dependencies = [
[[package]]
name = "ts-rs-macros"
version = "6.2.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f807fdb3151fee75df7485b901a89624358cd07a67a8fb1a5831bf5a07681ff"
checksum = "a6f41cc0aeb7a4a55730188e147d3795a7349b501f8334697fd37629b896cdc2"
dependencies = [
"Inflector",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.28",
"termcolor",
]
+1 -1
View File
@@ -61,7 +61,7 @@ nym-task = { path = "../../../common/task" }
nym-validator-client = { path = "../../../common/client-libs/validator-client" }
[dev-dependencies]
ts-rs = "6.1.2"
ts-rs = "7.0.0"
tempfile = "3.3.0"
[features]
+5 -5
View File
@@ -5864,9 +5864,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "ts-rs"
version = "6.2.1"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4added4070a4fdf9df03457206cd2e4b12417c8560a2954d91ffcbe60177a56a"
checksum = "e1ff1f8c90369bc172200013ac17ae86e7b5def580687df4e6127883454ff2b0"
dependencies = [
"thiserror",
"ts-rs-macros",
@@ -5874,14 +5874,14 @@ dependencies = [
[[package]]
name = "ts-rs-macros"
version = "6.2.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f807fdb3151fee75df7485b901a89624358cd07a67a8fb1a5831bf5a07681ff"
checksum = "a6f41cc0aeb7a4a55730188e147d3795a7349b501f8334697fd37629b896cdc2"
dependencies = [
"Inflector",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.28",
"termcolor",
]
+1 -1
View File
@@ -9,7 +9,7 @@ hex-literal = "0.3.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
strum = { version = "0.23", features = ["derive"] }
ts-rs = "6.1.2"
ts-rs = "7.0.0"
cosmwasm-std = "1.3.0"
cosmrs = "=0.14.0"
+1 -1
View File
@@ -66,7 +66,7 @@ nym-store-cipher = { path = "../../common/store-cipher", features = ["json"] }
nym-crypto = { path = "../../common/crypto", features = ["rand"] }
rand_chacha = "0.2"
tempfile = "3.3.0"
ts-rs = "6.1.2"
ts-rs = "7.0.0"
[features]
default = ["custom-protocol"]
@@ -130,7 +130,7 @@ impl Serializable for ControlResponse {
fn into_bytes(self) -> Vec<u8> {
std::iter::once(self.tag() as u8)
.chain(self.serialize_inner().into_iter())
.chain(self.serialize_inner())
.collect()
}
@@ -81,7 +81,7 @@ where
pub fn into_bytes(self) -> Vec<u8> {
if let Some(version) = self.interface_version.as_u8() {
std::iter::once(version)
.chain(self.content.into_bytes(self.interface_version).into_iter())
.chain(self.content.into_bytes(self.interface_version))
.collect()
} else {
self.content.into_bytes(self.interface_version)
@@ -137,7 +137,7 @@ where
}
} else {
std::iter::once(self.tag() as u8)
.chain(self.serialize_inner().into_iter())
.chain(self.serialize_inner())
.collect()
}
}
@@ -71,7 +71,7 @@ where
pub fn into_bytes(self) -> Vec<u8> {
if let Some(version) = self.interface_version.as_u8() {
std::iter::once(version)
.chain(self.content.into_bytes(self.interface_version).into_iter())
.chain(self.content.into_bytes(self.interface_version))
.collect()
} else {
self.content.into_bytes(self.interface_version)
@@ -127,7 +127,7 @@ where
}
} else {
std::iter::once(self.tag() as u8)
.chain(self.serialize_inner().into_iter())
.chain(self.serialize_inner())
.collect()
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
anyhow = "1"
ts-rs = "6.1.2"
ts-rs = { workspace = true }
walkdir = "2"
nym-validator-client = { path = "../../common/client-libs/validator-client", features = [