Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Oct 30, 2023
1 parent 0481645 commit 13b3f90
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class AztecNodeService implements AztecNode {
* @param leafIndex - The index of the leaf for which the sibling path is required.
* @returns The sibling path for the leaf index.
*/
public async getContractPath(leafIndex: bigint): Promise<SiblingPath<typeof CONTRACT_TREE_HEIGHT>> {
public async getContractSiblingPath(leafIndex: bigint): Promise<SiblingPath<typeof CONTRACT_TREE_HEIGHT>> {
const committedDb = await this.#getWorldState();
return committedDb.getSiblingPath(MerkleTreeId.CONTRACT_TREE, leafIndex);
}
Expand All @@ -311,7 +311,7 @@ export class AztecNodeService implements AztecNode {
* @param leafIndex - The index of the leaf for which the sibling path is required.
* @returns The sibling path for the leaf index.
*/
public async getNoteHashTreePath(leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>> {
public async getNoteHashTreeSiblingPath(leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>> {
const committedDb = await this.#getWorldState();
return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
}
Expand All @@ -334,7 +334,9 @@ export class AztecNodeService implements AztecNode {
* @param leafIndex - Index of the leaf in the tree.
* @returns The sibling path.
*/
public async getL1ToL2MessagesTreePath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>> {
public async getL1ToL2MessagesTreeSiblingPath(
leafIndex: bigint,
): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>> {
const committedDb = await this.#getWorldState();
return committedDb.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGES_TREE, leafIndex);
}
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/contract_tree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class ContractTree {
public async getContractMembershipWitness() {
const index = await this.getContractIndex();

const siblingPath = await this.stateInfoProvider.getContractPath(index);
const siblingPath = await this.stateInfoProvider.getContractSiblingPath(index);
return new MembershipWitness<typeof CONTRACT_TREE_HEIGHT>(
CONTRACT_TREE_HEIGHT,
index,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/kernel_oracle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class KernelOracle implements ProvingDataOracle {
}

async getNoteMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
const path = await this.node.getNoteHashTreePath(leafIndex);
const path = await this.node.getNoteHashTreeSiblingPath(leafIndex);
return new MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>(
path.pathSize,
leafIndex,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/simulator_oracle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class SimulatorOracle implements DBOracle {
const messageAndIndex = await this.stateInfoProvider.getL1ToL2MessageAndIndex(msgKey);
const message = messageAndIndex.message.toFieldArray();
const index = messageAndIndex.index;
const siblingPath = await this.stateInfoProvider.getL1ToL2MessagesTreePath(index);
const siblingPath = await this.stateInfoProvider.getL1ToL2MessagesTreeSiblingPath(index);
return {
message,
siblingPath: siblingPath.toFieldArray(),
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/types/src/interfaces/state_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export interface StateInfoProvider {
* @param leafIndex - The index of the leaf for which the sibling path is required.
* @returns The sibling path for the leaf index.
*/
getContractPath(leafIndex: bigint): Promise<SiblingPath<typeof CONTRACT_TREE_HEIGHT>>;
getContractSiblingPath(leafIndex: bigint): Promise<SiblingPath<typeof CONTRACT_TREE_HEIGHT>>;

/**
* Returns the sibling path for the given index in the note hash tree.
* @param leafIndex - The index of the leaf for which the sibling path is required.
* @returns The sibling path for the leaf index.
*/
getNoteHashTreePath(leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
getNoteHashTreeSiblingPath(leafIndex: bigint): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;

/**
* Gets a confirmed/consumed L1 to L2 message for the given message key (throws if not found).
Expand All @@ -43,5 +43,5 @@ export interface StateInfoProvider {
* @param leafIndex - Index of the leaf in the tree.
* @returns The sibling path.
*/
getL1ToL2MessagesTreePath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
getL1ToL2MessagesTreeSiblingPath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
}

0 comments on commit 13b3f90

Please sign in to comment.