Minter.sol#_executeInflationRateUpdate()
inflationManager().checkpointAllGauges()
is called after InflationRate is updated, causing users to lose rewards
#98
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L187-L215
Vulnerability details
When
Minter.sol#_executeInflationRateUpdate()
is called, if an_INFLATION_DECAY_PERIOD
has past sincelastInflationDecay
, it will update the InflationRate for all of the gauges.However, in the current implementation, the rates will be updated first, followed by the rewards being settled using the new rates on the gauges using
inflationManager().checkpointAllGauges()
.If the
_INFLATION_DECAY_PERIOD
has passed for a long time beforeMinter.sol#executeInflationRateUpdate()
is called, the users may lose a significant amount of rewards.On a side note,
totalAvailableToNow
is updated correctly.https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L187-L215
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L110-L125
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/KeeperGauge.sol#L110-L117
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L507-L519
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L173-L176
PoC
Given:
AmmGauge
pool;Minter.sol#_executeInflationRateUpdate()
is called;claimableRewards()
and received500
Bkd tokens.Expected Results:
1000
Bkd tokens as rewards.Actual Results:
500
Bkd tokens as rewards.Recommendation
Consider moving the call to
checkpointAllGauges()
to before thecurrentInflationAmountKeeper
is updated.The text was updated successfully, but these errors were encountered: