Skip to content

Commit 1b0898e

Browse files
ZenGround0rvagg
authored andcommitted
10 day grace period => 30 day grace period
1 parent 84fe5ff commit 1b0898e

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

src/add/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { CLIAuthOptions } from '../utils/cli-auth.js'
44
export interface AddOptions extends CLIAuthOptions {
55
filePath: string
66
bare?: boolean
7-
/** Auto-fund: automatically ensure minimum 10 days of runway */
7+
/** Auto-fund: automatically ensure minimum 30 days of runway */
88
autoFund?: boolean
99
}
1010

src/common/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/**
22
* Minimum runway in days to ensure WarmStorage can cover costs. Used when `--auto-fund` is passed to import or add commands
33
*/
4-
export const MIN_RUNWAY_DAYS = 10
4+
export const MIN_RUNWAY_DAYS = 30

src/common/upload-flow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export interface UploadFlowResult extends SynapseUploadResult {
4848

4949
/**
5050
* Perform auto-funding if requested
51-
* Automatically ensures a minimum of 10 days of runway based on current usage + new file requirements
51+
* Automatically ensures a minimum of 30 days of runway based on current usage + new file requirements
5252
*
5353
* @param synapse - Initialized Synapse instance
5454
* @param fileSize - Size of file being uploaded (in bytes)

src/core/payments/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { isSessionKeyMode } from '../synapse/index.js'
2222
// Constants
2323
export const USDFC_DECIMALS = 18
2424
const MIN_FIL_FOR_GAS = ethers.parseEther('0.1') // Minimum FIL padding for gas
25-
export const DEFAULT_LOCKUP_DAYS = 10 // WarmStorage requires 10 days lockup
25+
export const DEFAULT_LOCKUP_DAYS = 30 // WarmStorage requires 30 days lockup
2626

2727
// Maximum allowances for trusted WarmStorage service
2828
// Using MaxUint256 which MetaMask displays as "Unlimited"
@@ -379,7 +379,7 @@ export async function setServiceApprovals(
379379
): Promise<string> {
380380
const warmStorageAddress = synapse.getWarmStorageAddress()
381381

382-
// Max lockup period is always 10 days worth of epochs for WarmStorage
382+
// Max lockup period is always 30 days worth of epochs for WarmStorage
383383
const maxLockupPeriod = BigInt(DEFAULT_LOCKUP_DAYS) * TIME_CONSTANTS.EPOCHS_PER_DAY
384384

385385
// Set the service approval
@@ -535,7 +535,7 @@ export function calculateStorageAllowances(storageTiB: number, pricePerTiBPerEpo
535535
// Calculate rate allowance (per epoch payment)
536536
const rateAllowance = (pricePerTiBPerEpoch * BigInt(scaledStorage)) / BigInt(scale)
537537

538-
// Calculate lockup allowance (10 days worth)
538+
// Calculate lockup allowance (30 days worth)
539539
const epochsIn10Days = BigInt(DEFAULT_LOCKUP_DAYS) * TIME_CONSTANTS.EPOCHS_PER_DAY
540540
const lockupAllowance = rateAllowance * epochsIn10Days
541541

@@ -587,7 +587,7 @@ export function calculateActualCapacity(rateAllowance: bigint, pricePerTiBPerEpo
587587
export function calculateStorageFromUSDFC(usdfcAmount: bigint, pricePerTiBPerEpoch: bigint): number {
588588
if (pricePerTiBPerEpoch === 0n) return 0
589589

590-
// Calculate how much this covers for 10 days
590+
// Calculate how much this covers for 30 days
591591
const epochsIn10Days = BigInt(DEFAULT_LOCKUP_DAYS) * TIME_CONSTANTS.EPOCHS_PER_DAY
592592
const ratePerEpoch = usdfcAmount / epochsIn10Days
593593

@@ -597,7 +597,7 @@ export function calculateStorageFromUSDFC(usdfcAmount: bigint, pricePerTiBPerEpo
597597
/**
598598
* Compute the additional deposit required to fund current usage for a duration.
599599
*
600-
* The WarmStorage service maintains ~10 days of lockup (lockupUsed) and draws future
600+
* The WarmStorage service maintains ~30 days of lockup (lockupUsed) and draws future
601601
* lockups from the available deposit (deposited - lockupUsed). To keep the current
602602
* rails alive for N days, ensure available >= N days of spend at the current rateUsed.
603603
*
@@ -835,7 +835,7 @@ export function calculateDepositCapacity(
835835
}
836836

837837
// With infinite allowances, deposit is the only limiting factor
838-
// Deposit needs to cover: lockup (10 days) + at least some buffer
838+
// Deposit needs to cover: lockup (30 days) + at least some buffer
839839
const epochsIn10Days = BigInt(DEFAULT_LOCKUP_DAYS) * TIME_CONSTANTS.EPOCHS_PER_DAY
840840
const epochsPerMonth = TIME_CONSTANTS.EPOCHS_PER_MONTH
841841

src/import/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CLIAuthOptions } from '../utils/cli-auth.js'
33

44
export interface ImportOptions extends CLIAuthOptions {
55
filePath: string
6-
/** Auto-fund: automatically ensure minimum 10 days of runway */
6+
/** Auto-fund: automatically ensure minimum 30 days of runway */
77
autoFund?: boolean
88
}
99

