Skip to content

fix(devops,contracts): resolve issues #1543-#1546 (deploy.sh errexit, Redis docs, contract tests) - #1627

Merged
K1NGD4VID merged 1 commit into
LabsCrypt:mainfrom
anifast-123:fix/issues-1543-1544-1545-1546
Oct 18, 2026
Merged

K1NGD4VID merged 1 commit into
LabsCrypt:mainfrom
anifast-123:fix/issues-1543-1544-1545-1546

Conversation

@anifast-123

Copy link
Copy Markdown
Contributor

Summary

Resolves four third-wave audit issues spanning DevOps, docs, and contract test coverage.

#1546 — deploy.sh custom deploy/init error messages were dead code under set -e

scripts/deploy.sh captured command output via VAR=$(cmd) and then checked if [[ $? -ne 0 ]]. Under set -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 both stellar contract deploy and stellar contract invoke.

Verification: with mocked cargo/stellar, the old script exits 7 and prints no custom message; the new script exits 1 and prints Error: Deployment failed (or Error: 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 redis with no Redis service

docker-compose.yml does define a redis service, but its explanatory comment was attached to the pgbouncer service and backend/.env.example left REDIS_URL empty/unreachable.

Fix: restore the Redis comment, give pgbouncer its own, and pin/document REDIS_URL=redis://localhost:6379 — the port the redis compose service publishes — so the documented SSE-fanout flow works from a fresh clone. docker compose up -d redis targets a real, healthy service.

#1544 — Test cancel_stream/withdraw when sender == recipient

Added test_withdraw_self_stream_credits_shared_address_once and test_cancel_self_stream_settles_both_transfers: the shared address is credited exactly once on withdraw, and the two cancel_stream transfers (accrued to recipient + refund to sender) sum to the full deposit with no loss or duplication.

#1543 — Test cancel_stream on a fully accrued but never-withdrawn stream

Added test_cancel_fully_accrued_stream_without_withdraw_is_cancelled: the recipient receives 100% of the deposit, the sender refund is 0, and stream.status == StreamStatus::Cancelled (never Completed, which only apply_withdrawal sets).

Files changed

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 warnings clean
  • Mocked deploy.sh failure simulation for both the deploy and initialize paths (old vs new)
  • docker compose config validates with the redis service present

closes #1543
closes #1544
closes #1545
closes #1546

…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
@K1NGD4VID
K1NGD4VID merged commit 5402b40 into LabsCrypt:main Oct 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment