diff --git a/noir-projects/aztec-nr/aztec/src/context.nr b/noir-projects/aztec-nr/aztec/src/context.nr index 30bc5089f2ca..c82e1bee3448 100644 --- a/noir-projects/aztec-nr/aztec/src/context.nr +++ b/noir-projects/aztec-nr/aztec/src/context.nr @@ -1,6 +1,7 @@ mod globals; mod inputs; +mod packed_returns; mod private_context; mod public_context; mod interface; @@ -14,6 +15,6 @@ use call_interfaces::{ PublicStaticVoidCallInterface }; use private_context::PrivateContext; -use private_context::PackedReturns; +use packed_returns::PackedReturns; use public_context::PublicContext; use public_context::FunctionReturns; diff --git a/noir-projects/aztec-nr/aztec/src/context/packed_returns.nr b/noir-projects/aztec-nr/aztec/src/context/packed_returns.nr new file mode 100644 index 000000000000..1a56313d063b --- /dev/null +++ b/noir-projects/aztec-nr/aztec/src/context/packed_returns.nr @@ -0,0 +1,31 @@ +use crate::{hash::hash_args_array, oracle::returns::unpack_returns}; +use dep::protocol_types::traits::Deserialize; + +struct PackedReturns { + packed_returns: Field, +} + +impl PackedReturns { + pub fn new(packed_returns: Field) -> Self { + PackedReturns { packed_returns } + } + + pub fn assert_empty(self) { + assert_eq(self.packed_returns, 0); + } + + pub fn raw(self) -> Field { + self.packed_returns + } + + pub fn unpack(self) -> [Field; N] { + let unpacked: [Field; N] = unpack_returns(self.packed_returns); + assert_eq(self.packed_returns, hash_args_array(unpacked)); + unpacked + } + + pub fn unpack_into(self) -> T where T: Deserialize { + let unpacked: [Field; N] = self.unpack(); + Deserialize::deserialize(unpacked) + } +} diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index 5d536fc43879..71e1b39fdf6b 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -1,13 +1,16 @@ use crate::{ - context::{inputs::PrivateContextInputs, interface::ContextInterface}, + context::{inputs::PrivateContextInputs, interface::ContextInterface, packed_returns::PackedReturns}, messaging::process_l1_to_l2_message, hash::{hash_args_array, ArgsHasher, compute_unencrypted_log_hash}, keys::constants::{NULLIFIER_INDEX, OUTGOING_INDEX, NUM_KEY_TYPES, sk_generators}, note::{note_interface::NoteInterface, utils::compute_note_hash_for_insertion}, oracle::{ - key_validation_request::get_key_validation_request, arguments, returns, + key_validation_request::get_key_validation_request, arguments, returns::pack_returns, call_private_function::call_private_function_internal, header::get_header_at, - logs::{emit_encrypted_log, emit_encrypted_note_log, compute_encrypted_log}, + logs::{ + emit_encrypted_log, emit_encrypted_note_log, compute_encrypted_log, + emit_contract_class_unencrypted_log_private_internal, emit_unencrypted_log_private_internal +}, logs_traits::{LensForEncryptedLog, ToBytesForUnencryptedLog}, enqueue_public_function_call::{ enqueue_public_function_call_internal, set_public_teardown_function_call_internal, @@ -35,8 +38,8 @@ use dep::protocol_types::{ }, contrakt::{storage_read::StorageRead, storage_update_request::StorageUpdateRequest}, grumpkin_private_key::GrumpkinPrivateKey, grumpkin_point::GrumpkinPoint, header::Header, - messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, - traits::{is_empty, Deserialize, Empty}, utils::arrays::find_index + messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::{is_empty, Empty}, + utils::arrays::find_index }; // When finished, one can call .finish() to convert back to the abi @@ -153,7 +156,7 @@ impl PrivateContext { } pub fn set_return_hash(&mut self, returns_hasher: ArgsHasher) { - returns::pack_returns(returns_hasher.fields); + pack_returns(returns_hasher.fields); self.return_hash = returns_hasher.hash(); } @@ -717,69 +720,3 @@ impl Empty for PrivateContext { } } } - -// TODO(#6640)): This should be in its own file -struct PackedReturns { - packed_returns: Field, -} - -impl PackedReturns { - pub fn new(packed_returns: Field) -> Self { - PackedReturns { packed_returns } - } - - pub fn assert_empty(self) { - assert_eq(self.packed_returns, 0); - } - - pub fn raw(self) -> Field { - self.packed_returns - } - - pub fn unpack(self) -> [Field; N] { - let unpacked: [Field; N] = returns::unpack_returns(self.packed_returns); - assert_eq(self.packed_returns, hash_args_array(unpacked)); - unpacked - } - - pub fn unpack_into(self) -> T where T: Deserialize { - let unpacked: [Field; N] = self.unpack(); - Deserialize::deserialize(unpacked) - } -} - -// TODO(#6640)): This should not be here but in oracle folder -#[oracle(emitUnencryptedLog)] -fn emit_unencrypted_log_oracle_private( - _contract_address: AztecAddress, - _event_selector: Field, - _message: T, - _counter: u32 -) -> Field {} - -unconstrained pub fn emit_unencrypted_log_private_internal( - contract_address: AztecAddress, - event_selector: Field, - message: T, - counter: u32 -) -> Field { - emit_unencrypted_log_oracle_private(contract_address, event_selector, message, counter) -} - -#[oracle(emitContractClassUnencryptedLog)] -fn emit_contract_class_unencrypted_log_private( - contract_address: AztecAddress, - event_selector: Field, - message: [Field; N], - counter: u32 -) -> Field {} - -unconstrained pub fn emit_contract_class_unencrypted_log_private_internal( - contract_address: AztecAddress, - event_selector: Field, - message: [Field; N], - counter: u32 -) -> Field { - emit_contract_class_unencrypted_log_private(contract_address, event_selector, message, counter) -} - diff --git a/noir-projects/aztec-nr/aztec/src/keys/getters.nr b/noir-projects/aztec-nr/aztec/src/keys/getters.nr index f151bb46f4ac..8e56174ac835 100644 --- a/noir-projects/aztec-nr/aztec/src/keys/getters.nr +++ b/noir-projects/aztec-nr/aztec/src/keys/getters.nr @@ -6,7 +6,7 @@ use dep::protocol_types::{ use crate::{ context::PrivateContext, oracle::{keys::get_public_keys_and_partial_address, key_validation_request::get_key_validation_request}, - keys::{public_keys::PublicKeys, constants::{NULLIFIER_INDEX, INCOMING_INDEX, OUTGOING_INDEX}}, + keys::{public_keys::PublicKeys, constants::{NULLIFIER_INDEX, INCOMING_INDEX, OUTGOING_INDEX, TAGGING_INDEX}}, state_vars::{shared_mutable::shared_mutable_private_getter::SharedMutablePrivateGetter} }; @@ -17,7 +17,7 @@ trait KeyGetters { fn get_npk_m(header: Header, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint; fn get_ivpk_m(header: Header, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint; fn get_ovpk_m(header: Header, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint; -// fn get_tpk_m(header: Header, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint; + fn get_tpk_m(header: Header, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint; fn get_npk_m_hash(header: Header, context: &mut PrivateContext, address: AztecAddress) -> Field; } @@ -34,9 +34,9 @@ impl KeyGetters for Header { get_master_key(context, address, OUTGOING_INDEX, self) } - // fn get_tpk_m(self, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint { - // get_master_key(context, address, TAGGING_INDEX, self) - // } + fn get_tpk_m(self, context: &mut PrivateContext, address: AztecAddress) -> GrumpkinPoint { + get_master_key(context, address, TAGGING_INDEX, self) + } fn get_npk_m_hash(self, context: &mut PrivateContext, address: AztecAddress) -> Field { get_master_key(context, address, NULLIFIER_INDEX, self).hash() diff --git a/noir-projects/aztec-nr/aztec/src/oracle/logs.nr b/noir-projects/aztec-nr/aztec/src/oracle/logs.nr index 0064127fe385..36179f05c074 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/logs.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/logs.nr @@ -60,3 +60,37 @@ unconstrained pub fn compute_encrypted_log( preimage ) } + +#[oracle(emitUnencryptedLog)] +fn emit_unencrypted_log_oracle_private( + _contract_address: AztecAddress, + _event_selector: Field, + _message: T, + _counter: u32 +) -> Field {} + +unconstrained pub fn emit_unencrypted_log_private_internal( + contract_address: AztecAddress, + event_selector: Field, + message: T, + counter: u32 +) -> Field { + emit_unencrypted_log_oracle_private(contract_address, event_selector, message, counter) +} + +#[oracle(emitContractClassUnencryptedLog)] +fn emit_contract_class_unencrypted_log_private( + contract_address: AztecAddress, + event_selector: Field, + message: [Field; N], + counter: u32 +) -> Field {} + +unconstrained pub fn emit_contract_class_unencrypted_log_private_internal( + contract_address: AztecAddress, + event_selector: Field, + message: [Field; N], + counter: u32 +) -> Field { + emit_contract_class_unencrypted_log_private(contract_address, event_selector, message, counter) +} diff --git a/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.test.ts b/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.test.ts index 8fb24d52dc3f..5a0bddc2081a 100644 --- a/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.test.ts +++ b/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.test.ts @@ -1,5 +1,5 @@ import { AztecAddress, KeyValidationRequest, computeOvskApp, derivePublicKeyFromSecretKey } from '@aztec/circuits.js'; -import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; +import { GrumpkinScalar } from '@aztec/foundation/fields'; import { L1NotePayload } from './l1_note_payload.js'; @@ -48,10 +48,7 @@ describe('L1 Note Payload', () => { const getKeyValidationRequest = (ovskM: GrumpkinScalar, app: AztecAddress) => { const ovskApp = computeOvskApp(ovskM, app); - // TODO(#6640)): get rid of this ugly conversion - const ovskAppFr = Fr.fromBuffer(ovskApp.toBuffer()); - const ovpkM = derivePublicKeyFromSecretKey(ovskM); - return new KeyValidationRequest(ovpkM, ovskAppFr); + return new KeyValidationRequest(ovpkM, ovskApp); }; }); diff --git a/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.ts b/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.ts index d4bed3824bac..b5a4c31d9269 100644 --- a/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.ts +++ b/yarn-project/circuit-types/src/logs/l1_note_payload/l1_note_payload.ts @@ -1,6 +1,6 @@ import { AztecAddress, - GrumpkinPrivateKey, + type GrumpkinPrivateKey, type KeyValidationRequest, type PublicKey, computeIvpkApp, @@ -106,11 +106,8 @@ export class L1NotePayload { this.note, ).computeCiphertext(ephSk, ivpkApp); - // TODO(#6640)): do we want the conversion to be here? Unify the type everywhere? - const ovskApp = GrumpkinPrivateKey.fromBuffer(ovKeys.skApp.toBuffer()); - const outgoingBodyCiphertext = new EncryptedLogOutgoingBody(ephSk, recipient, ivpkApp).computeCiphertext( - ovskApp, + ovKeys.skAppAsGrumpkinPrivateKey, ephPk, ); diff --git a/yarn-project/circuit-types/src/logs/l1_note_payload/tagged_note.test.ts b/yarn-project/circuit-types/src/logs/l1_note_payload/tagged_note.test.ts index ba0f4d51cd42..4f4e48593b86 100644 --- a/yarn-project/circuit-types/src/logs/l1_note_payload/tagged_note.test.ts +++ b/yarn-project/circuit-types/src/logs/l1_note_payload/tagged_note.test.ts @@ -1,5 +1,5 @@ import { AztecAddress, KeyValidationRequest, computeOvskApp, derivePublicKeyFromSecretKey } from '@aztec/circuits.js'; -import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; +import { GrumpkinScalar } from '@aztec/foundation/fields'; import { L1NotePayload } from './l1_note_payload.js'; import { TaggedNote } from './tagged_note.js'; @@ -52,10 +52,8 @@ describe('L1 Note Payload', () => { const getKeyValidationRequest = (ovskM: GrumpkinScalar, app: AztecAddress) => { const ovskApp = computeOvskApp(ovskM, app); - // TODO(#6640)): get rid of this ugly conversion - const ovskAppFr = Fr.fromBuffer(ovskApp.toBuffer()); - const ovpkM = derivePublicKeyFromSecretKey(ovskM); - return new KeyValidationRequest(ovpkM, ovskAppFr); + + return new KeyValidationRequest(ovpkM, ovskApp); }; }); diff --git a/yarn-project/circuits.js/src/structs/key_validation_request.ts b/yarn-project/circuits.js/src/structs/key_validation_request.ts index ceb8e8e1c881..0064df2ebb9f 100644 --- a/yarn-project/circuits.js/src/structs/key_validation_request.ts +++ b/yarn-project/circuits.js/src/structs/key_validation_request.ts @@ -2,22 +2,35 @@ import { Fr, Point } from '@aztec/foundation/fields'; import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize'; import { KEY_VALIDATION_REQUEST_LENGTH } from '../constants.gen.js'; +import { GrumpkinPrivateKey } from '../types/grumpkin_private_key.js'; /** * Request for validating keys used in the app. */ export class KeyValidationRequest { + /** App-siloed secret key corresponding to the same underlying secret as master public key above. */ + public readonly skApp: Fr; + constructor( /** Master public key corresponding to the same underlying secret as app secret key below. */ public readonly pkM: Point, - /** App-siloed secret key corresponding to the same underlying secret as master public key above. */ - public readonly skApp: Fr, - ) {} + skApp: Fr | GrumpkinPrivateKey, + ) { + // I am doing this conversion here because in some places skApp is represented as GrumpkinPrivateKey (Fq). + // I can do this conversion even though Fq.MODULUS is larger than Fr.MODULUS because when we pass in + // the skApp as GrumpkinPrivateKey it was converted to that form from Fr. So, it is safe to convert it back + // to Fr. If this would change in the future the code below will throw an error so it should be easy to debug. + this.skApp = skApp instanceof Fr ? skApp : new Fr(skApp.toBigInt()); + } toBuffer() { return serializeToBuffer(this.pkM, this.skApp); } + get skAppAsGrumpkinPrivateKey() { + return new GrumpkinPrivateKey(this.skApp.toBigInt()); + } + static fromBuffer(buffer: Buffer | BufferReader) { const reader = BufferReader.asReader(buffer); return new KeyValidationRequest(Point.fromBuffer(reader), Fr.fromBuffer(reader)); diff --git a/yarn-project/pxe/src/note_processor/note_processor.test.ts b/yarn-project/pxe/src/note_processor/note_processor.test.ts index 1f7d223fdf02..df9bbaefcc78 100644 --- a/yarn-project/pxe/src/note_processor/note_processor.test.ts +++ b/yarn-project/pxe/src/note_processor/note_processor.test.ts @@ -133,10 +133,9 @@ describe('Note Processor', () => { ownerIvskM = allOwnerKeys.masterIncomingViewingSecretKey; ownerIvpkM = allOwnerKeys.publicKeys.masterIncomingViewingPublicKey; - // TODO(#6640)): get rid of this ugly conversion ownerOvKeys = new KeyValidationRequest( allOwnerKeys.publicKeys.masterOutgoingViewingPublicKey, - Fr.fromBuffer(computeOvskApp(allOwnerKeys.masterOutgoingViewingSecretKey, app).toBuffer()), + computeOvskApp(allOwnerKeys.masterOutgoingViewingSecretKey, app), ); }); diff --git a/yarn-project/simulator/src/client/private_execution.test.ts b/yarn-project/simulator/src/client/private_execution.test.ts index a38cef583518..6b18d2227139 100644 --- a/yarn-project/simulator/src/client/private_execution.test.ts +++ b/yarn-project/simulator/src/client/private_execution.test.ts @@ -194,7 +194,6 @@ describe('Private Execution test suite', () => { beforeEach(async () => { trees = {}; - // TODO(#6640) most of the oracles bellow seem to be stateless - move to beforeAll oracle = mock(); oracle.getKeyValidationRequest.mockImplementation((pkMHash: Fr, contractAddress: AztecAddress) => { if (pkMHash.equals(ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash())) { @@ -209,8 +208,7 @@ describe('Private Execution test suite', () => { return Promise.resolve( new KeyValidationRequest( ownerCompleteAddress.publicKeys.masterOutgoingViewingPublicKey, - // TODO(#6640)): nuke this ugly conversion - Fr.fromBuffer(computeOvskApp(ownerOvskM, contractAddress).toBuffer()), + computeOvskApp(ownerOvskM, contractAddress), ), ); } @@ -226,8 +224,7 @@ describe('Private Execution test suite', () => { return Promise.resolve( new KeyValidationRequest( recipientCompleteAddress.publicKeys.masterOutgoingViewingPublicKey, - // TODO(#6640)): nuke this ugly conversion - Fr.fromBuffer(computeOvskApp(recipientOvskM, contractAddress).toBuffer()), + computeOvskApp(recipientOvskM, contractAddress), ), ); } @@ -323,6 +320,8 @@ describe('Private Execution test suite', () => { }); describe('stateful test contract', () => { + const valueNoteTypeId = StatefulTestContractArtifact.notes['ValueNote'].id; + const contractAddress = defaultContractAddress; const mockFirstNullifier = new Fr(1111); let currentNoteIndex = 0n; @@ -373,8 +372,7 @@ describe('Private Execution test suite', () => { expect(result.newNotes).toHaveLength(1); const newNote = result.newNotes[0]; expect(newNote.storageSlot).toEqual(computeSlotForMapping(new Fr(1n), owner)); - // TODO(#6640)): update the constants here - expect(newNote.noteTypeId).toEqual(new Fr(869710811710178111116101n)); // ValueNote + expect(newNote.noteTypeId).toEqual(valueNoteTypeId); // ValueNote const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); expect(newNoteHashes).toHaveLength(1); @@ -404,8 +402,7 @@ describe('Private Execution test suite', () => { expect(result.newNotes).toHaveLength(1); const newNote = result.newNotes[0]; expect(newNote.storageSlot).toEqual(computeSlotForMapping(new Fr(1n), owner)); - // TODO(#6640): update the constants here - expect(newNote.noteTypeId).toEqual(new Fr(869710811710178111116101n)); // ValueNote + expect(newNote.noteTypeId).toEqual(valueNoteTypeId); // ValueNote const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); expect(newNoteHashes).toHaveLength(1); @@ -437,16 +434,14 @@ describe('Private Execution test suite', () => { recipient, ); - const noteTypeId = StatefulTestContractArtifact.notes['ValueNote'].id; - const notes = [ - buildNote(60n, ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash(), storageSlot, noteTypeId), - buildNote(80n, ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash(), storageSlot, noteTypeId), + buildNote(60n, ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash(), storageSlot, valueNoteTypeId), + buildNote(80n, ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash(), storageSlot, valueNoteTypeId), ]; oracle.getNotes.mockResolvedValue(notes); const consumedNotes = await asyncMap(notes, ({ nonce, note }) => - acirSimulator.computeNoteHashAndNullifier(contractAddress, nonce, storageSlot, noteTypeId, note), + acirSimulator.computeNoteHashAndNullifier(contractAddress, nonce, storageSlot, valueNoteTypeId, note), ); await insertLeaves(consumedNotes.map(n => n.siloedNoteHash)); @@ -461,14 +456,19 @@ describe('Private Execution test suite', () => { expect(result.newNotes).toHaveLength(2); const [changeNote, recipientNote] = result.newNotes; expect(recipientNote.storageSlot).toEqual(recipientStorageSlot); - expect(recipientNote.noteTypeId).toEqual(noteTypeId); + expect(recipientNote.noteTypeId).toEqual(valueNoteTypeId); const newNoteHashes = getNonEmptyItems(result.callStackItem.publicInputs.newNoteHashes); expect(newNoteHashes).toHaveLength(2); const [changeNoteHash, recipientNoteHash] = newNoteHashes; const [recipientInnerNoteHash, changeInnerNoteHash] = [ - await acirSimulator.computeInnerNoteHash(contractAddress, recipientStorageSlot, noteTypeId, recipientNote.note), - await acirSimulator.computeInnerNoteHash(contractAddress, storageSlot, noteTypeId, changeNote.note), + await acirSimulator.computeInnerNoteHash( + contractAddress, + recipientStorageSlot, + valueNoteTypeId, + recipientNote.note, + ), + await acirSimulator.computeInnerNoteHash(contractAddress, storageSlot, valueNoteTypeId, changeNote.note), ]; expect(recipientNoteHash.value).toEqual(recipientInnerNoteHash); expect(changeNoteHash.value).toEqual(changeInnerNoteHash); @@ -499,15 +499,19 @@ describe('Private Execution test suite', () => { const artifact = getFunctionArtifact(StatefulTestContractArtifact, 'destroy_and_create_no_init_check'); const storageSlot = computeSlotForMapping(new Fr(1n), owner); - const noteTypeId = StatefulTestContractArtifact.notes['ValueNote'].id; const notes = [ - buildNote(balance, ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash(), storageSlot, noteTypeId), + buildNote( + balance, + ownerCompleteAddress.publicKeys.masterNullifierPublicKey.hash(), + storageSlot, + valueNoteTypeId, + ), ]; oracle.getNotes.mockResolvedValue(notes); const consumedNotes = await asyncMap(notes, ({ nonce, note }) => - acirSimulator.computeNoteHashAndNullifier(contractAddress, nonce, storageSlot, noteTypeId, note), + acirSimulator.computeNoteHashAndNullifier(contractAddress, nonce, storageSlot, valueNoteTypeId, note), ); await insertLeaves(consumedNotes.map(n => n.siloedNoteHash)); @@ -944,6 +948,8 @@ describe('Private Execution test suite', () => { }); describe('pending note hashes contract', () => { + const valueNoteTypeId = PendingNoteHashesContractArtifact.notes['ValueNote'].id; + beforeEach(() => { oracle.getFunctionArtifact.mockImplementation((_, selector) => Promise.resolve(getFunctionArtifact(PendingNoteHashesContractArtifact, selector)), @@ -983,12 +989,11 @@ describe('Private Execution test suite', () => { PendingNoteHashesContractArtifact.storageLayout['balances'].slot, owner, ); - const noteTypeId = PendingNoteHashesContractArtifact.notes['ValueNote'].id; const innerNoteHash = await acirSimulator.computeInnerNoteHash( contractAddress, storageSlot, - noteTypeId, + valueNoteTypeId, noteAndSlot.note, ); expect(noteHash).toEqual(innerNoteHash); @@ -1057,12 +1062,11 @@ describe('Private Execution test suite', () => { PendingNoteHashesContractArtifact.storageLayout['balances'].slot, owner, ); - const noteTypeId = PendingNoteHashesContractArtifact.notes['ValueNote'].id; expect(execInsert.newNotes).toHaveLength(1); const noteAndSlot = execInsert.newNotes[0]; expect(noteAndSlot.storageSlot).toEqual(storageSlot); - expect(noteAndSlot.noteTypeId).toEqual(noteTypeId); + expect(noteAndSlot.noteTypeId).toEqual(valueNoteTypeId); expect(noteAndSlot.note.items[0]).toEqual(new Fr(amountToTransfer));