hats-finance / Circles-0x6ca9ca24d78af44582951825bef9eadcb210e5cf

Circles Protocol contracts
https://aboutcircles.com
GNU Affero General Public License v3.0
0 stars 0 forks source link

Incorrect error revert in `_verifyFlowMatrix()` function #105

Open hats-bug-reporter[bot] opened 5 days ago

hats-bug-reporter[bot] commented 5 days ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x97175c3b5ad7714858d29433b82be58c2b204785f3f0040cf77c3a6b3b0a88e4 Severity: low

Description: Description\ The function _verifyFlowMatrix() contains if() condition that checks if:

if (3 * _flow.length != _coordinates.length) {
            // Mismatch in flow and coordinates length.
            revert CirclesArraysLengthMismatch(_flow.length, _coordinates.length, 2);
        }

However, incorrect error message is being reverted in CirclesArraysLengthMismatch(_flow.length, _coordinates.length, 2);.

_flow.length is multiplied by 3 in the if condition, but in the error message, it is only _flow.length, causing a mismatch between the logic and the revert error.

Recommendation\ To fix this, the revert error message should correctly reflect the logic as follows:

if (3 * _flow.length != _coordinates.length) {
            // Mismatch in flow and coordinates length.
-            revert CirclesArraysLengthMismatch(_flow.length, _coordinates.length, 2);
+           revert CirclesArraysLengthMismatch(3 * _flow.length, _coordinates.length, 2);
        }
benjaminbollen commented 4 days ago

Same as #104 , thanks, but not a low issue.

Just to note: these errors have a uint8 code that identifies where in the code they are thrown, so that the developer can know what which data the error concerns