Strict reentrancy protection#65
Merged
N-thnI merged 3 commits intoJun 26, 2026
Merged
Conversation
- Implemented reentrancy guard using Soroban's temporary storage and RAII pattern. - Added `non_reentrant!` macro and applied it to state-mutating functions in `audit.rs`, `governance.rs`, and `circuit_breaker.rs`. - Upgraded error enums from `#[contracttype]` to `#[contracterror]` for correct `panic_with_error!` behavior. - Fixed `governance_tests.rs`: restored imports, implemented test logic, and provided contract context. - Resolved type mismatches and doc test issues in `governance.rs`. - Added `reentrancy_tests.rs` to verify the guard functionality. - Verified all 15 tests in `engine-core` pass. Co-authored-by: gloskull <189399494+gloskull@users.noreply.github.com>
…9159307060885706559 Implement Strict Reentrancy Protection
N-thnI
approved these changes
Jun 19, 2026
Contributor
|
please resolve conflicts and it will be ready for merge |
Contributor
Author
|
Conflicts have been resolved. |
Contributor
|
Good job |
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.
Implement strict reentrancy protection in the engine-core smart contracts. The solution uses a state lock in Soroban's temporary storage, managed by a ReentrancyGuard struct and a non_reentrant! macro.
Key changes:
Created engine-core/src/guards.rs with the guard logic and macro.
Applied reentrancy guards to critical entry points.
Refactored error enums to #[contracterror].
Fixed existing bugs in the test suite and contract logic that prevented compilation and test execution.
Added comprehensive tests for governance and reentrancy.
Closes gloskull#2