Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Apr 23, 2024
1 parent 6e1e316 commit 2a0c736
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract Test {

use dep::aztec::{
context::{Context, inputs::private_context_inputs::PrivateContextInputs},
hash::{pedersen_hash, poseidon2_hash, ArgsHasher},
hash::{compute_secret_hash, pedersen_hash, ArgsHasher},
note::{
lifecycle::{create_note, destroy_note}, note_getter::{get_notes, view_notes},
note_getter_options::NoteStatus
Expand Down Expand Up @@ -350,7 +350,7 @@ contract Test {
// Adapted from TokenContract#redeem_shield but without an initcheck so it can be run in simulator/src/client/private_execution.test.ts
fn consume_note_from_secret(secret: Field) {
let notes_set = storage.example_set;
let secret_hash = poseidon2_hash([secret, 92543]); // global GENERATOR_INDEX__TRANSPARENT_NOTE = 92543;
let secret_hash = compute_secret_hash(secret);
let mut options = NoteGetterOptions::new();
options = options.select(FieldNote::properties().value, secret_hash, Option::none()).set_limit(1);
let notes = notes_set.get_notes(options);
Expand Down
7 changes: 2 additions & 5 deletions yarn-project/simulator/src/client/private_execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
nonEmptySideEffects,
sideEffectArrayToValueArray,
} from '@aztec/circuits.js';
import { computeCommitmentNonce, computeVarArgsHash } from '@aztec/circuits.js/hash';
import { computeCommitmentNonce, computeSecretHash, computeVarArgsHash } from '@aztec/circuits.js/hash';
import { makeHeader } from '@aztec/circuits.js/testing';
import {
type FunctionArtifact,
Expand Down Expand Up @@ -62,9 +62,6 @@ import { AcirSimulator } from './simulator.js';

jest.setTimeout(60_000);

// Copied over from `transparent_note.nr` - not placed in constants.nr as it's not a protocol constant
const GENERATOR_INDEX__TRANSPARENT_NOTE = 92543;

describe('Private Execution test suite', () => {
let oracle: MockProxy<DBOracle>;
let node: MockProxy<AztecNode>;
Expand Down Expand Up @@ -730,7 +727,7 @@ describe('Private Execution test suite', () => {
it('Should be able to consume a dummy public to private message', async () => {
const artifact = getFunctionArtifact(TestContractArtifact, 'consume_note_from_secret');
const secret = new Fr(1n);
const secretHash = poseidon2Hash([secret, GENERATOR_INDEX__TRANSPARENT_NOTE]);
const secretHash = computeSecretHash(secret);
const note = new Note([secretHash]);
const storageSlot = new Fr(5);
oracle.getNotes.mockResolvedValue([
Expand Down
9 changes: 7 additions & 2 deletions yarn-project/simulator/src/client/simulator.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { type AztecNode, CompleteAddress, Note } from '@aztec/circuit-types';
import { GeneratorIndex, computeAppNullifierSecretKey, deriveKeys } from '@aztec/circuits.js';
import { computeInnerNoteHash, computeNoteContentHash, computeUniqueNoteHash, siloNoteHash } from '@aztec/circuits.js/hash';
import {
computeInnerNoteHash,
computeNoteContentHash,
computeUniqueNoteHash,
siloNoteHash,
} from '@aztec/circuits.js/hash';
import {
ABIParameterVisibility,
type FunctionArtifactWithDebugMetadata,
getFunctionArtifact,
} from '@aztec/foundation/abi';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { pedersenHash, poseidon2Hash } from '@aztec/foundation/crypto';
import { poseidon2Hash } from '@aztec/foundation/crypto';
import { Fr } from '@aztec/foundation/fields';
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';

Expand Down

0 comments on commit 2a0c736

Please sign in to comment.