From f435c392ac5e9e84b9eff4d182e4f6d571dbb4c5 Mon Sep 17 00:00:00 2001 From: Tom French Date: Sat, 11 Jan 2025 12:43:17 +0000 Subject: [PATCH] . --- .../src/main.nr | 9 +++++---- .../src/test/utils.nr | 17 ++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr index ba8478b6f46..a237e9a0bd0 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr @@ -48,7 +48,7 @@ contract ContractClassRegisterer { // TODO: We should be able to remove public_bytecode_commitment from the input if it's calculated in this function // docs:start:pop_capsule let packed_public_bytecode: [Field; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS] = - pop_capsule(); + unsafe { pop_capsule() }; // docs:end:pop_capsule // First field element contains the length of the bytecode let bytecode_length_in_bytes: u32 = packed_public_bytecode[0] as u32; @@ -121,7 +121,7 @@ contract ContractClassRegisterer { function_data: InnerPrivateFunction, ) { let private_bytecode: [Field; MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS] = - pop_capsule(); + unsafe { pop_capsule() }; let event = ClassPrivateFunctionBroadcasted { contract_class_id, @@ -162,7 +162,7 @@ contract ContractClassRegisterer { function_data: InnerUnconstrainedFunction, ) { let unconstrained_bytecode: [Field; MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS] = - pop_capsule(); + unsafe { pop_capsule() }; let event = ClassUnconstrainedFunctionBroadcasted { contract_class_id, artifact_metadata_hash, @@ -203,7 +203,8 @@ contract ContractClassRegisterer { // cannot prove non-registration. Therefore, it is possible that a malicious oracle might prevent sequencers // from including transactions with calls to certain badly-broadcasted contracts. // TODO(#8978): review correctness - let log_hash = emit_contract_class_unencrypted_log_private(contract_address, log, counter); + let log_hash = + unsafe { emit_contract_class_unencrypted_log_private(contract_address, log, counter) }; // 40 = addr (32) + raw log len (4) + processed log len (4) context.contract_class_logs_hashes.push( diff --git a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/test/utils.nr b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/test/utils.nr index 51082b188aa..92917a7b023 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/test/utils.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/test/utils.nr @@ -1,21 +1,16 @@ -use dep::aztec::{ - note::{note_getter::{MAX_NOTES_PER_PAGE, view_notes}, note_viewer_options::NoteViewerOptions}, - prelude::AztecAddress, - protocol_types::storage::map::derive_storage_slot_in_map, - test::helpers::test_environment::TestEnvironment, -}; +use dep::aztec::{prelude::AztecAddress, test::helpers::test_environment::TestEnvironment}; use crate::EasyPrivateVoting; pub fn setup() -> (&mut TestEnvironment, AztecAddress, AztecAddress) { - let mut env = TestEnvironment::new(); + let mut env = unsafe { TestEnvironment::new() }; - let admin = env.create_account(); + let admin = unsafe { env.create_account() }; let initializer_call_interface = EasyPrivateVoting::interface().constructor(admin); - let voting_contract = env.deploy_self("EasyPrivateVoting").with_public_void_initializer( - initializer_call_interface, - ); + let voting_contract = unsafe { + env.deploy_self("EasyPrivateVoting").with_public_void_initializer(initializer_call_interface) + }; // std::println(voting_contract); (&mut env, voting_contract.to_address(), admin) }