Skip to content

Improve contract syntax analyzer #1316

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Apr 24, 2025

Fix CheckWitnessUsageAnalyzer to check if result is used rather than specific patterns

Changes

  • Updated the CheckWitnessUsageAnalyzer to check if the result of Runtime.CheckWitness is being used in any way, rather than requiring specific patterns
  • The analyzer now only reports an issue if the CheckWitness call is used directly as a statement without capturing the result
  • Updated error messages to be more accurate
  • GasOptimizationAnalyzer already skips checking string literals in contract attributes

Reason for changes

The previous implementation of CheckWitnessUsageAnalyzer was too restrictive, requiring specific patterns like if statements or Assert calls. The updated version recognizes that the result of CheckWitness can be used in many valid ways, such as being assigned to a variable, used in a condition, passed as a parameter, etc.

@Jim8y Jim8y changed the title Improve storage analyzer docs Improve contract syntax analyzer Apr 24, 2025
@Wi1l-B0t
Copy link
Contributor

UT failed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants