Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Dec 8, 2024
1 parent 440e035 commit 1ac86e6
Show file tree
Hide file tree
Showing 11 changed files with 775 additions and 816 deletions.
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/authwit/src/cheatcodes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ where
C: CallInterface<M>,
{
let target = call_interface.get_contract_address();
let inputs = cheatcodes::get_private_context_inputs(get_block_number());
let inputs = cheatcodes::get_private_context_inputs(get_block_number() - 1);
let chain_id = inputs.tx_context.chain_id;
let version = inputs.tx_context.version;
let args_hash = hash_args(call_interface.get_args());
Expand All @@ -39,7 +39,7 @@ where
let current_contract = get_contract_address();
cheatcodes::set_contract_address(on_behalf_of);
let target = call_interface.get_contract_address();
let inputs = cheatcodes::get_private_context_inputs(get_block_number());
let inputs = cheatcodes::get_private_context_inputs(get_block_number() - 1);
let chain_id = inputs.tx_context.chain_id;
let version = inputs.tx_context.version;
let args_hash = hash_args(call_interface.get_args());
Expand Down
326 changes: 208 additions & 118 deletions noir-projects/noir-contracts/contracts/auth_contract/src/test/main.nr

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ unconstrained fn test_check_block_number() {
let router_contract_address = router_contract.to_address();
let router = Router::at(router_contract_address);

env.advance_block_by(9);
env.advance_block_by(8);

// First we sanity-check that current block number is as expected
let current_block_number = env.block_number();
Expand All @@ -28,7 +28,7 @@ unconstrained fn test_fail_check_block_number() {
let router_contract_address = router_contract.to_address();
let router = Router::at(router_contract_address);

env.advance_block_by(9);
env.advance_block_by(8);

// First we sanity-check that current block number is as expected
let current_block_number = env.block_number();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::test::utils;
use crate::Token;
use dep::authwit::cheatcodes as authwit_cheatcodes;
use dep::aztec::oracle::random::random;
use super::{utils::mint_to_private, utils::setup};

#[test]
unconstrained fn burn_private_on_behalf_of_self() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ unconstrained fn burn_public_on_behalf_of_other() {
utils::setup_and_mint_to_public(/* with_account_contracts */ true);
let burn_amount = mint_amount / 10;

env.advance_block_by(1);

// Burn on behalf of other
let burn_call_interface =
Token::at(token_contract_address).burn_public(owner, burn_amount, random());
Expand All @@ -32,7 +34,9 @@ unconstrained fn burn_public_on_behalf_of_other() {
env.impersonate(recipient);
// Burn tokens
burn_call_interface.call(&mut env.public());
utils::check_public_balance(token_contract_address, owner, mint_amount - burn_amount);
env.advance_block_by(1);

// utils::check_public_balance(token_contract_address, owner, mint_amount - burn_amount);
}

#[test(should_fail_with = "attempt to subtract with underflow")]
Expand Down
1 change: 1 addition & 0 deletions yarn-project/simulator/src/client/execution_note_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class ExecutionNoteCache {
* transaction (and thus not a new note).
*/
public nullifyNote(contractAddress: AztecAddress, innerNullifier: Fr, noteHash: Fr) {
console.log('NULLIFIED NOTE');
const siloedNullifier = siloNullifier(contractAddress, innerNullifier);
const nullifiers = this.getNullifiers(contractAddress);
nullifiers.add(siloedNullifier.value);
Expand Down
1 change: 1 addition & 0 deletions yarn-project/simulator/src/public/public_db_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export class WorldStateDB extends ContractsDataSourcePublicDB implements PublicS
public async getNullifierMembershipWitnessAtLatestBlock(
nullifier: Fr,
): Promise<NullifierMembershipWitness | undefined> {
console.log('FETCHING NULLIFIER MEMB WITNESS');
const timer = new Timer();
const index = await this.db.findLeafIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBuffer());
if (!index) {
Expand Down
Loading

0 comments on commit 1ac86e6

Please sign in to comment.