PR: #33 (feat/08-venus-adapter)
File: crates/charon-protocols/src/venus.rs
Lines: 84, 266-271
Problem: balanceOfUnderlying is external returns (non-view) in ABI line 84. Calls accrueInterest() internally before computing result. Adapter invokes it at line 266 inside fetch_position_inner on every (borrower, vToken) pair via eth_call. Although eth_call does not persist state, node simulates a state-mutating transaction for every call, inflating RPC cost and node CPU. Some archive nodes and rate-limiting proxies route non-view eth_calls differently and may reject or throttle them. ABI comment at 65-67 acknowledges the issue but does not fix it.
Impact: Increased RPC latency and resource usage per scan cycle. 50 borrowers x 8 markets = 400 simulated state-mutating calls per block. Archive nodes enforcing view-only eth_call semantics return errors; fetch_position_inner falls through warn! path, silently drops collateral data for every position.
Fix:
let v_balance = vt.balanceOf(borrower).call().await?.r#_0;
let rate = vt.exchangeRateStored().call().await?.r#_0;
let one_e18 = U256::from(10u64).pow(U256::from(18u64));
let supply = v_balance.saturating_mul(rate) / one_e18;
Both are pure view (ABI lines 74, 87). Remove balanceOfUnderlying from ABI block entirely.
PR: #33 (feat/08-venus-adapter)
File: crates/charon-protocols/src/venus.rs
Lines: 84, 266-271
Problem:
balanceOfUnderlyingisexternal returns(non-view) in ABI line 84. CallsaccrueInterest()internally before computing result. Adapter invokes it at line 266 insidefetch_position_inneron every (borrower, vToken) pair viaeth_call. Althougheth_calldoes not persist state, node simulates a state-mutating transaction for every call, inflating RPC cost and node CPU. Some archive nodes and rate-limiting proxies route non-vieweth_calls differently and may reject or throttle them. ABI comment at 65-67 acknowledges the issue but does not fix it.Impact: Increased RPC latency and resource usage per scan cycle. 50 borrowers x 8 markets = 400 simulated state-mutating calls per block. Archive nodes enforcing view-only
eth_callsemantics return errors;fetch_position_innerfalls throughwarn!path, silently drops collateral data for every position.Fix:
Both are pure view (ABI lines 74, 87). Remove
balanceOfUnderlyingfrom ABI block entirely.