Skip to content

Commit

Permalink
Merge pull request #261 from anoma/xuyang/fix_clippy
Browse files Browse the repository at this point in the history
fix clippy
  • Loading branch information
XuyangSong authored Mar 23, 2024
2 parents 7a81f34 + 15f6689 commit 16eeeab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions taiga_halo2/src/circuit/blake2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ impl<F: PrimeField> Blake2sChip<F> {
pub fn encode_result(
&self,
layouter: &mut impl Layouter<F>,
ret: &Vec<Blake2sWord<F>>,
ret: &[Blake2sWord<F>],
) -> Result<[AssignedCell<F, F>; 2], Error> {
let mut fields = vec![];
assert_eq!(ret.len(), 8);
Expand Down Expand Up @@ -976,7 +976,7 @@ impl<F: PrimeField> Blake2sWord<F> {
})
}

pub fn word_rotate(bits: &Vec<AssignedCell<F, F>>, by: usize) -> Vec<AssignedCell<F, F>> {
pub fn word_rotate(bits: &[AssignedCell<F, F>], by: usize) -> Vec<AssignedCell<F, F>> {
assert!(bits.len() == 32);
let by = by % 32;
bits.iter()
Expand Down
3 changes: 1 addition & 2 deletions taiga_halo2/src/circuit/vp_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ impl Encoder for ValidityPredicatePublicInputs {
impl<'a> Decoder<'a> for ValidityPredicatePublicInputs {
fn decode(term: Term<'a>) -> NifResult<Self> {
let val: Vec<pallas::Base> = Decoder::decode(term)?;
val.try_into()
.map_err(|_e| rustler::Error::Atom("failure to decode"))
Ok(val.into())
}
}

Expand Down
6 changes: 3 additions & 3 deletions taiga_halo2/src/resource_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ impl ResourcePlaintext {
self.0.to_vec()
}

pub fn padding(msg: &Vec<pallas::Base>) -> Self {
let mut plaintext = msg.clone();
pub fn padding(msg: &[pallas::Base]) -> Self {
let mut plaintext = msg.to_owned();
let padding = std::iter::repeat(pallas::Base::zero())
.take(RESOURCE_ENCRYPTION_PLAINTEXT_NUM - msg.len());
plaintext.extend(padding);
Expand Down Expand Up @@ -183,7 +183,7 @@ fn test_halo2_resource_encryption() {
pallas::Base::one(),
pallas::Base::one(),
];
let plaintext = ResourcePlaintext::padding(&message.to_vec());
let plaintext = ResourcePlaintext::padding(message.as_ref());
let encrypt_nonce = pallas::Base::from_u128(23333u128);

// Encryption
Expand Down

0 comments on commit 16eeeab

Please sign in to comment.