The contract incorrectly calculates the storage slot for the balanceOf(self) mapping by reversing the order of the key and base slot in the abi.encode function. It also mishandles simple storage variables by hashing their slot numbers unnecessarily. As a result, the contract reads from incorrect storage locations, leading to invalid parameter values that undermine the oracle’s reliability.
Affected Component : The PARAM_SLOTS array, specifically the entry for balanceOf(self), and the _extractParametersFromProof function that processes state proofs.
Root Cause:
For balanceOf(self), the slot is calculated as keccak256(abi.encode(18, SCRVUSD)) instead of the correct keccak256(abi.encode(SCRVUSD, 18)).
For simple variables (e.g., total_debt), the slot is hashed (e.g., keccak256(abi.encode(21))) rather than passed directly as 21.
Technical Impact:
The contract retrieves invalid data for balanceOf(self) and potentially other parameters due to accessing incorrect storage slots.
This breaks the functionality of the verifyScrvusdByBlockHash and verifyScrvusdByStateRoot functions, which rely on accurate parameter extraction to update the scrvUSD oracle .
The incorrect storage slot calculation directly impairs the contract’s core purpose: verifying and updating the scrvUSD oracle with accurate data. Invalid parameter values can lead to:
Incorrect price calculations in the oracle.
Financial losses or miscalculations in systems relying on the oracle.
Erosion of trust in the oracle’s accuracy.
The issue affects all transactions invoking verifyScrvusdByBlockHash or verifyScrvusdByStateRoot, making it a systemic flaw with widespread consequences.
Scope: Impacts the entire oracle update process, affecting downstream applications and users dependent on the scrvUSD oracle.
Manual code review
Correct Mapping Slot Calculation :
Update the balanceOf(self) slot calculation in the PARAM_SLOTS array to :
- Per sponsor comments, verified slot is vyper, solidity contract only verifies it. - Vyper computes storage slots different from solidity as seen [here](https://ethereum.stackexchange.com/questions/149311/storage-collision-in-vyper-hashmap)
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.