fix(privacy-channel): remove dead reentrancy guard (audit informative)#41
Open
AquiGorka wants to merge 1 commit into
Open
fix(privacy-channel): remove dead reentrancy guard (audit informative)#41AquiGorka wants to merge 1 commit into
AquiGorka wants to merge 1 commit into
Conversation
Soroban forbids reentrancy at the platform level: a contract cannot appear twice in the call stack, so a nested call fails first. The explicit RGUARD storage lock on transact could therefore never trigger -- it was a preemptive guard added in the pre-audit pass (#32, MOON-06), flagged as dead code by the RV informative finding (2026-07-07). Revert the MOON-06 change in full, restoring the pre-guard state: drop the enter/exit guard fns, the REENTRANCY_GUARD const + transient storage entry, both transact call sites and now-unused imports, the ReentrantCall error variant, and the moon06 test. Unrelated MOON remediations in the same files (MOON-02 instance-TTL bump, MOON-05 InvalidExternalAmount) are left untouched. channel-auth carried no such guard.
AquiGorka
force-pushed
the
fix/remove-reentrancy-guard
branch
from
July 8, 2026 15:56
16902e5 to
7d24257
Compare
fazzatti
approved these changes
Jul 9, 2026
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.
What
RV audit informative finding (2026-07-07 call): the privacy-channel contract carried an explicit reentrancy guard (
enter_reentrancy_guardontransact, a transient storage lock), added in the pre-audit pass (#32, MOON-06). But Soroban forbids reentrancy by design — a contract cannot appear twice in the call stack, so a nested call fails first. The guard's lock could never trigger; it is dead code. Gorka confirmed on the call.This reverts the MOON-06 change in full, restoring the pre-guard state.
Changes
contracts/privacy-channel/src/contract.rs: removedenter_reentrancy_guard/exit_reentrancy_guard, theREENTRANCY_GUARDconst + its transient storage entry, both call sites intransact, and the now-unused imports (moonlight_errors::Error,panic_with_error,symbol_short,Symbol).modules/errors/src/lib.rs: removed theReentrantCall = 3_008variant (introduced solely for the guard).contracts/privacy-channel/src/test/moon06.rs+ itspub mod moon06;declaration: deleted (the test existed only to exercise the guard).bump_instance_ttl) and MOON-05 (InvalidExternalAmount = 3_007) — are left untouched.channel-authcarried no such guard (verified).Coordination
Touches
privacy-channel/src/contract.rs, same file as open B1 PR #40 (set_admin). This change does not touch the set_admin code; expect a merge-time overlap — the second of {this, #40} to merge rebases.No version bump (consistent with the current audit-PR cluster; soroban-core versioning deferred to release).
Verification
cargo test --workspace: all 9 suites green, 0 failed (privacy-channel 13/13).cargo fmt --checkclean on touched files;cargo clippyintroduces no new warnings.stellar contract build(CI gate) green —transactstill exported.