Omniscia Optimex Audit

OptimexBTC Manual Review Findings

OptimexBTC Manual Review Findings

OBT-01M: Potential Race Condition of Mints

Description:

The OptimexBTC::mint function appears to reset the out-of-circulation available balance, however, it does so by burning the contract's existing balance and minting a new one.

This approach will not yield a consistent increase in the total supply of the token due to the fact that an allocation might be executed between an OptimexBTC::mint transaction's submission and its execution in the network.

Impact:

The OptimexBTC::totalSupply might be temporarily de-synchronized due to transaction ordering.

Example:

contracts/tokens/OptimexBTC.sol
56/**
57 @notice Mints the specified amount of tokens to itself
58 @dev Caller must have the MINTER role
59 @dev Burns the contract’s existing balance and mints the exact specified amount.
60 @param amount Amount of tokens to mint
61*/
62function mint(uint256 amount) external onlyRole(_MINTER) {
63 _burnSelf();
64
65 _mint(amount);
66}
67
68/**
69 @notice Allocates tokens to an authorized recipient
70 @dev Caller must have the ALLOCATOR role
71 @param to Address to transfer tokens to
72 @param amount Amount of tokens to transfer
73*/
74function allocateTo(
75 address to,
76 uint256 amount
77) external onlyRole(_ALLOCATOR) {
78 _allocateTo(to, amount);
79}

Recommendation:

We advise the code to either validate the amount burned in the contract or to accept an amount delta, ensuring consistency in the result of the OptimexBTC::mint operation.

Alleviation (c11bae0aacaeb7f4e4b53c864f96917ca574182f):

The Optimex team evaluated this exhibit and clarified that a temporary increase in the expected total supply can be trivially corrected and that they wish to acknowledge this exhibit.