Background
Soroban contract calls can trigger external token or custom contracts, opening vectors for reentrancy attacks if state is not updated before external calls.
Goal
Implement a reentrancy guard mechanism to prevent nested recursive invocations of critical settlement and withdrawal functions.
Acceptance Criteria
- Define
ReentrancyGuard state in transient or instance storage.
non_reentrant check in settle_session and withdraw_accrued.
- Reverts transaction with
Error::ReentrantCall if reentrancy is detected.
Key Files
contracts/src/security.rs, contracts/src/lib.rs
Background
Soroban contract calls can trigger external token or custom contracts, opening vectors for reentrancy attacks if state is not updated before external calls.
Goal
Implement a reentrancy guard mechanism to prevent nested recursive invocations of critical settlement and withdrawal functions.
Acceptance Criteria
ReentrancyGuardstate in transient or instance storage.non_reentrantcheck insettle_sessionandwithdraw_accrued.Error::ReentrantCallif reentrancy is detected.Key Files
contracts/src/security.rs,contracts/src/lib.rs