diff --git a/docs/docs/migration_notes.md b/docs/docs/migration_notes.md index 2181a6c67857..c2f8904aa0bb 100644 --- a/docs/docs/migration_notes.md +++ b/docs/docs/migration_notes.md @@ -5,6 +5,11 @@ keywords: [sandbox, aztec, notes, migration, updating, upgrading] --- Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them. + +## TBD +### [Aztec.nr] Removal of `getSiblingPath` oracle +Use `getMembershipWitness` oracle instead that returns both the sibling path and an index [index, ...sibling_path]. + ## 0.68.0 ### [archiver, node, pxe] Remove contract artifacts in node and archiver and store function names instead Contract artifacts were only in the archiver for debugging purposes. Instead function names are now (optionally) emitted diff --git a/yarn-project/pxe/src/simulator_oracle/index.ts b/yarn-project/pxe/src/simulator_oracle/index.ts index 8dd27cda80e9..cc5fdc29a52f 100644 --- a/yarn-project/pxe/src/simulator_oracle/index.ts +++ b/yarn-project/pxe/src/simulator_oracle/index.ts @@ -163,7 +163,7 @@ export class SimulatorOracle implements DBOracle { * @returns - The index of the commitment. Undefined if it does not exist in the tree. */ async getCommitmentIndex(commitment: Fr) { - return await this.findLeafIndex('latest', MerkleTreeId.NOTE_HASH_TREE, commitment); + return await this.#findLeafIndex('latest', MerkleTreeId.NOTE_HASH_TREE, commitment); } // We need this in public as part of the EXISTS calls - but isn't used in private @@ -172,20 +172,16 @@ export class SimulatorOracle implements DBOracle { } async getNullifierIndex(nullifier: Fr) { - return await this.findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier); + return await this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier); } - public async findLeafIndex( - blockNumber: L2BlockNumber, - treeId: MerkleTreeId, - leafValue: Fr, - ): Promise { + async #findLeafIndex(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise { const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [leafValue]); return leafIndex; } public async getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise { - const leafIndex = await this.findLeafIndex(blockNumber, treeId, leafValue); + const leafIndex = await this.#findLeafIndex(blockNumber, treeId, leafValue); if (!leafIndex) { throw new Error(`Leaf value: ${leafValue} not found in ${MerkleTreeId[treeId]}`); } diff --git a/yarn-project/simulator/src/client/db_oracle.ts b/yarn-project/simulator/src/client/db_oracle.ts index 9cb567184a8b..5688f83a984b 100644 --- a/yarn-project/simulator/src/client/db_oracle.ts +++ b/yarn-project/simulator/src/client/db_oracle.ts @@ -140,15 +140,6 @@ export interface DBOracle extends CommitmentsDB { */ getBlockHeader(): Promise; - /** - * Fetch the index of the leaf in the respective tree - * @param blockNumber - The block number at which to get the leaf index. - * @param treeId - The id of the tree to search. - * @param leafValue - The leaf value buffer. - * @returns - The index of the leaf. Undefined if it does not exist in the tree. - */ - findLeafIndex(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise; - /** * Fetches the index and sibling path of a leaf at a given block from a given tree. * @param blockNumber - The block number at which to get the membership witness.