Piece.from accepts padding larger than the tree (negative size) and heights below 2
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend-api-design, blockchain
Research direction
Start in piece/parse.ts and check how it validates height and padding before constructing a Piece. The report at report/synapse-core.csv lists failing vectors; compare those cases with the FRC-0069 minimum height and padding bound described in the issue. Done means invalid heights and padding are rejected without producing a negative size or a later .size error.
Written by the indexing model from the issue text.
Description
Running @filoz/synapse-core 0.10.2 against 1,244 PieceCIDv2 vectors generated from the FRC-0069 text (https://github.com/let-the-dreamers-rise/pdp-conform):
- Padding larger than the tree is accepted and the size goes negative. Height 2, padding 128 parses and reports raw size
-1; height 3, padding 256 gives-2(38 vectors). PDPVerifier and go-fil-commcid reject these. Any CID read from a provider, an indexer or a URL turns into a negative size with no error. - Heights 0 and 1 parse, and then
.sizethrowsundefined must be positive(30 vectors). The FRC minimum is 2. - Padding that doesn't follow the minimal-tree rule is accepted (74 vectors, e.g. 127 bytes as padding 127 at height 3). PDPVerifier accepts some of these too (asked in FilOzone/pdp), so this one may be policy.
- Sizes above
Number.MAX_SAFE_INTEGERthrow (247 vectors). Safe, but valid CIDs are rejected. Abigintsize would cover them.
CommP computation is correct: 930 of 930 payloads (0 B to 1 MiB, edge sizes) match the reference.
Suggested fix for 1 and 2: in piece/parse.ts, reject height < 2 and padding > 127 * 2^(height-2). Per-vector results: report/synapse-core.csv. Happy to open the PR.
Generated by Claude Code
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 35
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 38
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FilOzone/synapse-sdk
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FilOzone/synapse-sdk#749 · 1 comment ·
Maintainers usually reply within 1 day
-
keysmith: authorizationHeader takes now and refuses expired chains (after #1041)Possibly taken @JAG-UK claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 32/100
FilOzone/synapse-sdk#1084 · 1 comment ·
Maintainers usually reply within 1 day
-
Keysmith milestone 2Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
FilOzone/synapse-sdk#1082 ·
Maintainers usually reply within 1 day
-
Share viewer fails on gateways that ignore range requestsPossibly taken @BravoNatalie claimed this 2 days ago. Open
FilOzone/synapse-sdk#1081 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
FilOzone/synapse-sdk#1075 ·
Maintainers usually reply within 1 day
All issues in FilOzone/synapse-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
readest/readest#7413 · 1 comment ·
Maintainers usually reply within 1 day
-
content triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eliasstravik/herdr-projects#788 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Ability to edit tagsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day