Skip to content

venus: Comptroller.liquidationIncentiveMantissa() reverts on BSC mainnet (Diamond proxy does not route selector) #323

@obchain

Description

@obchain

Problem

VenusAdapter::new() aborts at startup when run against BSC mainnet (chain 56, Comptroller `0xfd36e2c2a6789db23113685031d7f16329158384`) because the call to `liquidationIncentiveMantissa()` reverts:

```
Error: Venus: Comptroller.liquidationIncentiveMantissa() failed
Caused by:
server returned an error response: error code 3: execution reverted:
Diamond: Function does not exist: 0x08c379a0...4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374
```

The Venus Unitroller on BSC was migrated to a diamond / facet pattern (EIP-2535-style) and `liquidationIncentiveMantissa()` is not exposed on the Diamond's selector table. The same call works on the legacy ABI we wired against in the unit tests, which is why this only surfaces against live mainnet RPC.

Impact

P1 / blocker — `charon listen` cannot start against BSC mainnet at all. The bot exits before any block is scanned, before `/metrics` is bound, and before Grafana panels can populate. Found while bringing up the local Prometheus + Grafana stack from PR #313.

Fix

Wrap the call in a fallback to the Venus governance default (`1.10e18` = 10% liquidation bonus, the value enshrined in the protocol since launch and unchanged by any executed governance proposal). Log a `warn!` so operators know the fallback fired:

```rust
let liquidation_incentive_mantissa = match comp
.liquidationIncentiveMantissa()
.call()
.await
{
Ok(r) => r._0,
Err(err) => {
warn!(err = ?err, "Venus Comptroller diamond did not route liquidationIncentiveMantissa() — falling back to governance default 1.10e18 (10% bonus)");
U256::from(1_100_000_000_000_000_000u64)
}
};
```

Long-term: the proper fix is to read the value from the active facet (Venus exposes it via the `liquidationIncentiveMantissa` storage slot in `ComptrollerStorage`), but that requires resolving the facet address from the diamond cut log first. Out of scope for unblocking the demo.

Severity

P1-core. Blocks any mainnet bring-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)priority: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