Skip to content

Fix frozen blocks approvals#26

Draft
juanbono wants to merge 1 commit into
audit_1from
fix/frozen-blocks-approvals
Draft

Fix frozen blocks approvals#26
juanbono wants to merge 1 commit into
audit_1from
fix/frozen-blocks-approvals

Conversation

@juanbono

Copy link
Copy Markdown
Collaborator

No description provided.

The existing `_approve` override blocked allowance state changes while
paused, but missed the symmetric case for frozen accounts: a frozen
owner could call `approve(...)` and stage an allowance that goes live
the moment the freeze is lifted, defeating the protective intent of
the freeze flag.

Add `whenNotFrozen(owner)` and `whenNotFrozen(spender)` to the override
to mirror `_update`'s symmetric `from`/`to` freeze policy. Both
directions are blocked:

- A frozen owner cannot grant allowance.
- A non-frozen owner cannot grant allowance to a frozen spender.

The spender side is intentional belt-and-braces — a frozen account
cannot exercise the allowance anyway, but blocking the grant prevents
it from going live on unfreeze.

Internal `_spendAllowance` (called by `transferFrom` / `burnFrom`) also
routes through `_approve`, so the freeze check fires at the allowance-
decrement step rather than at `_update`. Same outcome, marginally
different revert path — covered by tests.

Regression coverage:
- `test_ApproveByFrozenOwnerReverts` — frozen owner blocked at approve.
- `test_ApproveToFrozenSpenderReverts` — frozen spender blocked at approve.
- `test_TransferFromFrozenOwnerReverts` — internal `_approve` revert
  surfaces from `_spendAllowance` before `_update`.
- `test_TransferFromBySpenderWhenFrozenReverts` — frozen spender path.
- `test_ApproveAfterUnfreezeSucceeds` — block is reversible.
@juanbono
juanbono changed the base branch from main to audit_1 May 26, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant