Biconomy Hyphen 2.0 contest - Tomio's results

Next-Gen Multichain Relayer Protocol.

General Information

Platform: Code4rena

Start Date: 10/03/2022

Pot Size: $75,000 USDT

Total HM: 25

Participants: 54

Period: 7 days

Judge: pauliax

Total Solo HM: 10

Id: 97

League: ETH

Biconomy

Findings Distribution

Researcher Performance

Rank: 50/54

Findings: 1

Award: $60.01

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

60.0057 USDT - $60.01

Labels

bug
G (Gas Optimization)

External Links

  1. The default of uint is already 0

Proof of Concept: https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityFarming.sol#L144 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityFarming.sol#L158 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityFarming.sol#L233 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityFarming.sol#L266 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/WhitelistPeriodManager.sol#L247

Recommended Mitigation Steps: considered remove 0 value can save gas

========================================================================

  1. Avoiding external call can save gas

Proof of Concept: https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L354

Recommended Mitigation Steps: Change to:

if (denominator != 0) { fee = numerator / denominator; } }

========================================================================

  1. != 0 is a cheaper operation compared to > 0, when dealing with uint

Proof of Concept: https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityFarming.sol#L132 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityFarming.sol#L318 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityProviders.sol#L182 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityProviders.sol#L182 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityProviders.sol#L283 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityProviders.sol#L410

Recommended Mitigation Steps: Replace with: ! =

========================================================================

  1. 10 ** 18 can be changed to 1e18 and save some gas

Proof of Concept: https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityProviders.sol#L27

Recommended Mitigation Steps:

uint256 public constant BASE_DIVISOR = 1e18;

========================================================================

  1. more efficient gas usage by removing && operator

Proof of Concept: https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L156 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L247

Recommended Mitigation Steps: Example:

require( tokenManager.getDepositConfig(toChainId, tokenAddress).min <= amount,"Deposit amount not in Cap limit"); require( tokenManager.getDepositConfig(toChainId, tokenAddress).max >= amount, "Deposit amount not in Cap limit"); `` ========================================================================
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