Skip to content

fix(config): swap dead BTCB Chainlink address for live AggregatorV3 (closes #109)#337

Merged
obchain merged 1 commit into
mainfrom
fix/109-btcb-feed-address
Apr 26, 2026
Merged

fix(config): swap dead BTCB Chainlink address for live AggregatorV3 (closes #109)#337
obchain merged 1 commit into
mainfrom
fix/109-btcb-feed-address

Conversation

@obchain
Copy link
Copy Markdown
Owner

@obchain obchain commented Apr 26, 2026

Summary

  • Swap dead BTCB Chainlink feed 0x264990fbd0…1f0 (no bytecode on BSC mainnet) for the live AggregatorV3 0x8ECF7dE377F788A813F5215668E282556b35f300 discovered via the Venus oracle path.
  • Apply the same swap in config/fork.toml (forks mainnet block, hits same dead address).
  • Add a comment block above [chainlink.bnb] documenting the discovery path.

Closes #109 (re-fixed — the previous fix shipped a still-wrong address).

Why

cast code 0x264990fbd0A4796A3E3d8E37022BdAf1A5a4C1f0 --rpc-url https://bsc.drpc.org0x. EOA, no contract. Every BTCB price call has been silently failing with ABI decoding failed: buffer overrun while deserializing since PR #35.

Live charon log against the dead address:

WARN charon_scanner::oracle: chainlink refresh failed
  symbol=BTCB
  err=feed 'BTCB' (0x264990FBd0a4796a3E3d8E37022BdAf1A5a4C1f0): decimals() failed
       ABI decoding failed: buffer overrun while deserializing

Verification

$ cast code 0x8ECF7dE377F788A813F5215668E282556b35f300 --rpc-url https://bsc.drpc.org | head -c 30
0x6080604052348015610010576000

$ cast call 0x8ECF7dE377F788A813F5215668E282556b35f300 'decimals()(uint8)' --rpc-url https://bsc.drpc.org
18

$ cast call 0x8ECF7dE377F788A813F5215668E282556b35f300 'description()(string)' --rpc-url https://bsc.drpc.org
"BTC / USD"

$ cast call 0x8ECF7dE377F788A813F5215668E282556b35f300 'latestRoundData()(uint80,int256,uint256,uint256,uint80)' --rpc-url https://bsc.drpc.org
36893488147419392801
78090021016201850000000   # = $78,090
1777191159
1777191162
36893488147419392801

$ cast call 0x8ECF7dE377F788A813F5215668E282556b35f300 'owner()(address)' --rpc-url https://bsc.drpc.org
0xcb6754D5e11C4B70601D0F2068eA62089325979b   # same as BNB/USD owner — Chainlink-ops multisig

Decimal difference (no Rust change needed)

The new aggregator is 18-decimal, not 8 like the other feeds. PriceCache reads decimals() per feed at startup (crates/charon-scanner/src/oracle.rs:59) and CachedPrice::scaled_to rescales to any target — the difference is invisible to consumers.

Reviewer findings (blockchain-code-reviewer)

All applied:

  • Confirmed live address is Chainlink-ops-controlled, not a Venus wrapper (owner-match check).
  • Found config/fork.toml carries the same dead address — patched.
  • Added discovery-path comment so future reviewers don't have to redo the walk.
  • Verified no Rust source / test fixture pins the old address (grep -rn 264990fb returned only the two TOML hits).
  • Flagged for separate issue: the other four [chainlink.bnb] entries deserve the same cast code sanity check.

Test plan

  • cast code confirms bytecode on the new address (both dRPC and bsc-dataseed.binance.org)
  • decimals(), description(), latestRoundData() all succeed
  • owner() matches BNB/USD canonical feed owner
  • No Rust changes required — PriceCache is decimal-agnostic
  • CI gates (cargo / forge / docker)

…loses #109)

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.
@obchain obchain merged commit 1319a61 into main Apr 26, 2026
2 checks passed
@obchain obchain deleted the fix/109-btcb-feed-address branch April 26, 2026 08:22
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.

[PR #35] config/default.toml: wrong BTCB/USD feed address — every BTCB price call fails or hits non-feed

1 participant