Skip to content

Commit bc2d5f8

Browse files
authored
Merge branch 'main' into fix/issue-99-api-testing
2 parents b42c657 + 493ba83 commit bc2d5f8

104 files changed

Lines changed: 292705 additions & 2126 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Smart Contract Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: smart-contract-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
contract-tests:
16+
name: Contract Test Matrix
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
25+
- uses: Swatinem/rust-cache@v2
26+
27+
- name: Install cargo-llvm-cov
28+
uses: taiki-e/install-action@cargo-llvm-cov
29+
30+
- name: Edge cases
31+
run: cargo test --manifest-path contract/Cargo.toml --test edge_cases
32+
33+
- name: Security scenarios
34+
run: cargo test --manifest-path contract/Cargo.toml --test security
35+
36+
- name: Integration scenarios
37+
run: cargo test --manifest-path contract/Cargo.toml --test integration
38+
39+
- name: Performance benchmarks
40+
run: cargo test --manifest-path contract/Cargo.toml --test performance -- --nocapture
41+
42+
- name: Stress benchmarks
43+
run: cargo test --manifest-path contract/Cargo.toml --test stress -- --nocapture
44+
45+
- name: Coverage report
46+
run: cargo llvm-cov --manifest-path contract/Cargo.toml --workspace --lcov --output-path contract/coverage/lcov.info --html --output-dir contract/coverage/html
47+
48+
- name: Upload contract coverage
49+
uses: actions/upload-artifact@v4
50+
if: always()
51+
with:
52+
name: smart-contract-coverage-${{ github.run_number }}
53+
path: contract/coverage/
54+
retention-days: 30

PR_DESCRIPTION.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Summary
2+
3+
- expands the Soroban smart contract suite with dedicated edge case, security, integration, performance, and stress coverage
4+
- repairs the contract core so the smart contract crate builds and all contract tests pass again
5+
- adds root test commands, contract testing docs, snapshot artifacts, and a GitHub Actions workflow for contract testing and coverage
6+
7+
## What Changed
8+
9+
- added shared contract test harnesses and new suites under `contract/tests/`
10+
- restored a working contract implementation in `contract/src/` for escrow, bridge, insurance, pause, compliance, migration, and analytics flows
11+
- enabled importing the contract crate in integration tests via `rlib`
12+
- documented the new contract test matrix and commands
13+
- added `.github/workflows/smart-contract-tests.yml`
14+
15+
## Verification
16+
17+
```bash
18+
cargo test --manifest-path contract/Cargo.toml
19+
```
20+
21+
All contract unit, edge, security, integration, performance, and stress tests pass locally.
22+
23+
## Notes
24+
25+
- stress scenarios were tuned to stable CI-safe volumes so the Soroban test host does not hit budget exhaustion during the suite
26+
- contract snapshots were generated under `contract/test_snapshots/` during verification

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ cargo test # Backend tests
5656
docker-compose up # Indexer + DB
5757
```
5858
59+
## Smart Contract Testing
60+
61+
The Soroban contract now has dedicated suites for edge cases, security scenarios, integration flows, stress tests, and performance benchmarks under `contract/tests/`.
62+
63+
```bash
64+
npm run test:contract
65+
npm run test:contract:edge
66+
npm run test:contract:security
67+
npm run test:contract:integration
68+
npm run test:contract:performance
69+
npm run test:contract:stress
70+
npm run test:contract:coverage
71+
```
72+

TESTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This project uses a three-tier testing strategy:
1515
| Scalability | Jest + performance harness | `api/src/**/*.scalability.test.ts` | Throughput and latency trends across concurrency levels |
1616
| Monitoring | Jest + performance harness | `api/src/**/*.monitoring.test.ts` | Threshold alerts, error-rate visibility, and per-operation telemetry |
1717
| Security | Jest + scenario harness | `security/src/security.assessment.test.ts` | Penetration tests, vulnerability scans, compliance, monitoring |
18+
| Smart Contract | Soroban test harness | `contract/tests/*.rs`, `contract/tests/stress.rs` | Contract edge cases, security, integration, stress, benchmarks, coverage |
1819
| E2E | Cypress | `components/cypress/e2e/` | Full user flows |
1920

2021
## Running Tests
@@ -41,6 +42,15 @@ npm run test:docs --workspace=api
4142
npm run test:security
4243
npm run test:security --workspace=security
4344

45+
# Smart contract suites
46+
npm run test:contract
47+
npm run test:contract:edge
48+
npm run test:contract:security
49+
npm run test:contract:integration
50+
npm run test:contract:performance
51+
npm run test:contract:stress
52+
npm run test:contract:coverage
53+
4454
# E2E tests (requires app running on localhost:3000)
4555
npm run test:e2e
4656

@@ -52,6 +62,7 @@ cd components && npm run test:watch
5262

5363
All packages enforce **70% minimum** on branches, functions, lines, and statements.
5464
Coverage reports are written to `coverage/` in each package directory.
65+
For the contract crate, coverage artifacts are written to `contract/coverage/`.
5566

5667
## Unit Tests
5768

api/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ export type {
115115
RetryConfig,
116116
} from './types';
117117
export type { ApiConfig };
118+
export {
119+
ApiConnector,
120+
IntegrationMonitor,
121+
IntegrationService,
122+
} from './integration';
123+
export type {
124+
IntegrationConfig,
125+
IntegrationEvent,
126+
IntegrationHealth,
127+
IntegrationMetrics,
128+
IntegrationProvider,
129+
IntegrationStatus,
130+
} from './integration';
118131
export type {
119132
OperationPerformanceSummary,
120133
PerformanceAlert,

0 commit comments

Comments
 (0)