RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: low
Invalid

Typographical Error in Fund Struct and Logic (dealine_set vs. deadline_set)

Summary

The Fund struct and set_deadline function use dealine_set instead of the intended deadline_set. This typographical error is inconsistent with the variable’s purpose and could confuse developers or lead to accidental misuse in future updates.

Vulnerability Details

Location:

  • Fund struct: pub dealine_set: bool

  • set_deadline function: if fund.dealine_set

  • Description: The field is meant to track whether a deadline has been set for the fund but is misspelled as dealine_set instead of deadline_set. The logic still works because the typo is consistent, but it deviates from the intended naming convention.

Impact

** Confusion**: Developers reading or maintaining the code might misinterpret the field’s purpose due to the typo.

  • Future Bugs: If the typo is “fixed” in one place but not others, it could introduce logic errors (e.g., referencing deadline_set instead of dealine_set).

Tools Used

Manual Code Review: Identified during analysis of the contract’s logic and struct definitions.

Recommendations

Fix Typo: Rename dealine_set to deadline_set in both the Fund struct and set_deadline function

#[account]
#[derive(InitSpace)]
pub struct Fund {
// ... other fields ...
pub deadline_set: bool, // Corrected from dealine_set
}
pub fn set_deadline(ctx: Context<FundSetDeadline>, deadline: u64) -> Result<()> {
let fund = &mut ctx.accounts.fund;
if fund.deadline_set { // Corrected from dealine_set
return Err(ErrorCode::DeadlineAlreadySet.into());
}
fund.deadline = deadline;
Ok(())
}
Updates

Appeal created

bube Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[Invalid] Wrong naming of `deadline_set`

This is strong informational finding, there is no impact for the protocol. The variable is the same on all places.

Support

FAQs

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