Skip to content

Commit

Permalink
fixed camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Oct 20, 2023
1 parent 2785b2f commit 43e167b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('e2e_block_building', () => {

it('drops tx with public nullifier already emitted on the same block', async () => {
const secret = Fr.random();
const calls = times(2, () => contract.methods.createNullifierPublic(140n, secret));
const calls = times(2, () => contract.methods.create_nullifier_public(140n, secret));
for (const call of calls) await call.simulate();
const [tx1, tx2] = calls.map(call => call.send());
await tx1.wait();
Expand All @@ -141,7 +141,7 @@ describe('e2e_block_building', () => {
);

const calls = [
contract.methods.createNullifierPublic(140n, secret),
contract.methods.create_nullifier_public(140n, secret),
contract.methods.emit_nullifier(emittedPublicNullifier),
];

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_cheat_codes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ describe('e2e_cheat_codes', () => {
expect(Number(await rollup.read.lastBlockTs())).toEqual(newTimestamp);
expect(Number(await rollup.read.lastWarpedBlockTs())).toEqual(newTimestamp);

const txIsTimeEqual = contract.methods.isTimeEqual(newTimestamp).send();
const txIsTimeEqual = contract.methods.is_time_equal(newTimestamp).send();
const isTimeEqualReceipt = await txIsTimeEqual.wait({ interval: 0.1 });
expect(isTimeEqualReceipt.status).toBe(TxStatus.MINED);

// Since last rollup block was warped, txs for this rollup will have time incremented by 1
// See https://github.com/AztecProtocol/aztec-packages/issues/1614 for details
const txTimeNotEqual = contract.methods.isTimeEqual(newTimestamp + 1).send();
const txTimeNotEqual = contract.methods.is_time_equal(newTimestamp + 1).send();
const isTimeNotEqualReceipt = await txTimeNotEqual.wait({ interval: 0.1 });
expect(isTimeNotEqualReceipt.status).toBe(TxStatus.MINED);
// block is published at t >= newTimestamp + 1.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/guides/dapp_testing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('guides/dapp/testing', () => {
// docs:start:warp
const newTimestamp = Math.floor(Date.now() / 1000) + 60 * 60 * 24;
await cheats.aztec.warp(newTimestamp);
await testContract.methods.isTimeEqual(newTimestamp).send().wait();
await testContract.methods.is_time_equal(newTimestamp).send().wait();
// docs:end:warp
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract ImportTest {
target: Field
) -> Field {
let test_contract_instance = TestPrivateContextInterface::at(target);
let return_values = test_contract_instance.testCodeGen(
let return_values = test_contract_instance.test_code_gen(
&mut context,
1,
true,
Expand Down Expand Up @@ -56,7 +56,7 @@ contract ImportTest {
target: Field
) -> Field {
let test_contract_instance = TestPrivateContextInterface::at(target);
let return_values = test_contract_instance.getThisAddress(&mut context);
let return_values = test_contract_instance.get_this_address(&mut context);

return_values[0]
}
Expand All @@ -69,7 +69,7 @@ contract ImportTest {
target: Field,
) {
let test_contract_instance = TestPrivateContextInterface::at(target);
test_contract_instance.createNullifierPublic(&mut context, 1, 2);
test_contract_instance.create_nullifier_public(&mut context, 1, 2);
}

// Calls the createNullifierPublic on the Test contract at the target address
Expand All @@ -80,7 +80,7 @@ contract ImportTest {
target: Field,
) -> Field {
let test_contract_instance = TestPublicContextInterface::at(target);
let ret = test_contract_instance.createNullifierPublic(context, 1, 2);
let ret = test_contract_instance.create_nullifier_public(context, 1, 2);

ret[0]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl TestPrivateContextInterface {
}


pub fn createL2ToL1MessagePublic(
pub fn create_l2_to_l1_message_public(
self,
context: &mut PrivateContext,
amount: Field,
Expand All @@ -89,11 +89,11 @@ impl TestPrivateContextInterface {
serialized_args[0] = amount;
serialized_args[1] = secretHash;

context.call_public_function(self.address, 0xbac98727, serialized_args)
context.call_public_function(self.address, 0x9749ca06, serialized_args)
}


pub fn createNullifierPublic(
pub fn create_nullifier_public(
self,
context: &mut PrivateContext,
amount: Field,
Expand All @@ -103,7 +103,7 @@ impl TestPrivateContextInterface {
serialized_args[0] = amount;
serialized_args[1] = secretHash;

context.call_public_function(self.address, 0x42040a24, serialized_args)
context.call_public_function(self.address, 0xdf02db8d, serialized_args)
}


Expand Down Expand Up @@ -131,63 +131,63 @@ impl TestPrivateContextInterface {
}


pub fn getPortalContractAddress(
pub fn get_portal_contract_address(
self,
context: &mut PrivateContext,
aztec_address: Field
) -> [Field; RETURN_VALUES_LENGTH] {
let mut serialized_args = [0; 1];
serialized_args[0] = aztec_address;

context.call_private_function(self.address, 0xaf15a45f, serialized_args)
context.call_private_function(self.address, 0x98ff64fd, serialized_args)
}


pub fn getPublicKey(
pub fn get_public_key(
self,
context: &mut PrivateContext,
address: Field
) -> [Field; RETURN_VALUES_LENGTH] {
let mut serialized_args = [0; 1];
serialized_args[0] = address;

context.call_private_function(self.address, 0x88f0753b, serialized_args)
context.call_private_function(self.address, 0x5ccf578f, serialized_args)
}


pub fn getThisAddress(
pub fn get_this_address(
self,
context: &mut PrivateContext
) -> [Field; RETURN_VALUES_LENGTH] {
let mut serialized_args = [0; 0];

context.call_private_function(self.address, 0xd3953822, serialized_args)
context.call_private_function(self.address, 0x95a7b2ae, serialized_args)
}


pub fn getThisPortalAddress(
pub fn get_this_portal_address(
self,
context: &mut PrivateContext
) -> [Field; RETURN_VALUES_LENGTH] {
let mut serialized_args = [0; 0];

context.call_private_function(self.address, 0x82cc9431, serialized_args)
context.call_private_function(self.address, 0xc71384f5, serialized_args)
}


pub fn isTimeEqual(
pub fn is_time_equal(
self,
context: &mut PrivateContext,
time: Field
) {
let mut serialized_args = [0; 1];
serialized_args[0] = time;

context.call_public_function(self.address, 0xfff6026c, serialized_args)
context.call_public_function(self.address, 0x61fa2bda, serialized_args)
}


pub fn testCodeGen(
pub fn test_code_gen(
self,
context: &mut PrivateContext,
aField: Field,
Expand Down Expand Up @@ -216,7 +216,7 @@ impl TestPrivateContextInterface {
serialized_args[15] = aDeepStruct.manyNotes[2].amount;
serialized_args[16] = aDeepStruct.manyNotes[2].secretHash;

context.call_private_function(self.address, 0x81d7c118, serialized_args)
context.call_private_function(self.address, 0x0f054f9b, serialized_args)
}

}
Expand Down Expand Up @@ -256,7 +256,7 @@ impl TestPublicContextInterface {
}


pub fn createL2ToL1MessagePublic(
pub fn create_l2_to_l1_message_public(
self,
context: PublicContext,
amount: Field,
Expand All @@ -266,11 +266,11 @@ impl TestPublicContextInterface {
serialized_args[0] = amount;
serialized_args[1] = secretHash;

context.call_public_function(self.address, 0xbac98727, serialized_args)
context.call_public_function(self.address, 0x9749ca06, serialized_args)
}


pub fn createNullifierPublic(
pub fn create_nullifier_public(
self,
context: PublicContext,
amount: Field,
Expand All @@ -280,7 +280,7 @@ impl TestPublicContextInterface {
serialized_args[0] = amount;
serialized_args[1] = secretHash;

context.call_public_function(self.address, 0x42040a24, serialized_args)
context.call_public_function(self.address, 0xdf02db8d, serialized_args)
}


Expand All @@ -296,15 +296,15 @@ impl TestPublicContextInterface {
}


pub fn isTimeEqual(
pub fn is_time_equal(
self,
context: PublicContext,
time: Field
) -> [Field; RETURN_VALUES_LENGTH] {
let mut serialized_args = [0; 1];
serialized_args[0] = time;

context.call_public_function(self.address, 0xfff6026c, serialized_args)
context.call_public_function(self.address, 0x61fa2bda, serialized_args)
}

}
Expand Down
22 changes: 11 additions & 11 deletions yarn-project/noir-contracts/src/contracts/test_contract/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract Test {
abi::PrivateContextInputs,
context::PrivateContext,
oracle::{
get_public_key::get_public_key,
get_public_key::get_public_key as get_public_key_oracle,
context::get_portal_address,
rand::rand
},
Expand All @@ -29,38 +29,38 @@ contract Test {
// docs:end:empty-constructor

#[aztec(private)]
fn getPublicKey(
fn get_public_key(
address: Field,
) -> [Field; 2]{
let pub_key = get_public_key(address);
let pub_key = get_public_key_oracle(address);

[pub_key.x, pub_key.y]
}

// Get the portal contract address through an oracle call
#[aztec(private)]
fn getPortalContractAddress(
fn get_portal_contract_address(
aztec_address: Field
) -> Field {
get_portal_address(aztec_address)
}

// Get the address of the l1 portal for this contract (taken from the input context)
#[aztec(private)]
fn getThisPortalAddress() -> Field {
fn get_this_portal_address() -> Field {
context.this_portal_address()
}

// Get the address of this contract (taken from the input context)
#[aztec(private)]
fn getThisAddress() -> Field {
fn get_this_address() -> Field {
context.this_address()
}

// Test codegen for Aztec.nr interfaces
// See yarn-project/acir-simulator/src/client/private_execution.test.ts 'nested calls through autogenerated interface'
// Note; this function is deliberately NOT annotated with #[aztec(private)] due to its use in tests
fn testCodeGen(
fn test_code_gen(
inputs: PrivateContextInputs,
aField: Field,
aBool: bool,
Expand Down Expand Up @@ -92,7 +92,7 @@ contract Test {

// Purely exists for testing
#[aztec(public)]
fn createL2ToL1MessagePublic(
fn create_l2_to_l1_message_public(
amount: Field,
secretHash: Field,
) {
Expand All @@ -106,7 +106,7 @@ contract Test {

// Purely exists for testing
#[aztec(public)]
fn createNullifierPublic(
fn create_nullifier_public(
amount: Field,
secretHash: Field,
) {
Expand All @@ -125,7 +125,7 @@ contract Test {

// docs:start:is-time-equal
#[aztec(public)]
fn isTimeEqual(
fn is_time_equal(
time: Field,
) -> Field {
assert(context.timestamp() == time);
Expand Down Expand Up @@ -170,7 +170,7 @@ contract Test {
}

// Purely exists for testing
unconstrained fn getRandom(
unconstrained fn get_random(
kindaSeed: Field
) -> Field {
kindaSeed * rand()
Expand Down

0 comments on commit 43e167b

Please sign in to comment.