Skip to content

feat(pricing): add baseline floor and recalibrate quadratic coefficient#64

Merged
jacderida merged 1 commit intorc-2026.4.1from
feat/pricing-baseline-recalibration
Apr 7, 2026
Merged

feat(pricing): add baseline floor and recalibrate quadratic coefficient#64
jacderida merged 1 commit intorc-2026.4.1from
feat/pricing-baseline-recalibration

Conversation

@mickvandijke
Copy link
Copy Markdown
Collaborator

Summary

Phase 1 pricing recalibration per @jim / @AJ proposal.

The legacy formula price = (n / 6000)² produced ~$25/GB at the lower stable boundary and ~$0/GB when nodes were empty (only a 1-wei sentinel floor). Both unreasonable at the current ~$0.10/ANT token price.

New formula

price_per_chunk_ANT(n) = BASELINE + K × (n / D)²
Constant Value Role
BASELINE 0.00390625 ANT Spam barrier at empty
K 0.03515625 ANT Re-anchored quadratic coefficient
D 6000 Lower stable boundary (unchanged)

Pricing at key points

n price
0 0.00390625 ANT (baseline only)
6000 (D) 0.0390625 ANT (BASELINE + K)
12000 (2D) ~0.1445 ANT (BASELINE + 4K)
24000 (4D) ~0.566 ANT (BASELINE + 16K)

Notes

  • The non-zero BASELINE removes the need for the legacy MIN_PRICE_WEI = 1 sentinel; that branch is gone.
  • calculate_price signature is unchanged — no call-site updates needed in quote.rs or single_node.rs.
  • All wei constants are precomputed u128 literals; arithmetic uses Amount (U256) with saturating_mul/saturating_add for overflow safety on usize::MAX inputs.

Test plan

  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • cargo test --lib payment::pricing — 13/13 (rewritten for the new formula)
  • cargo test --lib payment:: — 147/147 (all downstream payment tests)
  • cargo test --test e2e --features test-utils payment — 10/10 (live testnet + Anvil EVM, full quote→pay→verify→store flow)

🤖 Generated with Claude Code

Phase 1 pricing recalibration. The legacy formula
`price = (n / 6000)²` produced ~$25/GB at the lower stable boundary
and ~$0/GB when nodes were empty (with only a 1-wei sentinel floor) —
both unreasonable for the current ~\$0.10/ANT token price.

New formula:
    price_per_chunk_ANT(n) = BASELINE + K × (n / D)²

with BASELINE = 0.00390625 ANT (spam barrier at empty), K = 0.03515625
ANT (re-anchored coefficient), and D = 6000 (unchanged). The non-zero
baseline removes the need for the legacy MIN_PRICE_WEI = 1 sentinel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jacderida jacderida merged commit b895b16 into rc-2026.4.1 Apr 7, 2026
1 check passed
@jacderida jacderida deleted the feat/pricing-baseline-recalibration branch April 7, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants