fix: enter reentrancy guard before validation - #152
Closed
xtep103 wants to merge 1 commit into
Closed
Conversation
Collaborator
|
@xtep103 closing this in favor of #151, which you opened first for the same issue (#132) and which is the more complete fix, it replaces check_reentrancy_guard cleanly in withdraw() and adds the regression test the issue asked for. This PR's version of withdraw() leaves the old check_reentrancy_guard() call in place and adds enter_reentrancy_guard() right after it, so the guard ends up checked twice for no reason, and it doesn't add any test coverage. Let's continue on #151. |
This file contains hidden or 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
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
Move
enter_reentrancy_guard()earlier in the Tholos v2 entrypointsassert_outcome,dispute,register, andwithdraw, so the guard isacquired immediately after authentication and before validation or other
state-changing work.
This is a defensive reordering only; no validation or transfer logic was
changed.
Test plan
cargo fmt --checkgit diff --checkcargo test— could not complete locally because the Windows MSVClinker (
link.exe) is unavailableexit_reentrancy_guard()callsremain in place
Closes #132