-
Notifications
You must be signed in to change notification settings - Fork 430
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 when storage can never be freed up #1932
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It reuses functions implemented in use-ink#1914, so we need to rebase and modify it when it is merged.
SkymanOne
approved these changes
Oct 4, 2023
jubnzv
added a commit
to jubnzv/ink
that referenced
this pull request
Oct 5, 2023
cmichi
pushed a commit
that referenced
this pull request
Oct 25, 2023
* feat(linter): strict balance equality lint The current implementation works only with intraprocedural MIR and does not support taint propagation across function calls. Closes #1811 * feat(lint): Handle temporary values resulted after Rvalue::Use * fix(lint): spans to emit diagnostics Previously, diagnostics did not work, since `terminator.span` is resulted after macro expansion * feat(tests): more tests * feat(lint): Manually traverse functions in user-defined code This is required to implement interprocedural analysis * feat(lint): interprocedural analysis that finds tainted returns * fix(lint): recursive calls in interprocedural analysis * fix(lint): false negative on `CheckedBinaryOp` * feat(lint): propagation through references * feat(lint): Propagate tainted values through `&mut` arguments * chore(lint): docstring, comments * feat(lint): handle comparison of references in functions * chore(tests): comments * feat(lint+tests): updated `pass` test, fixed binop conditions * feat(tests): test for lint suppressions * chore(tests): fmt * chore(tests): fmt * chore: Add changelog entry * chore(lint): Reuse utility functions introduced in #1932 * chore: Fix changelog * chore: Fix comments
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1431
cargo-contract
orpallet-contracts
?Description
This PR introduces a new lint for
ink_linting
that finds storage fields ofMapping
andVec
types that are used to insert elements, however there is no way to remove their elements.When a user executes a contract function that writes to storage, they have to put a deposit down for the amount of storage space used. Whoever frees up that storage at some later point gets the deposit back. Therefore, it is always a good idea to make it possible for users to free up their storage space, and this lint helps developers to find these cases.
By default, it has the
Allow
warning level, which means, that that lint must be explicitly enabled by the developer. The reason for that is that there are many cases where adding elements without removing them is necessary and should not be considered as an error.Checklist before requesting a review
CHANGELOG.md