The _setLastUpdateBlock
internal function in the RAACMinter contract is responsible for updating the lastUpdateBlock variable, which tracks the block number of the last token minting event triggered by the tick function. While the function includes a check to ensure newLastUpdateBlock does not exceed the current block number (block.number), it lacks a validation to prevent setting newLastUpdateBlock to a value less than the existing lastUpdateBlock. This omission allows an authorized caller (e.g., someone with the PAUSER_ROLE) to "rewind" lastUpdateBlock, potentially leading to over-minting of RAAC tokens when tick is subsequently called.
The function is called by a pause, unpause, and emergency shutdown when updateLastBlock is true.
The tick function calculates the number of blocks since the last update as blocksSinceLastUpdate = currentBlock - lastUpdateBlock and mints tokens proportional to this difference (emissionRate * blocksSinceLastUpdate).
The tick function calculates the number of blocks since the last update as blocksSinceLastUpdate = currentBlock - lastUpdateBlock and mints tokens proportional to this difference (emissionRate * blocksSinceLastUpdate).
: By setting lastUpdateBlock to a lower value than its current state, the difference blocksSinceLastUpdate increases artificially when tick is called. This results in minting more RAAC tokens than intended, inflating the token supply beyond the designed emission schedule.
The absence of a check ensuring newLastUpdateBlock >= lastUpdateBlock allows rewinding of lastUpdateBlock.
Current state: lastUpdateBlock = 1000, block.number = 1500, emissionRate = 1e18 RAAC per block.
pause(true, 500) is called by a PAUSER_ROLE holder, setting lastUpdateBlock = 500.
Later, at block.number = 1600, tick is called:
blocksSinceLastUpdate = 1600 - 500 = 1100
.
Minted tokens= 1e18 * 1100 = 1100e18
Raac.
Without rewinding, if lastUpdateBlock remained 1000:
blocksSinceLastUpdate = 1600 - 1000 = 600.
Minted tokens = 1e18 * 600 = 600e18 RAAC.
An extra 500e18 RAAC is minted due to the rewind, exceeding the intended emission.
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.