Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Jan 29, 2025
1 parent e2ff413 commit 9d73a21
Show file tree
Hide file tree
Showing 34 changed files with 45 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ linker = "aarch64-linux-gnu-gcc"
linker = "riscv64-linux-gnu-gcc"

[alias]
ci-fmt = "fmt --all -- --check"
ci-fmt = "+nightly fmt --all -- --check"
ci-fmt-fix = "fmt --all"
ci-clippy = "lints clippy --all-targets --all-features"
ci-clippy = "lints +nightly clippy --all-targets --all-features"
ci-test-compile = "test --no-run --workspace --all-features --no-default-features"
ci-test = "nextest run --all-features --release --workspace --exclude tari_integration_tests --profile ci"
ci-cucumber = "test --release --test cucumber --all-features --package tari_integration_tests -- -t @critical"
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ name: CI

env:
toolchain: stable
nightly_toolchain: nightly-2024-07-07
CARGO_HTTP_MULTIPLEXING: false
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: true
Expand All @@ -36,7 +37,7 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- name: toolchain
- name: nightly_toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.toolchain }}
Expand Down Expand Up @@ -69,11 +70,11 @@ jobs:
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly
- name: cargo format
run: cargo fmt --all -- --check
run: cargo +nightly fmt --all -- --check
- name: Install cargo-lints
run: cargo install cargo-lints
- name: Clippy check (with lints)
run: cargo lints clippy --all-targets --all-features
run: cargo +nightly lints clippy --all-targets --all-features

