diff --git a/ethereum/circuits/lib/src/misc/arrays.nr b/ethereum/circuits/lib/src/misc/arrays.nr index 7d021916..77bfa0f2 100644 --- a/ethereum/circuits/lib/src/misc/arrays.nr +++ b/ethereum/circuits/lib/src/misc/arrays.nr @@ -72,11 +72,3 @@ pub fn sub_array_equals( } result } - -pub fn slice_to_array(slice: [u8]) -> [u8; LENGTH] { - let mut array = [0; LENGTH]; - for i in 0..LENGTH { - array[i] = slice[i]; - } - array -} diff --git a/ethereum/circuits/lib/src/misc/bytes32.nr b/ethereum/circuits/lib/src/misc/bytes32.nr index 85dc6825..527fe837 100644 --- a/ethereum/circuits/lib/src/misc/bytes32.nr +++ b/ethereum/circuits/lib/src/misc/bytes32.nr @@ -1,4 +1,4 @@ -use crate::misc::arrays::{memcpy, slice_to_array}; +use crate::misc::arrays::memcpy; use crate::misc::types::Bytes32; pub fn address_to_bytes32(address: [u8; 20]) -> Bytes32 { @@ -11,5 +11,5 @@ pub fn address_to_bytes32(address: [u8; 20]) -> Bytes32 { pub fn field_to_bytes32(value: Field) -> [u8; 32] { let byte_slice = value.to_be_bytes(32); - slice_to_array(byte_slice) + byte_slice.as_array() }