In the BaseGauge
contract's constructor
, the minBoost
parameter is incorrectly set to 1e18 instead of 10000 (basis points). This causes an arithmetic underflow in the boost calculation, leading to a complete failure of the staking mechanism and potential denial of service for the gauge system.
The BaseGauge is an abstract contract that serves as the base implementation for RWA and RAAC gauges. Because of the above bug, both contracts become useless because the boost calculation mechanism is broken as described below.
The boost system is designed to work in basis points (10000 = 1x) [https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/libraries/governance/BoostCalculator.sol#L37]
The BaseGauge uses the BoostCalculator library for it's boostState variable [https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/governance/gauges/BaseGauge.sol#L70]
The maxBoost is correctly set to 25000 (2.5x)
The minBoost is incorrectly set to 1e18 instead of 10000
If a user wants to stake the transaction reverts as described in the flow below:
This causes an arithmetic underflow in the boost calculation:
In order to run the test you need to:
Run foundryup
to get the latest version of Foundry
Install hardhat-foundry: npm install --save-dev @nomicfoundation/hardhat-foundry
Import it in your Hardhat config: require("@nomicfoundation/hardhat-foundry");
Make sure you've set the BASE_RPC_URL
in the .env
file or comment out the forking
option in the hardhat config.
Run npx hardhat init-foundry
There is one file in the test folder that will throw an error during compilation so rename the file in test/unit/libraries/ReserveLibraryMock.sol
to => ReserveLibraryMock.sol_broken
so it doesn't get compiled anymore (we don't need it anyways).
Create a new folder test/foundry
Paste the below code into a new test file i.e.: FoundryTest.t.sol
Run the test: forge test --mc FoundryTest -vvvv
Complete failure of the staking mechanism
Denial of service for the entire gauge system
Inability to stake tokens or earn rewards
Requirement to redeploy the gauge contracts
The Likelihood is High => it will always happen
The Impact is Low/Med => no direct loss of funds but it breaks the whole gauge reward system
Foundry
Manual Review
Add constants for clarity and update constructor:
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.