fix(pmt): dedupe hashtree hasher dependency - #9349
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the @chainsafe/persistent-merkle-tree dependency from version 1.2.1 to 1.2.5 across several workspace packages, including api, beacon-node, cli, light-client, prover, and state-transition. Feedback was provided regarding a resulting version split for the @chainsafe/as-sha256 dependency; it is recommended to align all packages to version 1.2.4 to maintain dependency deduplication and avoid loading redundant WASM blobs.
| '@chainsafe/persistent-merkle-tree@1.2.5': | ||
| dependencies: | ||
| '@chainsafe/as-sha256': 1.2.0 | ||
| '@chainsafe/as-sha256': 1.2.4 |
There was a problem hiding this comment.
The update to @chainsafe/persistent-merkle-tree@1.2.5 has introduced a version split for its dependency @chainsafe/as-sha256 (now using 1.2.4), while other packages in the workspace (and @chainsafe/ssz@1.4.0) are still locked to 1.2.0 in the lockfile.
To maintain the goal of deduplication and ensure a consistent hashing stack, consider aligning all direct dependencies on @chainsafe/as-sha256 to ^1.2.4 across the workspace packages. This will prevent having multiple versions of the same library (and potentially multiple WASM blobs) in the dependency graph.
There was a problem hiding this comment.
Good catch. The new @chainsafe/as-sha256@1.2.4 was pulled transitively by persistent-merkle-tree@1.2.5, while @chainsafe/ssz@1.4.0 and our direct workspace deps still resolve 1.2.0. That split is orthogonal to the goal of this PR (deduping PMT so setHasher(hashtreeHasher) applies to all SSZ consumers) — addressing it would also require an aligned bump in @chainsafe/ssz itself, since its 1.4.0 release pins as-sha256 ^1.2.0. I'd prefer to keep this PR focused on the PMT dedup and handle the as-sha256 alignment in a follow-up that coordinates the SSZ side.
nflaig
left a comment
There was a problem hiding this comment.
@lodekeeper what's the reason for opening this PR?
|
Triggered by your ping in topic #10031 that the local patch had been sitting too long. Substantive reason: workspace deps declare Bumping all direct deps to |
|
superseded by #9352 |
Summary
@chainsafe/persistent-merkle-treeto^1.2.1^1.2.5so they dedupe with@chainsafe/ssz@1.4.0Why
setHasher(hashtreeHasher)only helps when callers and SSZ share the same PMT instance. The split between direct^1.2.1deps and SSZ's transitive1.2.5kept two copies in the graph, so some paths still used the slow noble hasher.After this change,
pnpm why @chainsafe/persistent-merkle-treeshows the workspace resolving PMT1.2.5consistently through the direct deps and through SSZ.Testing
pnpm lint