Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
open-pull-requests-limit: 10
reviewers:
- "Smartdevs17" # Based on the repo URL found in package.json
- 'Smartdevs17' # Based on the repo URL found in package.json
groups:
dependencies:
patterns:
- "*"
- '*'
update-types:
- "patch"
- "minor"
- 'patch'
- 'minor'
commit-message:
prefix: "fix(deps)"
include: "scope"
prefix: 'fix(deps)'
include: 'scope'
labels:
- "dependencies"
- "security"
- 'dependencies'
- 'security'

- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
commit-message:
prefix: "ci(actions)"
prefix: 'ci(actions)'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
run: npm ci --legacy-peer-deps

- name: Run NPM Audit
run: npm audit --audit-level=high
run: npx audit-ci --config audit-ci.json

typescript-typecheck:
name: TypeScript Type Check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-detox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: E2E Detox Tests

on:
push:
branches: [ "main" ]
branches: ['main']

jobs:
test-ios:
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/fuzz-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,69 @@ name: Subscription Contract Fuzzing Tests

on:
push:
branches: [ main, develop ]
branches: [main, develop]
paths:
- 'contracts/subscription/**'
- '.github/workflows/fuzz-tests.yml'
- '.github/workflows/fuzz-test.yml'
pull_request:
branches: [ main, develop ]
branches: [main, develop]
paths:
- 'contracts/subscription/**'

jobs:
fuzz:
runs-on: ubuntu-latest
name: Run Fuzzing Tests

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal

- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-git-

- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-
- name: Run fuzzing tests

- name: Run contract fuzz smoke suite
run: |
cd contracts/subscription
cd contracts
cargo test --lib
cargo test --test fuzz_tests
cargo test --test pricing_fuzz_tests
cargo test --test rate_limit_fuzz_tests

for target in fuzz pricing_fuzz rate_limit_fuzz; do
if cargo test --test "$target" --no-run >/dev/null 2>&1; then
cargo test --test "$target"
else
echo "::warning::Cargo test target '$target' is not registered; running workspace tests instead."
fi
done
cargo test --verbose

- name: Print test results
if: always()
run: |
echo "Fuzzing tests completed!"
echo "Fuzzing tests completed!"
7 changes: 6 additions & 1 deletion .github/workflows/invariant-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ jobs:
env:
PROPTEST_CASES: ${{ env.PROPTEST_CASES }}
run: |
cargo test --test invariants -- --nocapture 2>&1 | tee invariant-test-results.txt
if cargo test --test invariants --no-run >/dev/null 2>&1; then
cargo test --test invariants -- --nocapture 2>&1 | tee invariant-test-results.txt
else
echo "::warning::Cargo test target 'invariants' is not registered; running the full contract suite instead." | tee invariant-test-results.txt
cargo test --verbose 2>&1 | tee -a invariant-test-results.txt
fi

# ── Run all contract tests to ensure nothing regressed ─────────────
- name: Run full contract test suite
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,3 @@ jobs:
run: |
npx expo login --token $EXPO_TOKEN
npx expo publish --release-channel production


8 changes: 2 additions & 6 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,5 @@ jobs:
- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Run NPM Audit
run: npm audit --audit-level=high

- name: Advanced Vulnerability Scan (audit-ci)
run: |
npx audit-ci --high --critical --package-manager npm
- name: Run NPM audit baseline
run: npx audit-ci --config audit-ci.json
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ cp .env.example .env

> **Note**: If `.env.example` doesn't exist, create a new `.env` file with the following variables:

