The RAACToken's tax mechanism can interfere with the FeeCollector's operations if the FeeCollector address is not whitelisted. This oversight would lead to accounting mismatches between collected and recorded fees, potentially disrupting the protocol's fee distribution system.
The issue arises from the interaction between RAACToken's tax mechanism and FeeCollector's fee accounting when proper whitelisting is not implemented:
In RAACToken, all transfers are taxed unless the sender or receiver is whitelisted:
The FeeCollector records the full amount it expects to receive:
The test demonstrates this behavior:
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
If FeeCollector is not whitelisted:
Tokens transferred to FeeCollector would be taxed
FeeCollector's internal accounting would be incorrect
Fee distribution calculations would be inaccurate => transaction will fail
Protocol operations dependent on fee distribution will fail
Foundry
Manual Review
Add explicit whitelisting of FeeCollector in collectFee function:
Or exclude the feeCollector address in the _update function by default:
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.