Repository navigation
feat(core): add wallet-free storage cost estimators - #1031
Merged
Merged
Conversation
estimateOnboardingCost prices bringing data onto FWSS: create-data-set and add-pieces fees for a piece count and batch size, plus the deposit needed up front (30-day streaming lockup and lifecycle reserve), per copy. estimateStorageCost prices keeping data for a duration: recurring rate and total across copies. Both are pure functions over getPriceList output, so pricing pages and calculators can stay in step with contract pricing without a wallet or account state.
filecoin-encryption-envelope
@filoz/keysmith
@filoz/synapse-core
@filoz/synapse-react
@filoz/synapse-sdk
commit: |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
synapse-dev | 0286701 | Commit Preview URL Branch Preview URL |
Oct 22 2026, 02:15 PM |
Reuse estimateStorageCost for the onboarding streaming lockup instead of recomputing the rate. Replace the lower-bound and copies-ratio assertions with exact values, add a lockup-period case so swapping defaultLockupPeriod for EPOCHS_PER_MONTH fails, and cover each non-positive input guard.
hugomrdias
requested changes
Oct 21, 2026
4 tasks
Contributor
Author
|
first consumer: filecoin-project/filecoin-io-website#48, a calculator on filecoin.io/pricing. |
hugomrdias
approved these changes
Oct 22, 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.
Pricing pages and calculators (filecoin.cloud/ipfs2filecoin today, a general pricing calculator next) currently hardcode FWSS rates, and the ipfs2filecoin constants went stale with the v1.4.0 upgrade. This adds two pure functions to
@filoz/synapse-core/warm-storageso those pages can readgetPriceList()and stay in step with contract pricing, without a wallet or account state.estimateOnboardingCost: what it costs to bring data on. Create-data-set and add-pieces fees for a piece count and batch size, plus the up-front deposit (30-day streaming lockup and lifecycle reserve), across copies.estimateStorageCost: what it costs to keep data for a duration. Recurring rate and total across copies.Why not reuse what's here:
calculateUploadFeesandcalculateLifecycleReserveFundingtake one size per piece, which doesn't work for estimates like 10 TiB of 10 KiB files (about 1 billion pieces). They also price every piece as its own add-pieces call; that conservative default is kept here (piecesPerAddPiecesCalldefaults to1n), but callers can model batching.getUploadCostsandcalculateDepositNeededneed account state.Storage is priced from
sizeInBytesrather than PDP leaf counts, which can differ by up to 31 bytes per piece. The JSDoc points atcalculateEffectiveRatefor exact per-data-set math.Against the live mainnet price list, 10 TiB in 1 GiB pieces, 100 per call, 2 copies:
The deposit includes the lifecycle reserve and the replenishments the add-pieces fees trigger; the fees are paid out of it, not on top of it.
Tests:
test/estimate-costs.test.tsuses the v1.4.0 mainnet price list.