Skip to content

[pipeline] repay_to_usd_cents_placeholder underprices BNB/BTC/ETH by 600x-60000x; no tracking issue opened #178

@obchain

Description

@obchain

Refs #42

PR: feat(cli): wire scanner → router → builder → simulator pipeline (feat/17-cli-e2e-pipeline)
Commit: latest on feat/17-cli-e2e-pipeline
File: crates/charon-cli/src/main.rs or crates/charon-executor/src/builder.rs (repay_to_usd_cents_placeholder function)

Problem:

The placeholder assumes 1 debt token = 1 USD at 18 decimals. Real Venus market prices on BSC:

  • BNB: ~00, underprice factor 600x
  • BTCB: ~0,000, underprice factor 60,000x
  • ETH: ~,000, underprice factor 3,000x
  • USDT/USDC: ~, correct

For BNB-debt: repay_amount is in wei (e.g. 1 BNB = 1e18 wei). If treated as cents, reported profit = 1e18 cents = e16, passing every threshold. If truncated to u64 (max 1.8e19), 1 BNB of repay still overflows in cents for any reasonable profit fraction. The workspace lint deny(arithmetic_side_effects) should catch arithmetic overflow here — if it does not, the conversion wraps silently.

For BTC-debt at 0,000: even a 0.01 BTC repay = 1e15 wei, reported as 1e15 cents = e13 profit. Every opportunity passes the min_profit gate regardless of actual economics.

The PR acknowledges this placeholder but opens no tracking issue. The CLAUDE.md requires placeholder code to have corresponding tracking issues.

Impact:

  1. Min-profit gate is non-functional for all non-stablecoin markets (the majority of Venus TVL).
  2. Queue ordering is meaningless across price tiers.
  3. No tracking issue means this placeholder may persist into the broadcast PR.

Fix: Open a tracking issue for implementing wei-to-USD conversion using Chainlink 8-decimal feed prices and per-token decimals before this PR merges. Until resolved, add a runtime assertion that panics if the debt token is not a known stablecoin, making the placeholder's scope explicit and preventing silent misuse on BNB/BTC/ETH markets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p1-coreCore MVP scopestatus:readyScoped and ready to pick up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions