Skip to content

Commit

Permalink
Remove anys in getSnapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Mar 21, 2024
1 parent 47a666a commit 9a8af31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion yarn-project/merkle-tree/src/interfaces/indexed_tree.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { SiblingPath } from '@aztec/circuit-types';
import { IndexedTreeLeaf, IndexedTreeLeafPreimage } from '@aztec/foundation/trees';

import { IndexedTreeSnapshot, TreeSnapshot, TreeSnapshotBuilder } from '../snapshots/snapshot_builder.js';
import { AppendOnlyTree } from './append_only_tree.js';
import { MerkleTree } from './merkle_tree.js';

/**
* Factory for creating leaf preimages.
Expand Down Expand Up @@ -73,7 +75,10 @@ export interface BatchInsertionResult<TreeHeight extends number, SubtreeSiblingP
/**
* Indexed merkle tree.
*/
export interface IndexedTree extends AppendOnlyTree<Buffer> {
export interface IndexedTree
extends MerkleTree<Buffer>,
TreeSnapshotBuilder<IndexedTreeSnapshot>,
Omit<AppendOnlyTree<Buffer>, keyof TreeSnapshotBuilder<TreeSnapshot<Buffer>>> {
/**
* Finds the index of the largest leaf whose value is less than or equal to the provided value.
* @param newValue - The new value to be inserted into the tree.
Expand Down
6 changes: 2 additions & 4 deletions yarn-project/world-state/src/world-state-db/merkle_trees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,9 @@ export class MerkleTrees implements MerkleTreeDb {

public async getSnapshot(blockNumber: number): Promise<TreeSnapshots> {
return {
[MerkleTreeId.NULLIFIER_TREE]: (await this.trees[MerkleTreeId.NULLIFIER_TREE].getSnapshot(blockNumber)) as any,
[MerkleTreeId.NULLIFIER_TREE]: await this.trees[MerkleTreeId.NULLIFIER_TREE].getSnapshot(blockNumber),
[MerkleTreeId.NOTE_HASH_TREE]: await this.trees[MerkleTreeId.NOTE_HASH_TREE].getSnapshot(blockNumber),
[MerkleTreeId.PUBLIC_DATA_TREE]: (await this.trees[MerkleTreeId.PUBLIC_DATA_TREE].getSnapshot(
blockNumber,
)) as any,
[MerkleTreeId.PUBLIC_DATA_TREE]: await this.trees[MerkleTreeId.PUBLIC_DATA_TREE].getSnapshot(blockNumber),
[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: await this.trees[MerkleTreeId.L1_TO_L2_MESSAGE_TREE].getSnapshot(
blockNumber,
),
Expand Down

0 comments on commit 9a8af31

Please sign in to comment.