Updates
160,000 USDC
View results
Submission Details
Severity: low
Valid

[L-02] `InvalidType` exception error for literal array `len`

Vulnerability Details

This issue is recorded on an OSX, python: 3.11 version.

Code snippet example where this happens is provided below:

@external
def foobar():
a:uint256 = len([1,2,3,4,5])

Impact

Attempting to get the len(length) of a literal array fails with compiler bubbling up an InvalidType exception error message even though literal arrays can be passed as dynamic. The contract code snippet provided above fails to compile with the InvalidType error exception message.

Tools Used

Manual Review

Recommendations

Making sure the len built-in method handles the cases of both literal and dynamic arrays would be a great fix for this issue. A custom error message for other types of data types passed which are not supported would be an added fix for error message bubbling.

Updates

Lead Judging Commences

patrickalphac Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Builtins don't work great with literal lists

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.