Skip to content

Commit 7fb4361

Browse files
committed
test: regenerate contract-snapshots for v4-next
Re-runs the cargo-insta snapshot tests against the v4-next compiler and the v4-next aztec-nr / contract code, accepting the diffs: - compile_failure/authorization_selector_collision: one extra 'check_parent_traits_are_implemented: missing trait ID' diagnostic on v4-next's authorization.nr. - expand/avm_gadgets_test_contract: keccak_hash_300 doesn't exist on v4-next's avm_gadgets_test_contract. - expand/avm_test_contract: ordering / minor signature differences on v4-next's avm_test_contract.
1 parent e61be60 commit 7fb4361

3 files changed

Lines changed: 73 additions & 122 deletions

File tree

noir-projects/contract-snapshots/tests/snapshots/compile_failure/authorization_selector_collision/snapshots__stderr.snap

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ error: check_trait_impl_where_clause_matches_trait_where_clause: missing trait I
3838
│ ---------------- While running this function attribute
3939
4040

41+
error: check_parent_traits_are_implemented: missing trait ID
42+
┌─ <repo>/noir-projects/aztec-nr/aztec/src/macros/authorization.nr:23:16
43+
44+
23 │ let name = s.name();
45+
│ --------
46+
47+
┌─ src/main.nr:24:5
48+
49+
24 │ #[authorization]
50+
│ ---------------- While running this function attribute
51+
52+
4153
error: check_trait_impl_method_matches_declaration: missing trait impl
4254
┌─ <repo>/noir-projects/aztec-nr/aztec/src/macros/authorization.nr:42:16
4355
@@ -64,4 +76,4 @@ error: Selector collision detected between authorizations 'EventCollision8370082
6476
3: register_authorization
6577
at <repo>/noir-projects/aztec-nr/aztec/src/macros/authorization.nr:15:9
6678

67-
Aborting due to 5 previous errors
79+
Aborting due to 6 previous errors

noir-projects/contract-snapshots/tests/snapshots/expand/avm_gadgets_test_contract/snapshots__expanded.snap

Lines changed: 13 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
source: tests/snapshots.rs
33
expression: stdout
44
---
5+
56
use aztec::macros::aztec;
67
use aztec::macros::aztec;
78

@@ -12,10 +13,6 @@ contract AvmGadgetsTest {
1213
#[contract_library_method]
1314
fn keccak_hash(data: [u8; 10]) -> [u8; 32];
1415

15-
#[deprecated(deny, "Direct invocation of public functions is not supported. You attempted to call keccak_hash_300. See https://docs.aztec.network/errors/6")]
16-
#[contract_library_method]
17-
fn keccak_hash_300(data: [u8; 300]) -> [u8; 32];
18-
1916
#[deprecated(deny, "Direct invocation of public functions is not supported. You attempted to call keccak_hash_1400. See https://docs.aztec.network/errors/6")]
2017
#[contract_library_method]
2118
fn keccak_hash_1400(data: [u8; 1400]) -> [u8; 32];
@@ -159,12 +156,6 @@ contract AvmGadgetsTest {
159156
Self { target_contract: aztec::protocol::address::AztecAddress::zero()}
160157
}
161158

162-
pub fn sha256_hash_1536(self, data: [u8; 1536]) -> aztec::context::calls::PublicCall<16, 1536, [u8; 32]> {
163-
let serialized_params: [Field; 1536] = <[u8; 1536] as aztec::protocol::traits::Serialize>::serialize(data);
164-
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(373006257_Field);
165-
aztec::context::calls::PublicCall::<16, 1536, [u8; 32]>::new(self.target_contract, selector, "sha256_hash_1536", serialized_params)
166-
}
167-
168159
pub fn pedersen_hash_with_index(self, data: [Field; 10]) -> aztec::context::calls::PublicCall<24, 10, Field> {
169160
let serialized_params: [Field; 10] = <[Field; 10] as aztec::protocol::traits::Serialize>::serialize(data);
170161
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(3265405934_Field);
@@ -297,10 +288,10 @@ contract AvmGadgetsTest {
297288
aztec::context::calls::PublicCall::<16, 1400, [u8; 32]>::new(self.target_contract, selector, "keccak_hash_1400", serialized_params)
298289
}
299290

300-
pub fn keccak_hash_300(self, data: [u8; 300]) -> aztec::context::calls::PublicCall<15, 300, [u8; 32]> {
301-
let serialized_params: [Field; 300] = <[u8; 300] as aztec::protocol::traits::Serialize>::serialize(data);
302-
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(3065624740_Field);
303-
aztec::context::calls::PublicCall::<15, 300, [u8; 32]>::new(self.target_contract, selector, "keccak_hash_300", serialized_params)
291+
pub fn sha256_hash_1536(self, data: [u8; 1536]) -> aztec::context::calls::PublicCall<16, 1536, [u8; 32]> {
292+
let serialized_params: [Field; 1536] = <[u8; 1536] as aztec::protocol::traits::Serialize>::serialize(data);
293+
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(373006257_Field);
294+
aztec::context::calls::PublicCall::<16, 1536, [u8; 32]>::new(self.target_contract, selector, "sha256_hash_1536", serialized_params)
304295
}
305296

306297
pub fn offchain_receive(self, messages: BoundedVec<aztec::messages::processing::offchain::OffchainMessage, 16>) -> aztec::context::calls::UtilityCall<16, 321, ()> {
@@ -349,15 +340,6 @@ contract AvmGadgetsTest {
349340
}
350341

351342
impl CallSelf<aztec::context::PublicContext> {
352-
pub fn sha256_hash_1536(self, data: [u8; 1536]) -> [u8; 32] {
353-
let serialized_params: [Field; 1536 * 1] = <[u8; 1536] as aztec::protocol::traits::Serialize<N = 1536 * 1>>::serialize(data);
354-
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(373006257_Field);
355-
// Safety: comment added by `nargo expand`
356-
unsafe {
357-
aztec::context::calls::PublicCall::<16, 1536 * 1, [u8; 32]>::new(self.address, selector, "sha256_hash_1536", serialized_params).call(self.context)
358-
}
359-
}
360-
361343
pub fn pedersen_hash_with_index(self, data: [Field; 10]) -> Field {
362344
let serialized_params: [Field; 10 * 1] = <[Field; 10] as aztec::protocol::traits::Serialize<N = 10 * 1>>::serialize(data);
363345
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(3265405934_Field);
@@ -556,12 +538,12 @@ contract AvmGadgetsTest {
556538
}
557539
}
558540

559-
pub fn keccak_hash_300(self, data: [u8; 300]) -> [u8; 32] {
560-
let serialized_params: [Field; 300 * 1] = <[u8; 300] as aztec::protocol::traits::Serialize<N = 300 * 1>>::serialize(data);
561-
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(3065624740_Field);
541+
pub fn sha256_hash_1536(self, data: [u8; 1536]) -> [u8; 32] {
542+
let serialized_params: [Field; 1536 * 1] = <[u8; 1536] as aztec::protocol::traits::Serialize<N = 1536 * 1>>::serialize(data);
543+
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(373006257_Field);
562544
// Safety: comment added by `nargo expand`
563545
unsafe {
564-
aztec::context::calls::PublicCall::<15, 300 * 1, [u8; 32]>::new(self.address, selector, "keccak_hash_300", serialized_params).call(self.context)
546+
aztec::context::calls::PublicCall::<16, 1536 * 1, [u8; 32]>::new(self.address, selector, "sha256_hash_1536", serialized_params).call(self.context)
565547
}
566548
}
567549
}
@@ -577,15 +559,6 @@ contract AvmGadgetsTest {
577559
}
578560

579561
impl EnqueueSelf<&mut aztec::context::PrivateContext> {
580-
pub fn sha256_hash_1536(self, data: [u8; 1536]) {
581-
let serialized_params: [Field; 1536 * 1] = <[u8; 1536] as aztec::protocol::traits::Serialize<N = 1536 * 1>>::serialize(data);
582-
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(373006257_Field);
583-
let calldata: [Field; 1 + (1536 * 1)] = [<aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::ToField>::to_field(selector)].concat(serialized_params);
584-
let calldata_hash: Field = aztec::hash::hash_calldata_array(calldata);
585-
aztec::oracle::execution_cache::store(calldata, calldata_hash);
586-
self.context.call_public_function_with_calldata_hash(self.address, calldata_hash, false, false);
587-
}
588-
589562
pub fn pedersen_hash_with_index(self, data: [Field; 10]) {
590563
let serialized_params: [Field; 10 * 1] = <[Field; 10] as aztec::protocol::traits::Serialize<N = 10 * 1>>::serialize(data);
591564
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(3265405934_Field);
@@ -784,10 +757,10 @@ contract AvmGadgetsTest {
784757
self.context.call_public_function_with_calldata_hash(self.address, calldata_hash, false, false);
785758
}
786759

787-
pub fn keccak_hash_300(self, data: [u8; 300]) {
788-
let serialized_params: [Field; 300 * 1] = <[u8; 300] as aztec::protocol::traits::Serialize<N = 300 * 1>>::serialize(data);
789-
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(3065624740_Field);
790-
let calldata: [Field; 1 + (300 * 1)] = [<aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::ToField>::to_field(selector)].concat(serialized_params);
760+
pub fn sha256_hash_1536(self, data: [u8; 1536]) {
761+
let serialized_params: [Field; 1536 * 1] = <[u8; 1536] as aztec::protocol::traits::Serialize<N = 1536 * 1>>::serialize(data);
762+
let selector: aztec::protocol::abis::function_selector::FunctionSelector = <aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::FromField>::from_field(373006257_Field);
763+
let calldata: [Field; 1 + (1536 * 1)] = [<aztec::protocol::abis::function_selector::FunctionSelector as aztec::protocol::traits::ToField>::to_field(selector)].concat(serialized_params);
791764
let calldata_hash: Field = aztec::hash::hash_calldata_array(calldata);
792765
aztec::oracle::execution_cache::store(calldata, calldata_hash);
793766
self.context.call_public_function_with_calldata_hash(self.address, calldata_hash, false, false);
@@ -815,13 +788,6 @@ contract AvmGadgetsTest {
815788
let return_value: [Field; 32 * 1] = <[u8; 32] as aztec::protocol::traits::Serialize<N = 32 * 1>>::serialize(__aztec_nr_internals__keccak_hash(arg0));
816789
aztec::oracle::avm::avm_return(return_value.as_vector());
817790
};
818-
if selector == 3065624740_Field {
819-
let input_calldata: [Field; 300 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 300] as aztec::protocol::traits::Serialize<N = 300 * 1>>::N);
820-
let mut reader: aztec::protocol::utils::reader::Reader<300 * 1> = aztec::protocol::utils::reader::Reader::<300 * 1>::new(input_calldata);
821-
let arg0: [u8; 300] = <[u8; 300] as aztec::protocol::traits::Deserialize<N = 300 * 1>>::stream_deserialize(&mut reader);
822-
let return_value: [Field; 32 * 1] = <[u8; 32] as aztec::protocol::traits::Serialize<N = 32 * 1>>::serialize(__aztec_nr_internals__keccak_hash_300(arg0));
823-
aztec::oracle::avm::avm_return(return_value.as_vector());
824-
};
825791
if selector == 372001522_Field {
826792
let input_calldata: [Field; 1400 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 1400] as aztec::protocol::traits::Serialize<N = 1400 * 1>>::N);
827793
let mut reader: aztec::protocol::utils::reader::Reader<1400 * 1> = aztec::protocol::utils::reader::Reader::<1400 * 1>::new(input_calldata);
@@ -987,10 +953,6 @@ contract AvmGadgetsTest {
987953
pub data: [u8; 1400],
988954
}
989955
990-
pub struct keccak_hash_300_parameters {
991-
pub data: [u8; 300],
992-
}
993-
994956
pub struct keccak_hash_parameters {
995957
pub data: [u8; 10],
996958
}
@@ -1087,12 +1049,6 @@ contract AvmGadgetsTest {
10871049
return_type: [u8; 32],
10881050
}
10891051
1090-
#[abi(functions)]
1091-
pub struct keccak_hash_300_abi {
1092-
parameters: keccak_hash_300_parameters,
1093-
return_type: [u8; 32],
1094-
}
1095-
10961052
#[abi(functions)]
10971053
pub struct keccak_hash_abi {
10981054
parameters: keccak_hash_parameters,
@@ -1273,24 +1229,6 @@ contract AvmGadgetsTest {
12731229
}
12741230
}
12751231
1276-
unconstrained fn __aztec_nr_internals__keccak_hash_300(data: [u8; 300]) -> pub [u8; 32] {
1277-
let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf<aztec::context::PublicContext>, CallSelfStatic<aztec::context::PublicContext>, CallInternal<aztec::context::PublicContext>> = {
1278-
let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field {
1279-
let serialized_args: [Field; 300 * 1] = aztec::oracle::avm::calldata_copy(1_u32, <[u8; 300] as aztec::protocol::traits::Serialize<N = 300 * 1>>::N);
1280-
aztec::hash::hash_args(serialized_args)
1281-
});
1282-
let storage: () = ();
1283-
let self_address: aztec::protocol::address::AztecAddress = context.this_address();
1284-
let call_self: CallSelf<aztec::context::PublicContext> = CallSelf::<aztec::context::PublicContext> { address: self_address, context: context};
1285-
let call_self_static: CallSelfStatic<aztec::context::PublicContext> = CallSelfStatic::<aztec::context::PublicContext> { address: self_address, context: context};
1286-
let internal: CallInternal<aztec::context::PublicContext> = CallInternal::<aztec::context::PublicContext> { context: context};
1287-
aztec::contract_self::contract_self_public::ContractSelfPublic::<(), CallSelf<aztec::context::PublicContext>, CallSelfStatic<aztec::context::PublicContext>, CallInternal<aztec::context::PublicContext>>::new(context, storage, call_self, call_self_static, internal)
1288-
};
1289-
{
1290-
keccak256::keccak256(data, data.len())
1291-
}
1292-
}
1293-
12941232
unconstrained fn __aztec_nr_internals__pedersen_hash(data: [Field; 10]) -> pub Field {
12951233
let mut self: aztec::contract_self::contract_self_public::ContractSelfPublic<(), CallSelf<aztec::context::PublicContext>, CallSelfStatic<aztec::context::PublicContext>, CallInternal<aztec::context::PublicContext>> = {
12961234
let context: aztec::context::PublicContext = aztec::context::PublicContext::new(|| -> Field {

0 commit comments

Comments
 (0)