From 948310a03fd5639239f1df0ec06f95ebbe6dd03e Mon Sep 17 00:00:00 2001 From: benesjan Date: Mon, 30 Oct 2023 11:03:17 +0000 Subject: [PATCH] no camel case in test contract --- .../import_test_contract/src/main.nr | 16 ++-- .../contracts/test_contract/src/interface.nr | 76 +++++++++---------- .../src/contracts/test_contract/src/main.nr | 60 +++++++-------- 3 files changed, 76 insertions(+), 76 deletions(-) diff --git a/yarn-project/noir-contracts/src/contracts/import_test_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/import_test_contract/src/main.nr index 11247b403b6..599a28218fb 100644 --- a/yarn-project/noir-contracts/src/contracts/import_test_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/import_test_contract/src/main.nr @@ -32,15 +32,15 @@ contract ImportTest { true, 1 as u32, [1, 2], - AStructTestCodeGenStruct { amount: 1, secretHash: 2 }, + AStructTestCodeGenStruct { amount: 1, secret_hash: 2 }, ADeepStructTestCodeGenStruct { - aField: 1, - aBool: true, - aNote: ANoteADeepStructTestCodeGenStruct { amount: 1, secretHash: 2 }, - manyNotes: [ - ManyNotesADeepStructTestCodeGenStruct { amount: 1, secretHash: 2 }, - ManyNotesADeepStructTestCodeGenStruct { amount: 1, secretHash: 2 }, - ManyNotesADeepStructTestCodeGenStruct { amount: 1, secretHash: 2 }, + a_field: 1, + a_bool: true, + a_note: ANoteADeepStructTestCodeGenStruct { amount: 1, secret_hash: 2 }, + many_notes: [ + ManyNotesADeepStructTestCodeGenStruct { amount: 1, secret_hash: 2 }, + ManyNotesADeepStructTestCodeGenStruct { amount: 1, secret_hash: 2 }, + ManyNotesADeepStructTestCodeGenStruct { amount: 1, secret_hash: 2 }, ] } ); diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr b/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr index 66b6bd143d4..589fc69f397 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr +++ b/yarn-project/noir-contracts/src/contracts/test_contract/src/interface.nr @@ -6,24 +6,24 @@ use dep::aztec::constants_gen::RETURN_VALUES_LENGTH; struct AStructTestCodeGenStruct { amount: Field, - secretHash: Field, + secret_hash: Field, } struct ADeepStructTestCodeGenStruct { - aField: Field, - aBool: bool, - aNote: ANoteADeepStructTestCodeGenStruct, - manyNotes: [ManyNotesADeepStructTestCodeGenStruct;3], + a_field: Field, + a_bool: bool, + a_note: ANoteADeepStructTestCodeGenStruct, + many_notes: [ManyNotesADeepStructTestCodeGenStruct;3], } struct ANoteADeepStructTestCodeGenStruct { amount: Field, - secretHash: Field, + secret_hash: Field, } struct ManyNotesADeepStructTestCodeGenStruct { amount: Field, - secretHash: Field, + secret_hash: Field, } @@ -83,11 +83,11 @@ impl TestPrivateContextInterface { self, context: &mut PrivateContext, amount: Field, - secretHash: Field + secret_hash: Field ) { let mut serialized_args = [0; 2]; serialized_args[0] = amount; - serialized_args[1] = secretHash; + serialized_args[1] = secret_hash; context.call_public_function(self.address, 0x9749ca06, serialized_args) } @@ -97,11 +97,11 @@ impl TestPrivateContextInterface { self, context: &mut PrivateContext, amount: Field, - secretHash: Field + secret_hash: Field ) { let mut serialized_args = [0; 2]; serialized_args[0] = amount; - serialized_args[1] = secretHash; + serialized_args[1] = secret_hash; context.call_public_function(self.address, 0xdf02db8d, serialized_args) } @@ -200,31 +200,31 @@ impl TestPrivateContextInterface { pub fn test_code_gen( self, context: &mut PrivateContext, - aField: Field, - aBool: bool, - aNumber: u32, - anArray: [Field;2], - aStruct: AStructTestCodeGenStruct, - aDeepStruct: ADeepStructTestCodeGenStruct + a_field: Field, + a_bool: bool, + a_number: u32, + an_array: [Field;2], + a_struct: AStructTestCodeGenStruct, + a_deep_struct: ADeepStructTestCodeGenStruct ) -> [Field; RETURN_VALUES_LENGTH] { let mut serialized_args = [0; 17]; - serialized_args[0] = aField; - serialized_args[1] = aBool as Field; - serialized_args[2] = aNumber as Field; - serialized_args[3] = anArray[0]; - serialized_args[4] = anArray[1]; - serialized_args[5] = aStruct.amount; - serialized_args[6] = aStruct.secretHash; - serialized_args[7] = aDeepStruct.aField; - serialized_args[8] = aDeepStruct.aBool as Field; - serialized_args[9] = aDeepStruct.aNote.amount; - serialized_args[10] = aDeepStruct.aNote.secretHash; - serialized_args[11] = aDeepStruct.manyNotes[0].amount; - serialized_args[12] = aDeepStruct.manyNotes[0].secretHash; - serialized_args[13] = aDeepStruct.manyNotes[1].amount; - serialized_args[14] = aDeepStruct.manyNotes[1].secretHash; - serialized_args[15] = aDeepStruct.manyNotes[2].amount; - serialized_args[16] = aDeepStruct.manyNotes[2].secretHash; + serialized_args[0] = a_field; + serialized_args[1] = a_bool as Field; + serialized_args[2] = a_number as Field; + serialized_args[3] = an_array[0]; + serialized_args[4] = an_array[1]; + serialized_args[5] = a_struct.amount; + serialized_args[6] = a_struct.secret_hash; + serialized_args[7] = a_deep_struct.a_field; + serialized_args[8] = a_deep_struct.a_bool as Field; + serialized_args[9] = a_deep_struct.a_note.amount; + serialized_args[10] = a_deep_struct.a_note.secret_hash; + serialized_args[11] = a_deep_struct.many_notes[0].amount; + serialized_args[12] = a_deep_struct.many_notes[0].secret_hash; + serialized_args[13] = a_deep_struct.many_notes[1].amount; + serialized_args[14] = a_deep_struct.many_notes[1].secret_hash; + serialized_args[15] = a_deep_struct.many_notes[2].amount; + serialized_args[16] = a_deep_struct.many_notes[2].secret_hash; context.call_private_function(self.address, 0x0f054f9b, serialized_args) } @@ -270,11 +270,11 @@ impl TestPublicContextInterface { self, context: PublicContext, amount: Field, - secretHash: Field + secret_hash: Field ) -> [Field; RETURN_VALUES_LENGTH] { let mut serialized_args = [0; 2]; serialized_args[0] = amount; - serialized_args[1] = secretHash; + serialized_args[1] = secret_hash; context.call_public_function(self.address, 0x9749ca06, serialized_args) } @@ -284,11 +284,11 @@ impl TestPublicContextInterface { self, context: PublicContext, amount: Field, - secretHash: Field + secret_hash: Field ) -> [Field; RETURN_VALUES_LENGTH] { let mut serialized_args = [0; 2]; serialized_args[0] = amount; - serialized_args[1] = secretHash; + serialized_args[1] = secret_hash; context.call_public_function(self.address, 0xdf02db8d, serialized_args) } diff --git a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr b/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr index 329b67abf99..3b50aa2154a 100644 --- a/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr +++ b/yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr @@ -64,27 +64,27 @@ contract Test { // Note; this function is deliberately NOT annotated with #[aztec(private)] due to its use in tests fn test_code_gen( inputs: PrivateContextInputs, - aField: Field, - aBool: bool, - aNumber: u32, - anArray: [Field; 2], - aStruct: DummyNote, - aDeepStruct: DeepStruct, + a_field: Field, + a_bool: bool, + a_number: u32, + an_array: [Field; 2], + a_struct: DummyNote, + a_deep_struct: DeepStruct, ) -> distinct pub abi::PrivateCircuitPublicInputs { let mut args: BoundedVec = BoundedVec::new(0); - args.push(aField); - args.push(aBool as Field); - args.push(aNumber as Field); - args.push_array(anArray); - args.push(aStruct.amount); - args.push(aStruct.secretHash); - args.push(aDeepStruct.aField); - args.push(aDeepStruct.aBool as Field); - args.push(aDeepStruct.aNote.amount); - args.push(aDeepStruct.aNote.secretHash); - for note in aDeepStruct.manyNotes { + args.push(a_field); + args.push(a_bool as Field); + args.push(a_number as Field); + args.push_array(an_array); + args.push(a_struct.amount); + args.push(a_struct.secret_hash); + args.push(a_deep_struct.a_field); + args.push(a_deep_struct.a_bool as Field); + args.push(a_deep_struct.a_note.amount); + args.push(a_deep_struct.a_note.secret_hash); + for note in a_deep_struct.many_notes { args.push(note.amount); - args.push(note.secretHash); + args.push(note.secret_hash); } let args_hash = abi::hash_args(args.storage); let mut context = PrivateContext::new(inputs, args_hash); @@ -96,10 +96,10 @@ contract Test { #[aztec(public)] fn create_l2_to_l1_message_public( amount: Field, - secretHash: Field, + secret_hash: Field, ) { // Create a commitment to the amount - let note = DummyNote::new(amount, secretHash); + let note = DummyNote::new(amount, secret_hash); // Public oracle call to emit new commitment. context.message_portal(note.get_commitment()); @@ -110,10 +110,10 @@ contract Test { #[aztec(public)] fn create_nullifier_public( amount: Field, - secretHash: Field, + secret_hash: Field, ) { // Create a commitment to the amount - let note = DummyNote::new(amount, secretHash); + let note = DummyNote::new(amount, secret_hash); // Public oracle call to emit new commitment. context.push_new_nullifier(note.get_commitment(), EMPTY_NULLIFIED_COMMITMENT); @@ -186,26 +186,26 @@ contract Test { struct DummyNote { amount: Field, - secretHash: Field + secret_hash: Field } impl DummyNote { - fn new(amount: Field, secretHash: Field) -> pub Self { + fn new(amount: Field, secret_hash: Field) -> pub Self { Self { amount: amount, - secretHash: secretHash + secret_hash: secret_hash } } fn get_commitment(self) -> pub Field { - pedersen_hash([self.amount, self.secretHash],0) + pedersen_hash([self.amount, self.secret_hash],0) } } struct DeepStruct { - aField: Field, - aBool: bool, - aNote: DummyNote, - manyNotes: [DummyNote; 3], + a_field: Field, + a_bool: bool, + a_note: DummyNote, + many_notes: [DummyNote; 3], } }