The Graph L2 bridge contest - sakman's results

A protocol for indexing and querying blockchain data.

General Information

Platform: Code4rena

Start Date: 07/10/2022

Pot Size: $50,000 USDC

Total HM: 4

Participants: 62

Period: 5 days

Judge: 0xean

Total Solo HM: 2

Id: 169

League: ETH

The Graph

Findings Distribution

Researcher Performance

Rank: 58/62

Findings: 1

Award: $20.79

🌟 Selected for report: 0

🚀 Solo Findings: 0

1. Use x < y + 1 in stead of x <= y

contracts/gateway/L1GraphTokenGateway.sol: L224 L275

contracts/l2/token/GraphTokenUpgradeable.sol: L95

2. Cache storage variables in function call stack to save gas

contracts/governance/Governed.sol: L55-L66

contracts/governance/Pausable.sol: L27-L34 L41-L48

3. You can make state variables take less slots than they currently are

contracts/governance/Pausable.sol: L8

4. Use 1 and 2 for true and false

contracts/governance/Pausable.sol: L8 L10

5. When comparing variables of type uint, use require(x != 0) instead of require(x > 0)

contracts/gateway/L1GraphTokenGateway.sol: L201 L217

contracts/l2/gateway/L2GraphTokenGateway.sol: L146

6. Calldata is cheaper than memory for function input

contracts/arbitrum/L1ArbitrumMessenger.sol: L48 L49 L75

contracts/arbitrum/L2ArbitrumMessenger.sol: L41

contracts/l2/gateway/L2GraphTokenGateway.sol: L266 L286

contracts/gateway/L1GraphTokenGateway.sol: L290 L331

contracts/governance/Managed.sol: L173

7. Use multiple requires instead of a single one with &&

contracts/governance/Governed.sol: L54-L57

contracts/gateway/L1GraphTokenGateway.sol: L142

contracts/upgrades/GraphProxy.sol: L142-L145

8. Function that are called only once can be inlined in the calling function

This change will save around 30 gas units

contracts/l2/token/GraphTokenUpgradeable.sol: L195

contracts/gateway/L1GraphTokenGateway.sol: L290

contracts/l2/gateway/L2GraphTokenGateway.sol: L286

9. Use constant and immutable for constants

contracts/governance/Managed.sol: L29

10. Use immutable instead of constant for the following to save runtime gas

contracts/l2/token/GraphTokenUpgradeable.sol: L38 L39

11. Use require(x) instead of require(x == true)

contracts/gateway/L1GraphTokenGateway.sol: L214

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