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
#1910 has introduced a safe API for reading and writing from Mapping and Lazy 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:
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:
We should also consider this for the new StorageVec. I think it's safe to say the lint can consider any method where a try_ alternative exists.
The warnings should be raised only if there are no explicit checks for encoded size of the inserted key/value in user's code
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
…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
#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: