Skip to content

fix: enforce blacklist on burns; add forceBurn for seizure#198

Open
dmytro-horbatenko wants to merge 1 commit intomainfrom
fix/mtoken-oft-blacklist-bypass
Open

fix: enforce blacklist on burns; add forceBurn for seizure#198
dmytro-horbatenko wants to merge 1 commit intomainfrom
fix/mtoken-oft-blacklist-bypass

Conversation

@dmytro-horbatenko
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an adminBurn function to the mToken contract, allowing authorized burners to remove tokens from blacklisted addresses. This is implemented using a state variable flag, _adminBurnInProgress, to conditionally bypass blacklist checks within the token transfer hooks. The storage layout was preserved by adjusting the contract's storage gap, and comprehensive tests were added to verify the new functionality and its security constraints. Review feedback highlights that the state-flag approach could be fragile if the contract is extended with additional hooks, potentially leading to unintended bypasses of blacklist checks in subclasses.

Comment on lines +67 to +69
_adminBurnInProgress = true;
_burn(from, amount);
_adminBurnInProgress = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of a state variable flag _adminBurnInProgress to bypass blacklist checks in _beforeTokenTransfer is a common pattern but can be fragile in an inheritance context. If this contract is extended by subclasses that implement hooks (such as _afterTokenTransfer) which trigger further token operations, those operations will also bypass the blacklist check on the from address because the flag remains true until the adminBurn execution completes. While the risk is currently mitigated by the onlyRole restriction on adminBurn, consider if a more localized context or a counter-based approach would be more robust for future-proofing the contract against unexpected side effects in extended hooks.

@dmytro-horbatenko dmytro-horbatenko force-pushed the fix/mtoken-oft-blacklist-bypass branch from fa7cf29 to 427a736 Compare March 31, 2026 12:30
@dmytro-horbatenko dmytro-horbatenko changed the title fix: enforce blacklist on burns; add adminBurn for seizure fix: enforce blacklist on burns; add forceBurn for seizure Apr 1, 2026
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