29483 - [SC - Insight] RewardTimelockcanExecuteTransaction - Reward tr...
RewardTimelock::canExecuteTransaction() - Reward transaction allowed to execute before the cooldown period has strictly passed.
RewardTimelock::canExecuteTransaction() - Reward transaction allowed to execute before the cooldown period has strictly passed.Description
Brief/Intro
Vulnerability Details
function canExecuteTransaction(bytes32 txHash) external view returns (bool) {
TxStorageData memory txData = txHashData[txHash];
if (vaultFreezer.isFrozen(txData.vault)) return false;
if (!arbitration.vaultIsInArbitration(txData.vault)) return false;
// @dev Time shouldn't be 0 if vault is in arbitration.
// @dev At least txCooldown time should have passed since the vault entered into an arbitration.
if (block.timestamp - arbitration.timeSinceOngoingArbitration(txData.vault) < txData.cooldown) return false;
return
txData.state == TxState.Queued &&
txData.queueTimestamp + txData.cooldown <= block.timestamp &&
//txData.queueTimestamp + txData.cooldown < block.timestamp && /// @audit added for PoC/testing purposes
(txData.expiration == 0 || txData.queueTimestamp + txData.cooldown + txData.expiration > block.timestamp);
}Awesome Analogy:
So to summarize:
Impact Details
IMPACT:
References
Proof of Concept
PoC:
TESTS:
Test 1: demonstrating the bug, allowing for reward tx execution during cooldown period, instead of only AFTER cooldown ends
Test 2: demonstrating the bugfix, allowing for reward tx execution only AFTER cooldown period.
For next two tests we increase the warp time by 1 second, i.e. 24 hours + 1 seconds.
Test 3: same as Test 1(with bug) but reward tx executed 1 second later:
Test 4: demonstrating the bugfix, allowing for reward tx execution only AFTER cooldown period.
Recommended bugfix:
Previous29467 - [SC - Low] RewardTimelockexecuteRewardTransaction - L Inco...Next29484 - [SC - Insight] Potential Loss of Precision in Conversion from ...
Last updated
Was this helpful?