From e9ab9260777ab017d7abb8267394beb9c807a953 Mon Sep 17 00:00:00 2001 From: Daksh Date: Wed, 1 Nov 2023 14:06:04 -0400 Subject: [PATCH] Change Crossover to CrossoverType like other wasm arguments types Fix clippy warnings --- assets/schema.json | 4 ++-- src/ffi.rs | 4 ++-- src/types.rs | 4 ++-- src/utils.rs | 7 +++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/assets/schema.json b/assets/schema.json index cf46182..1f04706 100644 --- a/assets/schema.json +++ b/assets/schema.json @@ -139,7 +139,7 @@ } } }, - "Crossover": { + "CrossoverType": { "description": "The value of the Crossover and the blinder", "type": "object", "required": [ @@ -193,7 +193,7 @@ }, "crossover": { "description": "The crossover value", - "$ref": "#/definitions/Crossover" + "$ref": "#/definitions/CrossoverType" }, "fee": { "description": "A rkyv serialized Fee", diff --git a/src/ffi.rs b/src/ffi.rs index b46f7c3..82a5084 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -239,7 +239,7 @@ pub fn execute(args: i32, len: i32) -> i64 { outputs.push(o); } - let rng = &mut utils::rng(&rng_seed); + let rng = &mut utils::rng(rng_seed); let tx = tx::UnprovenTransaction::new( rng, inputs, outputs, fee, crossover, call, ); @@ -313,7 +313,7 @@ pub fn filter_notes(args: i32, len: i32) -> i64 { let notes: Vec<_> = notes .into_iter() - .zip(flags.into_iter()) + .zip(flags) .filter_map(|(n, f)| (!f).then_some(n)) .collect(); diff --git a/src/types.rs b/src/types.rs index efe61ab..62409ee 100644 --- a/src/types.rs +++ b/src/types.rs @@ -33,7 +33,7 @@ pub struct BalanceResponse { } #[doc = " The value of the Crossover and the blinder"] #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] -pub struct Crossover { +pub struct CrossoverType { #[doc = " The rkyv serialized blinder of the crossover"] pub blinder: Vec, #[doc = " The rkyv serialized bytes of the crossover struct"] @@ -49,7 +49,7 @@ pub struct ExecuteArgs { pub call: Option, #[doc = " The crossover value"] #[serde(skip_serializing_if = "Option::is_none")] - pub crossover: Option, + pub crossover: Option, #[doc = " A rkyv serialized Fee"] pub fee: Vec, #[doc = " The gas limit of the transaction"] diff --git a/src/utils.rs b/src/utils.rs index 556d537..e83227c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -101,10 +101,9 @@ where compose(true, ptr, len) } -/// Creates a secure RNG from a seed. -/// We should keep this above 64 to be secure -pub fn rng(seed: &[u8; 32]) -> ChaCha12Rng { - ChaCha12Rng::from_seed(*seed) +/// Creates a secure RNG directly a seed. +pub fn rng(seed: [u8; 32]) -> ChaCha12Rng { + ChaCha12Rng::from_seed(seed) } /// Creates a secure RNG from a seed with embedded index.