Skip to content
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

Add CEI pattern static analysis #3168

Merged
merged 25 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
17b35fa
Add CEI pattern static analysis
anton-trunov Oct 19, 2022
e356add
CEI analysis: update Forc.lock
anton-trunov Oct 27, 2022
b65306e
apply review suggestions: we don't analyze scripts, libs and predicates
anton-trunov Oct 28, 2022
559bfde
apply review suggestions: more descriptive names for AST analyzing fu…
anton-trunov Oct 28, 2022
9eb73ee
apply review suggestions: __revert does not introduce any effect in t…
anton-trunov Oct 28, 2022
653c83a
apply review suggestions: Forc.toml fix (stdlib path)
anton-trunov Oct 28, 2022
68a2f02
apply review suggestions: format test sway code
anton-trunov Oct 29, 2022
df78f08
refactor test: split into a test with standalone function into a sepa…
anton-trunov Oct 29, 2022
ffa9153
test with if-statement
anton-trunov Oct 29, 2022
16f3c60
process asm blocks and account for storage writes
anton-trunov Oct 29, 2022
e74f86f
more tests: explicit storage var update (storage.var = ...)
anton-trunov Oct 29, 2022
b6af959
more tests: more complex control flow test
anton-trunov Oct 29, 2022
3ddd762
report method name in warnings
anton-trunov Oct 29, 2022
b950017
Add read-after-interaction check
anton-trunov Oct 30, 2022
dc2f2c3
Merge branch 'master' into anton-trunov/cei-pattern-violation
anton-trunov Oct 30, 2022
b23323e
fix cei_pattern_violation_english_auction test
anton-trunov Oct 30, 2022
f4bddc6
apply review suggestion: simplify english auction a lot but preserve …
anton-trunov Oct 31, 2022
3d9ad25
Merge branch 'master' into anton-trunov/cei-pattern-violation
anton-trunov Oct 31, 2022
8e1b3c7
Merge branch 'master' into anton-trunov/cei-pattern-violation
anton-trunov Oct 31, 2022
b6d34d3
fix test: remove forgotten file
anton-trunov Oct 31, 2022
cd62408
Merge branch 'master' into anton-trunov/cei-pattern-violation
anton-trunov Nov 4, 2022
c40dcc3
Merge branch 'master' into anton-trunov/cei-pattern-violation
anton-trunov Nov 9, 2022
2f23286
Refactor CEI analysis to take nested code blocks into account
anton-trunov Nov 9, 2022
ee75910
Apply suggested change
anton-trunov Nov 9, 2022
498fe6e
Merge branch 'master' into anton-trunov/cei-pattern-violation
mohammadfawaz Nov 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sway-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ pub fn parsed_to_ast(
errors.push(e);
}

// CEI pattern analysis
let cei_analysis_warnings =
semantic_analysis::cei_pattern_analysis::analyze_program(&typed_program);
warnings.extend(cei_analysis_warnings);

// Check that all storage initializers can be evaluated at compile time.
let typed_wiss_res = typed_program.get_typed_program_with_initialized_storage_slots(
&mut ctx,
Expand Down
1 change: 1 addition & 0 deletions sway-core/src/semantic_analysis.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Type checking for Sway.
pub mod ast_node;
pub(crate) mod cei_pattern_analysis;
mod module;
pub mod namespace;
mod node_dependencies;
Expand Down
Loading