Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
Use array
Browse files Browse the repository at this point in the history
  • Loading branch information
Daksh14 committed Jun 7, 2024
1 parent 58c928b commit 6f37be8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-06-04
nightly
16 changes: 5 additions & 11 deletions src/compat/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use dusk_bls12_381::BlsScalar;
use dusk_bytes::Serializable;
use phoenix_core::{
transaction::{ArchivedTreeLeaf, TreeLeaf},
Note, PublicKey,
Note, PublicKey, SecretKey, ViewKey,
};

use alloc::{string::ToString, vec::Vec};
Expand Down Expand Up @@ -48,16 +48,10 @@ pub fn check_note_ownership(args: i32, len: i32) -> i64 {
let mut nullifiers = Vec::new();
let mut block_heights = Vec::new();
let mut public_spend_keys = Vec::new();
let mut view_keys = Vec::with_capacity(MAX_KEY);
let mut secret_keys = Vec::with_capacity(MAX_KEY);

for idx in 0..MAX_KEY {
let idx = idx as u64;
let view_key = key::derive_vk(&seed, idx);
let sk = key::derive_sk(&seed, idx as _);
view_keys.push(view_key);
secret_keys.push(sk);
}
let view_keys: [ViewKey; MAX_KEY] =
core::array::from_fn(|i| key::derive_vk(&seed, i as _));
let secret_keys: [SecretKey; MAX_KEY] =
core::array::from_fn(|i| key::derive_sk(&seed, i as _));

for leaf_bytes in leaf_chunk.by_ref() {
let TreeLeaf { block_height, note } = match rkyv::from_bytes(leaf_bytes)
Expand Down

0 comments on commit 6f37be8

Please # to comment.