From fcbc9378323065f6f0b3fdf143afec2a2ee3cf99 Mon Sep 17 00:00:00 2001 From: obchain Date: Sun, 26 Apr 2026 13:48:35 +0530 Subject: [PATCH] fix(config): swap dead BTCB Chainlink address for live AggregatorV3 (closes #109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The address shipped in #109's "fix" — 0x264990fbd0…1f0 — has no bytecode on BSC mainnet. `cast code` returns 0x against both dRPC and bsc-dataseed.binance.org, so every `decimals()` / `latestRoundData()` call against it abi-decodes garbage and BTCB-collateral positions have been silently unpriceable since #35 landed. Discovered the live address by walking the on-chain Venus oracle path: ResilientOracle (0x6592b5DE…) → ChainlinkOracle facet (0x1B210344…) → tokenConfigs(BTCB) → 0x8ECF7dE377F788A813F5215668E282556b35f300 Verified live against bsc.drpc.org: cast code → 19,145 bytes of bytecode decimals() → 18 (Venus uses 18-decimal Chainlink wrappers, not the standard 8-decimal feeds) description() → "BTC / USD" latestRoundData → answer ≈ 78,090e18 (= $78,090), fresh round Confirmed Chainlink-ops-owned: feed `owner()` is 0xcb6754D5…, the same multisig that owns the BNB/USD canonical feed. PriceCache (`crates/charon-scanner/src/oracle.rs:33,59`) reads `decimals()` per feed at startup and `CachedPrice::scaled_to` rescales to a target — the 8→18 decimal difference is invisible to consumers, no Rust changes required. Same swap applied to `config/fork.toml` since the fork profile pins mainnet block forks and would have hit the same garbage decode. Comment block above [chainlink.bnb] in default.toml records the Venus-oracle discovery path so future reviewers don't have to walk it again. Adjacent finding (separate issue recommended): the other four [chainlink.bnb] entries (BNB, ETH, USDT, USDC) were sourced the same way from docs.chain.link. Given one of five was bytecodeless, the remaining four warrant the same cast-code/decimals/description sanity check. --- config/default.toml | 13 ++++++++++++- config/fork.toml | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/default.toml b/config/default.toml index 84c731e..57b8e53 100644 --- a/config/default.toml +++ b/config/default.toml @@ -90,9 +90,20 @@ bind = "127.0.0.1:9091" # ── Chainlink price feeds (per chain, per asset symbol) ─────────────────── # Only feeds listed here are polled by the PriceCache. Add more as new # Venus markets become relevant. Feed addresses from docs.chain.link. +# +# Note on BTCB: docs.chain.link historically advertised the 8-decimal +# proxy 0x264990fb…1f0 as "BTC / USD" on BSC, but that address has no +# bytecode on mainnet today (decimals()/latestRoundData() abi-decode +# garbage). The address used below was discovered by walking Venus's +# ResilientOracle (0x6592b5DE…) → ChainlinkOracle facet (0x1B210344…) +# → tokenConfigs(BTCB) and then verified to be Chainlink-owned by +# matching its `owner()` (0xcb6754D5…) against the BNB/USD canonical +# feed's owner. It is an 18-decimal aggregator; PriceCache reads +# `decimals()` per feed and `CachedPrice::scaled_to` rescales, so the +# 8-vs-18 difference is invisible to consumers. [chainlink.bnb] BNB = "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE" -BTCB = "0x264990fbd0A4796A3E3d8E37022BdAf1A5a4C1f0" # BTC / USD (canonical, docs.chain.link) +BTCB = "0x8ECF7dE377F788A813F5215668E282556b35f300" # BTC / USD — 18-dec AggregatorV3, Chainlink-ops-owned (#109) ETH = "0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e" USDT = "0xB97Ad0E74fa7d920791E90258A6E2085088b4320" USDC = "0x51597f405303C4377E36123cBc172b13269EA163" diff --git a/config/fork.toml b/config/fork.toml index d542a5f..9a3efad 100644 --- a/config/fork.toml +++ b/config/fork.toml @@ -96,7 +96,7 @@ bind = "127.0.0.1:9091" # Mainnet feed addresses resolve against the fork. [chainlink.bnb] BNB = "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE" -BTCB = "0x264990fbd0A4796A3E3d8E37022BdAf1A5a4C1f0" +BTCB = "0x8ECF7dE377F788A813F5215668E282556b35f300" # BTC / USD — 18-dec AggregatorV3, Chainlink-ops-owned (#109) ETH = "0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e" USDT = "0xB97Ad0E74fa7d920791E90258A6E2085088b4320" USDC = "0x51597f405303C4377E36123cBc172b13269EA163"