Commit 7e87f4c
fix: add shared guard to prevent zero pricing (#237)
* fix: add shared guard to prevent zero pricePerTiBPerEpoch in capacity and storage calculations
- Introduced assertPriceNonZero() in core/utils/validate-pricing.ts
- Integrated into calculateActualCapacity() and calculateStorageFromUSDFC()
- Updated tests to expect throws on zero pricing
- Prevents Infinity / unsafe deposit calculations
* Update src/core/utils/validate-pricing.ts
Co-authored-by: Copilot <[email protected]>
* linting
---------
Co-authored-by: Russell Dempsey <[email protected]>
Co-authored-by: Copilot <[email protected]>1 parent dda7d35 commit 7e87f4c
File tree
3 files changed
+38
-18
lines changed- src
- core
- payments
- utils
- test/unit
3 files changed
+38
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
508 | 509 | | |
509 | 510 | | |
510 | 511 | | |
511 | | - | |
| 512 | + | |
512 | 513 | | |
513 | 514 | | |
514 | 515 | | |
| |||
536 | 537 | | |
537 | 538 | | |
538 | 539 | | |
539 | | - | |
| 540 | + | |
540 | 541 | | |
541 | 542 | | |
542 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
60 | 75 | | |
61 | 76 | | |
62 | 77 | | |
| |||
342 | 357 | | |
343 | 358 | | |
344 | 359 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
348 | 364 | | |
349 | 365 | | |
350 | 366 | | |
| |||
360 | 376 | | |
361 | 377 | | |
362 | 378 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
376 | 383 | | |
377 | 384 | | |
378 | 385 | | |
| |||
0 commit comments