fix(fwss): price PDP rails on raw bytes, not Fr32-expanded leaf size#471
Merged
Conversation
`updatePaymentRates` was multiplying leafCount by 32 to derive total bytes, which is the Fr32-expanded size, not the raw payload size. Switch to the new `Cids.leafCountToRawSize` to apply the 127/128 ratio, removing the ~0.787% per-byte overcharge. Also marks `getDataSetSizeInBytes` deprecated and to-be-removed; it now delegates to the same helper rather than computing Fr32 size. Drops the `BYTES_PER_LEAF` constant. Bumps lib/pdp submodule to FilOzone/pdp#266. Fixes: #451
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts FWSS payment rail pricing to charge based on raw payload bytes derived from PDP leaf counts, instead of the FR32-expanded byte size, eliminating the ~0.787% per-byte overcharge described in #451.
Changes:
- Update
updatePaymentRatesto compute total bytes viaCids.leafCountToRawSize(leafCount)(raw-size upper bound). - Deprecate
getDataSetSizeInBytesand make it delegate to the same raw-size helper. - Add regression tests covering rate updates on piece add and on next proving period after removals.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| service_contracts/src/FilecoinWarmStorageService.sol | Switches pricing byte calculation from FR32 leaf bytes to raw-size approximation via Cids.leafCountToRawSize. |
| service_contracts/src/lib/FilecoinWarmStorageServiceStateLibrary.sol | Deprecates getDataSetSizeInBytes and changes it to return raw-size approximation via Cids.leafCountToRawSize. |
| service_contracts/src/lib/FilecoinWarmStorageServiceStateInternalLibrary.sol | Regenerated/internal variant reflecting the same deprecated raw-size delegation. |
| service_contracts/test/FilecoinWarmStorageService.t.sol | Adds tests asserting rails price on raw bytes for piece additions and post-removal recomputation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
Submodule updated to https://github.com/FilOzone/pdp/releases/tag/v3.3.0 |
Kubuxu
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
updatePaymentRateswas multiplying leafCount by 32 to derive total bytes, which is the Fr32-expanded size, not the raw payload size. Switch to the newCids.leafCountToRawSizeto apply the 127/128 ratio, removing the ~0.787% per-byte overcharge.Also marks
getDataSetSizeInBytesdeprecated and to-be-removed; it now delegates to the same helper rather than computing Fr32 size. Drops theBYTES_PER_LEAFconstant.Bumps lib/pdp submodule to FilOzone/pdp#266.
Fixes: #451
Pending: we're going to tag + release pdp with that change, but not deploy it, so I'll update here with a new head commit when that's done but it'll be the same code.