From 625f39e389fb87db4a23de130b54f17f07ba8284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Thu, 18 Jul 2024 14:33:21 +0000 Subject: [PATCH 1/2] chore: remove more aztec-nr warnings (numerics and unused variables) --- noir-projects/aztec-nr/authwit/src/auth.nr | 4 +- .../aztec-nr/authwit/src/auth_witness.nr | 4 +- .../aztec/src/context/public_context.nr | 52 +++++++++---------- .../aztec/src/encrypted_logs/incoming_body.nr | 6 +-- .../aztec/src/encrypted_logs/payload.nr | 2 +- .../aztec-nr/aztec/src/note/note_emission.nr | 4 +- .../aztec-nr/aztec/src/note/utils.nr | 2 +- .../aztec-nr/aztec/src/oracle/encryption.nr | 2 +- .../aztec-nr/aztec/src/oracle/keys.nr | 2 +- .../aztec-nr/aztec/src/oracle/logs_traits.nr | 2 +- .../src/state_vars/private_mutable/test.nr | 9 ++-- .../aztec/src/test/helpers/cheatcodes.nr | 48 ++++++++--------- .../src/test/helpers/test_environment.nr | 28 +++++----- .../aztec/src/test/mocks/mock_note.nr | 6 +-- .../src/compressed_string.nr | 10 ++-- 15 files changed, 89 insertions(+), 92 deletions(-) diff --git a/noir-projects/aztec-nr/authwit/src/auth.nr b/noir-projects/aztec-nr/authwit/src/auth.nr index de42feab354..c7220bb10bd 100644 --- a/noir-projects/aztec-nr/authwit/src/auth.nr +++ b/noir-projects/aztec-nr/authwit/src/auth.nr @@ -285,7 +285,7 @@ pub fn assert_inner_hash_valid_authwit_public(context: &mut PublicContext, on_be * @param args The arguments of the function that is being called */ // docs:start:compute_authwit_message_hash_from_call -pub fn compute_authwit_message_hash_from_call( +pub fn compute_authwit_message_hash_from_call( caller: AztecAddress, consumer: AztecAddress, chain_id: Field, @@ -307,7 +307,7 @@ pub fn compute_authwit_message_hash_from_call( * * @param args The arguments to hash */ -pub fn compute_inner_authwit_hash(args: [Field; N]) -> Field { +pub fn compute_inner_authwit_hash(args: [Field; N]) -> Field { pedersen_hash(args, GENERATOR_INDEX__AUTHWIT_INNER) } diff --git a/noir-projects/aztec-nr/authwit/src/auth_witness.nr b/noir-projects/aztec-nr/authwit/src/auth_witness.nr index 2efa77defea..a5d2474c633 100644 --- a/noir-projects/aztec-nr/authwit/src/auth_witness.nr +++ b/noir-projects/aztec-nr/authwit/src/auth_witness.nr @@ -1,5 +1,5 @@ #[oracle(getAuthWitness)] -unconstrained fn get_auth_witness_oracle(_message_hash: Field) -> [Field; N] {} +unconstrained fn get_auth_witness_oracle(_message_hash: Field) -> [Field; N] {} /** * Oracle wrapper to fetch an `auth_witness` for a given `message_hash` from the PXE. @@ -7,6 +7,6 @@ unconstrained fn get_auth_witness_oracle(_message_hash: Field) -> [Field; N] * @param message_hash The hash of the message for which the `auth_witness` is to be fetched. * @return The `auth_witness` for the given `message_hash` as Field array. */ -unconstrained pub fn get_auth_witness(message_hash: Field) -> [Field; N] { +unconstrained pub fn get_auth_witness(message_hash: Field) -> [Field; N] { get_auth_witness_oracle(message_hash) } diff --git a/noir-projects/aztec-nr/aztec/src/context/public_context.nr b/noir-projects/aztec-nr/aztec/src/context/public_context.nr index 7a5267c7b74..32afffb88ae 100644 --- a/noir-projects/aztec-nr/aztec/src/context/public_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/public_context.nr @@ -15,19 +15,19 @@ impl PublicContext { PublicContext { inputs } } - pub fn emit_unencrypted_log(&mut self, log: T) where T: Serialize { + pub fn emit_unencrypted_log(_self: &mut Self, log: T) where T: Serialize { emit_unencrypted_log(Serialize::serialize(log).as_slice()); } - pub fn note_hash_exists(self, note_hash: Field, leaf_index: Field) -> bool { + pub fn note_hash_exists(_self: Self, note_hash: Field, leaf_index: Field) -> bool { note_hash_exists(note_hash, leaf_index) == 1 } - pub fn l1_to_l2_msg_exists(self, msg_hash: Field, msg_leaf_index: Field) -> bool { + pub fn l1_to_l2_msg_exists(_self: Self, msg_hash: Field, msg_leaf_index: Field) -> bool { l1_to_l2_msg_exists(msg_hash, msg_leaf_index) == 1 } - fn nullifier_exists(self, unsiloed_nullifier: Field, address: AztecAddress) -> bool { + fn nullifier_exists(_self: Self, unsiloed_nullifier: Field, address: AztecAddress) -> bool { nullifier_exists(unsiloed_nullifier, address.to_field()) == 1 } @@ -60,12 +60,12 @@ impl PublicContext { self.push_nullifier(nullifier, 0); } - fn message_portal(&mut self, recipient: EthAddress, content: Field) { + fn message_portal(_self: &mut Self, recipient: EthAddress, content: Field) { send_l2_to_l1_msg(recipient, content); } fn call_public_function( - self: &mut Self, + _self: &mut Self, contract_address: AztecAddress, function_selector: FunctionSelector, args: [Field], @@ -85,7 +85,7 @@ impl PublicContext { } fn static_call_public_function( - self: &mut Self, + _self: &mut Self, contract_address: AztecAddress, function_selector: FunctionSelector, args: [Field], @@ -103,65 +103,65 @@ impl PublicContext { } fn delegate_call_public_function( - self: &mut Self, - contract_address: AztecAddress, - function_selector: FunctionSelector, - args: [Field] + _self: &mut Self, + _contract_address: AztecAddress, + _function_selector: FunctionSelector, + _args: [Field] ) -> FunctionReturns { assert(false, "'delegate_call_public_function' not implemented!"); FunctionReturns::new([0; RETURNS_COUNT]) } - fn push_note_hash(&mut self, note_hash: Field) { + fn push_note_hash(_self: &mut Self, note_hash: Field) { emit_note_hash(note_hash); } - fn push_nullifier(&mut self, nullifier: Field, _nullified_commitment: Field) { + fn push_nullifier(_self: &mut Self, nullifier: Field, _nullified_commitment: Field) { // Cannot nullify pending commitments in AVM, so `nullified_commitment` is not used emit_nullifier(nullifier); } - fn this_address(self) -> AztecAddress { + fn this_address(_self: Self) -> AztecAddress { address() } - pub fn storage_address(self) -> AztecAddress { + pub fn storage_address(_self: Self) -> AztecAddress { storage_address() } - fn msg_sender(self) -> AztecAddress { + fn msg_sender(_self: Self) -> AztecAddress { sender() } - fn selector(self) -> FunctionSelector { + fn selector(_self: Self) -> FunctionSelector { FunctionSelector::from_u32(function_selector()) } fn get_args_hash(self) -> Field { self.inputs.args_hash } - fn transaction_fee(self) -> Field { + fn transaction_fee(_self: Self) -> Field { transaction_fee() } - fn chain_id(self) -> Field { + fn chain_id(_self: Self) -> Field { chain_id() } - fn version(self) -> Field { + fn version(_self: Self) -> Field { version() } - fn block_number(self) -> Field { + fn block_number(_self: Self) -> Field { block_number() } - fn timestamp(self) -> u64 { + fn timestamp(_self: Self) -> u64 { timestamp() } - pub fn fee_per_l2_gas(self) -> Field { + pub fn fee_per_l2_gas(_self: Self) -> Field { fee_per_l2_gas() } - pub fn fee_per_da_gas(self) -> Field { + pub fn fee_per_da_gas(_self: Self) -> Field { fee_per_da_gas() } - fn l2_gas_left(self) -> Field { + fn l2_gas_left(_self: Self) -> Field { l2_gas_left() } - fn da_gas_left(self) -> Field { + fn da_gas_left(_self: Self) -> Field { da_gas_left() } diff --git a/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr b/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr index 17bf123833b..6b25525a7ae 100644 --- a/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr +++ b/noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr @@ -60,7 +60,7 @@ mod test { global ADDRESS_NOTE_BYTES_LEN = 32 * 3 + 64; impl NoteInterface for AddressNote { - fn compute_note_content_hash(self) -> Field {1} + fn compute_note_content_hash(_self: Self) -> Field {1} fn get_note_type_id() -> Field { 1 @@ -70,11 +70,11 @@ mod test { fn set_header(&mut self, header: NoteHeader) {self.header = header; } - fn compute_note_hash_and_nullifier(self, context: &mut PrivateContext) -> (Field, Field) { + fn compute_note_hash_and_nullifier(_self: Self, _context: &mut PrivateContext) -> (Field, Field) { (1, 1) } - fn compute_note_hash_and_nullifier_without_context(self) -> (Field, Field) {(1,1)} + fn compute_note_hash_and_nullifier_without_context(_self: Self) -> (Field, Field) {(1,1)} fn serialize_content(self) -> [Field; ADDRESS_NOTE_LEN] { [self.address.to_field(), self.owner.to_field(), self.randomness]} diff --git a/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr b/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr index 5d6fc89be15..4c7601db80c 100644 --- a/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr +++ b/noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr @@ -166,7 +166,7 @@ mod test { let note = MockNoteBuilder::new(note_value).contract_address(contract_address).storage_slot(storage_slot).build(); let eph_sk = 0x1358d15019d4639393d62b97e1588c095957ce74a1c32d6ec7d62fe6705d9538; - OracleMock::mock("getRandomField").returns(eph_sk); + let _ = OracleMock::mock("getRandomField").returns(eph_sk); let recipient = AztecAddress::from_field(0x10ee41ee4b62703b16f61e03cb0d88c4b306a9eb4a6ceeb2aff13428541689a2); diff --git a/noir-projects/aztec-nr/aztec/src/note/note_emission.nr b/noir-projects/aztec-nr/aztec/src/note/note_emission.nr index e9391f50207..dd2622ff5eb 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_emission.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_emission.nr @@ -15,7 +15,7 @@ impl NoteEmission { _emit(self); } - pub fn discard(self) {} + pub fn discard(_self: Self) {} } /** @@ -41,5 +41,5 @@ impl OuterNoteEmission { } } - pub fn discard(self) {} + pub fn discard(_self: Self) {} } diff --git a/noir-projects/aztec-nr/aztec/src/note/utils.nr b/noir-projects/aztec-nr/aztec/src/note/utils.nr index 45326beaf8c..dfe87cc4346 100644 --- a/noir-projects/aztec-nr/aztec/src/note/utils.nr +++ b/noir-projects/aztec-nr/aztec/src/note/utils.nr @@ -16,7 +16,7 @@ pub fn compute_inner_note_hash_from_preimage(storage_slot: Field, note_content_h ) } -fn compute_inner_note_hash(note: Note) -> Field where Note: NoteInterface { +pub fn compute_inner_note_hash(note: Note) -> Field where Note: NoteInterface { let header = note.get_header(); let note_hash = note.compute_note_content_hash(); diff --git a/noir-projects/aztec-nr/aztec/src/oracle/encryption.nr b/noir-projects/aztec-nr/aztec/src/oracle/encryption.nr index 3208c4396a8..cc9969fa7c7 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/encryption.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/encryption.nr @@ -1,5 +1,5 @@ #[oracle(aes128Encrypt)] -pub fn aes128_encrypt_oracle( +unconstrained pub fn aes128_encrypt_oracle( input: [u8; N], iv: [u8; 16], key: [u8; 16] diff --git a/noir-projects/aztec-nr/aztec/src/oracle/keys.nr b/noir-projects/aztec-nr/aztec/src/oracle/keys.nr index 92403bf9eae..3955cce4832 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/keys.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/keys.nr @@ -8,7 +8,7 @@ unconstrained fn get_public_keys_and_partial_address_oracle_wrapper(address: Azt get_public_keys_and_partial_address_oracle(address) } -fn get_public_keys_and_partial_address(address: AztecAddress) -> (PublicKeys, PartialAddress) { +pub fn get_public_keys_and_partial_address(address: AztecAddress) -> (PublicKeys, PartialAddress) { let result = get_public_keys_and_partial_address_oracle_wrapper(address); let keys = PublicKeys { diff --git a/noir-projects/aztec-nr/aztec/src/oracle/logs_traits.nr b/noir-projects/aztec-nr/aztec/src/oracle/logs_traits.nr index 2bf1bc02f82..cd27ead6498 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/logs_traits.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/logs_traits.nr @@ -360,7 +360,7 @@ impl ToBytesForUnencryptedLog for str< fn to_be_bytes_arr(self) -> [u8; N] { str_to_be_bytes_arr(self) } - fn output_bytes(self) -> [u8; M] { + fn output_bytes(_self: Self) -> [u8; M] { [0; M] } } diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr index a707f3a4d91..05fd51045af 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable/test.nr @@ -1,7 +1,7 @@ use dep::protocol_types::{address::AztecAddress, point::Point}; use crate::{context::PrivateContext, state_vars::private_mutable::PrivateMutable}; use crate::test::{mocks::mock_note::MockNote, helpers::{cheatcodes, test_environment::TestEnvironment}}; -use std::{unsafe::zeroed, test::OracleMock}; +use std::test::OracleMock; global storage_slot = 17; @@ -13,7 +13,7 @@ fn in_private(env: &mut TestEnvironment) -> PrivateMutable Field {} +unconstrained fn oracle_get_chain_id() -> Field {} #[oracle(getVersion)] -fn oracle_get_version() -> Field {} +unconstrained fn oracle_get_version() -> Field {} #[oracle(getContractAddress)] -fn oracle_get_contract_address() -> AztecAddress {} +unconstrained fn oracle_get_contract_address() -> AztecAddress {} #[oracle(setContractAddress)] -fn oracle_set_contract_address(address: AztecAddress) {} +unconstrained fn oracle_set_contract_address(address: AztecAddress) {} #[oracle(getBlockNumber)] -fn oracle_get_block_number() -> u32 {} +unconstrained fn oracle_get_block_number() -> u32 {} #[oracle(advanceBlocksBy)] -fn oracle_advance_blocks_by(blocks: u32) {} +unconstrained fn oracle_advance_blocks_by(blocks: u32) {} #[oracle(getPrivateContextInputs)] -fn oracle_get_private_context_inputs(historical_block_number: u32) -> PrivateContextInputs {} +unconstrained fn oracle_get_private_context_inputs(historical_block_number: u32) -> PrivateContextInputs {} #[oracle(getPublicContextInputs)] -fn oracle_get_public_context_inputs() -> PublicContextInputs {} +unconstrained fn oracle_get_public_context_inputs() -> PublicContextInputs {} #[oracle(deploy)] -fn oracle_deploy( +unconstrained fn oracle_deploy( path: str, initializer: str, args: [Field], @@ -158,42 +158,42 @@ fn oracle_deploy( ) -> [Field; CONTRACT_INSTANCE_LENGTH] {} #[oracle(directStorageWrite)] -fn direct_storage_write_oracle( +unconstrained fn direct_storage_write_oracle( _contract_address: AztecAddress, _storage_slot: Field, _values: [Field; N] ) -> [Field; N] {} #[oracle(createAccount)] -fn oracle_create_account() -> TestAccount {} +unconstrained fn oracle_create_account() -> TestAccount {} #[oracle(addAccount)] -fn oracle_add_account(secret: Field, partial_address: PartialAddress) -> TestAccount {} +unconstrained fn oracle_add_account(secret: Field, partial_address: PartialAddress) -> TestAccount {} #[oracle(deriveKeys)] -fn oracle_derive_keys(secret: Field) -> PublicKeys {} +unconstrained fn oracle_derive_keys(secret: Field) -> PublicKeys {} #[oracle(getMsgSender)] -fn oracle_get_msg_sender() -> AztecAddress {} +unconstrained fn oracle_get_msg_sender() -> AztecAddress {} #[oracle(setMsgSender)] -fn oracle_set_msg_sender(msg_sender: AztecAddress) {} +unconstrained fn oracle_set_msg_sender(msg_sender: AztecAddress) {} #[oracle(getSideEffectsCounter)] -fn oracle_get_side_effects_counter() -> u32 {} +unconstrained fn oracle_get_side_effects_counter() -> u32 {} #[oracle(addAuthWitness)] -fn orable_add_authwit(address: AztecAddress, message_hash: Field) {} +unconstrained fn orable_add_authwit(address: AztecAddress, message_hash: Field) {} #[oracle(assertPublicCallFails)] -fn oracle_assert_public_call_fails( +unconstrained fn oracle_assert_public_call_fails( target_address: AztecAddress, function_selector: FunctionSelector, args: [Field] ) {} #[oracle(assertPrivateCallFails)] -fn oracle_assert_private_call_fails( +unconstrained fn oracle_assert_private_call_fails( target_address: AztecAddress, function_selector: FunctionSelector, argsHash: Field, @@ -203,13 +203,13 @@ fn oracle_assert_private_call_fails( ) {} #[oracle(addNullifiers)] -fn oracle_add_nullifiers(contractAddress: AztecAddress, nullifiers: [Field]) {} +unconstrained fn oracle_add_nullifiers(contractAddress: AztecAddress, nullifiers: [Field]) {} #[oracle(addNoteHashes)] -fn oracle_add_note_hashes(contractAddress: AztecAddress, inner_note_hashes: [Field]) {} +unconstrained fn oracle_add_note_hashes(contractAddress: AztecAddress, inner_note_hashes: [Field]) {} #[oracle(getFunctionSelector)] -fn oracle_get_function_selector() -> FunctionSelector {} +unconstrained fn oracle_get_function_selector() -> FunctionSelector {} #[oracle(setFunctionSelector)] -fn oracle_set_function_selector(selector: FunctionSelector) {} +unconstrained fn oracle_set_function_selector(selector: FunctionSelector) {} diff --git a/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr b/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr index 35df950bc50..159c2e82e5d 100644 --- a/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr +++ b/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr @@ -26,15 +26,15 @@ impl TestEnvironment { Self {} } - fn block_number(self) -> u32 { + fn block_number(_self: Self) -> u32 { cheatcodes::get_block_number() } - fn contract_address(self) -> AztecAddress { + fn contract_address(_self: Self) -> AztecAddress { cheatcodes::get_contract_address() } - fn impersonate(self, address: AztecAddress) { + fn impersonate(_self: Self, address: AztecAddress) { cheatcodes::set_contract_address(address) } @@ -43,11 +43,11 @@ impl TestEnvironment { self.advance_block_by(difference); } - fn advance_block_by(&mut self, blocks: u32) { + fn advance_block_by(_self: &mut Self, blocks: u32) { cheatcodes::advance_blocks_by(blocks); } - fn public(self) -> PublicContext { + fn public(_self: Self) -> PublicContext { let mut inputs = cheatcodes::get_public_context_inputs(); PublicContext::new(inputs) } @@ -57,7 +57,7 @@ impl TestEnvironment { } // unconstrained is a key word, so we mis-spell purposefully here, like we do with contrakt - fn unkonstrained(self) -> UnconstrainedContext { + fn unkonstrained(_self: Self) -> UnconstrainedContext { UnconstrainedContext::new() } @@ -71,7 +71,7 @@ impl TestEnvironment { PrivateContext::new(inputs, 0) } - fn create_account(self) -> AztecAddress { + fn create_account(_self: Self) -> AztecAddress { let test_account = cheatcodes::create_account(); let address = test_account.address; let keys = test_account.keys; @@ -121,12 +121,12 @@ impl TestEnvironment { address } - fn deploy(self, path: str) -> Deployer { + fn deploy(_self: Self, path: str) -> Deployer { Deployer { path, public_keys_hash: 0 } } fn call_private( - self, + _self: Self, call_interface: C ) -> T where C: CallInterface, T: Deserialize { let original_fn = call_interface.get_original(); @@ -148,7 +148,7 @@ impl TestEnvironment { } fn call_private_void( - self, + _self: Self, call_interface: C ) where C: CallInterface { let original_fn = call_interface.get_original(); @@ -170,7 +170,7 @@ impl TestEnvironment { } fn call_public( - self, + _self: Self, call_interface: C ) -> T where C: CallInterface { let original_fn = call_interface.get_original(); @@ -195,7 +195,7 @@ impl TestEnvironment { } fn assert_public_call_fails( - self, + _self: Self, call_interface: C ) where C: CallInterface { cheatcodes::assert_public_call_fails( @@ -206,7 +206,7 @@ impl TestEnvironment { } fn assert_private_call_fails( - self, + _self: Self, call_interface: C ) where C: CallInterface { cheatcodes::assert_private_call_fails( @@ -220,7 +220,7 @@ impl TestEnvironment { } pub fn store_note_in_cache( - self, + _self: Self, note: &mut Note, storage_slot: Field, contract_address: AztecAddress diff --git a/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr b/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr index eca9c30826f..f5dd8c400c6 100644 --- a/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr +++ b/noir-projects/aztec-nr/aztec/src/test/mocks/mock_note.nr @@ -23,7 +23,7 @@ impl NoteInterface for MockNote { } } - fn compute_note_content_hash(self) -> Field { + fn compute_note_content_hash(_self: Self) -> Field { 0 } @@ -39,11 +39,11 @@ impl NoteInterface for MockNote { 0 } - fn compute_note_hash_and_nullifier(self, _context: &mut PrivateContext) -> (Field, Field) { + fn compute_note_hash_and_nullifier(_self: Self, _context: &mut PrivateContext) -> (Field, Field) { (0, 0) } - fn compute_note_hash_and_nullifier_without_context(self) -> (Field, Field) { + fn compute_note_hash_and_nullifier_without_context(_self: Self) -> (Field, Field) { (0, 0) } diff --git a/noir-projects/aztec-nr/compressed-string/src/compressed_string.nr b/noir-projects/aztec-nr/compressed-string/src/compressed_string.nr index f67c46e8cb5..d73d024a8b1 100644 --- a/noir-projects/aztec-nr/compressed-string/src/compressed_string.nr +++ b/noir-projects/aztec-nr/compressed-string/src/compressed_string.nr @@ -4,11 +4,11 @@ use dep::aztec::protocol_types::{utils::field::field_from_bytes, traits::{Eq, Se // Compresses M bytes into N fields. // Can be used for longer strings that don't fit in a single field. // Each field can store 31 characters, so N should be M/31 rounded up. -struct CompressedString { +struct CompressedString { value: [Field; N] } -impl CompressedString { +impl CompressedString { pub fn from_string(input_string: str) -> Self { let mut fields = [0; N]; let byts = input_string.as_bytes(); @@ -46,20 +46,20 @@ impl CompressedString { } } -impl Eq for CompressedString { +impl Eq for CompressedString { fn eq(self, other: CompressedString) -> bool { self.value == other.value } } -impl Serialize for CompressedString { +impl Serialize for CompressedString { fn serialize(self) -> [Field; N] { self.value } } -impl Deserialize for CompressedString { +impl Deserialize for CompressedString { fn deserialize(input: [Field; N]) -> Self { Self { value: input } } From eaa9006bb8cb01741c91aa10dee1098e320f8e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Thu, 18 Jul 2024 14:36:07 +0000 Subject: [PATCH 2/2] add proto circuit file --- .../crates/types/src/tests/merkle_tree_utils.nr | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/tests/merkle_tree_utils.nr b/noir-projects/noir-protocol-circuits/crates/types/src/tests/merkle_tree_utils.nr index e7bdbc19917..8ba25199d3f 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/tests/merkle_tree_utils.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/tests/merkle_tree_utils.nr @@ -160,9 +160,7 @@ impl u32 { - // Silence warning for unused self, pending proper fix. - let _ = self; + pub fn get_next_available_index(_self: Self) -> u32 { SUBTREE_ITEMS } }