Repository navigation
fix(devops,contracts): resolve issues #1543-#1546 (deploy.sh errexit, Redis docs, contract tests) - #1627
Merged
K1NGD4VID merged 1 commit intoOct 18, 2026
Conversation
…absCrypt#1546 LabsCrypt#1546 (deploy.sh errexit dead code): capture `stellar contract deploy` and `stellar contract invoke` output directly as the `if` condition (`if ! VAR=$(cmd); then`) so the custom "Deployment failed" / "Contract initialization failed" diagnostics and captured output are actually reachable under `set -e`. Verified with mocked stellar/cargo: old script exited 7 with no custom message; new script exits 1 and prints both the custom error block and the captured command output. LabsCrypt#1545 (docs Redis vs docker-compose): the Redis service existed but its explanatory comment was attached to pgbouncer, and backend/.env.example had no local Redis URL. Restore the Redis comment, give pgbouncer its own, and pin REDIS_URL to redis://localhost:6379 (the port published by the `redis` compose service) so the documented `docker compose up -d redis` flow works from a fresh clone. LabsCrypt#1544 (contracts self-stream tests): add test_withdraw_self_stream_credits_shared_address_once and test_cancel_self_stream_settles_both_transfers, asserting the shared sender==recipient address is credited exactly once and that accrued_amount + refunded_amount sum to the full deposit. LabsCrypt#1543 (contracts fully-accrued cancel test): add test_cancel_fully_accrued_stream_without_withdraw_is_cancelled asserting 100% to recipient, 0 refund, and StreamStatus::Cancelled (not Completed). closes LabsCrypt#1543 closes LabsCrypt#1544 closes LabsCrypt#1545 closes LabsCrypt#1546
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.
Summary
Resolves four third-wave audit issues spanning DevOps, docs, and contract test coverage.
#1546 —
deploy.shcustom deploy/init error messages were dead code underset -escripts/deploy.shcaptured command output viaVAR=$(cmd)and then checkedif [[ $? -ne 0 ]]. Underset -e, a failing command substitution in a plain assignment terminates the script before that check, so the custom diagnostics were unreachable.Fix: check the exit status in the same statement —
if ! DEPLOY_OUTPUT=$(...); then— for bothstellar contract deployandstellar contract invoke.Verification: with mocked
cargo/stellar, the old script exits7and prints no custom message; the new script exits1and printsError: Deployment failed(orError: Contract initialization failed) plus the captured command output. This is the errexit control-flow bug specifically, distinct from the already-closed #887 (env-var defaults) and #515 (deploy.sh vs deploy.ts divergence).#1545 — docs told contributors
docker compose up -d rediswith no Redis servicedocker-compose.ymldoes define aredisservice, but its explanatory comment was attached to thepgbouncerservice andbackend/.env.exampleleftREDIS_URLempty/unreachable.Fix: restore the Redis comment, give pgbouncer its own, and pin/document
REDIS_URL=redis://localhost:6379— the port therediscompose service publishes — so the documented SSE-fanout flow works from a fresh clone.docker compose up -d redistargets a real, healthy service.#1544 — Test
cancel_stream/withdrawwhen sender == recipientAdded
test_withdraw_self_stream_credits_shared_address_onceandtest_cancel_self_stream_settles_both_transfers: the shared address is credited exactly once on withdraw, and the twocancel_streamtransfers (accrued to recipient + refund to sender) sum to the full deposit with no loss or duplication.#1543 — Test
cancel_streamon a fully accrued but never-withdrawn streamAdded
test_cancel_fully_accrued_stream_without_withdraw_is_cancelled: the recipient receives 100% of the deposit, the sender refund is 0, andstream.status == StreamStatus::Cancelled(neverCompleted, which onlyapply_withdrawalsets).Files changed
scripts/deploy.sh— errexit-safe deploy/init error handling ([DevOps] deploy.sh's custom deploy/init error messages are dead code under set -e #1546)docker-compose.yml,docs/DEVELOPMENT.md,backend/.env.example— Redis service/URL consistency ([DevOps] docs/DEVELOPMENT.md tells contributors todocker compose up -d redisbut no redis service exists #1545)contracts/stream_contract/src/test.rs— 3 new tests ([Contracts] Test cancel_stream on a fully accrued but never-withdrawn stream #1543, [Contracts] Test cancel_stream/withdraw when sender equals recipient #1544)Testing
cargo test -p stream_contract— 252 passed, 0 failed, 1 ignored (includes the 3 new tests)bash scripts/lint-rust.sh—cargo fmt --check+cargo clippy --all-targets -- -D warningscleandeploy.shfailure simulation for both the deploy and initialize paths (old vs new)docker compose configvalidates with theredisservice presentcloses #1543
closes #1544
closes #1545
closes #1546