Skip to content

[good first issue] Add EIP-2612 permit() fuzz tests for Stablecoin #27

@abhicris

Description

@abhicris

Context

contracts/Stablecoin.sol includes EIP-2612 permit() support for gasless approvals. forge-test/Stablecoin.t.sol does not fuzz permit signatures — we only have a happy-path check (if any). Permit is a high-risk surface (signature-malleability, expired deadlines, replay via nonce reuse) and deserves property-based coverage.

Scope

Files to touch:

  • forge-test/Stablecoin.t.sol — add a new test contract or section PermitTests.
  • Use vm.sign + vm.warp to fuzz (owner, spender, value, deadline, nonce) tuples.

Cases to cover:

  • Valid permit lifts allowance and increments nonce.
  • Expired deadline reverts.
  • Wrong-chain / wrong-verifyingContract reverts.
  • Signature replay (same nonce twice) reverts.

Acceptance criteria

  • 4+ new fuzz tests, each with explicit assertEq / vm.expectRevert.
  • forge test passes locally.

Estimated effort

M — 3 hrs.

kcolbchain / Abhishek Krishna

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions