Stader Labs - DavidGiladi's results

Decentralized ETH liquid staking protocol with 4 ETH bond for anyone to be a node operator.

General Information

Platform: Code4rena

Start Date: 02/06/2023

Pot Size: $100,000 USDC

Total HM: 15

Participants: 75

Period: 7 days

Judge: Picodes

Total Solo HM: 5

Id: 249

League: ETH

Stader Labs

Findings Distribution

Researcher Performance

Rank: 61/75

Findings: 1

Award: $21.62

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

21.6219 USDC - $21.62

Labels

bug
G (Gas Optimization)
grade-b
G-18

External Links

Please note: I reported issues that were overlooked by the winning bot. I reported only on instances that were missed

Optimal Struct Variable Order

  • Severity: Gas Optimization
  • Confidence: High

Description

Detect optimal variable order in struct definitions to decrease the number of slots used.

  • Optimization opportunity in struct File: contracts/interfaces/INodeRegistry.sol#6-15 <br> Validator

  • original variable order (count: 8 slots)

    • ValidatorStatus status
    • bytes pubkey
    • bytes preDepositSignature
    • bytes depositSignature
    • address withdrawVaultAddress
    • uint256 operatorId
    • uint256 depositBlock
    • uint256 withdrawnBlock
  • optimized variable order (count: 7 slots)

    • address withdrawVaultAddress
    • ValidatorStatus status
    • bytes pubkey
    • bytes preDepositSignature
    • bytes depositSignature
    • uint256 operatorId
    • uint256 depositBlock
    • uint256 withdrawnBlock

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/interfaces/INodeRegistry.sol#L6-L15

</details>

Usage of Custom Errors for Gas Efficiency

  • Severity: Gas Optimization
  • Confidence: High

Description

This detector flags functions that use revert()/require() strings, which are less gas efficient than custom errors. Custom errors, available from Solidity version 0.8.4, save approximately 50 gas each time they're used by avoiding the need to allocate and store the revert string.

<details> <summary> There are 1 instances of this issue: </summary>

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/VaultProxy.sol#L47

</details>

Use Small Integer For Efficiency

  • Severity: Gas Optimization
  • Confidence: High

Description

This detector flags contracts that inefficiently use uint or int of sizes smaller than 32 bytes. The EVM operates on 32 bytes at a time, thus using elements smaller than this may cause your contract's gas usage to be higher. Refer to the Solidity documentation for more details: https://docs.soliditylang.org/en/v0.8.11/internals/layout_in_storage.html.

<details> <summary> There are 10 instances of this issue: </summary>

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PermissionlessNodeRegistry.sol#L30

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PermissionedNodeRegistry.sol#L31

  • File: contracts/VaultProxy.sol#12 <br> VaultProxy.poolId poolId use 256 bites instead of 8

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/VaultProxy.sol#L12

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PermissionedNodeRegistry.sol#L33

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PoolUtils.sol#L13

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PermissionlessNodeRegistry.sol#L32

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PermissionlessNodeRegistry.sol#L31

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PoolUtils.sol#L14

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PoolSelector.sol#L18

https://github.com/code-423n4/2023-06-stader/blob/main/contracts/PermissionedNodeRegistry.sol#L32

</details>

#0 - c4-judge

2023-06-14T05:41:40Z

Picodes marked the issue as grade-b

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