Skip to content

feat(core)!: remove unused Piece merkle, fr32 and sizing exports - #1163

Merged
hugomrdias merged 1 commit into
masterfrom
hugomrdias/merkle-ts-public-exports-d3968b
Nov 24, 2026
Merged

hugomrdias merged 1 commit into
masterfrom
hugomrdias/merkle-ts-public-exports-d3968b

Conversation

@hugomrdias

Copy link
Copy Markdown
Member

What

Removes public exports from @filoz/synapse-core/piece that nothing uses, and the internals that only existed for them.

Breaking: no longer exported

  • Piece.merkle: computeNode, truncate, zeroRoot
  • Piece.fr32: expand, reduce
  • Sizing: paddedSizeFor, heightFor, paddedSizeAtHeight, MIN_SIZE, MAX_SIZE, MAX_HEIGHT, BYTES_PER_QUAD

Internal cleanup in piece/internal

  • Deleted merkle.ts, zero-comm.ts, fr32.ts and uint64.ts.
  • Removed dead code from size.ts, digest.ts and constants.ts, and made constants private where nothing else imports them.

Why

PieceCID hashing goes through commp-wasm, so these were leftovers from the old JS implementation. No package, example or app in this repo used them outside synapse-core's own tests. A public GitHub code search for most of these names found no outside users either, though it can't see private code.

Reviewer notes

  • Overlap with fix(core): drop sync-multihash-sha2 and align piece size limits with commp-wasm #1152: that PR corrected MAX_SIZE and MAX_HEIGHT, and this one removes them. If both ship in the same release, the changelog will list the fix and the removal.
  • No replacement for paddedSizeFor: callers can no longer get a piece's padded size without hashing. PieceCID.paddedSize still works once there is a PieceCID. Upload validation is unaffected because it uses SIZE_CONSTANTS.
  • Kept: MULTIHASH_CODE, MULTIHASH_NAME and CODEC_CODE stay public.
  • Tests: removed the tests for the deleted exports. The duplicated pieceCidWithRawSize helper is now shared in test/utils/piece-cid.ts with its own height calculation.

Testing

  • Build and lint pass for synapse-core and its dependents, including the docs build.
  • synapse-core tests pass in Node (1156) and the browser (1148).
  • Not run locally: the dependents' own test suites.

🤖 Generated with Claude Code

PieceCID hashing goes through commp-wasm, so nothing outside the tests
used these exports or the internals behind them.

BREAKING CHANGE: these are no longer exported from
`@filoz/synapse-core/piece`: `merkle` (`computeNode`, `truncate`,
`zeroRoot`), `fr32` (`expand`, `reduce`), `paddedSizeFor`, `heightFor`,
`paddedSizeAtHeight`, `MIN_SIZE`, `MAX_SIZE`, `MAX_HEIGHT` and
`BYTES_PER_QUAD`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Nov 23, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T19:57:50.276731Z 41a4d8d PR opened
🔒 Security Review ✅ Completed 2026-11-23T19:58:59.647715Z 41a4d8d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

filecoin-encryption-envelope

npm i https://pkg.pr.new/filecoin-encryption-envelope@1163

@filoz/keysmith

npm i https://pkg.pr.new/@filoz/keysmith@1163

@filoz/synapse-core

npm i https://pkg.pr.new/@filoz/synapse-core@1163

@filoz/synapse-react

npm i https://pkg.pr.new/@filoz/synapse-react@1163

@filoz/synapse-sdk

npm i https://pkg.pr.new/@filoz/synapse-sdk@1163

commit: 41a4d8d

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview: https://pr-1163-synapse-dev.filoz.workers.dev

Built from 41a4d8d.

@FilOzzy FilOzzy moved this from 📌 Triage to 🔎 Awaiting review in FOC Nov 23, 2026
@hugomrdias

Copy link
Copy Markdown
Member Author

@pullfrog review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: Sound as a breaking release — removing the unused JavaScript helpers narrows the public API without changing the WASM hashing or upload validation paths.

Reviewed changes — I checked the full diff against the published API, in-repo callers, and CI results.

  • Public exports: The removal affects both @filoz/synapse-core/piece and the root piece namespace. I found no remaining in-repo callers of the removed exports. PieceCID.paddedSize still works for an existing CID, but it is not a replacement for paddedSizeFor when only the raw size is known.
  • Internal cleanup: The unused FR32, Merkle, and sizing code is gone; the digest and size logic used by PieceCID is unchanged.
  • Coverage: The shared test fixture preserves checks at the 64 GiB padded upload boundary and one raw byte above it. GitHub CI passed the core and SDK test jobs, lint, and the docs build.

Pullfrog  | View workflow run | Using gpt-6.2-sol | 𝕏

@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC Nov 24, 2026
@hugomrdias
hugomrdias merged commit 1c7fc53 into master Nov 24, 2026
13 checks passed
@hugomrdias
hugomrdias deleted the hugomrdias/merkle-ts-public-exports-d3968b branch November 24, 2026 16:54
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

4 participants