Claim validation should use efficient logic to check if a user has already claimed their pizza slice
The has_claimed_slice()
function contains redundant conditional logic that can be simplified for better gas efficiency and code clarity
Likelihood:
The redundant logic executes on every claim validation check
Unnecessary gas consumption occurs in every claim_slice()
operation
Impact:
Increased gas costs for users claiming pizza slices
Reduced code readability and maintainability
The current implementation uses an unnecessary if-else construct to return a boolean value that already exists. Since simple_map::contains_key()
returns a boolean, wrapping it in a conditional that returns true
or false
is redundant and wastes gas on every validation call.
The optimized version directly returns the boolean result from simple_map::contains_key()
. This eliminates unnecessary conditional logic, reduces gas consumption, and improves code clarity. The function behavior remains identical while being more efficient and readable.
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.