You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description and Context
The issue occurs in two files: MockAllMetadataViewModule.sol and MockCoreMetadataViewModule.sol, where Strings.toHexString is used incorrectly for address type variables (ipId and owner(ipId)).
Problem:
The Strings.toHexString function expects a uint256 input, but the ipId and owner(ipId) variables are of type address. Directly passing an address type without converting it to uint256 will lead to unexpected behavior or compilation issues.
Test
The issue was validated by running tests to confirm the improper usage of Strings.toHexString. Below are the details of the steps taken and the observed outputs:
Steps:
-Created a test case to use Strings.toHexString directly with an address type variable (ipId).
-Observed the compilation error due to the incorrect type conversion.
Observed Output:
Compilation error when directly using Strings.toHexString(ipId) without conversion.
Steps to Reproduce
1- In MockAllMetadataViewModule.sol:
Locate the tokenURI function.
Find the following incorrect usage:
2- In MockCoreMetadataViewModule.sol:
Locate the tokenURI and description functions.
Find the following incorrect usage:
Strings.toHexString(ipId);
Strings.toHexString(owner(ipId));
3-Attempt to compile or execute functions that use Strings.toHexString with address type inputs without proper conversion.
Experienced Behavior
The Strings.toHexString function is used incorrectly with address variables, causing compilation errors or incorrect results.
Expected Behavior
The Strings.toHexString function should correctly convert an address variable to a hexadecimal string by first casting it to uint160.
Solution Recommendation
The solution is to cast the address type variables (ipId and owner(ipId)) to uint160 before passing them to Strings.toHexString.
Description and Context
The issue occurs in two files: MockAllMetadataViewModule.sol and MockCoreMetadataViewModule.sol, where Strings.toHexString is used incorrectly for address type variables (ipId and owner(ipId)).
Problem:
The Strings.toHexString function expects a uint256 input, but the ipId and owner(ipId) variables are of type address. Directly passing an address type without converting it to uint256 will lead to unexpected behavior or compilation issues.
Test
The issue was validated by running tests to confirm the improper usage of Strings.toHexString. Below are the details of the steps taken and the observed outputs:
Steps:
-Created a test case to use Strings.toHexString directly with an address type variable (ipId).
-Observed the compilation error due to the incorrect type conversion.
Observed Output:
Compilation error when directly using Strings.toHexString(ipId) without conversion.
Steps to Reproduce
1- In MockAllMetadataViewModule.sol:
Locate the tokenURI function.
Find the following incorrect usage:
Strings.toHexString(ipId);
Strings.toHexString(owner(ipId));
2- In MockCoreMetadataViewModule.sol:
Locate the tokenURI and description functions.
Find the following incorrect usage:
Strings.toHexString(ipId);
Strings.toHexString(owner(ipId));
3-Attempt to compile or execute functions that use Strings.toHexString with address type inputs without proper conversion.
Experienced Behavior
The Strings.toHexString function is used incorrectly with address variables, causing compilation errors or incorrect results.
Expected Behavior
The Strings.toHexString function should correctly convert an address variable to a hexadecimal string by first casting it to uint160.
Solution Recommendation
The solution is to cast the address type variables (ipId and owner(ipId)) to uint160 before passing them to Strings.toHexString.
File: MockAllMetadataViewModule.sol
Incorrect Usage:
Strings.toHexString(ipId);
Strings.toHexString(owner(ipId));
Correct Usage:
Strings.toHexString(uint160(ipId));
Strings.toHexString(uint160(owner(ipId)));
File: MockCoreMetadataViewModule.sol
Incorrect Usage:
Strings.toHexString(ipId);
Strings.toHexString(owner(ipId));
Correct Usage:
Strings.toHexString(uint160(ipId));
Strings.toHexString(uint160(owner(ipId)));
The text was updated successfully, but these errors were encountered: