Skip to content

fix: remove dead duplicate reentrancy-guard module (core/guards.rs) - #231

Closed
ZacLou wants to merge 1 commit into
Vero-protocol:mainfrom
ZacLou:fix/remove-dead-reentrancy-guard-165
Closed

ZacLou wants to merge 1 commit into
Vero-protocol:mainfrom
ZacLou:fix/remove-dead-reentrancy-guard-165

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026 •

Copy link
Copy Markdown

Summary

Closes #165

Problem

engine-core/src/core/guards.rs implemented a second, fully-tested reentrancy guard (ReentrancyGuard, enter_guard, exit_guard, with_guard) that was never called from any contract entry point. Every real entry point uses the non_reentrant! macro defined in the top-level engine-core/src/guards.rs.

The two implementations used different storage keys (C_REENTR vs RE_GUARD), creating a split-brain maintenance hazard where a future contributor could reach for the dead guard instead of the active one.

Changes

  • Deleted engine-core/src/core/guards.rs (106 lines)
  • Removed pub mod guards; from engine-core/src/core/mod.rs

Verification

  • Confirmed via rg "core::guards\|core/guards" that no code outside the module itself references core::guards
  • The reentrancy_tests.rs file references crate::guards:: (the top-level module), not core::guards::
  • The non_reentrant! macro from guards.rs remains the single, active reentrancy guard implementation

Impact

No behavioral change. Dead code removal only.

The core/guards.rs module implemented a second ReentrancyGuard
(ReentrancyGuard::new, enter_guard, exit_guard, with_guard) that was
never called from any contract entry point. All real entry points use
the non_reentrant! macro from the top-level guards.rs instead.

Deleted core/guards.rs and removed its pub mod declaration from
core/mod.rs to eliminate the split-brain state where two reentrancy
guard implementations coexist with different storage keys.

Addresses Vero-protocol#165
@ZacLou
ZacLou requested review from N-i-xx and N-thnI as code owners September 5, 2026 10:02
@ZacLou

ZacLou commented Sep 27, 2026

Copy link
Copy Markdown
Author

Closing this to keep the queue tidy.

@ZacLou ZacLou closed this Sep 27, 2026
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] Dead duplicate reentrancy-guard module (core/guards.rs) diverges from the actively-used guards.rs

1 participant