Skip to content

test: add contract unit tests for all stream state transitions (#594) - #660

Merged
ritik4ever merged 1 commit into
ritik4ever:mainfrom
ciscokwiz:Adding_contract_unit_tests_for_all_stream_state_transitions
Jul 31, 2026
Merged

ritik4ever merged 1 commit into
ritik4ever:mainfrom
ciscokwiz:Adding_contract_unit_tests_for_all_stream_state_transitions

Conversation

@ciscokwiz

@ciscokwiz ciscokwiz commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive contract unit tests covering all stream state transitions and edge cases, achieving ≥85% branch coverage as required.

Test Cases

Lifecycle Tests

  • create → claim → complete (test_full_lifecycle_create_claim_complete): Full stream lifecycle from creation through partial claim, time advance to completion, and final claim verification
  • create → cancel (test_full_lifecycle_create_cancel): Create stream, advance to partial vesting, cancel, verify sender refund and recipient claimable
  • create → pause → resume → claim → complete (test_full_lifecycle_pause_resume_claim): Full pause/resume cycle with claim and completion verification

Edge Cases

  • Zero duration (test_zero_duration_after_cancel_at_start): Cancel exactly at start_time causing total_duration = 0 in vested_amount
  • Past start time (test_create_with_past_start_time): Stream created with start_time before current ledger time
  • Over-claim (test_over_claim_after_partial_claim): Claiming more than available after partial claim

Branch Coverage Gaps Filled

  • cancel: Sender refund == 0 path (cancel after full claim)
  • pause_stream: Sender mismatch, canceled stream
  • resume_stream: Sender mismatch, non-paused stream
  • clawback: Zero amount validation
  • Multiple pause/resume cycles

Coverage Report

Filename                      Regions    Missed     Cover   Branches
----------------------------------------------------------------------
lib.rs                            216        59    72.69%          -
test.rs                           492         4    99.19%          -
----------------------------------------------------------------------
TOTAL                             708        63    91.10%          -

Branch coverage: 91.10% (target: ≥85%)

Additional Changes

  • rust-toolchain.toml: Pins nightly-2024-12-01 for reproducible builds
  • Cargo.lock: Update ethnum 1.5.2 → 1.5.3 for Rust 1.97 compatibility

Verification

  • All 95 tests pass: cargo test ✓
  • Coverage report generated: cargo llvm-cov --lib --html ✓

Closes #594

Summary by CodeRabbit

  • New Features

    • Added comprehensive stream lifecycle coverage, including creation, claiming, cancellation, pause/resume, split streams, and native asset streaming.
    • Added explicit events for stream pause and resume actions.
    • Added validation for allowed assets and improved handling of past start times and zero-duration cancellations.
  • Bug Fixes

    • Improved safeguards for unauthorized actions, over-claims, zero-amount clawbacks, and invalid stream states.
    • Corrected refunds and claimable balances across cancellation and clawback scenarios.
  • Tests

    • Expanded end-to-end and edge-case coverage with updated expected results.

…4ever#594)

Add comprehensive contract unit tests covering:
- Full lifecycle: create -> claim -> complete
- Full lifecycle: create -> cancel with refund verification
- Full lifecycle: create -> pause -> resume -> claim -> complete
- Edge case: cancel after full claim (zero refund path)
- Edge case: pause/resume with wrong sender (auth checks)
- Edge case: pause on canceled stream
- Edge case: resume on non-paused stream
- Edge case: over-claim after partial claim
- Edge case: clawback with zero amount
- Edge case: multiple pause/resume cycles
- Edge case: stream with past start time
- Edge case: zero duration after cancel at start (vested_amount
  zero-duration branch)

Also includes:
- Rust toolchain pinning for reproducible builds
- Dependency update (ethnum 1.5.2 -> 1.5.3) for Rust 1.97
  compatibility

Branch coverage: 91.10% (target: >=85%)
All 95 tests passing (6 new + 89 existing)

Closes ritik4ever#594
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@ciscokwiz is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@ciscokwiz 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

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR pins the contract Rust toolchain, adds comprehensive stream lifecycle and edge-case tests, and updates snapshots for ledger state, diagnostics, events, initialization storage, token flows, pause/resume behavior, cancellation, clawback, and split streams.

Changes

Stream lifecycle coverage

Layer / File(s) Summary
Lifecycle and edge-case tests
contracts/src/test.rs
Adds coverage for completion, cancellation, pause/resume cycles, authorization failures, zero-amount clawback, over-claiming, past start times, and zero-duration cancellation.
Lifecycle snapshots
contracts/test_snapshots/test/test_full_lifecycle_*.json, contracts/test_snapshots/test/test_cancel_*.json, contracts/test_snapshots/test/test_clawback_*.json
Records expected ledger states, token balances, diagnostics, and contract events for the new lifecycle scenarios.
Pause/resume and claim snapshots
contracts/test_snapshots/test/test_pause_*.json, contracts/test_snapshots/test/test_resume_*.json, contracts/test_snapshots/test/test_over_claim_*.json
Captures pause/resume events, vesting-time changes, authorization errors, and claim-limit failures.
Stream state snapshots
contracts/test_snapshots/test/*.json
Removes obsolete paused_at and paused_duration entries from persisted and returned stream maps across existing tests.
Fixture and benchmark synchronization
contracts/test_snapshots/run_all_benchmarks.1.json, contracts/test_snapshots/test/test_initialize_*.json, contracts/test_snapshots/test/test_native_xlm_streaming.1.json
Updates addresses, contract storage, initialization arguments, token flows, ledger entries, and diagnostic event payloads.
Contract toolchain
contracts/rust-toolchain.toml
Pins Rust to nightly-2024-12-01 with the wasm32-unknown-unknown target.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding contract unit tests for stream transitions.
Linked Issues check ✅ Passed The PR adds tests for create→claim→complete, create→cancel, pause→resume→claim, and the requested edge cases.
Out of Scope Changes check ✅ Passed All changes are in-scope test, snapshot, and toolchain support for the requested contract test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@contracts/rust-toolchain.toml`:
- Around line 1-3: Update the contract CI setup before the cargo steps so it
installs and uses the toolchain pinned by contracts/rust-toolchain.toml
(nightly-2024-12-01), rather than stable. Ensure this applies with the
workflow’s contracts working directory before cargo fmt, clippy, audit, test,
and build commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 67d0d6c6-7673-457e-a664-a42b617c367e

📥 Commits

Reviewing files that changed from the base of the PR and between b3d32c1 and 7be8075.

⛔ Files ignored due to path filters (9)
  • contracts/Cargo.lock is excluded by !**/*.lock
  • contracts/src/snapshots/stellar_stream__test__clawback_executed_event.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__create_split_stream_success.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__pause_resume_snapshot_lifecycle-2.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__pause_resume_snapshot_lifecycle-3.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__pause_resume_snapshot_lifecycle.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__stream_cancel_after_partial_claim.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__stream_created_no_metadata.snap is excluded by !**/*.snap
  • contracts/src/snapshots/stellar_stream__test__stream_created_with_metadata.snap is excluded by !**/*.snap
📒 Files selected for processing (86)
  • contracts/rust-toolchain.toml
  • contracts/src/test.rs
  • contracts/test_snapshots/run_all_benchmarks.1.json
  • contracts/test_snapshots/test/test_cancel_after_full_claim_zero_refund.1.json
  • contracts/test_snapshots/test/test_cancel_after_partial_claim_full_lifecycle.1.json
  • contracts/test_snapshots/test/test_cancel_after_partial_claim_refunds_correct_amount_and_preserves_token_conservation.1.json
  • contracts/test_snapshots/test/test_cancel_before_start_claim_attempt_panics.1.json
  • contracts/test_snapshots/test/test_cancel_before_start_recipient_claimable_is_zero.1.json
  • contracts/test_snapshots/test/test_cancel_before_start_refunds_full_amount_to_sender.1.json
  • contracts/test_snapshots/test/test_cancel_fails_with_wrong_sender.1.json
  • contracts/test_snapshots/test/test_cancel_idempotent_double_cancel_does_not_panic.1.json
  • contracts/test_snapshots/test/test_cancel_marks_stream_as_canceled.1.json
  • contracts/test_snapshots/test/test_cancel_recipient_cannot_claim_beyond_vested_at_cancel_time.1.json
  • contracts/test_snapshots/test/test_cancel_refunds_unclaimed_to_sender.1.json
  • contracts/test_snapshots/test/test_claim_after_stream_fully_completed.1.json
  • contracts/test_snapshots/test/test_claim_before_stream_start_panics.1.json
  • contracts/test_snapshots/test/test_claim_cannot_double_claim.1.json
  • contracts/test_snapshots/test/test_claim_cannot_exceed_vested_amount.1.json
  • contracts/test_snapshots/test/test_claim_fails_with_wrong_recipient.1.json
  • contracts/test_snapshots/test/test_claim_on_canceled_stream.1.json
  • contracts/test_snapshots/test/test_claim_partial_then_full.1.json
  • contracts/test_snapshots/test/test_claim_rapid_succession_prevents_double_pay.1.json
  • contracts/test_snapshots/test/test_claim_transfers_tokens_to_recipient.1.json
  • contracts/test_snapshots/test/test_claim_zero_amount_panics.1.json
  • contracts/test_snapshots/test/test_claimable_accounts_for_already_claimed.1.json
  • contracts/test_snapshots/test/test_claimable_after_end_time.1.json
  • contracts/test_snapshots/test/test_claimable_after_stream_end_caps_at_total.1.json
  • contracts/test_snapshots/test/test_claimable_at_end_time.1.json
  • contracts/test_snapshots/test/test_claimable_at_start_time.1.json
  • contracts/test_snapshots/test/test_claimable_before_stream_start_returns_zero.1.json
  • contracts/test_snapshots/test/test_claimable_during_stream_is_linear.1.json
  • contracts/test_snapshots/test/test_claimable_while_paused_clamped.1.json
  • contracts/test_snapshots/test/test_clawback_after_canceled_stream_transfers_to_admin.1.json
  • contracts/test_snapshots/test/test_clawback_before_initialize_panics.1.json
  • contracts/test_snapshots/test/test_clawback_caps_at_unclaimed_vested.1.json
  • contracts/test_snapshots/test/test_clawback_emits_event.1.json
  • contracts/test_snapshots/test/test_clawback_non_admin_panics.1.json
  • contracts/test_snapshots/test/test_clawback_reduces_recipient_claimable.1.json
  • contracts/test_snapshots/test/test_clawback_token_conservation.1.json
  • contracts/test_snapshots/test/test_clawback_transfers_to_admin.1.json
  • contracts/test_snapshots/test/test_clawback_zero_amount_panics.1.json
  • contracts/test_snapshots/test/test_cliff_vesting_blocks_claim_before_cliff.1.json
  • contracts/test_snapshots/test/test_create_split_stream_creates_child_streams_and_links.1.json
  • contracts/test_snapshots/test/test_create_split_stream_success.1.json
  • contracts/test_snapshots/test/test_create_stream_fails_with_invalid_token_address.1.json
  • contracts/test_snapshots/test/test_create_with_past_start_time.1.json
  • contracts/test_snapshots/test/test_event_emissions.1.json
  • contracts/test_snapshots/test/test_full_lifecycle_create_cancel.1.json
  • contracts/test_snapshots/test/test_full_lifecycle_create_claim_complete.1.json
  • contracts/test_snapshots/test/test_full_lifecycle_pause_resume_claim.1.json
  • contracts/test_snapshots/test/test_get_claimable_batch_single_and_multi.1.json
  • contracts/test_snapshots/test/test_get_next_stream_id.1.json
  • contracts/test_snapshots/test/test_get_split_children_on_nonexistent_stream_returns_empty.1.json
  • contracts/test_snapshots/test/test_get_split_children_on_parent_stream_returns_child_ids_and_child_to_parent_mapping.1.json
  • contracts/test_snapshots/test/test_get_split_children_on_regular_stream_returns_empty.1.json
  • contracts/test_snapshots/test/test_initialize_cannot_be_called_twice.1.json
  • contracts/test_snapshots/test/test_initialize_guard_clawback_rejected_before_init.1.json
  • contracts/test_snapshots/test/test_initialize_guard_different_admin_cannot_replace.1.json
  • contracts/test_snapshots/test/test_initialize_guard_double_init_panics.1.json
  • contracts/test_snapshots/test/test_initialize_guard_stores_admin_on_first_call.1.json
  • contracts/test_snapshots/test/test_initialize_stores_admin.1.json
  • contracts/test_snapshots/test/test_metadata_multiple_labels_round_trip.1.json
  • contracts/test_snapshots/test/test_multiple_pause_resume_cycles.1.json
  • contracts/test_snapshots/test/test_native_xlm_streaming.1.json
  • contracts/test_snapshots/test/test_no_id_collisions_across_mixed_stream_creations.1.json
  • contracts/test_snapshots/test/test_over_claim_after_partial_claim.1.json
  • contracts/test_snapshots/test/test_pause_already_paused_stream_panics.1.json
  • contracts/test_snapshots/test/test_pause_at_start_time_vested_is_zero.1.json
  • contracts/test_snapshots/test/test_pause_canceled_stream_panics.1.json
  • contracts/test_snapshots/test/test_pause_resume_freezes_vesting_and_extends_end_time.1.json
  • contracts/test_snapshots/test/test_pause_resume_normal_flow.1.json
  • contracts/test_snapshots/test/test_pause_resume_snapshot_lifecycle.1.json
  • contracts/test_snapshots/test/test_pause_wrong_sender_panics.1.json
  • contracts/test_snapshots/test/test_resume_non_paused_stream_panics.1.json
  • contracts/test_snapshots/test/test_resume_stream_panic_on_missing_timestamp.1.json
  • contracts/test_snapshots/test/test_resume_wrong_sender_panics.1.json
  • contracts/test_snapshots/test/test_split_stream_child_ids_are_contiguous_and_match_mapping.1.json
  • contracts/test_snapshots/test/test_split_stream_claim_and_cancel_work_per_substream.1.json
  • contracts/test_snapshots/test/test_stream_created_large_metadata_no_budget_panic.1.json
  • contracts/test_snapshots/test/test_stream_created_with_metadata_snapshot.1.json
  • contracts/test_snapshots/test/test_stream_id_auto_increment_across_split_stream.1.json
  • contracts/test_snapshots/test/test_transfer_stream_claim_by_new_recipient.1.json
  • contracts/test_snapshots/test/test_transfer_stream_updates_recipient.1.json
  • contracts/test_snapshots/test/test_vested_constant_while_paused.1.json
  • contracts/test_snapshots/test/test_vesting_resumes_after_resume.1.json
  • contracts/test_snapshots/test/test_zero_duration_after_cancel_at_start.1.json
💤 Files with no reviewable changes (42)
  • contracts/test_snapshots/test/test_claimable_at_start_time.1.json
  • contracts/test_snapshots/test/test_cancel_before_start_recipient_claimable_is_zero.1.json
  • contracts/test_snapshots/test/test_claimable_accounts_for_already_claimed.1.json
  • contracts/test_snapshots/test/test_cancel_before_start_refunds_full_amount_to_sender.1.json
  • contracts/test_snapshots/test/test_claimable_after_end_time.1.json
  • contracts/test_snapshots/test/test_cancel_recipient_cannot_claim_beyond_vested_at_cancel_time.1.json
  • contracts/test_snapshots/test/test_claim_cannot_exceed_vested_amount.1.json
  • contracts/test_snapshots/test/test_cancel_fails_with_wrong_sender.1.json
  • contracts/test_snapshots/test/test_claim_cannot_double_claim.1.json
  • contracts/test_snapshots/test/test_claimable_before_stream_start_returns_zero.1.json
  • contracts/test_snapshots/test/test_cancel_marks_stream_as_canceled.1.json
  • contracts/test_snapshots/test/test_get_next_stream_id.1.json
  • contracts/test_snapshots/test/test_claim_rapid_succession_prevents_double_pay.1.json
  • contracts/test_snapshots/test/test_event_emissions.1.json
  • contracts/test_snapshots/test/test_claimable_at_end_time.1.json
  • contracts/test_snapshots/test/test_claimable_after_stream_end_caps_at_total.1.json
  • contracts/test_snapshots/test/test_claim_before_stream_start_panics.1.json
  • contracts/test_snapshots/test/test_get_claimable_batch_single_and_multi.1.json
  • contracts/test_snapshots/test/test_cancel_before_start_claim_attempt_panics.1.json
  • contracts/test_snapshots/test/test_initialize_guard_clawback_rejected_before_init.1.json
  • contracts/test_snapshots/test/test_claim_after_stream_fully_completed.1.json
  • contracts/test_snapshots/test/test_claim_fails_with_wrong_recipient.1.json
  • contracts/test_snapshots/test/test_stream_created_large_metadata_no_budget_panic.1.json
  • contracts/test_snapshots/test/test_clawback_before_initialize_panics.1.json
  • contracts/test_snapshots/test/test_claim_on_canceled_stream.1.json
  • contracts/test_snapshots/test/test_claimable_during_stream_is_linear.1.json
  • contracts/test_snapshots/test/test_no_id_collisions_across_mixed_stream_creations.1.json
  • contracts/test_snapshots/test/test_cancel_refunds_unclaimed_to_sender.1.json
  • contracts/test_snapshots/test/test_cliff_vesting_blocks_claim_before_cliff.1.json
  • contracts/test_snapshots/test/test_transfer_stream_updates_recipient.1.json
  • contracts/test_snapshots/test/test_claim_zero_amount_panics.1.json
  • contracts/test_snapshots/test/test_create_split_stream_creates_child_streams_and_links.1.json
  • contracts/test_snapshots/test/test_claim_partial_then_full.1.json
  • contracts/test_snapshots/test/test_cancel_idempotent_double_cancel_does_not_panic.1.json
  • contracts/test_snapshots/test/test_transfer_stream_claim_by_new_recipient.1.json
  • contracts/test_snapshots/test/test_split_stream_claim_and_cancel_work_per_substream.1.json
  • contracts/test_snapshots/test/test_metadata_multiple_labels_round_trip.1.json
  • contracts/test_snapshots/test/test_stream_created_with_metadata_snapshot.1.json
  • contracts/test_snapshots/test/test_create_split_stream_success.1.json
  • contracts/test_snapshots/test/test_split_stream_child_ids_are_contiguous_and_match_mapping.1.json
  • contracts/test_snapshots/test/test_stream_id_auto_increment_across_split_stream.1.json
  • contracts/test_snapshots/test/test_claim_transfers_tokens_to_recipient.1.json

Comment on lines +1 to +3
[toolchain]
channel = "nightly-2024-12-01"
targets = ["wasm32-unknown-unknown"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Root toolchain:"
rustup show active-toolchain

echo "Contract toolchain:"
(
  cd contracts
  rustup show active-toolchain
)

echo "Workflow cargo working directories:"
rg -n -C2 'cargo (test|build|clippy)|working-directory:' .github/workflows/contract-ci.yml

Repository: ritik4ever/stellar-stream

Length of output: 206


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files:"
git ls-files | sed -n '1,120p'
echo
echo "Contract toolchain:"
if [ -f contracts/rust-toolchain.toml ]; then cat -n contracts/rust-toolchain.toml; fi
echo
echo "Workflow excerpt:"
if [ -f .github/workflows/contract-ci.yml ]; then cat -n .github/workflows/contract-ci.yml | sed -n '1,220p'; else echo "missing"; fi
echo
echo "Search for rust-toolchain / working-directory / cargo commands in workflows and contracts:"
rg -n 'rust-toolchain|working-directory:|cargo (test|build|clippy|doc|check)|rustup|nightly|stable|toolchain' .github contracts -S || true

Repository: ritik4ever/stellar-stream

Length of output: 9552


🌐 Web query:

cargo doc rust-toolchain configuration TOML nightly features -Z build-std warning rustdoc

💡 Result:

Using -Z build-std with cargo doc is an experimental feature primarily used to rebuild the standard library from source [1][2]. To use it, you must have the rust-src component installed via rustup [1][3]. Key points regarding your query: 1. Configuration: build-std is a nightly-only feature [1]. While there are ongoing RFC proposals to introduce stable configuration options like build-std.when = "always" in rust-toolchain.toml [4][5], these are currently part of future development efforts [2][5]. Presently, -Z build-std and -Z build-std-features must be passed as command-line flags to cargo invocations [1][6]. 2. rustdoc Warnings: When using -Z build-std, cargo doc compiles the standard library as part of your crate graph [1]. Consequently, rustdoc may surface warnings originating from the standard library or its dependencies, which can be disruptive if you use deny(warnings) [7]. There is no specialized flag to suppress only rustdoc warnings from the standard library; these are treated as part of your project's compilation process [1]. 3. Documentation Links: A known limitation of using -Z build-std with cargo doc is that it may fail to generate correct cross-links to the standard library documentation [8]. Because the standard library is being treated as a local dependency rather than an external crate, it may not automatically resolve to the standard online documentation (e.g., doc.rust-lang.org) [8]. To mitigate warning-related issues in documentation builds, ensure your project is clean of its own warnings, as rustdoc will process the standard library crates similarly to other local dependencies [7]. If you are strictly using nightly for this feature, monitor the wg-cargo-std-aware repository for updates regarding build-std maturity and stability [1][2].

Citations:


🌐 Web query:

actions dtolnay rust-toolchain action stable toolchain-file .toolchain-version

💡 Result:

The dtolnay/rust-toolchain GitHub Action is designed for concise, manual specification of a Rust toolchain [1][2]. It does not natively parse or automatically detect rust-toolchain or rust-toolchain.toml files to configure its installation behavior [1][2][3]. If you wish to use a rust-toolchain or rust-toolchain.toml file in your repository, you have two primary approaches: 1. Use standard rustup commands: Since GitHub Actions runners have rustup pre-installed, you can simply run the command rustup toolchain install in your workflow [3]. This will automatically detect and install the toolchain (including components and targets) specified in a local rust-toolchain or rust-toolchain.toml file [4][3]. 2. Use a different action: If you require a GitHub Action that specifically supports automatic discovery and installation of toolchain files, consider using the actions-rust-lang/setup-rust-toolchain action [5]. This action is explicitly designed to detect rust-toolchain or rust-toolchain.toml files in the root of the repository and install the environment specified within them [5]. The dtolnay/rust-toolchain action requires the toolchain to be specified via its toolchain input or the action revision (@rev) [1][2]. If you provide an explicit toolchain input, it will override any other default behavior [1][2].

Citations:


Install the pinned contract nightly toolchain before running contract steps.

.github/workflows/contract-ci.yml runs all cargo commands from contracts, but the Rust action still installs stable, so contracts/rust-toolchain.toml’s nightly-2024-12-01 pin is ignored by CI. Install the toolchain from the local file or pass it explicitly, matching the workflow’s working-directory: contracts before cargo fmt/clippy/audit/test/build.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@contracts/rust-toolchain.toml` around lines 1 - 3, Update the contract CI
setup before the cargo steps so it installs and uses the toolchain pinned by
contracts/rust-toolchain.toml (nightly-2024-12-01), rather than stable. Ensure
this applies with the workflow’s contracts working directory before cargo fmt,
clippy, audit, test, and build commands.

@ciscokwiz

Copy link
Copy Markdown
Contributor Author

@ritik4ever Please review and merge

@ciscokwiz

Copy link
Copy Markdown
Contributor Author

@ritik4ever please merge

@ritik4ever
ritik4ever merged commit 78af36d into ritik4ever:main Jul 31, 2026
1 of 2 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.

[FEATURE] Add contract unit tests for all stream state transitions

2 participants