Skip to content

test(smart-contract): make generated Soroban contract tests deterministic and network-independent - #434

Merged
dDevAhmed merged 1 commit into
DigiNodes:mainfrom
cleank0de:test/deterministic-soroban-contract-tests
Nov 20, 2026
Merged

dDevAhmed merged 1 commit into
DigiNodes:mainfrom
cleank0de:test/deterministic-soroban-contract-tests

Conversation

@cleank0de

Copy link
Copy Markdown
Contributor

Summary

Makes the generated Soroban starter contract tests explicitly deterministic and completely offline/network-independent, adds regression coverage in the template test suite, and runs cargo test in the dedicated Cargo CI job.

Changes

  • templates/smart-contract/contracts/hello/src/test.rs:
    • Introduced deterministic_env() with explicit DETERMINISTIC_LEDGER_SEQUENCE and DETERMINISTIC_LEDGER_TIMESTAMP values on local Env::default().
    • Added deterministic tests covering the documented hello("StellarForge") behavior, empty-string handling, and ledger sequence/timestamp independence with actionable failure messages.
  • tests/smart-contract-template.test.ts:
    • Added deterministic regression assertions checking that generated contract tests configure explicit ledger/time state locally and do not reference Stellar RPC endpoints, wallets, or secret keys.
  • .github/workflows/ci.yml:
    • Extended the cargo-smoke job to run cargo test on the generated smart-contract workspace.

Verification

  • cargo test on the smart-contract template: 3 passed, 0 failed
  • npm run lint: passed
  • npm run audit:workflow-permissions: passed
  • npx prettier --check --end-of-line auto tests/smart-contract-template.test.ts: passed

Closes #325

@cleank0de
cleank0de requested a review from dDevAhmed as a code owner November 20, 2026 02:50
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed802b0f-c3d6-43dd-a8d0-4935a072b1cf
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@dDevAhmed
dDevAhmed merged commit 994f4ad into DigiNodes:main Nov 20, 2026
6 of 12 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.

SW-144 — Make generated Soroban contract tests deterministic and network-independent

2 participants