src/payments/fund.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { isTTY, log } from '../utils/cli-logger.js'
3232
import type { AutoFundOptions, FundingAdjustmentResult, FundOptions } from './types.js'
3333

3434
// Helper: confirm/warn or bail when target implies < 10-day runway
35-
async function ensureBelowTenDaysAllowed(opts: {
35+
async function ensureBelowThirtyDaysAllowed(opts: {
3636
spinner: Spinner
3737
warningLine1: string
3838
warningLine2: string
@@ -52,7 +52,7 @@ async function ensureBelowTenDaysAllowed(opts: {
5252
log.flush()
5353

5454
const proceed = await confirm({
55-
message: 'Proceed with reducing runway below 10 days?',
55+
message: 'Proceed with reducing runway below 30 days?',
5656
initialValue: false,
5757
})
5858
if (!proceed) {
@@ -347,14 +347,14 @@ export async function runFund(options: FundOptions): Promise<void> {
347347
}
348348
delta = 0n
349349
}
350-
} else if (runwayCheckDays != null && runwayCheckDays < 10) {
350+
} else if (runwayCheckDays != null && runwayCheckDays < Number(TIME_CONSTANTS.DEFAULT_LOCKUP_DAYS)) {
351351
const line1 = hasDays
352-
? 'Requested runway below 10-day safety baseline.'
353-
: 'Target deposit implies less than 10 days of runway at current spend.'
352+
? 'Requested runway below 30-day safety baseline.'
353+
: 'Target deposit implies less than 30 days of runway at current spend.'
354354
const line2 = hasDays
355-
? 'WarmStorage reserves 10 days of costs; a shorter runway risks termination.'
355+
? 'WarmStorage reserves 30 days of costs; a shorter runway risks termination.'
356356
: 'Increase target or accept risk: shorter runway may cause termination.'
357-
await ensureBelowTenDaysAllowed({
357+
await ensureBelowThirtyDaysAllowed({
358358
spinner,
359359
warningLine1: line1,
360360
warningLine2: line2,

src/payments/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export function displayPricing(pricePerGiBPerMonth: bigint, pricePerTiBPerMonth:
299299
log.line(pc.bold('Current Pricing:'))
300300
log.indent(`1 GiB/month: ${formatUSDFC(pricePerGiBPerMonth)} USDFC`)
301301
log.indent(`1 TiB/month: ${formatUSDFC(pricePerTiBPerMonth)} USDFC`)
302-
log.indent(pc.gray('(for each upload, WarmStorage service will reserve 10 days of costs as security)'))
302+
log.indent(pc.gray('(for each upload, WarmStorage service will reserve 30 days of costs as security)'))
303303
log.flush()
304304
}
305305

src/test/unit/payments-setup.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('Payment Setup Tests', () => {
196196
'0xwarmstorage',
197197
rateAllowance,
198198
lockupAllowance,
199-
28800n, // 10 days * 2880 epochs/day
199+
86400, // 30 days * 2880 epochs/day
200200
'USDFC'
201201
)
202202
})
@@ -210,7 +210,7 @@ describe('Payment Setup Tests', () => {
210210
expect(allowances.storageCapacityTiB).toBe(1)
211211
expect(allowances.rateAllowance).toBe(ethers.parseUnits('0.0000565', 18))
212212
expect(allowances.lockupAllowance).toBe(
213-
ethers.parseUnits('0.0000565', 18) * 2880n * 10n // rate * epochs/day * 10 days
213+
ethers.parseUnits('0.0000565', 18) * 2880n * 30n // rate * epochs/day * 30 days
214214
)
215215
})
216216

@@ -231,7 +231,7 @@ describe('Payment Setup Tests', () => {
231231
// 1.5 TiB
232232
expect(allowances.rateAllowance).toBe(ethers.parseUnits('0.00008475', 18))
233233
expect(allowances.lockupAllowance).toBe(
234-
ethers.parseUnits('0.00008475', 18) * 2880n * 10n // rate * epochs/day * 10 days
234+
ethers.parseUnits('0.00008475', 18) * 2880n * 30n // rate * epochs/day * 30 days
235235
)
236236
})
237237

@@ -355,8 +355,8 @@ describe('Payment Setup Tests', () => {
355355
describe('calculateStorageFromUSDFC', () => {
356356
it('should calculate storage capacity from USDFC amount with high precision', () => {
357357
const pricePerTiBPerEpoch = ethers.parseUnits('0.0000565', 18)
358-
// 10 days worth of 1GiB/month = 0.0015881472 USDFC
359-
const usdfcAmount = ethers.parseUnits('0.0015881472', 18)
358+
// 30 days worth of 1GiB/month = 0.0047644416 USDFC
359+
const usdfcAmount = ethers.parseUnits('0.0047644416', 18)
360360

361361
const capacityTiB = calculateStorageFromUSDFC(usdfcAmount, pricePerTiBPerEpoch)
362362

src/test/unit/payments.compute.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('computeAdjustmentForExactDays', () => {
8686
const rateUsed = 1_000_000_000_000_000_000n // 1 USDFC/epoch
8787
const perDay = rateUsed * TIME_CONSTANTS.EPOCHS_PER_DAY
8888
const days = 10
89-
const available = perDay * 10n // exactly 10 days
89+
const available = perDay * 30n // exactly 30 days
9090
const status = makeStatus({ depositedAmount: available, lockupUsed: 0n, rateUsed })
9191
const res = computeAdjustmentForExactDays(status, days)
9292
const perHour = perDay / 24n
@@ -163,7 +163,7 @@ describe('computeAdjustmentForExactDaysWithFile', () => {
163163
it('adds file requirements to existing usage', () => {
164164
// Scenario: Existing storage, adding another file
165165
const rateUsed = 1_000_000_000_000_000_000n // 1 USDFC/epoch
166-
const lockupUsed = rateUsed * BigInt(10) * TIME_CONSTANTS.EPOCHS_PER_DAY // 10 days worth
166+
const lockupUsed = rateUsed * BigInt(30) * TIME_CONSTANTS.EPOCHS_PER_DAY // 30 days worth
167167
const depositedAmount = (lockupUsed * 12n) / 10n // 20% buffer
168168
const status = makeStatus({ depositedAmount, lockupUsed, rateUsed })
169169

0 commit comments

Comments
 (0)