-
Notifications
You must be signed in to change notification settings - Fork 18
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
rollback global context in error case #621
base: main
Are you sure you want to change the base?
Conversation
a4a05ca
to
7891268
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #621 +/- ##
==========================================
- Coverage 85.67% 85.67% -0.01%
==========================================
Files 46 46
Lines 24599 24609 +10
Branches 24599 24609 +10
==========================================
+ Hits 21076 21084 +8
Misses 1672 1672
- Partials 1851 1853 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we could have some tests to prove the efficiency of the change ?
I was thinking about that too. Actually, we do have tests to verify the error path, for instance: https://github.com/stacks-network/clarity-wasm/blob/main/clar2wasm/tests/lib_tests.rs#L4091 and https://github.com/stacks-network/clarity-wasm/blob/main/clar2wasm/tests/lib_tests.rs#L4103 among others. Also, in this PR, I added the instantiation of the global context for tests, which is needed to validate the changes. A more detailed test would require additional work to validate context management, state verification, and a more rigorous assessment of the integration with stacks-core. This is a task that can be addressed separately, imo, since we are already covering it with some tests and also relying the validation of the changes here on fuzzing tests. |
Where are those tests actually? What are we covering? |
The tests that I linked above are impacted by this PR. That means a context was not initialized before, but now it is initialized and rolled back in error cases. Without the change on https://github.com/stacks-network/clarity-wasm/pull/621/files#diff-88585f598b79cb14968cf2e11093aacaa49eb5f7553ded728347b3ffafc8c410R500 they will fail. The changes are only visible during runtime errors. Normal conditions remain unaffected by this PR, but this issue is hindering the fuzzing tests. Therefore, I suggest merging this PR, deploying a new release, and validating it also with fuzzing tests. |
Fuzzing tests are not enough imho since they are out of our control. |
I just checked this, and made the change only in tests/lib_tests.rs, the tests don't fail at all. |
Thinking about the things we can control, you're right. Let me take a stab at adding more tests for this PR. |
Fix #549
In case of an error, the function context needs to be cleaned up, rolling back to a pristine state.