| Variable | Description | Example Value |
| -------------------- | ----------------------------------------- | ----------------------------------------------------------------- |
| `STELLAR_NETWORK` | `testnet` or `public` Stellar network | `testnet` |
| `CONTRACT_ID` | Deployed SubTrackr proxy contract ID (stable) | `CB64...` (your deployed proxy contract address) |
| `WEB3AUTH_CLIENT_ID` | Web3Auth client ID for social login | Get one from [Web3Auth Dashboard](https://dashboard.web3auth.io/) |
| Variable | Description | Example Value |
| -------------------- | --------------------------------------------- | ----------------------------------------------------------------- |
| `STELLAR_NETWORK` | `testnet` or `public` Stellar network | `testnet` |
| `CONTRACT_ID` | Deployed SubTrackr proxy contract ID (stable) | `CB64...` (your deployed proxy contract address) |
| `WEB3AUTH_CLIENT_ID` | Web3Auth client ID for social login | Get one from [Web3Auth Dashboard](https://dashboard.web3auth.io/) |

### 4. Run the Mobile App

Expand Down Expand Up @@ -243,6 +243,7 @@ SubTrackr prioritizes the security of your subscriptions and on-chain transactio
- **Reporting**: Found a vulnerability? Please see our [Security Policy](docs/security.md) for reporting guidelines.

To run a manual security audit:

```bash
npm run security:audit
```
Expand Down
1 change: 1 addition & 0 deletions app/screens/AccountingExportScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '../../src/screens/AccountingExportScreen';
1 change: 1 addition & 0 deletions app/services/accountingExport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../../src/services/accountingExport';
45 changes: 16 additions & 29 deletions app/services/batchTransactionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
export interface BatchTransaction {
functionName: string;
params: any[];

Check warning on line 10 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected any. Specify a different type
dependsOn?: number;
required: boolean;
}
Expand All @@ -18,7 +18,7 @@
export interface OperationResult {
index: number;
success: boolean;
result?: any;

Check warning on line 21 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected any. Specify a different type
error?: string;
}

Expand Down Expand Up @@ -52,16 +52,10 @@
* Add transaction to batch queue
* @returns true if added, false if batch is full
*/
addTransaction(
functionName: string,
params: any[],
required: boolean = true
): boolean {
addTransaction(functionName: string, params: any[], required: boolean = true): boolean {

Check warning on line 55 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected any. Specify a different type
// Check if batch is full
if (this.pendingTransactions.length >= this.maxBatchSize) {
console.warn(
`Batch is full (${this.maxBatchSize}), cannot add more transactions`
);
console.warn(`Batch is full (${this.maxBatchSize}), cannot add more transactions`);
return false;
}

Expand All @@ -72,7 +66,7 @@
};

this.pendingTransactions.push(transaction);
console.log(

Check warning on line 69 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected console statement
`✅ Added ${functionName}. Pending: ${this.pendingTransactions.length}/${this.maxBatchSize}`
);

Expand All @@ -84,7 +78,7 @@
*/
addTransactionWithDependency(
functionName: string,
params: any[],

Check warning on line 81 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected any. Specify a different type
dependsOn: number,
required: boolean = true
): boolean {
Expand Down Expand Up @@ -135,18 +129,16 @@
* Useful for gas estimation and validation
*/
async simulateBatch(): Promise<BatchExecutionResult> {
console.log(`📊 Simulating batch with ${this.pendingTransactions.length} operations...`);

Check warning on line 132 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected console statement

const totalGas = this.getGasEstimate();
const batchId = this.generateBatchId();

const results: OperationResult[] = this.pendingTransactions.map(
(tx, index) => ({
index,
success: true,
result: null,
})
);
const results: OperationResult[] = this.pendingTransactions.map((tx, index) => ({
index,
success: true,
result: null,
}));

return {
batchId,
Expand All @@ -163,12 +155,12 @@
* Execute batch synchronously
*/
async executeBatch(atomic: boolean = true): Promise<BatchExecutionResult> {
console.log(

Check warning on line 158 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected console statement
`🚀 Executing batch with ${this.pendingTransactions.length} operations (atomic: ${atomic})...`
);

if (this.pendingTransactions.length === 0) {
throw new Error("❌ No transactions to execute");
throw new Error('❌ No transactions to execute');
}

const results: OperationResult[] = [];
Expand All @@ -186,7 +178,7 @@
results.push({
index: i,
success: false,
error: "Skipped due to atomic failure",
error: 'Skipped due to atomic failure',
});
failCount++;
continue;
Expand All @@ -199,7 +191,7 @@
results.push({
index: i,
success: false,
error: "Dependency failed",
error: 'Dependency failed',
});
failCount++;

Expand All @@ -212,7 +204,7 @@

// Execute transaction
try {
console.log(` 📝 Executing: ${tx.functionName}`);

Check warning on line 207 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected console statement

// Simulate execution
const result = await this.executeTransaction(tx);
Expand Down Expand Up @@ -256,10 +248,8 @@
// Clear batch after execution
this.pendingTransactions = [];

console.log(
`✅ Batch complete: ${successCount}/${batchResult.totalOperations} successful`
);
console.log(`✅ Batch complete: ${successCount}/${batchResult.totalOperations} successful`);

Check warning on line 251 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected console statement
console.log(` Gas used: ${totalGas.toLocaleString()} units`);

Check warning on line 252 in app/services/batchTransactionService.ts

View workflow job for this annotation

GitHub Actions / TypeScript Lint & Format

Unexpected console statement

return batchResult;
}
Expand All @@ -267,7 +257,7 @@
/**
* Execute single transaction (simulated)
*/
private async executeTransaction(tx: BatchTransaction): Promise<any> {
private async executeTransaction(_tx: BatchTransaction): Promise<any> {
// In real implementation, call actual contract function
// For now, simulate with delay
return new Promise((resolve) => {
Expand All @@ -282,17 +272,14 @@
*/
clearBatch(): void {
this.pendingTransactions = [];
console.log("🗑️ Batch cleared");
console.log('🗑️ Batch cleared');
}

/**
* Get gas estimate for pending batch
*/
getGasEstimate(): number {
return (
this.baseGasCost +
this.pendingTransactions.length * this.gasPerOperation
);
return this.baseGasCost + this.pendingTransactions.length * this.gasPerOperation;
}

/**
Expand Down Expand Up @@ -322,7 +309,7 @@
*/
setMaxBatchSize(size: number): void {
if (size > 100) {
console.warn("Max batch size should not exceed 100");
console.warn('Max batch size should not exceed 100');
return;
}
this.maxBatchSize = size;
Expand Down Expand Up @@ -363,4 +350,4 @@
}

// Export for use in React components
export default BatchTransactionService;
export default BatchTransactionService;
Loading
Loading