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.
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.
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.
manual review
Bitwise Operations: Use bitwise operations to store multiple boolean values in a single storage slot, reducing the overall gas costs.
Audit and Testing: Conduct a thorough audit and testing of the contract to ensure that the new storage mechanism is correctly implemented and secure.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.