Skip to content

Commit

Permalink
resolve 'unused crate::utils::read_scalar_field import' warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrusu committed Mar 23, 2024
1 parent 049f1e1 commit 8bb88af
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion taiga_halo2/src/circuit/vp_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::{
proof::Proof,
resource::{RandomSeed, Resource, ResourceCommitment},
resource_encryption::{ResourceCiphertext, SecretKey},
utils::{mod_r_p, read_base_field},
utils::mod_r_p,
vp_vk::ValidityPredicateVerifyingKey,
};
use dyn_clone::{clone_trait_object, DynClone};
Expand Down Expand Up @@ -206,6 +206,7 @@ impl BorshDeserialize for VPVerifyingInfo {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
// Read vk
use crate::circuit::vp_examples::TrivialValidityPredicateCircuit;
use crate::utils::read_base_field;
let params = SETUP_PARAMS_MAP.get(&VP_CIRCUIT_PARAMS_SIZE).unwrap();
let vk = VerifyingKey::read::<_, TrivialValidityPredicateCircuit>(reader, params)?;
// Read proof
Expand Down
3 changes: 1 addition & 2 deletions taiga_halo2/src/circuit/vp_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
error::TransactionError,
proof::Proof,
resource::{RandomSeed, Resource},
utils::read_base_field,
vp_commitment::ValidityPredicateCommitment,
vp_vk::ValidityPredicateVerifyingKey,
};
Expand Down Expand Up @@ -134,7 +133,7 @@ impl BorshSerialize for TrivialValidityPredicateCircuit {
#[cfg(feature = "borsh")]
impl BorshDeserialize for TrivialValidityPredicateCircuit {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
let owned_resource_id = read_base_field(reader)?;
let owned_resource_id = crate::utils::read_base_field(reader)?;
let input_resources: Vec<_> = (0..NUM_RESOURCE)
.map(|_| Resource::deserialize_reader(reader))
.collect::<Result<_, _>>()?;
Expand Down
6 changes: 3 additions & 3 deletions taiga_halo2/src/merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::hash::{Hash, Hasher};

use crate::merkle_tree::LR::{L, R};
use crate::resource::ResourceCommitment;
use crate::utils::{poseidon_hash, read_base_field};
use crate::utils::poseidon_hash;
use crate::{constant::TAIGA_COMMITMENT_TREE_DEPTH, resource::Resource};
use ff::PrimeField;
use halo2_proofs::arithmetic::Field;
Expand Down Expand Up @@ -68,7 +68,7 @@ impl BorshSerialize for Anchor {
#[cfg(feature = "borsh")]
impl BorshDeserialize for Anchor {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
let value = read_base_field(reader)?;
let value = crate::utils::read_base_field(reader)?;
Ok(Self(value))
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ impl BorshSerialize for Node {
#[cfg(feature = "borsh")]
impl BorshDeserialize for Node {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
let value = read_base_field(reader)?;
let value = crate::utils::read_base_field(reader)?;
Ok(Self(value))
}
}
Expand Down
4 changes: 2 additions & 2 deletions taiga_halo2/src/nullifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::hash::Hash;

use crate::{
resource::ResourceCommitment,
utils::{poseidon_hash_n, prf_nf, read_base_field},
utils::{poseidon_hash_n, prf_nf},
};
use halo2_proofs::arithmetic::Field;
use pasta_curves::group::ff::PrimeField;
Expand Down Expand Up @@ -91,7 +91,7 @@ impl BorshSerialize for Nullifier {
#[cfg(feature = "borsh")]
impl BorshDeserialize for Nullifier {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
let value = read_base_field(reader)?;
let value = crate::utils::read_base_field(reader)?;
Ok(Self(value))
}
}
Expand Down
5 changes: 3 additions & 2 deletions taiga_halo2/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
merkle_tree::{Anchor, MerklePath, Node},
nullifier::{Nullifier, NullifierKeyContainer},
shielded_ptx::ResourceVPVerifyingInfoSet,
utils::{poseidon_hash_n, poseidon_to_curve, read_base_field},
utils::{poseidon_hash_n, poseidon_to_curve},
};
use blake2b_simd::Params as Blake2bParams;
use ff::{FromUniformBytes, PrimeField};
Expand Down Expand Up @@ -67,7 +67,7 @@ impl BorshSerialize for ResourceCommitment {
#[cfg(feature = "borsh")]
impl BorshDeserialize for ResourceCommitment {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
let value = read_base_field(reader)?;
let value = crate::utils::read_base_field(reader)?;
Ok(Self(value))
}
}
Expand Down Expand Up @@ -329,6 +329,7 @@ impl BorshSerialize for Resource {
#[cfg(feature = "borsh")]
impl BorshDeserialize for Resource {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
use crate::utils::read_base_field;
use byteorder::{LittleEndian, ReadBytesExt};
use std::io;
// Read logic
Expand Down
3 changes: 1 addition & 2 deletions taiga_halo2/src/shielded_ptx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::merkle_tree::Anchor;
use crate::nullifier::Nullifier;
use crate::proof::Proof;
use crate::resource::{ResourceCommitment, ResourceValidityPredicates};
use crate::utils::read_scalar_field;
use halo2_proofs::plonk::Error;
use pasta_curves::pallas;
use rand::RngCore;
Expand Down Expand Up @@ -354,7 +353,7 @@ impl BorshDeserialize for ShieldedPartialTransaction {
let binding_sig_r = if binding_sig_r_type == 0 {
None
} else {
let r = read_scalar_field(reader)?;
let r = crate::utils::read_scalar_field(reader)?;
Some(r)
};

Expand Down

0 comments on commit 8bb88af

Please sign in to comment.