Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jan 7, 2025
1 parent b04d2e5 commit 534de00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
5 changes: 5 additions & 0 deletions docs/docs/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions yarn-project/pxe/src/simulator_oracle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<bigint | undefined> {
async #findLeafIndex(blockNumber: L2BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<bigint | undefined> {
const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [leafValue]);
return leafIndex;
}

public async getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
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]}`);
}
Expand Down
9 changes: 0 additions & 9 deletions yarn-project/simulator/src/client/db_oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,6 @@ export interface DBOracle extends CommitmentsDB {
*/
getBlockHeader(): Promise<BlockHeader>;

/**
* 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<bigint | undefined>;

/**
* 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.
Expand Down

0 comments on commit 534de00

Please sign in to comment.