machete:
# Checks for unused dependencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl BasicAuthCredentials {
/// Creates a new `Credentials` instance from a username and password (PHC string bytes).
pub fn new(user_name: String, phc_password_hash: SafePassword) -> Result<Self, BasicAuthError> {
// Validate the username is well formed
if user_name.as_bytes().len() > MAX_USERNAME_LEN {
if user_name.len() > MAX_USERNAME_LEN {
return Err(BasicAuthError::InvalidUsername);
}
// Validate the password is a well formed byte representation of a PHC string
Expand All @@ -72,7 +72,7 @@ impl BasicAuthCredentials {
user_name_bytes[bytes.len()..MAX_USERNAME_LEN].clone_from_slice(&random_bytes[bytes.len()..MAX_USERNAME_LEN]);

Ok(Self {
user_name_bytes_length: user_name.as_bytes().len(),
user_name_bytes_length: user_name.len(),
user_name_bytes,
phc_password_hash,
random_bytes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn wallet_payment_address(
network: Network,
) -> Result<TariAddress, ParseInputError> {
// Verify config setting
return match TariAddress::from_str(&config_wallet_payment_address) {
match TariAddress::from_str(&config_wallet_payment_address) {
Ok(address) => {
if address == TariAddress::default() {
println!();
Expand Down
2 changes: 1 addition & 1 deletion base_layer/common_types/src/types/bullet_rangeproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<'de> Deserialize<'de> for BulletRangeProof {
where D: Deserializer<'de> {
struct RangeProofVisitor;

impl<'de> Visitor<'de> for RangeProofVisitor {
impl Visitor<'_> for RangeProofVisitor {
type Value = BulletRangeProof;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
1 change: 0 additions & 1 deletion base_layer/core/src/base_node/proto/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl TryFrom<NodeCommsResponse> for ProtoNodeCommsResponse {
.map(TryInto::try_into)
.collect::<Result<Vec<proto::core::HistoricalBlock>, _>>()?
.into_iter()
.map(Into::into)
.collect();
Ok(ProtoNodeCommsResponse::HistoricalBlocks(historical_blocks))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ pub struct BaseNodeStateMachine<B: BlockchainBackend> {

impl<B: BlockchainBackend + 'static> BaseNodeStateMachine<B> {
/// Instantiate a new Base Node.
pub fn new(
db: AsyncBlockchainDb<B>,
local_node_interface: LocalNodeCommsInterface,
Expand Down
4 changes: 2 additions & 2 deletions base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ impl LMDBDatabase {
txn: &ConstTransaction<'_>,
height: u64,
) -> Result<Option<BlockAccumulatedData>, ChainStorageError> {
lmdb_get(txn, &self.block_accumulated_data_db, &height).map_err(Into::into)
lmdb_get(txn, &self.block_accumulated_data_db, &height)
}

#[allow(clippy::ptr_arg)]
Expand All @@ -1650,7 +1650,7 @@ impl LMDBDatabase {
txn: &ConstTransaction<'_>,
header_hash: &HashOutput,
) -> Result<Option<u64>, ChainStorageError> {
lmdb_get(txn, &self.block_hashes_db, header_hash.as_slice()).map_err(Into::into)
lmdb_get(txn, &self.block_hashes_db, header_hash.as_slice())
}

fn fetch_header_accumulated_data_by_height(
Expand Down
4 changes: 2 additions & 2 deletions base_layer/core/src/consensus/consensus_encoding/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ mod tests {

// Script is chosen because the consensus encoding impl for TariScript has 2 writes
let mut hasher = Blake2b::<U32>::default();
TestHashDomain::add_domain_separation_tag(&mut hasher, &format!("{}.n{}", "foo", network.as_byte()));
TestHashDomain::add_domain_separation_tag(&mut hasher, format!("{}.n{}", "foo", network.as_byte()));

let expected_hash = hasher.chain_update(b"\xff\x00\x00\x00\x00\x00\x00\x00").finalize();
let hash = DomainSeparatedConsensusHasher::<TestHashDomain, Blake2b<U32>>::new("foo")
Expand All @@ -122,7 +122,7 @@ mod tests {
// Script is chosen because the consensus encoding impl for TariScript has 2 writes
let test_subject = script!(Nop).unwrap();
let mut hasher = Blake2b::<U32>::default();
TestHashDomain::add_domain_separation_tag(&mut hasher, &format!("{}.n{}", "foo", network.as_byte()));
TestHashDomain::add_domain_separation_tag(&mut hasher, format!("{}.n{}", "foo", network.as_byte()));

let expected_hash = hasher.chain_update(b"\x01\x73").finalize();
let hash = DomainSeparatedConsensusHasher::<TestHashDomain, Blake2b<U32>>::new("foo")
Expand Down
1 change: 0 additions & 1 deletion base_layer/core/src/covenants/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
/// let covenant = covenant!(or(absolute_height(@uint(42)), field_eq(@field::features_flags, @uint(8)))).unwrap();
/// covenant.execute(...)?;
/// ```
#[macro_export]
macro_rules! covenant {
($token:ident($($args:tt)*)) => {{
Expand Down
1 change: 0 additions & 1 deletion base_layer/core/src/proof_of_work/difficulty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ impl Difficulty {
/// - `Div for Difficulty` `/` must not be used at all; difficulties should only be added to or subtracted from
/// - `From<u64> for Difficulty` `Difficulty::from<u64>` must not be used, use `from_u64(value)` instead; to prevent
/// assignment `< MIN_DIFFICULTY`
impl Default for Difficulty {
fn default() -> Self {
Difficulty::min()
Expand Down
5 changes: 1 addition & 4 deletions base_layer/core/src/proof_of_work/lwma_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ impl LinearWeightedMovingAverage {
if *timestamp > previous_timestamp {
this_timestamp = *timestamp;
} else {
this_timestamp = match previous_timestamp.checked_add(EpochTime::from(1)) {
Some(t) => t,
None => return None,
};
this_timestamp = previous_timestamp.checked_add(EpochTime::from(1))?;
}
let solve_time = min(
this_timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ pub struct TransactionOutput {
/// An output for a transaction, includes a range proof and Tari script metadata
impl TransactionOutput {
/// Create new Transaction Output
pub fn new(
version: TransactionOutputVersion,
features: OutputFeatures,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ pub struct UnblindedOutput {

impl UnblindedOutput {
/// Creates a new un-blinded output
#[allow(clippy::too_many_arguments)]
pub fn new(
version: TransactionOutputVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub struct WalletOutput {

impl WalletOutput {
/// Creates a new wallet output
#[allow(clippy::too_many_arguments)]
pub async fn new<KM: TransactionKeyManagerInterface>(
version: TransactionOutputVersion,
Expand Down
14 changes: 7 additions & 7 deletions base_layer/key_manager/src/mnemonic_wordlists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// A sorted mnemonic word list of 2048 characters for the Chinese Simplified language
#[rustfmt::skip]
pub const MNEMONIC_CHINESE_SIMPLIFIED_WORDS: [&str; 2048] = [
pub static MNEMONIC_CHINESE_SIMPLIFIED_WORDS: [&str; 2048] = [
"一", "丁", "七", "万", "丈", "三", "上", "下", "不", "与", "专", "且", "世", "丘", "丙", "业",
"丛", "东", "丝", "丢", "两", "严", "丧", "个", "中", "丰", "串", "临", "丹", "为", "主", "丽",
"举", "乃", "久", "么", "义", "之", "乌", "乎", "乏", "乐", "乔", "乘", "乙", "九", "也", "习",
Expand Down Expand Up @@ -141,7 +141,7 @@ pub const MNEMONIC_CHINESE_SIMPLIFIED_WORDS: [&str; 2048] = [

/// A sorted mnemonic word list of 2048 words from the English language
#[rustfmt::skip]
pub const MNEMONIC_ENGLISH_WORDS: [&str; 2048] = [
pub static MNEMONIC_ENGLISH_WORDS: [&str; 2048] = [
"abandon", "ability", "able", "about", "above", "absent", "absorb", "abstract", "absurd", "abuse", "access", "accident", "account", "accuse", "achieve", "acid",
"acoustic", "acquire", "across", "act", "action", "actor", "actress", "actual", "adapt", "add", "addict", "address", "adjust", "admit", "adult", "advance",
"advice", "aerobic", "affair", "afford", "afraid", "again", "age", "agent", "agree", "ahead", "aim", "air", "airport", "aisle", "alarm", "album",
Expand Down Expand Up @@ -274,7 +274,7 @@ pub const MNEMONIC_ENGLISH_WORDS: [&str; 2048] = [

/// A sorted mnemonic word list of 2048 words from the French language
#[rustfmt::skip]
pub const MNEMONIC_FRENCH_WORDS: [&str; 2048] = [
pub static MNEMONIC_FRENCH_WORDS: [&str; 2048] = [
"abaisser", "abandon", "abdiquer", "abeille", "abolir", "aborder", "aboutir", "aboyer", "abrasif", "abreuver", "abriter", "abroger", "abrupt", "absence", "absolu", "absurde",
"abusif", "abyssal", "academie", "acajou", "acarien", "accabler", "accepter", "acclamer", "accolade", "accroche", "accuser", "acerbe", "achat", "acheter", "aciduler", "acier",
"acompte", "acquerir", "acronyme", "acteur", "actif", "actuel", "adepte", "adequat", "adhesif", "adjectif", "adjuger", "admettre", "admirer", "adopter", "adorer", "adoucir",
Expand Down Expand Up @@ -407,7 +407,7 @@ pub const MNEMONIC_FRENCH_WORDS: [&str; 2048] = [

/// A sorted mnemonic word list of 2048 words from the Italian language
#[rustfmt::skip]
pub const MNEMONIC_ITALIAN_WORDS: [&str; 2048] = [
pub static MNEMONIC_ITALIAN_WORDS: [&str; 2048] = [
"abaco", "abbaglio", "abbinato", "abete", "abisso", "abolire", "abrasivo", "abrogato", "accadere", "accenno", "accusato", "acetone", "achille", "acido", "acqua", "acre",
"acrilico", "acrobata", "acuto", "adagio", "addebito", "addome", "adeguato", "aderire", "adipe", "adottare", "adulare", "affabile", "affetto", "affisso", "affranto", "aforisma",
"afoso", "africano", "agave", "agente", "agevole", "aggancio", "agire", "agitare", "agonismo", "agricolo", "agrumeto", "aguzzo", "alabarda", "alato", "albatro", "alberato",
Expand Down Expand Up @@ -540,7 +540,7 @@ pub const MNEMONIC_ITALIAN_WORDS: [&str; 2048] = [

/// A sorted mnemonic word list of 2048 words from the Japanese language
#[rustfmt::skip]
pub const MNEMONIC_JAPANESE_WORDS: [&str; 2048] = [
pub static MNEMONIC_JAPANESE_WORDS: [&str; 2048] = [
"あいこくしん", "あいさつ", "あいだ", "あおぞら", "あかちゃん", "あきる", "あけがた", "あける", "あこがれる", "あさい", "あさひ", "あしあと", "あじわう", "あずかる", "あずき", "あそぶ",
"あたえる", "あたためる", "あたりまえ", "あたる", "あっしゅく", "あつい", "あつかう", "あつまり", "あつめる", "あてな", "あてはまる", "あひる", "あふれる", "あぶら", "あぶる", "あまい",
"あまど", "あまやかす", "あまり", "あみもの", "あめりか", "あやまる", "あゆむ", "あらいぐま", "あらし", "あらすじ", "あらためる", "あらゆる", "あらわす", "ありがとう", "あわせる", "あわてる",
Expand Down Expand Up @@ -673,7 +673,7 @@ pub const MNEMONIC_JAPANESE_WORDS: [&str; 2048] = [

/// A sorted mnemonic word list of 2048 words from the Korean language
#[rustfmt::skip]
pub const MNEMONIC_KOREAN_WORDS: [&str; 2048] = [
pub static MNEMONIC_KOREAN_WORDS: [&str; 2048] = [
"가격", "가끔", "가난", "가능", "가득", "가르침", "가뭄", "가방", "가상", "가슴", "가운데", "가을", "가이드", "가입", "가장", "가정",
"가족", "가죽", "각오", "각자", "간격", "간부", "간섭", "간장", "간접", "간판", "갈등", "갈비", "갈색", "갈증", "감각", "감기",
"감소", "감수성", "감자", "감정", "갑자기", "강남", "강당", "강도", "강력히", "강변", "강북", "강사", "강수량", "강아지", "강원도", "강의",
Expand Down Expand Up @@ -806,7 +806,7 @@ pub const MNEMONIC_KOREAN_WORDS: [&str; 2048] = [

/// A sorted mnemonic word list of 2048 words from the Spanish language
#[rustfmt::skip]
pub const MNEMONIC_SPANISH_WORDS: [&str; 2048] = [
pub static MNEMONIC_SPANISH_WORDS: [&str; 2048] = [
"abaco", "abdomen", "abeja", "abierto", "abogado", "abono", "aborto", "abrazo", "abrir", "abuelo", "abuso", "acabar", "academia", "acceso", "accion", "aceite",
"acelga", "acento", "aceptar", "acido", "aclarar", "acne", "acoger", "acoso", "activo", "acto", "actriz", "actuar", "acudir", "acuerdo", "acusar", "adicto",
"admitir", "adoptar", "adorno", "aduana", "adulto", "aereo", "afectar", "aficion", "afinar", "afirmar", "agil", "agitar", "agonia", "agosto", "agotar", "agregar",
Expand Down
4 changes: 2 additions & 2 deletions base_layer/mmr/src/merkle_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ impl Display for MerkleProof {
self.path
.iter()
.enumerate()
.fold(Ok(()), |_, (i, h)| f.write_str(&format!("{:3}: {}\n", i, h.to_hex())))?;
.try_fold((), |_, (i, h)| f.write_str(&format!("{:3}: {}\n", i, h.to_hex())))?;
f.write_str("Peaks:\n")?;
self.peaks
.iter()
.enumerate()
.fold(Ok(()), |_, (i, h)| f.write_str(&format!("{:3}: {}\n", i, h.to_hex())))?;
.try_fold((), |_, (i, h)| f.write_str(&format!("{:3}: {}\n", i, h.to_hex())))?;
Ok(())
}
}
6 changes: 3 additions & 3 deletions base_layer/mmr/src/sparse_merkle_tree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl PathIterator<'_> {
}
}

impl<'a> Iterator for PathIterator<'a> {
impl Iterator for PathIterator<'_> {
type Item = TraverseDirection;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -155,7 +155,7 @@ impl<'a> Iterator for PathIterator<'a> {
}
}

impl<'a> DoubleEndedIterator for PathIterator<'a> {
impl DoubleEndedIterator for PathIterator<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.cursor_front >= self.cursor_back {
return None;
Expand All @@ -171,7 +171,7 @@ impl<'a> DoubleEndedIterator for PathIterator<'a> {
}
}

impl<'a> ExactSizeIterator for PathIterator<'a> {
impl ExactSizeIterator for PathIterator<'_> {
fn len(&self) -> usize {
self.cursor_back.saturating_sub(self.cursor_front)
}
Expand Down
2 changes: 1 addition & 1 deletion base_layer/mmr/src/sparse_merkle_tree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct TerminalBranch<'a, H> {
empty_siblings: Vec<bool>,
}

impl<'a, H: Digest<OutputSize = U32>> TerminalBranch<'a, H> {
impl<H: Digest<OutputSize = U32>> TerminalBranch<'_, H> {
/// Returns the terminal node of the branch
pub fn terminal(&self) -> &Node<H> {
let branch = self.parent.as_branch().unwrap();
Expand Down
1 change: 0 additions & 1 deletion base_layer/p2p/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ impl P2pInitializer {
.map(|s| SeedPeer::from_str(s))
.map(|r| r.map(Peer::from))
.collect::<Result<Vec<_>, _>>()
.map_err(Into::into)
}

async fn try_resolve_dns_seeds(config: &PeerSeedsConfig) -> Result<Vec<Peer>, ServiceInitializationError> {
Expand Down
5 changes: 2 additions & 3 deletions base_layer/p2p/src/services/liveness/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use tari_comms::{
};
use tari_comms_dht::{
domain_message::OutboundDomainMessage,
outbound::{DhtOutboundError, OutboundMessageRequester},
outbound::{OutboundMessageRequester},
};
use tari_service_framework::reply_channel::RequestContext;
use tari_shutdown::ShutdownSignal;
Expand Down Expand Up @@ -257,8 +257,7 @@ where
OutboundDomainMessage::new(&TariMessageType::PingPong, msg),
"Send ping".to_string(),
)
.await
.map_err(Into::<DhtOutboundError>::into)?;
.await?;

Ok(nonce)
}
Expand Down
4 changes: 2 additions & 2 deletions comms/core/src/connection_manager/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ pub(super) fn validate_peer_identity_message(
.into());
}

if user_agent.as_bytes().len() > config.max_user_agent_byte_length {
if user_agent.len() > config.max_user_agent_byte_length {
return Err(PeerValidatorError::PeerIdentityUserAgentTooLong {
length: user_agent.as_bytes().len(),
length: user_agent.len(),
max: config.max_user_agent_byte_length,
}
.into());
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/connectivity/connection_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl PeerConnectionState {

/// Return true if the underlying connection exists and is connected, otherwise false
pub fn is_connected(&self) -> bool {
self.status.is_connected() && self.connection().map_or(false, |c| c.is_connected())
self.status.is_connected() && self.connection().is_some_and(|c| c.is_connected())
}

pub fn connection_mut(&mut self) -> Option<&mut PeerConnection> {
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/memsocket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ pub struct Incoming<'a> {
inner: &'a mut MemoryListener,
}

impl<'a> Stream for Incoming<'a> {
impl Stream for Incoming<'_> {
type Item = io::Result<MemorySocket>;

fn poll_next(mut self: Pin<&mut Self>, context: &mut Context) -> Poll<Option<Self::Item>> {
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/noise/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ where TSocket: AsyncRead + AsyncWrite + Unpin
}

async fn flush(&mut self) -> io::Result<()> {
self.socket.flush().await.map_err(Into::into)
self.socket.flush().await
}

async fn receive(&mut self) -> io::Result<usize> {
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/peer_manager/node_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ where D: Deserializer<'de> {
marker: PhantomData<K>,
}

impl<'de> de::Visitor<'de> for KeyStringVisitor<NodeId> {
impl de::Visitor<'_> for KeyStringVisitor<NodeId> {
type Value = NodeId;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/protocol/rpc/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl BodyBytes {
#[allow(clippy::from_over_into)]
impl Into<Bytes> for BodyBytes {
fn into(self) -> Bytes {
self.0.map(Bytes::from).unwrap_or_default()
self.0.unwrap_or_default()
}
}

Expand Down
4 changes: 2 additions & 2 deletions comms/core/src/socks/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ where TSocket: AsyncRead + AsyncWrite + Unpin
match auth {
Authentication::None => {},
Authentication::Password { username, password } => {
let username_len = username.as_bytes().len();
let username_len = username.len();
if !(1..=255).contains(&username_len) {
return Err(SocksError::InvalidAuthValues(
"username length should between 1 to 255".to_string(),
));
}
let password_len = password.as_bytes().len();
let password_len = password.len();
if !(1..=255).contains(&password_len) {
return Err(SocksError::InvalidAuthValues(
"password length should between 1 to 255".to_string(),
Expand Down
Loading

0 comments on commit 9d73a21

Please sign in to comment.