-
Notifications
You must be signed in to change notification settings - Fork 426
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
Linter: Warn about using non-fallible APIs for Lazy
and Mapping
#2017
Labels
Comments
jubnzv
added
B-feature-request
A request for a new feature.
A-linter
Issue regarding the ink! linter.
labels
Dec 11, 2023
We should also consider this for the new
My naive approach would be to just emit the lint for any non-statically sized type (i.e., not emitting it for types we know they have statically sized types). |
jubnzv
added a commit
to jubnzv/ink
that referenced
this issue
Jan 1, 2024
5 tasks
jubnzv
added a commit
that referenced
this issue
Jan 10, 2024
…2045) * feat: Lint skeleton and tests for #2017 * feat: Basic checks for primitive types only * feat: Recursive checks if nested types have statically known encoded size Improve the heuristcs to check if nested types in ADTs, tuples and arrays have statically encoded types, and therefore should not be reported. This removes false positives on the default ink types like `AccountId` (alias to `[u8; 32]`). * chore: Update CHANGELOG * feat(tests): Test more statically unknown types in the `fail` test * feat(tests): Type aliases in `pass` * fix: Lint suppressions * chore: Add new stderr * chore: cleanup * chore(doc): Update examples * trigger GitHub actions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
#1910 has introduced a safe API for reading and writing from
Mapping
andLazy
to and from storage. This API is intended to use by default when there are no explicit checks for encoded size of the object.A new lint should check these cases and raise warnings when the following functions are used:
Mapping.get
Mapping.insert
Mapping.take
Lazy.get
Lazy.set
And suggest to replace them to their safe
try_
alternatives. The warnings should be raised only if there are no explicit checks for encoded size of the inserted key/value in user's code.The text was updated successfully, but these errors were encountered: