Skip to content

Commit 6a02841

Browse files
authored
[chore] Clippy fix (#6060)
* clippy multiple of fix * removed dead code? * huh? * ci fixes
1 parent 4cd4dc2 commit 6a02841

File tree

13 files changed

+16
-543
lines changed

13 files changed

+16
-543
lines changed

.github/workflows/ci-build-vpn-api-wasm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
wasm:
12-
runs-on: arc-ubuntu-22.04
12+
runs-on: arc-linux-latest
1313
env:
1414
CARGO_TERM_COLOR: always
1515
RUSTUP_PERMIT_COPY_RENAME: 1

.github/workflows/ci-nym-wallet-rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
runs-on: arc-ubuntu-22.04
14+
runs-on: arc-linux-latest
1515
env:
1616
CARGO_TERM_COLOR: always
1717
RUSTUP_PERMIT_COPY_RENAME: 1

.github/workflows/ci-sdk-wasm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
wasm:
14-
runs-on: arc-ubuntu-22.04
14+
runs-on: arc-linux-latest
1515
env:
1616
CARGO_TERM_COLOR: always
1717
RUSTUP_PERMIT_COPY_RENAME: 1

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/nym_offline_compact_ecash/src/scheme/keygen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl TryFrom<&[u8]> for SecretKeyAuth {
4747

4848
fn try_from(bytes: &[u8]) -> Result<SecretKeyAuth> {
4949
// There should be x and at least one y
50-
if bytes.len() < 32 * 2 + 8 || (bytes.len() - 8) % 32 != 0 {
50+
if bytes.len() < 32 * 2 + 8 || !(bytes.len() - 8).is_multiple_of(32) {
5151
return Err(CompactEcashError::DeserializationInvalidLength {
5252
actual: bytes.len(),
5353
modulus_target: bytes.len() - 8,
@@ -152,7 +152,7 @@ impl TryFrom<&[u8]> for VerificationKeyAuth {
152152

153153
fn try_from(bytes: &[u8]) -> Result<VerificationKeyAuth> {
154154
// There should be at least alpha, one betaG1 and one betaG2 and their length
155-
if bytes.len() < 96 * 2 + 48 + 8 || (bytes.len() - 8 - 96) % (96 + 48) != 0 {
155+
if bytes.len() < 96 * 2 + 48 + 8 || !(bytes.len() - 8 - 96).is_multiple_of(96 + 48) {
156156
return Err(CompactEcashError::DeserializationInvalidLength {
157157
actual: bytes.len(),
158158
modulus_target: bytes.len() - 8 - 96,

common/nymsphinx/params/src/key_rotation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl From<u32> for SphinxKeyRotation {
4444
fn from(value: u32) -> Self {
4545
if value == 0 || value == u32::MAX {
4646
SphinxKeyRotation::Unknown
47-
} else if value % 2 == 0 {
47+
} else if value.is_multiple_of(2) {
4848
SphinxKeyRotation::EvenRotation
4949
} else {
5050
SphinxKeyRotation::OddRotation

nym-api/nym-api-requests/src/ecash/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl BlindSignRequestBody {
168168
pub fn try_decode_joined_commitments(
169169
joined: &[u8],
170170
) -> Result<Vec<G1Projective>, CompactEcashError> {
171-
if joined.len() % 48 != 0 {
171+
if !joined.len().is_multiple_of(48) {
172172
// that's not the most ideal error variant, but creating dedicated error type would have been an overkill
173173
return Err(CompactEcashError::DeserializationLengthMismatch {
174174
type_name: "joined commitments".to_string(),

nym-node/src/config/old_configs/old_config_v10.rs

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,6 @@ impl Default for HttpV10 {
438438
}
439439
}
440440

441-
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]
442-
#[serde(deny_unknown_fields)]
443-
pub struct MixnodePathsV10 {}
444-
445441
#[derive(Debug, Clone, Serialize, Deserialize)]
446442
#[serde(deny_unknown_fields)]
447443
pub struct DebugV10 {
@@ -541,17 +537,6 @@ impl Default for VerlocDebugV10 {
541537
}
542538
}
543539

544-
#[derive(Debug, Clone, Serialize, Deserialize)]
545-
#[serde(deny_unknown_fields)]
546-
pub struct MixnodeConfigV10 {
547-
pub storage_paths: MixnodePathsV10,
548-
549-
pub verloc: VerlocV10,
550-
551-
#[serde(default)]
552-
pub debug: DebugV10,
553-
}
554-
555540
impl DebugV10 {
556541
const DEFAULT_NODE_STATS_LOGGING_DELAY: Duration = Duration::from_millis(60_000);
557542
const DEFAULT_NODE_STATS_UPDATING_DELAY: Duration = Duration::from_millis(30_000);
@@ -566,21 +551,6 @@ impl Default for DebugV10 {
566551
}
567552
}
568553

569-
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]
570-
#[serde(deny_unknown_fields)]
571-
pub struct EntryGatewayPathsV10 {
572-
/// Path to sqlite database containing all persistent data: messages for offline clients,
573-
/// derived shared keys and available client bandwidths.
574-
pub clients_storage: PathBuf,
575-
576-
pub stats_storage: PathBuf,
577-
578-
/// Path to file containing cosmos account mnemonic used for zk-nym redemption.
579-
pub cosmos_mnemonic: PathBuf,
580-
581-
pub authenticator: AuthenticatorPathsV10,
582-
}
583-
584554
#[derive(Debug, Clone, Serialize, Deserialize)]
585555
#[serde(default)]
586556
pub struct ZkNymTicketHandlerDebugV10 {
@@ -647,55 +617,6 @@ impl Default for ZkNymTicketHandlerDebugV10 {
647617
}
648618
}
649619

650-
#[derive(Debug, Clone, Serialize, Deserialize)]
651-
#[serde(deny_unknown_fields)]
652-
pub struct EntryGatewayConfigDebugV10 {
653-
/// Number of messages from offline client that can be pulled at once (i.e. with a single SQL query) from the storage.
654-
pub message_retrieval_limit: i64,
655-
pub zk_nym_tickets: ZkNymTicketHandlerDebugV10,
656-
}
657-
658-
impl EntryGatewayConfigDebugV10 {
659-
const DEFAULT_MESSAGE_RETRIEVAL_LIMIT: i64 = 100;
660-
}
661-
662-
impl Default for EntryGatewayConfigDebugV10 {
663-
fn default() -> Self {
664-
EntryGatewayConfigDebugV10 {
665-
message_retrieval_limit: Self::DEFAULT_MESSAGE_RETRIEVAL_LIMIT,
666-
zk_nym_tickets: Default::default(),
667-
}
668-
}
669-
}
670-
671-
#[derive(Debug, Clone, Serialize, Deserialize)]
672-
#[serde(deny_unknown_fields)]
673-
pub struct EntryGatewayConfigV10 {
674-
pub storage_paths: EntryGatewayPathsV10,
675-
676-
/// Indicates whether this gateway is accepting only coconut credentials for accessing the mixnet
677-
/// or if it also accepts non-paying clients
678-
pub enforce_zk_nyms: bool,
679-
680-
/// Socket address this node will use for binding its client websocket API.
681-
/// default: `[::]:9000`
682-
pub bind_address: SocketAddr,
683-
684-
/// Custom announced port for listening for websocket client traffic.
685-
/// If unspecified, the value from the `bind_address` will be used instead
686-
/// default: None
687-
#[serde(deserialize_with = "de_maybe_port")]
688-
pub announce_ws_port: Option<u16>,
689-
690-
/// If applicable, announced port for listening for secure websocket client traffic.
691-
/// (default: None)
692-
#[serde(deserialize_with = "de_maybe_port")]
693-
pub announce_wss_port: Option<u16>,
694-
695-
#[serde(default)]
696-
pub debug: EntryGatewayConfigDebugV10,
697-
}
698-
699620
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]
700621
#[serde(deny_unknown_fields)]
701622
pub struct NetworkRequesterPathsV10 {
@@ -786,20 +707,6 @@ pub struct AuthenticatorPathsV10 {
786707
// it's possible we might have to add credential storage here for return tickets
787708
}
788709

789-
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]
790-
#[serde(deny_unknown_fields)]
791-
pub struct ExitGatewayPathsV10 {
792-
pub clients_storage: PathBuf,
793-
794-
pub stats_storage: PathBuf,
795-
796-
pub network_requester: NetworkRequesterPathsV10,
797-
798-
pub ip_packet_router: IpPacketRouterPathsV10,
799-
800-
pub authenticator: AuthenticatorPathsV10,
801-
}
802-
803710
#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]
804711
pub struct AuthenticatorV10 {
805712
#[serde(default)]
@@ -928,45 +835,6 @@ impl Default for NetworkRequesterV10 {
928835
}
929836
}
930837

931-
#[derive(Debug, Clone, Serialize, Deserialize)]
932-
#[serde(deny_unknown_fields)]
933-
pub struct ExitGatewayDebugV10 {
934-
/// Number of messages from offline client that can be pulled at once (i.e. with a single SQL query) from the storage.
935-
pub message_retrieval_limit: i64,
936-
}
937-
938-
impl ExitGatewayDebugV10 {
939-
const DEFAULT_MESSAGE_RETRIEVAL_LIMIT: i64 = 100;
940-
}
941-
942-
impl Default for ExitGatewayDebugV10 {
943-
fn default() -> Self {
944-
ExitGatewayDebugV10 {
945-
message_retrieval_limit: Self::DEFAULT_MESSAGE_RETRIEVAL_LIMIT,
946-
}
947-
}
948-
}
949-
950-
#[derive(Debug, Clone, Serialize, Deserialize)]
951-
#[serde(deny_unknown_fields)]
952-
pub struct ExitGatewayConfigV10 {
953-
pub storage_paths: ExitGatewayPathsV10,
954-
955-
/// specifies whether this exit node should run in 'open-proxy' mode
956-
/// and thus would attempt to resolve **ANY** request it receives.
957-
pub open_proxy: bool,
958-
959-
/// Specifies the url for an upstream source of the exit policy used by this node.
960-
pub upstream_exit_policy_url: Url,
961-
962-
pub network_requester: NetworkRequesterV10,
963-
964-
pub ip_packet_router: IpPacketRouterV10,
965-
966-
#[serde(default)]
967-
pub debug: ExitGatewayDebugV10,
968-
}
969-
970838
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Serialize)]
971839
#[serde(deny_unknown_fields)]
972840
pub struct GatewayTasksPathsV10 {

0 commit comments

Comments
 (0)