Beginner FriendlyGameFi
100 EXP
View results
Submission Details
Impact: low
Likelihood: high
Invalid

Redundant Double Check in has_claimed_slice Function

Root + Impact

Description

  • In the has_claimed_slice view function, the implementation performs a redundant double check using table::contains.

  • The first if (!table::contains(...)) { return false } already ensures that when the user is not in the table, false is returned.

  • The final table::contains(&state.claimed_users, user) is therefore redundant, since the value was just checked in the prior condition.

#[view]
public fun has_claimed_slice(user: address): bool acquires ModuleData, State {
let state = borrow_global<State>(get_resource_address());
if (!table::contains(&state.claimed_users, user)) {
return false
};
table::contains(&state.claimed_users, user)
}

Risk

Likelihood:

  • No functional bug or security issue.

Impact:

  • Impact 1

  • Impact 2

Proof of Concept

Both branches of logic resolve to the same return value:
If user not in table → return false.
If user in table → return true.

Recommended Mitigation

Remove the redundant check and single-call table::contains directly:
- if (!table::contains(&state.claimed_users, user)) {
- return false
- };
Updates

Appeal created

bube Lead Judge 9 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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