Skip to content

fix: enter reentrancy guard before validation - #152

Closed
xtep103 wants to merge 1 commit into
drydocs:mainfrom
xtep103:fix/issue-132-reentrancy-guard
Closed

fix: enter reentrancy guard before validation#152
xtep103 wants to merge 1 commit into
drydocs:mainfrom
xtep103:fix/issue-132-reentrancy-guard

Conversation

@xtep103

@xtep103 xtep103 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Move enter_reentrancy_guard() earlier in the Tholos v2 entrypoints
assert_outcome, dispute, register, and withdraw, so the guard is
acquired 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 --check
  • git diff --check
  • cargo test — could not complete locally because the Windows MSVC
    linker (link.exe) is unavailable
  • Manually verified that the existing exit_reentrancy_guard() calls
    remain in place

Closes #132

@collinsezedike

Copy link
Copy Markdown
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.

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.

[Bug] Reentrancy guard checked late in four tholos-v2 entrypoints

3 participants