Skip to content

Fix: 4 issues (#942, #943, #944, #945) - #1016

Merged
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
Emmyt24:simple/942-943-944-945
Oct 17, 2026
Merged

Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
Emmyt24:simple/942-943-944-945

Conversation

@Emmyt24

@Emmyt24 Emmyt24 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Closes #942
Closes #943
Closes #944
Closes #945

Issues

#942 Contract: test remove_delegate requires recipient auth

Description

remove_delegate requires the stream recipient's auth; only the happy path is tested.

Location

contracts/streaming/src/lib.rs; tests in contracts/streaming/src/test*.rs.

Task

Without mocking all auths, assert a non-recipient cannot remove the delegate.

Run cargo test from contracts/.

Acceptance criteria

  • Unauthorized call fails
  • Recipient call succeeds
  • cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check pass

Good for contributors because

Small, isolated Soroban test using existing fixtures — a gentle intro to the contract.

#943 Contract: test remove_delegate when no delegate is set

Description

Behaviour of remove_delegate on a stream that never had a delegate is untested.

History

#‍656 asked for this but was closed without the test landing — test.rs only covers removing an existing delegate.

Location

contracts/streaming/src/lib.rs; tests in contracts/streaming/src/test*.rs.

Task

Assert it succeeds (no-op), emits DelegateRemovedEvent, and get_delegate stays None.

Run cargo test from contracts/.

Acceptance criteria

  • Behaviour documented by the test
  • cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check pass

Good for contributors because

Small, isolated Soroban test using existing fixtures — a gentle intro to the contract.

#944 Contract: assert bump_stream emits StreamBumpedEvent

Description

bump_stream (lib.rs ~1357) publishes StreamBumpedEvent, but tests only check it doesn't fail.

Location

contracts/streaming/src/lib.rs; tests in contracts/streaming/src/test*.rs.

Task

Assert the event is emitted with the right stream_id and ledger timestamp.

Run cargo test from contracts/.

Acceptance criteria

  • Event contents asserted
  • cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check pass

Good for contributors because

Small, isolated Soroban test using existing fixtures — a gentle intro to the contract.

#945 Contract: document bump_stream behaviour while paused

Description

Unlike most mutating entrypoints, bump_stream does not call require_not_paused. No test records whether that is intended.

Location

contracts/streaming/src/lib.rs; tests in contracts/streaming/src/test*.rs.

Task

Add a test that pauses the contract and calls bump_stream, asserting the current behaviour (it succeeds). Note in the PR that this is intentional (TTL upkeep should work while paused) or flag it.

Run cargo test from contracts/.

Acceptance criteria

  • Test pins the current behaviour
  • cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check pass

Good for contributors because

Small, isolated Soroban test using existing fixtures — a gentle intro to the contract.

Summary

All changes are test-only; do not modify contracts/streaming/src/lib.rs. For the auth test in test_security.rs, follow the existing MockAuth/MockAuthInvoke pattern used by other auth tests (e.g. test_auth_attacker_cannot_cancel), using fn_name: "remove_delegate" and args (id,).into_val(&ctx.env). For event assertions, use env.events().all() and decode the event body; the StreamBumpedEvent and DelegateRemovedEvent structs are defined in lib.rs. Run cargo test, cargo clippy --all-targets -- -D warnings, and cargo fmt --check from contracts/ before submitting.

Changes

  • Add a test test_remove_delegate_requires_recipient_auth (or similar) to contracts/streaming/src/test_security.rs using the existing Ctx fixture. Create a stream, set a delegate, then mock auths for a non-recipient (e.g. ctx.attacker) invoking remove_delegate with args (id,) and assert the call panics (use #[should_panic] or try_remove_delegate returning an auth error). Then add a positive test (or extend the same test) mocking the recipient's auth for remove_delegate and assert success and get_delegate(&id) == None. Ensure cargo test, cargo clippy --all-targets -- -D warnings, and cargo fmt --check pass from contracts/. (contracts/streaming/src/test_security.rs)
  • In contracts/streaming/src/test.rs, strengthen the existing test_remove_delegate_is_safe_noop_when_never_set (or add a new test) to assert that remove_delegate on a stream that never had a delegate: (1) succeeds, (2) emits a DelegateRemovedEvent with the correct stream_id and recipient (inspect t.env.events().all() and match the event payload), and (3) leaves get_delegate(&stream_id) == None. Keep using the existing TestEnv fixture. Ensure cargo test, cargo clippy --all-targets -- -D warnings, and cargo fmt --check pass from contracts/. (contracts/streaming/src/test.rs)
  • In contracts/streaming/src/test_features.rs, add tests for bump_stream: (1) test_bump_stream_emits_event — create a stream, call bump_stream, capture t.env.events().all(), and assert a StreamBumpedEvent is emitted with the expected stream_id and the current ledger timestamp; (2) test_bump_stream_works_while_paused — initialize with admin, create a stream, call client.pause(), then call client.bump_stream(&stream_id) and assert it succeeds (and optionally that the StreamBumpedEvent is emitted), with a comment documenting that this is intentional so TTL upkeep works while paused (or flag it in the PR). Use the existing TestEnv fixture. Ensure cargo test, cargo clippy --all-targets -- -D warnings, and cargo fmt --check pass from contracts/. (contracts/streaming/src/test_features.rs)

Co-authored-by: Simple Agent <agent@simple.dev>
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Emmyt24 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Austinaminu2
Austinaminu2 merged commit 61280f0 into FlowwStar:main Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants