Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Invalid

High Gas Costs Due to Storing Boolean Values in whitelistAddress Mapping

Summary

Storing boolean values in a mapping can lead to high gas costs, especially when dealing with a large number of addresses. Using bitwise operations to store multiple boolean values in a single storage slot can significantly reduce gas costs and improve the efficiency of the contract. Implementing this optimization and conducting thorough audits and testing are essential to address this issue and enhance the contract's performance and cost-effectiveness. The severity of this issue is classified as medium due to the potential impact on gas costs and contract efficiency.

Vulnerability Details

The whitelistAddress mapping in the RAACToken contract stores boolean values to indicate whether an address is whitelisted or not. Storing boolean values in a mapping can be gas-intensive, especially if there are a large number of addresses (e.g., 10,000 whitelisted addresses and 5,000 blacklisted addresses). This can lead to high gas costs for storage operations, making the contract less efficient and more expensive to use.

Impact

  • High Gas Costs: Storing a large number of boolean values in a mapping can lead to high gas costs for storage operations.

  • Inefficiency: The contract becomes less efficient and more expensive to use due to the high gas costs associated with storing boolean values.

Tools Used

manual review

Recommendations

  1. Bitwise Operations: Use bitwise operations to store multiple boolean values in a single storage slot, reducing the overall gas costs.

  2. Audit and Testing: Conduct a thorough audit and testing of the contract to ensure that the new storage mechanism is correctly implemented and secure.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

0xtonchi Submitter
6 months ago
inallhonesty Lead Judge
6 months ago
inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!