<!-- canonical: https://0xsimao.com/findings/m-0-active-mapping-entry-deleted -->

# No need to set isActive to false if that mapping entry was deleted

Low/Info · Three Sigma · Stablecoin framework · 8th January, 2024

Finding 3S-M^0-N03 of the M^0 Minter Gateway security review.

- Protocol: https://www.m0.org/
- Report: /reports/m-0
- Codebase: https://github.com/0xsimao/ttg/tree/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c
- Source: https://cdn.sanity.io/files/qoqld077/production/1cdafafad874aba76e062ad8c216c98338c096db.pdf

---

### Description

In [MinterGateway.deactivateMinter](https://github.com/MZero-Labs/protocol/blob/3499f50ff3382729f3e59565b19386ba61ef8e36/src/MinterGateway.sol#L357) the minter's entry in _minterStates is deleted using the

```solidity
delete keyword: function deactivateMinter(address minter_) external
onlyActiveMinter(minter_) returns (uint240 inactiveOwedM_) {
    // ... delete _minterStates[minter_];
    delete _mintProposals[minter_];
    _minterStates[minter_].isDeactivated = true;
    _minterStates[minter_].isActive = false;
    // ... }
```

This action sets all types of that specific entry to its default value, and so, there is no need
to set isActive to false as this is the default value set by the delete keyword.

### Recommendation

Remove the following line from deactivateMinter function:
_minterStates[minter_].isActive = false;

### Status

Addressed in [#8024584](https://github.com/MZero-Labs/protocol/commit/8024584e9d3ee0292410ffb00df7927f52acc257).

---

Related findings:

- [In fillPair(), when the taker is the maker, the reduceOnly order mapping is not being deleted](https://0xsimao.com/findings/nftperp-i-fill-taker-maker-deleted): Nftperp Exchange
- [StakingOperator does not set isUnlockWindowActive to true in the constructor if the flag passed is true](https://0xsimao.com/findings/singularity-staking-window-active-flag): Singularity
