From 77441fbd18c5aabc9102fe8e3b9af528b9ae3cf6 Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:20:57 +0000 Subject: [PATCH] Fix to get BP working. --- .../src/state/merkle/SyncCachedLinkedMerkleTreeStore.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/sequencer/src/state/merkle/SyncCachedLinkedMerkleTreeStore.ts b/packages/sequencer/src/state/merkle/SyncCachedLinkedMerkleTreeStore.ts index 4926126c..f38d9990 100644 --- a/packages/sequencer/src/state/merkle/SyncCachedLinkedMerkleTreeStore.ts +++ b/packages/sequencer/src/state/merkle/SyncCachedLinkedMerkleTreeStore.ts @@ -31,8 +31,8 @@ export class SyncCachedLinkedMerkleTreeStore this.nodeStore.setNode(key, level, value); } - public getLeaf(index: bigint): StoredLeaf | undefined { - return this.leafStore.getLeaf(index) ?? this.parent.getLeaf(index); + public getLeaf(path: bigint): StoredLeaf | undefined { + return this.leafStore.getLeaf(path) ?? this.parent.getLeaf(path); } public setLeaf(index: bigint, value: LinkedLeaf) { @@ -42,7 +42,10 @@ export class SyncCachedLinkedMerkleTreeStore // Need to make sure we call the parent as the super will usually be empty // The tree calls this method. public getMaximumIndex(): bigint | undefined { - return this.parent.getMaximumIndex(); + return (this.leafStore.getMaximumIndex() ?? -1) > + (this.parent.getMaximumIndex() ?? -1) + ? this.leafStore.getMaximumIndex() + : this.parent.getMaximumIndex(); } public getLeafLessOrEqual(path: bigint): StoredLeaf | undefined {