Backd Tokenomics contest - SmartSek's results

Maximize the power of your assets and start earning yield

General Information

Platform: Code4rena

Start Date: 27/05/2022

Pot Size: $75,000 USDC

Total HM: 20

Participants: 58

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 15

Id: 131

League: ETH

Backd

Findings Distribution

Researcher Performance

Rank: 8/58

Findings: 3

Award: $3,472.66

🌟 Selected for report: 1

πŸš€ Solo Findings: 1

Findings Information

🌟 Selected for report: SmartSek

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

2732.5332 USDC - $2,732.53

External Links

Lines of code

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmConvexGauge.sol#L107-L111 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmConvexGauge.sol#L129-L134

Vulnerability details

Impact

The view functions used for a user to check their claimable rewards vary in their implementation. This can cause users to believe they are due X amount but will receive Y.

Proof of Concept

If the inflationRecipient is set, then poolStakedIntegral will be incremented in claimableRewards() but not in any other function like allClaimableRewards() or poolCheckpoint().

If a user calls claimableRewards() after the inflationRepient has been set, claimableRewards() will return a larger value than allClaimableRewards() or the amount actually returned by claimRewards().

Tools Used

Manual review

To make the logic consistent, claimableRewards() needs if (inflationRecipient == address(0)) added to it.

#0 - GalloDaSballo

2022-06-21T01:43:54Z

The warden has identified an incorrect implementation in how rewards are shown, while no assets are at risk, the issue identified is a programming mistake that could cause further issues.

For this reason I agree with Medium Severity

#1 - GalloDaSballo

2022-06-22T22:07:38Z

I'm still fairly conflicted on severity as the impact is going to be quite small, however at this time, because the "code is wrong", I still think Medium Severity to be valid

Awards

666.4988 USDC - $666.50

Labels

bug
QA (Quality Assurance)
resolved
sponsor confirmed

External Links

[L-01] Inconsistency in event emissions

Events are emitted at the beginning vs end of the function execution. Temporary variables are/aren't used in the event emission call.

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/utils/Preparable.sol#L140-L154

[L-02] Code vs comment conflict: Backwards imp. of β€œsafe”

The "safe" function is not the safe version. The unsafe version is the one that reverts in unsuccessful.

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/AddressProvider.sol#L307-L327

[L-03] Use of deprecated SafeApprove()

SafeApprove() has been deprecated according to OpenZeppelin.

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/FeeBurner.sol#L118

[L-04] Improper ownership transfer

It is recommended to make ownership transfer a two-step process where you firstly set a pending owner address and then accept the pending owner in a second call.

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/VestedEscrow.sol#L68-L72

[L-05] Missing event emissions on important setter functions

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmConvexGauge.sol#L86-L96

[L-06] Missing address(0) checks on important functions

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L227-L232 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/StakerVault.sol#L322 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/StakerVault.sol#L381 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/VestedEscrow.sol#L146 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmGauge.sol#L131

[N-01] Inconsistency in using modifier

Sometimes modifier is used. Sometimes require statement is used.

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/KeeperGauge.sol#L57 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/AmmGauge.sol#L50

[N-02] Typo in "an"

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L66

#0 - GalloDaSballo

2022-06-20T00:40:20Z

[L-01] Inconsistency in event emissions

Agree with the catch, consistency is key

[L-02] Code vs comment conflict: Backwards imp. of β€œsafe”

Nice catch

[L-03] Use of deprecated SafeApprove()

Valid but code is safe

##Β [L-04] Improper ownership transfer Disagree but valid

[L-05] Missing event emissions on important setter functions

Non-critical

[L-06] Missing address(0) checks on important functions

Valid per industry standard

[N-01] Inconsistency in using modifier

Agree, nice catch

Typo

Agree

This is the type of reports I'd like to see more of, actually specific catches that are custom tailored for the code in scope.

I'll do my best to give extra points to this report which is short, sweet and written by a human being

Awards

73.6341 USDC - $73.63

Labels

bug
G (Gas Optimization)
resolved
sponsor confirmed

External Links

[G-01] Unnecessary less than check

amount is a UINT and therefore can not be less than 0. Change <= to ==

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/LpGauge.sol#L59

#0 - GalloDaSballo

2022-06-17T22:42:55Z

Should save 3 gas

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter