-
Notifications
You must be signed in to change notification settings - Fork 6
fix: pad rawSize for payment calculations #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ import { | |
| MAX_LOCKUP_ALLOWANCE, | ||
| MAX_RATE_ALLOWANCE, | ||
| MIN_FIL_FOR_GAS, | ||
| padSizeToPDPLeaves, | ||
| STORAGE_SCALE_MAX, | ||
| STORAGE_SCALE_MAX_BI, | ||
| USDFC_DECIMALS, | ||
|
|
@@ -826,7 +827,8 @@ export function calculateDepositCapacity( | |
| * @returns Required allowances for the piece | ||
| */ | ||
| export function calculateRequiredAllowances(pieceSizeBytes: number, pricePerTiBPerEpoch: bigint): StorageAllowances { | ||
| const storageTiB = pieceSizeBytes / Number(SIZE_CONSTANTS.TiB) | ||
| const paddedSizeBytes = padSizeToPDPLeaves(pieceSizeBytes) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a lot of other places where we use your util function is correct, but I'm worried we're missing a few places.. this might need to wait until we clean up src/core/payments
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds, good. let me find some of them while you're doing the cleanup. what do you think? |
||
| const storageTiB = paddedSizeBytes / Number(SIZE_CONSTANTS.TiB) | ||
| return calculateStorageAllowances(storageTiB, pricePerTiBPerEpoch) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't go in constants.ts it should probably go in a new file:
/core/payments/utils.tsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright. let me update that.