Skip to content

[Bug] Enforce bond_amount <= i128::MAX / 2 at initialization #34

Description

@collinsezedike

Description

resolve computes let payout = assertion.bond * 2; when a dispute resolves, but initialize only rejects bond_amount <= 0. There is no upper bound, so a large enough bond_amount overflows on the doubling.

Steps to reproduce

  1. Call initialize with bond_amount close to i128::MAX (anything greater than i128::MAX / 2).
  2. Have an asserter post an assertion and a disputer dispute it.
  3. Have resolvers vote to a majority.

Expected behavior

initialize rejects a bond_amount that could overflow bond * 2 during resolution, with a new Error variant (e.g. InvalidBondAmount extended, or a new variant).

Actual behavior

initialize accepts the value. The overflow happens later, inside resolve, at the point the payout is computed, permanently stranding both bonds since the dispute can never successfully resolve.

Environment

  • Network: local
  • Contract: tholos
  • Commit or tag: f9ad187

Possible impact

Yes, this affects fund safety: both the asserter's and disputer's bonds become permanently locked in the contract once a dispute on an overflow-prone assertion is resolved, since the payout transfer can never succeed. This does not rise to a live vulnerability requiring private disclosure since it requires the admin to configure an extreme bond_amount, not something an attacker can trigger against a sanely configured deployment, so a public issue is appropriate rather than SECURITY.md.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions