Skip to content

feat: added Sandbox Mode for Testing New Features with Real Data#688

Merged
Jagadeeshftw merged 8 commits intoJagadeeshftw:masterfrom
okekefrancis112:sandbox
Feb 26, 2026
Merged

feat: added Sandbox Mode for Testing New Features with Real Data#688
Jagadeeshftw merged 8 commits intoJagadeeshftw:masterfrom
okekefrancis112:sandbox

Conversation

@okekefrancis112
Copy link
Contributor

Summary

This PR implements a sandbox (shadow) mode for testing new contract features against real-ish data without impacting production state (Closes #614). The core addition is a SandboxManager in the Go backend (backend/internal/soroban/sandbox.go) that mirrors selected escrow operations (lock, release, refund, payout) to physically separate Soroban contract instances deployed at different addresses. Shadow operations run asynchronously in bounded goroutines with detached contexts, use a separate Stellar keypair to avoid tx_bad_seq conflicts with production, and are fully fire-and-forget — failures are logged but never block or affect production calls. Configuration is driven entirely by environment variables (SANDBOX_ENABLED, SANDBOX_ESCROW_CONTRACT_ID, SANDBOX_SHADOWED_OPERATIONS, etc.), with per-operation toggling and a configurable concurrency cap. A deploy-sandbox.sh script wraps the existing deployment tooling to stand up sandbox contract instances. The PR also includes 9 Go unit tests validating enable/disable logic, semaphore bounds, and startup validation, plus 3 Soroban-level Rust tests proving that two contract instances deployed from the same WASM are fully independent — operations on one never affect the other's balances. A minor pre-existing bug (ambiguous integer type in lib.rs:344) was fixed to unblock the WASM build.

Closes: #614

@vercel
Copy link

vercel bot commented Feb 25, 2026

@okekefrancis112 is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Jagadeeshftw
Copy link
Owner

please resolve the conflicts

Resolved 3 conflicting files:
- escrow/lib.rs: kept master's reentrancy-guarded partial_release with dual escrow type handling, preserved sandbox test module
- test_e2e_upgrade_with_pause.rs: adopted master's cleaner test structure with token_client API
- grainlify-core/lib.rs: kept master's optimized wasm path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@okekefrancis112
Copy link
Contributor Author

please resolve the conflicts

conflicts resolved. @Jagadeeshftw

okekefrancis112 and others added 3 commits February 26, 2026 12:15
- Remove dead create_token_contract call in test_e2e_upgrade_with_pause.rs
- Remove unused Ledger import
- Add set_anonymous_resolver admin method (contract reads AnonymousResolver
  from storage but had no setter, causing test_anonymization compilation error)
- Add missing token transfer in partial_release (state was updated but tokens
  were never transferred to the contributor)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Jagadeeshftw Jagadeeshftw merged commit 946dde9 into Jagadeeshftw:master Feb 26, 2026
1 of 4 checks passed
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.

Provide Sandbox Mode for Testing New Features with Real Data

2 participants