Open hats-bug-reporter[bot] opened 2 months ago
Best practice
@0xmahdirostami
Low Severity: These are typically minor issues that pose a limited impact on the system. They might include: Inefficiencies in gas usage. Minor deviations from best practices that don't lead to security risks. Small bugs that do not affect the protocol's functionality or security.
I think it's more than best practices. A audited code should never have panic error. This effects EVM in the backend. Please revaluate according to Hats rule.
Github username: -- Twitter username: -- Submission hash (on-chain): 0xa6fbe743e268cec3e64e0e27a8a0b7511e5b089682aaa86babf785af7d23e157 Severity: medium
Description: Description
SingelTokenVirtualRewarderUpgradeable::deposit
andwithdraw
can give panic error.From the solidity docs
"Panic" refers to a condition indicating that the EVM has encountered an issue it cannot handle
Proof of Concept (PoC) File
deposit will give panic error due to overflow and withdraw due to underflow.
Revised Code File (Optional)
Handle such panic errors and revert with
Error
"Error" uses the "REVERT" opcode to halt execution and revert any changes made to the contract state. This allows the contract to gracefully handle unexpected conditions and return to a known, stable state
eg