diff --git a/packages/ssz/src/viewDU/container.ts b/packages/ssz/src/viewDU/container.ts index e0c16cdd..e3910de8 100644 --- a/packages/ssz/src/viewDU/container.ts +++ b/packages/ssz/src/viewDU/container.ts @@ -74,26 +74,17 @@ class ContainerTreeViewDU>> extends * - if old _rootNode is hashed, then only need to put pending changes to HashComputationGroup * - if old _rootNode is not hashed, need to traverse and put to HashComputationGroup */ - commit(hashComps: HashComputationGroup | null = null): void { + commit(): void { const isOldRootHashed = this._rootNode.h0 !== null; if (this.nodesChanged.size === 0 && this.viewsChanged.size === 0) { - if (!isOldRootHashed && hashComps !== null) { - getHashComputations(this._rootNode, hashComps.offset, hashComps.byLevel); - } return; } const nodesChanged: {index: number; node: Node}[] = []; - let hashCompsView: HashComputationGroup | null = null; - // if old root is not hashed, no need to pass HashComputationGroup to child view bc we need to do full traversal here - if (hashComps != null && isOldRootHashed) { - // each view may mutate HashComputationGroup at offset + depth - hashCompsView = {byLevel: hashComps.byLevel, offset: hashComps.offset + this.type.depth}; - } for (const [index, view] of this.viewsChanged) { const fieldType = this.type.fieldsEntries[index].fieldType as unknown as CompositeTypeAny; - const node = fieldType.commitViewDU(view, hashCompsView); + const node = fieldType.commitViewDU(view); // Set new node in nodes array to ensure data represented in the tree and fast nodes access is equal this.nodes[index] = node; nodesChanged.push({index, node}); @@ -117,13 +108,14 @@ class ContainerTreeViewDU>> extends this.type.depth, indexes, nodes, - isOldRootHashed ? hashComps : null + // isOldRootHashed ? hashComps : null + null, ); - // old root is not hashed, need to traverse and put to HashComputationGroup - if (!isOldRootHashed && hashComps !== null) { - getHashComputations(this._rootNode, hashComps.offset, hashComps.byLevel); - } + // // old root is not hashed, need to traverse and put to HashComputationGroup + // if (!isOldRootHashed && hashComps !== null) { + // getHashComputations(this._rootNode, hashComps.offset, hashComps.byLevel); + // } this.nodesChanged.clear(); this.viewsChanged.clear();