The minter
and burner
roles in the RToken contract are defined and assigned but are never actually used in the mint and burn functions. Instead, the contract relies solely on the onlyReservePool
modifier, making these roles redundant. As a result, setting them has no effect on the contract's functionality.
The _minter
and _burner
variables are defined and assigned using the setMinter
and setBurner
functions. However, these roles are never referenced when enforcing access control for minting and burning. Instead, the contract uses the onlyReservePool
modifier, which only checks if the caller is the reserve pool.
As seen above, minting and burning rely entirely on onlyReservePool
, making _minter
and _burner
irrelevant.
Security Assumptions Are Broken: The existence of setMinter
and setBurner
functions implies that these roles should control minting and burning. However, they have no real effect.
Potential Confusion for Developers & Auditors: Future developers may assume these roles are functional, leading to incorrect security assumptions.
Unnecessary Gas Costs: Unused storage variables _minter
and _burner
consume unnecessary contract storage.
To confirm that _minter
and _burner
are unused, modify the test suite RToken.test.js::BeforeEach
instructions to remove calls to setMinter
and setBurner
, then execute the tests.
The minting and burning functions continue to work as expected, proving that these roles have no effect.
Try assigning _minter
and _burner
to a different address and attempt to mint/burn from that address. The transaction will fail, confirming that these roles are not enforced.
Option 1: Remove the Unused Roles
If _minter
and _burner
are not necessary, remove them from the contract to eliminate confusion and reduce gas costs.
Option 2: Implement Proper Role Enforcement
Introduce new onlyMinter
and onlyBurner
modifiers to enforce access control.
Apply these modifiers to mint
and burn
functions instead of onlyReservePool
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.