Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message #161

Open
code423n4 opened this issue Nov 17, 2021 · 0 comments
Open

Misleading error message #161

code423n4 opened this issue Nov 17, 2021 · 0 comments
Assignees
Labels
0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

WatchPug

Vulnerability details

https://github.com/code-423n4/2021-11-nested/blob/f646002b692ca5fa3631acfff87dda897541cf41/contracts/NestedRecords.sol#L56-L79

/// @notice Add a record for NFT data into our mappings
/// @param _nftId The id of the NFT
/// @param _token The address of the token
/// @param _amount The amount of tokens bought
/// @param _reserve The address of the reserve
function createRecord(
    uint256 _nftId,
    address _token,
    uint256 _amount,
    address _reserve
) public onlyFactory {
    require(records[_nftId].tokens.length < maxHoldingsCount, "NestedRecords: TOO_MANY_ORDERS");
    require(
        _reserve != address(0) && (_reserve == records[_nftId].reserve || records[_nftId].reserve == address(0)),
        "NestedRecords: INVALID_RESERVE"
    );

    Holding memory holding = records[_nftId].holdings[_token];
    require(!holding.isActive, "NestedRecords: HOLDING_EXISTS");

    records[_nftId].holdings[_token] = Holding({ token: _token, amount: _amount, isActive: true });
    records[_nftId].tokens.push(_token);
    records[_nftId].reserve = _reserve;
}

The error message "NestedRecords: TOO_MANY_ORDERS" should be changed to "NestedRecords: TOO_MANY_TOKENS".

@code423n4 code423n4 added 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Something isn't working labels Nov 17, 2021
code423n4 added a commit that referenced this issue Nov 17, 2021
@maximebrugel maximebrugel added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Nov 19, 2021
@adrien-supizet adrien-supizet self-assigned this Dec 1, 2021
@adrien-supizet adrien-supizet removed their assignment Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants