diff --git a/taiga_halo2/src/circuit/blake2s.rs b/taiga_halo2/src/circuit/blake2s.rs index 91d7a5f0..429a2dd6 100644 --- a/taiga_halo2/src/circuit/blake2s.rs +++ b/taiga_halo2/src/circuit/blake2s.rs @@ -431,7 +431,7 @@ impl Blake2sChip { pub fn encode_result( &self, layouter: &mut impl Layouter, - ret: &Vec>, + ret: &[Blake2sWord], ) -> Result<[AssignedCell; 2], Error> { let mut fields = vec![]; assert_eq!(ret.len(), 8); @@ -976,7 +976,7 @@ impl Blake2sWord { }) } - pub fn word_rotate(bits: &Vec>, by: usize) -> Vec> { + pub fn word_rotate(bits: &[AssignedCell], by: usize) -> Vec> { assert!(bits.len() == 32); let by = by % 32; bits.iter() diff --git a/taiga_halo2/src/circuit/vp_circuit.rs b/taiga_halo2/src/circuit/vp_circuit.rs index 3449d9e6..7615ceb1 100644 --- a/taiga_halo2/src/circuit/vp_circuit.rs +++ b/taiga_halo2/src/circuit/vp_circuit.rs @@ -147,8 +147,7 @@ impl Encoder for ValidityPredicatePublicInputs { impl<'a> Decoder<'a> for ValidityPredicatePublicInputs { fn decode(term: Term<'a>) -> NifResult { let val: Vec = Decoder::decode(term)?; - val.try_into() - .map_err(|_e| rustler::Error::Atom("failure to decode")) + Ok(val.into()) } } diff --git a/taiga_halo2/src/resource_encryption.rs b/taiga_halo2/src/resource_encryption.rs index 7e49a710..79427e4a 100644 --- a/taiga_halo2/src/resource_encryption.rs +++ b/taiga_halo2/src/resource_encryption.rs @@ -132,8 +132,8 @@ impl ResourcePlaintext { self.0.to_vec() } - pub fn padding(msg: &Vec) -> 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); @@ -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