diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..1209f73 --- /dev/null +++ b/.env.example @@ -0,0 +1,26 @@ +# ============================================================= +# Decentralized Time-Lock Vault — Environment Variables +# ============================================================= +# +# Copy this file to `.env` and fill in your values. +# cp .env.example .env +# +# WARNING: Never commit the actual `.env` file to version control. +# It is already listed in `.gitignore`. +# ============================================================= + +# REQUIRED: Stellar testnet secret key used by the deploy script. +# Generate one with: soroban keys generate --network testnet deployer +SOROBAN_SECRET_KEY=S... + +# OPTIONAL: Override the default RPC URL for testnet deployment. +# Default: https://soroban-testnet.stellar.org +# SOROBAN_RPC_URL=https://soroban-testnet.stellar.org + +# OPTIONAL: Override the default network passphrase. +# Default: Test SDF Network ; September 2015 +# SOROBAN_NETWORK_PASSPHRASE=Test SDF Network ; September 2015 + +# OPTIONAL: WASM size threshold in bytes for the `check-wasm-size` Make target. +# Default: 65536 (64 KB) +# MAX_WASM_BYTES=65536 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0eca0a2..b09aed6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,6 +7,19 @@ updates: labels: - dependencies + - package-ecosystem: cargo + directory: / + schedule: + interval: weekly + labels: + - dependencies + - rust + groups: + soroban: + patterns: + - "soroban-sdk" + - "soroban-sdk-macros" + # Note: Dependabot does not support arbitrary binary downloads. # The stellar-cli version (STELLAR_CLI_VERSION in .github/workflows/ci.yml) # must be updated manually when a new release is published at: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf4aa12..58b5d17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,46 @@ jobs: - name: Run doc tests run: cargo test --doc --features testutils + # ---------------------------------------------------------------- + # Test (release mode — catches optimisation-related regressions) + # ---------------------------------------------------------------- + test-release: + name: Unit Tests (release) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Cache cargo registry + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Run tests (release) + run: cargo test --release --features testutils + + # ---------------------------------------------------------------- + # Shell syntax validation + # ---------------------------------------------------------------- + shellcheck: + name: Shell Syntax Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install shellcheck + run: sudo apt-get update && sudo apt-get install -y shellcheck + - name: Check deploy_testnet.sh + run: shellcheck scripts/deploy_testnet.sh + # ---------------------------------------------------------------- # Unsafe Code Scanner (cargo-geiger) # ---------------------------------------------------------------- @@ -161,7 +201,7 @@ jobs: build: name: Build WASM (${{ matrix.toolchain }}) runs-on: ubuntu-latest - needs: [lint, test, deny] + needs: [lint, test, test-release, deny] strategy: matrix: toolchain: [stable, '1.81'] # MSRV diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aebe2a..f5e70a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `initialize(admin, fee_recipient, max_deposit, max_lock_secs)` sets the admin and fee recipient addresses; optionally overrides compile-time limits for `MAX_DEPOSIT_AMOUNT` and `MAX_LOCK_DURATION_SECS`; can only be called once **Core** -- `deposit(depositor, token, amount, unlock_time, penalty_bps)` locks tokens until `unlock_time`; returns a per-depositor `deposit_id` -- `deposit_for(payer, depositor, token, amount, unlock_time, penalty_bps)` same as `deposit` but a third-party `payer` funds the vault on behalf of `depositor` +- `deposit(depositor, token, amount, unlock_time, penalty_bps)` locks tokens until `unlock_time` (Unix seconds derived from the ledger clock via `env.ledger().timestamp()`); returns a per-depositor `deposit_id` +- `deposit_for(payer, depositor, token, amount, unlock_time, penalty_bps)` same as `deposit` but a third-party `payer` funds the vault on behalf of `depositor`; the `payer` must sign the transaction and the depositor's address is stored as the beneficiary - `withdraw(depositor, deposit_id)` returns the full locked amount to the depositor once `unlock_time` has passed - `cancel_deposit(depositor, deposit_id)` early exit before unlock; applies `penalty_bps` penalty sent to `fee_recipient`, remainder returned to depositor @@ -42,6 +42,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `get_depositors(offset, limit) -> Vec
` paginated list of active depositor addresses - `is_initialized() -> bool` whether `initialize` has been called +#### Ledger-Based Deposit Timing + +Unlock times are validated and enforced using the **Soroban ledger clock** (`env.ledger().timestamp()`), not wall-clock time. Key implications: + +- `unlock_time` must be supplied as a Unix timestamp (seconds since the Unix epoch). +- The contract reads `env.ledger().timestamp()` once per invocation and caches the value locally to avoid repeated host-function calls. +- A deposit is accepted only when `unlock_time > now` (strictly future). +- A `withdraw` succeeds only when `env.ledger().timestamp() >= unlock_time`. +- Ledger close times on Stellar advance roughly every 5–6 seconds. For short lock durations, callers should account for this granularity when choosing `unlock_time`. + +Example — depositing with a 1-hour lock: +``` +let now: u64 = env.ledger().timestamp(); // e.g. 1_700_000_000 +let one_hour = 3_600_u64; +contract.deposit(&depositor, &token, &amount, &(now + one_hour), &0_u32); +``` + +The `deposit_for` function follows the same ledger-time semantics: +``` +// payer funds the vault; depositor is the beneficiary +contract.deposit_for(&payer, &depositor, &token, &amount, &(now + one_hour), &0_u32); +``` + #### Protocol Constants - `MAX_DEPOSIT_AMOUNT` `1_000_000_000_000_000` (10^15 token base units) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b3a5e0..6f1d72a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,3 +84,63 @@ This convention applies to any repeated host accessor (`env.ledger().sequence()` ## Test Snapshots Running `cargo test` may generate a `contracts/time-lock-vault/test_snapshots/` directory containing XDR snapshots of contract state produced by the Soroban test environment. These are transient build artefacts, not committed regression fixtures, and are listed in `.gitignore`. Do not commit them. + +## Soroban-Specific Guidance + +### How the Test Environment Works + +Soroban unit tests use the `soroban-sdk` testutils feature to spin up an in-process simulated ledger. There is **no external node or network** required. The simulated environment provides a `MockHost` that emulates ledger storage, events, and auth. + +Key points: +- Tests must run natively (without `--target wasm32-unknown-unknown`) so that testutils can compile. +- The `testutils` feature is in `[dev-dependencies]` only and is never compiled into the production WASM. +- Never run `cargo test --target wasm32-unknown-unknown` — it will fail because testutils are not available in the WASM target. + +### Running Tests + +```bash +# Run the full test suite +cargo test --features testutils + +# Run a single test with stdout +cargo test test_deposit_success --features testutils -- --nocapture + +# Run tests in release mode (catches optimisation-related edge cases) +cargo test --release --features testutils + +# Run all tests with output +cargo test --features testutils -- --nocapture +``` + +### Writing New Tests + +All tests live in `contracts/time-lock-vault/src/test.rs`. Follow these conventions: + +1. Use `soroban_sdk::testutils::Ledger` to set the ledger timestamp before calling time-sensitive functions: + +```rust +env.ledger().with_mut(|l| { + l.timestamp = 1_700_000_000; +}); +``` + +2. Advance ledger time to simulate the passage of time: + +```rust +env.ledger().with_mut(|l| { + l.timestamp += 3_600; // advance 1 hour +}); +``` + +3. Assert on typed errors, not on panic messages: + +```rust +let err = contract.withdraw(&depositor, &0).unwrap_err(); +assert_eq!(err, VaultError::FundsStillLocked.into()); +``` + +4. Every new contract function or behaviour change must be accompanied by at least one positive-path and one negative-path test. + +### Soroban SDK Version + +The workspace is pinned to `soroban-sdk = "22"` in `Cargo.toml`. Do not change the SDK version in a feature PR — version bumps require a dedicated chore PR with a full audit of breaking-change behaviour. diff --git a/ISSUES.md b/ISSUES.md new file mode 100644 index 0000000..24eb110 --- /dev/null +++ b/ISSUES.md @@ -0,0 +1,224 @@ +# ISSUES.md — Decentralized Time-Lock Vault +## Wave Program — Batch 1 (125 Issues) + +> Stack: Rust · Soroban SDK v22 · Stellar Blockchain · Persistent Storage +> All issues are implementation-focused, non-duplicate, and grounded in the actual codebase. + +--- + +## 🔴 BUGS (Issues #1–#22) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 1 | `deposit_by_ledger` bypasses the paused contract guard | Critical | Advanced | `bug` `security` `pause` | +| 2 | `deposit_by_ledger` does not enforce minimum lock duration | High | Advanced | `bug` `validation` `contract` | +| 3 | `deposit_by_ledger` does not enforce maximum lock duration | High | Advanced | `bug` `validation` `contract` | +| 4 | `withdraw_to` only works for time-based deposits, ignoring ledger deposits | High | Advanced | `bug` `contract` `storage` | +| 5 | `emergency_withdraw` only works for time-based deposits, ignoring ledger deposits | High | Advanced | `bug` `admin` `recovery` | +| 6 | `get_vault` does not expose ledger-based deposits | High | Advanced | `bug` `api` `storage` | +| 7 | `time_remaining` ignores ledger-based deposits and returns 0 | High | Advanced | `bug` `api` `ux` | +| 8 | `get_deposit_ids` skips ledger-based deposit IDs | Medium | Intermediate | `bug` `api` `storage` | +| 9 | `get_vault_batch` reads only time-based deposits, not ledger-based deposits | Medium | Intermediate | `bug` `api` `storage` | +| 10 | `cancel_deposit` cannot cancel ledger-based deposits | Medium | Intermediate | `bug` `contract` `storage` | +| 11 | `remove_depositor` can clear an address while ledger deposits remain active | Medium | Intermediate | `bug` `storage` `consistency` | +| 12 | README documents non-existent `batch_emergency_withdraw` API | Medium | Beginner | `bug` `documentation` `contract` | +| 13 | README omits `deposit_by_ledger`, `withdraw_to`, and ledger deposit semantics | Medium | Beginner | `bug` `documentation` `api` | +| 14 | `deposit_by_ledger` uses a different validation path than `deposit`/`deposit_for` | Low | Intermediate | `bug` `refactor` `contract` | +| 15 | `initialize` treats zero `max_lock_secs` as `LockDurationTooLong` instead of explicit invalid config | Low | Beginner | `bug` `validation` `contract` | +| 16 | `deposit_by_ledger` does not validate `unlock_ledger` against network sequence drift | Low | Intermediate | `bug` `validation` `future-proofing` | +| 17 | `get_depositors` pagination accepts an unbounded `limit`, leading to high memory use | Low | Intermediate | `bug` `api` `scalability` | +| 18 | `VaultEntry.depositor` duplicates the address available in the storage key | Low | Beginner | `bug` `storage` `types` | +| 19 | `LedgerVaultEntry.depositor` duplicates the address available in the storage key | Low | Beginner | `bug` `storage` `types` | +| 20 | `README` has no explicit example for `pause`/`unpause` behavior | Low | Beginner | `bug` `documentation` `admin` | +| 21 | Ledger-based deposits are not documented as part of `get_vault` and `time_remaining` | Low | Beginner | `bug` `documentation` `api` | +| 22 | `advance_time` test helper reconstructs ledger state instead of incrementing sequence consistently | Low | Intermediate | `bug` `testing` `helpers` | + +--- + +## 🟠 SECURITY (Issues #23–#38) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 23 | No explicit token contract validation allows malicious token contracts | Critical | Advanced | `security` `token` `validation` | +| 24 | `deposit_by_ledger` bypasses pause, weakening emergency shutdown controls | High | Advanced | `security` `admin` `pause` | +| 25 | `emergency_withdraw` does not support ledger deposits, leaving some funds unrecoverable in recovery flow | High | Advanced | `security` `admin` `recovery` | +| 26 | `time_remaining` returns 0 for ledger deposits, creating a misleading unlocked signal | High | Intermediate | `security` `api` `ux` | +| 27 | `get_vault` and `get_vault_batch` hide ledger deposit state from external indexers | Medium | Intermediate | `security` `transparency` `api` | +| 28 | `cancel_deposit` inability to cancel ledger deposits weakens depositor control | Medium | Intermediate | `security` `contract` `ux` | +| 29 | Admin storage reads do not bump TTL; admin privilege can expire unintentionally | Medium | Intermediate | `security` `storage` `admin` | +| 30 | Ledger deposit sequence semantics are not documented, raising future validation risk | Medium | Intermediate | `security` `documentation` `contract` | +| 31 | No freeze mechanism for an address in case of compromised depositor or token abuse | Medium | Advanced | `security` `admin` `contract` | +| 32 | No wallet recovery or migration path for ledger and timestamp deposits simultaneously | Medium | Advanced | `security` `upgrades` `admin` | +| 33 | Fee fallback to depositor in `cancel_deposit` is not clearly documented | Low | Intermediate | `security` `contract` `ux` | +| 34 | `withdraw_to` allows any recipient address without additional validation | Low | Intermediate | `security` `ux` `contract` | +| 35 | `deposit_by_ledger` provides a sequence-based lock without cross-checking timestamp conversions | Low | Intermediate | `security` `contract` `future-proofing` | +| 36 | No on-chain key versioning in persistent storage for future contract upgrades | Medium | Advanced | `security` `storage` `upgrades` | +| 37 | No event emitted when `cancel_transfer_admin` is invoked with no pending admin present | Low | Beginner | `security` `events` `admin` | +| 38 | `lock_duration` validation is duplicated in multiple deposit paths, increasing audit surface | Low | Beginner | `security` `audit` `refactor` | + +--- + +## 🟡 PERFORMANCE (Issues #39–#50) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 39 | `storage::add_depositor` scans the entire depositor list on every deposit | Medium | Intermediate | `performance` `storage` `cost` | +| 40 | `storage::remove_depositor` rebuilds the depositor list each removal | Medium | Intermediate | `performance` `storage` `cost` | +| 41 | `get_deposit_ids` iterates all deposit IDs up to the counter for every call | Medium | Intermediate | `performance` `storage` `scalability` | +| 42 | `get_depositors_page` has no defensive cap on `limit` | Medium | Intermediate | `performance` `api` `memory` | +| 43 | Event topics include full `Address` values, increasing payload size | Low | Intermediate | `performance` `events` `cost` | +| 44 | `VaultEntry` stores depositor twice, increasing persistent storage footprint | Low | Beginner | `performance` `storage` `types` | +| 45 | `LedgerVaultEntry` stores depositor twice, increasing persistent storage footprint | Low | Beginner | `performance` `storage` `types` | +| 46 | `token::Client::new()` is recreated in each function instead of using a helper | Low | Beginner | `performance` `contract` `refactor` | +| 47 | Shared deposit validation code is duplicated across paths | Low | Beginner | `performance` `contract` `refactor` | +| 48 | `time_remaining` loads full entry data when only timestamp comparison is required | Low | Intermediate | `performance` `storage` `contract` | +| 49 | `setup()` test helper re-registers the contract for every test | Low | Intermediate | `performance` `testing` `dx` | +| 50 | `advance_time` test helper reconstructs a full ledger snapshot on every call | Low | Beginner | `performance` `testing` `dx` | + +--- + +## 🔵 DOCUMENTATION (Issues #51–#68) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 51 | README lacks concrete Soroban CLI invocation examples for deposit and withdraw | High | Beginner | `documentation` `dx` `readme` | +| 52 | CHANGELOG does not clearly document the addition of ledger-based deposits | Medium | Beginner | `documentation` `audit` | +| 53 | CONTRIBUTING lacks Soroban-specific contribution and testing guidance | Medium | Beginner | `documentation` `contributing` | +| 54 | SECURITY.md has no responsible disclosure process or severity guidelines | High | Beginner | `documentation` `security` | +| 55 | `BUMP_THRESHOLD` and `BUMP_TARGET` constants are undocumented in `storage.rs` | Medium | Beginner | `documentation` `constants` | +| 56 | `MAX_DEPOSIT_AMOUNT` comment should clarify units and short/long-scale terminology | Low | Beginner | `documentation` `types` | +| 57 | `VaultEntry` and `LedgerVaultEntry` fields lack unit documentation | High | Beginner | `documentation` `types` `api` | +| 58 | `events.rs` lacks a module-level explanation of event topic conventions | Low | Beginner | `documentation` `events` | +| 59 | `storage.rs` does not document the complete persistent key layout | Medium | Beginner | `documentation` `storage` | +| 60 | `contract.rs` does not explain the security model for `emergency_withdraw` | Medium | Beginner | `documentation` `admin` `contract` | +| 61 | README does not explain the difference between time-based and ledger-based deposits | High | Beginner | `documentation` `readme` | +| 62 | README does not document pause semantics for all deposit paths | Medium | Beginner | `documentation` `admin` `readme` | +| 63 | `scripts/deploy_testnet.sh` lacks inline usage examples and default environment assumptions | Medium | Beginner | `documentation` `scripts` | +| 64 | README has no local Soroban standalone node integration testing instructions | High | Beginner | `documentation` `testing` | +| 65 | plan.md does not define sprint cadence, review process, or branch policies | Low | Beginner | `documentation` `process` | +| 66 | README does not document when `is_initialized` must be checked before invocation | Medium | Beginner | `documentation` `contract` | +| 67 | README does not clarify `get_vault` vs `get_vault_batch` differences | Low | Beginner | `documentation` `api` | +| 68 | lib.rs comment on the storage model is outdated compared to current key definitions | Medium | Beginner | `documentation` `lib` | + +--- + +## 🟢 TESTING (Issues #69–#88) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 69 | No test verifying `deposit_by_ledger` rejects deposits while paused | High | Intermediate | `testing` `pause` | +| 70 | No test verifying `deposit_by_ledger` rejects too-short ledger lock durations | High | Intermediate | `testing` `validation` | +| 71 | No test verifying `deposit_by_ledger` rejects too-long ledger lock durations | High | Intermediate | `testing` `validation` | +| 72 | No test for `withdraw_to` with ledger-based deposits | High | Intermediate | `testing` `contract` | +| 73 | No test for `emergency_withdraw` when a ledger-based deposit exists | High | Intermediate | `testing` `admin` | +| 74 | No test for `get_vault` ledger-deposit visibility | Medium | Intermediate | `testing` `api` | +| 75 | No test for `time_remaining` with ledger-based deposits | Medium | Intermediate | `testing` `api` | +| 76 | No test for `get_deposit_ids` including ledger-based deposit IDs | Medium | Intermediate | `testing` `storage` | +| 77 | No test for `get_vault_batch` covering ledger deposit paths | Medium | Intermediate | `testing` `api` | +| 78 | No test for `remove_depositor` with mixed deposit types | Medium | Intermediate | `testing` `storage` | +| 79 | No test for `deposit_by_ledger` transfer failure rollback | Medium | Advanced | `testing` `error-path` | +| 80 | No test for `pause`/`unpause` semantics across both deposit methods | Medium | Intermediate | `testing` `admin` | +| 81 | No test for `cancel_deposit` behavior on ledger deposits | Low | Intermediate | `testing` `contract` | +| 82 | No test verifying `get_constants` with custom initialization values | Low | Beginner | `testing` `constants` | +| 83 | No test verifying `deposit_for` and `deposit` share the same amount constraints | Low | Beginner | `testing` `consistency` | +| 84 | No test verifying `withdraw_to` event payload values | Low | Intermediate | `testing` `events` | +| 85 | No test for `get_depositor_count` after mixed deposit removals | Low | Beginner | `testing` `storage` | +| 86 | No integration test validating README example flows | Medium | Advanced | `testing` `integration` | +| 87 | No fuzz or boundary tests for minimum and maximum deposit amounts across paths | Medium | Advanced | `testing` `fuzzing` | +| 88 | No stress test for `get_depositors` pagination size and edge behavior | Low | Advanced | `testing` `performance` | + +--- + +## ⚪ REFACTORING (Issues #89–#100) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 89 | Extract shared deposit validation logic into a single helper | Medium | Intermediate | `refactor` `contract` | +| 90 | Factor ledger and timestamp deposit storage into separate helper modules | Medium | Intermediate | `refactor` `storage` | +| 91 | Introduce reusable `require_admin` helper to simplify admin checks | Low | Beginner | `refactor` `dx` | +| 92 | Introduce a shared pause guard helper for deposit entry points | Low | Beginner | `refactor` `admin` | +| 93 | Extract token transfer operations into a reusable helper | Low | Beginner | `refactor` `contract` | +| 94 | Remove duplicate depositor storage in `VaultEntry` and `LedgerVaultEntry` if possible | Low | Beginner | `refactor` `storage` | +| 95 | Replace `test.rs` 5-tuple setup with a `TestContext` struct | Low | Beginner | `refactor` `testing` | +| 96 | Extract constants like `TEST_MINT_AMOUNT` from repeated test literals | Low | Beginner | `refactor` `testing` | +| 97 | Simplify repeated admin authorization pattern in contract.rs | Medium | Intermediate | `refactor` `contract` | +| 98 | Consolidate `types.rs` and `errors.rs` into a smaller model module for cohesion | Low | Beginner | `refactor` `structure` | +| 99 | Simplify crate exports in `lib.rs` for a cleaner public interface | Low | Beginner | `refactor` `lib` | +| 100 | Update `Makefile` check target to include build verification for parity with CI | Medium | Beginner | `refactor` `devops` | + +--- + +## 🔧 FEATURES / SCALABILITY (Issues #101–#112) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 101 | Add `top_up(depositor, amount)` to increase a lock without changing unlock time | High | Intermediate | `feature` `contract` | +| 102 | Add `extend_lock(depositor, new_unlock_time)` to lengthen existing locks | High | Intermediate | `feature` `contract` | +| 103 | Add `batch_emergency_withdraw` to match README and support recovery migration | High | Advanced | `feature` `admin` `security` | +| 104 | Add `batch_withdraw` to withdraw multiple deposits in one call | Medium | Advanced | `feature` `contract` `scalability` | +| 105 | Add `deposit_on_behalf` for third-party deposit flow | Medium | Advanced | `feature` `contract` `ux` | +| 106 | Add admin-configurable token whitelist for accepted token contracts | Medium | Advanced | `feature` `admin` `security` | +| 107 | Add `get_all_vaults` or paginated aggregate query for off-chain indexing | Medium | Advanced | `feature` `api` `scalability` | +| 108 | Add `get_total_locked(token)` aggregate query for TVL and analytics | Medium | Intermediate | `feature` `api` `analytics` | +| 109 | Add runtime update support for `fee_recipient` without redeploying | Medium | Advanced | `feature` `admin` `economics` | +| 110 | Add admin-managed emergency freeze for specific depositors or tokens | Medium | Advanced | `feature` `admin` `security` | +| 111 | Add configurable deposit penalty caps or fee rules for `cancel_deposit` | Low | Advanced | `feature` `contract` `economics` | +| 112 | Add a `vault_status` query summarizing contract pause/admin state | Low | Intermediate | `feature` `api` `ux` | + +--- + +## 🚀 CI/CD & DEVOPS (Issues #113–#121) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 113 | Add `cargo audit` to CI to catch dependency vulnerabilities | High | Intermediate | `devops` `ci` `security` | +| 114 | Add a GitHub Release workflow that builds optimized WASM assets | High | Intermediate | `devops` `ci` `release` | +| 115 | Add `cargo test --release --features testutils` to CI for optimized build coverage | Medium | Intermediate | `devops` `ci` `testing` | +| 116 | Add shell syntax and usage validation for `scripts/deploy_testnet.sh` | Medium | Intermediate | `devops` `ci` `scripts` | +| 117 | Add a `Makefile` target for toolchain and `soroban-cli` bootstrap | Medium | Beginner | `devops` `dx` `makefile` | +| 118 | Add `.env.example` documenting required environment variables for deployment | Medium | Beginner | `devops` `dx` `documentation` | +| 119 | Add CI guard for README examples and local integration instructions | Medium | Intermediate | `devops` `documentation` | +| 120 | Add WASM size regression checks across PRs | Medium | Intermediate | `devops` `ci` `performance` | +| 121 | Add Dependabot or Renovate config for `soroban-sdk` and Rust dependency updates | Medium | Beginner | `devops` `dependencies` | + +--- + +## 🎨 DEVELOPER EXPERIENCE (Issues #122–#125) + +| # | Title | Priority | Difficulty | Tags | +|---|---|---|---|---| +| 122 | Add a developer quickstart section for contract iteration and local testing | Medium | Beginner | `dx` `testing` | +| 123 | Extend issue templates with a Soroban security-contract bug checklist | Medium | Beginner | `dx` `github` `security` | +| 124 | Extend PR template with contract-specific testing and audit checklist | Medium | Beginner | `dx` `github` `contributing` | +| 125 | Add a contributor-facing troubleshooting section for Soroban CLI and WASM build issues | Low | Beginner | `dx` `documentation` | + +--- + +## Summary Statistics + +| Category | Count | Critical | High | Medium | Low | +|---|---|---|---|---|---| +| Bugs | 22 | 1 | 5 | 12 | 4 | +| Security | 16 | 1 | 5 | 9 | 1 | +| Performance | 12 | 0 | 0 | 7 | 5 | +| Documentation | 18 | 0 | 4 | 10 | 4 | +| Testing | 20 | 0 | 5 | 11 | 4 | +| Refactoring | 12 | 0 | 0 | 5 | 7 | +| Features | 12 | 0 | 2 | 8 | 2 | +| CI/CD | 9 | 0 | 3 | 6 | 0 | +| Developer Experience | 4 | 0 | 0 | 4 | 0 | +| **Total** | **125** | **2** | **24** | **67** | **32** | + +--- + +## Recommended Sprint Order + +1. Critical contract and security bugs: #1, #4, #5, #6, #23, #24, #25, #113, #114 +2. Ledger deposit consistency and API coverage: #2–#11, #69–#79 +3. Documentation and testing: #51–#65, #69–#88 +4. Refactor and performance cleanup: #39–#50, #89–#100 +5. CI/CD and developer experience: #115–#121, #122–#125 + +--- + +*Generated for Wave Program · Decentralized Time-Lock Vault · Soroban / Stellar* diff --git a/ISSUES_FORMATTED.md b/ISSUES_FORMATTED.md new file mode 100644 index 0000000..93007ab --- /dev/null +++ b/ISSUES_FORMATTED.md @@ -0,0 +1,2512 @@ +--- +`Ledger deposit path` bypasses the paused contract guard +- Priority: Critical +- Difficulty: Advanced +- Labels: "bug", "security", "pause" + +Description + +The current implementation of ``deposit_by_ledger` bypasses the paused contract guard` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`Ledger deposit path` does not enforce minimum lock duration +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "validation", "contract" + +Description + +The current implementation of ``deposit_by_ledger` does not enforce minimum lock duration` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`Ledger deposit path` does not enforce maximum lock duration +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "validation", "contract" + +Description + +The current implementation of ``deposit_by_ledger` does not enforce maximum lock duration` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`Withdraw-to path` only works for time-based deposits, ignoring ledger deposits +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "contract", "storage" + +Description + +The current implementation of ``withdraw_to` only works for time-based deposits, ignoring ledger deposits` introduces a contract behavior gap that must be corrected. The withdrawal implementation does not correctly handle deposits created by ledger-based locks. This inconsistency leaves valid ledger deposits unreachable through the public withdraw API. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +Withdraw actions should support ledger-based deposits and return the correct outcome for both timestamp and ledger locks. + +Tasks + +- [ ] Review `withdraw_to` logic and verify ledger deposit compatibility. +- [ ] Add ledger deposit handling if missing. +- [ ] Add tests that exercise withdrawal of ledger-based deposits. + +--- +`Emergency withdrawal path` only works for time-based deposits, ignoring ledger deposits +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "admin", "recovery" + +Description + +The current implementation of ``emergency_withdraw` only works for time-based deposits, ignoring ledger deposits` introduces a contract behavior gap that must be corrected. The emergency recovery path only supports timestamp-based deposits and ignores ledger-based vault entries. That exposes a recovery gap where some deposits cannot be recovered by admin functions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Emergency recovery should cover both timestamp and ledger-based deposits so admin recovery is complete. + +Tasks + +- [ ] Review emergency withdrawal paths for ledger and timestamp deposits. +- [ ] Extend `emergency_withdraw` to support ledger-based deposit entries. +- [ ] Add tests that exercise emergency recovery for ledger deposits. + +--- +`Vault query` does not expose ledger-based deposits +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "api", "storage" + +Description + +The current implementation of ``get_vault` does not expose ledger-based deposits` introduces a contract behavior gap that must be corrected. The vault query API currently omits ledger-based deposits from its results. External clients cannot reliably inspect all active vaults, undermining transparency and off-chain indexing. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +The vault query should return all active deposits regardless of whether they were created by timestamp or ledger lock semantics. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +`Time remaining query` ignores ledger-based deposits and returns 0 +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "api", "ux" + +Description + +The current implementation of ``time_remaining` ignores ledger-based deposits and returns 0` introduces a contract behavior gap that must be corrected. The time remaining calculation ignores ledger-based deposits and returns misleading values. This can cause callers to believe a deposit is unlocked when it is still locked by ledger sequence. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +The time remaining query should compute the correct remaining lock interval for ledger-based deposits and not return misleading zero values. + +Tasks + +- [ ] Audit time remaining calculation for ledger deposit entries. +- [ ] Fix the logic so ledger-based deposits produce correct remaining lock values. +- [ ] Add regression tests for ledger-derived remaining times. + +--- +`Deposit ID enumeration` skips ledger-based deposit IDs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "api", "storage" + +Description + +The current implementation of ``get_deposit_ids` skips ledger-based deposit IDs` introduces a contract behavior gap that must be corrected. The deposit identifier query does not include ledger-based entries, so clients cannot enumerate every deposit. This breaks deposit discovery and any off-chain feature that relies on a complete deposit list. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Deposit ID enumeration should list every deposit, including ledger-based entries, so external indexers can discover all active vaults. + +Tasks + +- [ ] Audit deposit ID enumeration for ledger deposit entries. +- [ ] Update `get_deposit_ids` to include all active deposits. +- [ ] Add tests for ledger deposit ID visibility. + +--- +`Vault batch query` reads only time-based deposits, not ledger-based deposits +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "api", "storage" + +Description + +The current implementation of ``get_vault_batch` reads only time-based deposits, not ledger-based deposits` introduces a contract behavior gap that must be corrected. The batch vault query currently omits ledger-based deposits, preventing complete client-side vault enumeration. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Batch vault queries should include ledger deposits and return complete vault state for clients. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +`Deposit cancellation` cannot cancel ledger-based deposits +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "contract", "storage" + +Description + +The current implementation of ``cancel_deposit` cannot cancel ledger-based deposits` introduces a contract behavior gap that must be corrected. The cancel flow does not support ledger-based deposits, creating an inconsistent user experience. Depositors may not be able to cancel deposits they expect to manage, exposing functional gaps in the contract logic. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Cancel deposit should support the same deposit types and allow users to cancel valid ledger-based deposits where appropriate. + +Tasks + +- [ ] Review cancel flow for ledger deposit support. +- [ ] Extend cancel logic to handle ledger-based deposits consistently. +- [ ] Add tests covering cancellation of ledger deposits. + +--- +`Depositor removal` can clear an address while ledger deposits remain active +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "storage", "consistency" + +Description + +The current implementation of ``remove_depositor` can clear an address while ledger deposits remain active` introduces a contract behavior gap that must be corrected. The depositor removal path can remove an address while ledger deposits remain active. This risks leaving orphaned deposit state and breaking retrieval APIs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`. + +Expected Behavior + +Removing a depositor should not break active ledger deposits or leave orphaned state in storage. + +Tasks + +- [ ] Review depositor removal logic and ledger deposit interactions. +- [ ] Prevent removal of a depositor with active ledger deposits or clear related state safely. +- [ ] Add tests for depositor removal under mixed deposit conditions. + +--- +README documents non-existent `batch_Emergency withdrawal path` API +- Priority: Medium +- Difficulty: Beginner +- Labels: "bug", "documentation", "contract" + +Description + +The current implementation of `README documents non-existent `batch_emergency_withdraw` API` introduces a contract behavior gap that must be corrected. The emergency recovery path only supports timestamp-based deposits and ignores ledger-based vault entries. That exposes a recovery gap where some deposits cannot be recovered by admin functions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Emergency recovery should cover both timestamp and ledger-based deposits so admin recovery is complete. + +Tasks + +- [ ] Review emergency withdrawal paths for ledger and timestamp deposits. +- [ ] Extend `emergency_withdraw` to support ledger-based deposit entries. +- [ ] Add tests that exercise emergency recovery for ledger deposits. + +--- +README omits `Ledger deposit path`, `withdraw_to`, and ledger deposit semantics +- Priority: Medium +- Difficulty: Beginner +- Labels: "bug", "documentation", "api" + +Description + +The current implementation of `README omits `deposit_by_ledger`, `withdraw_to`, and ledger deposit semantics` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`Ledger deposit path` uses a different validation path than `deposit`/`deposit_for` +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "refactor", "contract" + +Description + +The current implementation of ``deposit_by_ledger` uses a different validation path than `deposit`/`deposit_for`` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`initialize` treats zero `max_lock_secs` as `LockDurationTooLong` instead of explicit invalid config +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "validation", "contract" + +Description + +The current implementation of ``initialize` treats zero `max_lock_secs` as `LockDurationTooLong` instead of explicit invalid config` introduces a contract behavior gap that must be corrected. The initialization validation path does not distinguish invalid config from lock duration failures clearly. This makes configuration errors harder to debug and may allow invalid runtime settings. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +Initialization should validate config inputs explicitly and fail with appropriate errors for invalid `max_lock_secs` values. + +Tasks + +- [ ] Review `initialize` validation paths in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Improve error handling for invalid configuration inputs. +- [ ] Add tests for invalid `max_lock_secs` values during initialization. + +--- +`Ledger deposit path` does not validate `unlock_ledger` against network sequence drift +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "validation", "future-proofing" + +Description + +The current implementation of ``deposit_by_ledger` does not validate `unlock_ledger` against network sequence drift` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`get_depositors` pagination accepts an unbounded `limit`, leading to high memory use +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "api", "scalability" + +Description + +The current implementation of ``get_depositors` pagination accepts an unbounded `limit`, leading to high memory use` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +`VaultEntry.depositor` duplicates the address available in the storage key +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "storage", "types" + +Description + +The current implementation of ``VaultEntry.depositor` duplicates the address available in the storage key` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`LedgerVaultEntry.depositor` duplicates the address available in the storage key +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "storage", "types" + +Description + +The current implementation of ``LedgerVaultEntry.depositor` duplicates the address available in the storage key` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`README` has no explicit example for `pause`/`unpause` behavior +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "documentation", "admin" + +Description + +The current implementation of ``README` has no explicit example for `pause`/`unpause` behavior` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +Ledger-based deposits are not documented as part of `Vault query` and `time_remaining` +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "documentation", "api" + +Description + +The current implementation of `Ledger-based deposits are not documented as part of `get_vault` and `time_remaining`` introduces a contract behavior gap that must be corrected. The vault query API currently omits ledger-based deposits from its results. External clients cannot reliably inspect all active vaults, undermining transparency and off-chain indexing. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +The vault query should return all active deposits regardless of whether they were created by timestamp or ledger lock semantics. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +`advance_time` test helper reconstructs ledger state instead of incrementing sequence consistently +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "testing", "helpers" + +Description + +The current implementation of ``advance_time` test helper reconstructs ledger state instead of incrementing sequence consistently` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +No explicit token contract validation allows malicious token contracts +- Priority: Critical +- Difficulty: Advanced +- Labels: "security", "token", "validation" + +Description + +The current implementation of `No explicit token contract validation allows malicious token contracts` introduces a contract behavior gap that must be corrected. The contract accepts token addresses without explicit validation before transfers. This can allow malicious or malformed token contracts to be used, compromising safety and accounting. Affected files: `contracts/time-lock-vault/src/contract.rs` and `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Token contract addresses should be validated before use to prevent malicious or malformed token contracts. + +Tasks + +- [ ] Add token contract validation before performing token transfers. +- [ ] Document the validation expectations. +- [ ] Add tests for invalid token contract addresses. + +--- +`Ledger deposit path` bypasses pause, weakening emergency shutdown controls +- Priority: High +- Difficulty: Advanced +- Labels: "security", "admin", "pause" + +Description + +The current implementation of ``deposit_by_ledger` bypasses pause, weakening emergency shutdown controls` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +`Emergency withdrawal path` does not support ledger deposits, leaving some funds unrecoverable in recovery flow +- Priority: High +- Difficulty: Advanced +- Labels: "security", "admin", "recovery" + +Description + +The current implementation of ``emergency_withdraw` does not support ledger deposits, leaving some funds unrecoverable in recovery flow` introduces a contract behavior gap that must be corrected. The emergency recovery path only supports timestamp-based deposits and ignores ledger-based vault entries. That exposes a recovery gap where some deposits cannot be recovered by admin functions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Emergency recovery should cover both timestamp and ledger-based deposits so admin recovery is complete. + +Tasks + +- [ ] Review emergency withdrawal paths for ledger and timestamp deposits. +- [ ] Extend `emergency_withdraw` to support ledger-based deposit entries. +- [ ] Add tests that exercise emergency recovery for ledger deposits. + +--- +`Time remaining query` returns 0 for ledger deposits, creating a misleading unlocked signal +- Priority: High +- Difficulty: Intermediate +- Labels: "security", "api", "ux" + +Description + +The current implementation of ``time_remaining` returns 0 for ledger deposits, creating a misleading unlocked signal` introduces a contract behavior gap that must be corrected. The time remaining calculation ignores ledger-based deposits and returns misleading values. This can cause callers to believe a deposit is unlocked when it is still locked by ledger sequence. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +The time remaining query should compute the correct remaining lock interval for ledger-based deposits and not return misleading zero values. + +Tasks + +- [ ] Audit time remaining calculation for ledger deposit entries. +- [ ] Fix the logic so ledger-based deposits produce correct remaining lock values. +- [ ] Add regression tests for ledger-derived remaining times. + +--- +`get_vault` and `Vault batch query` hide ledger deposit state from external indexers +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "transparency", "api" + +Description + +The current implementation of ``get_vault` and `get_vault_batch` hide ledger deposit state from external indexers` introduces a contract behavior gap that must be corrected. The batch vault query currently omits ledger-based deposits, preventing complete client-side vault enumeration. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Batch vault queries should include ledger deposits and return complete vault state for clients. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +`Deposit cancellation` inability to cancel ledger deposits weakens depositor control +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "contract", "ux" + +Description + +The current implementation of ``cancel_deposit` inability to cancel ledger deposits weakens depositor control` introduces a contract behavior gap that must be corrected. The cancel flow does not support ledger-based deposits, creating an inconsistent user experience. Depositors may not be able to cancel deposits they expect to manage, exposing functional gaps in the contract logic. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Cancel deposit should support the same deposit types and allow users to cancel valid ledger-based deposits where appropriate. + +Tasks + +- [ ] Review cancel flow for ledger deposit support. +- [ ] Extend cancel logic to handle ledger-based deposits consistently. +- [ ] Add tests covering cancellation of ledger deposits. + +--- +Admin storage reads do not bump TTL; admin privilege can expire unintentionally +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "storage", "admin" + +Description + +The current implementation of `Admin storage reads do not bump TTL; admin privilege can expire unintentionally` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Ledger deposit sequence semantics are not documented, raising future validation risk +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "documentation", "contract" + +Description + +The current implementation of `Ledger deposit sequence semantics are not documented, raising future validation risk` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +No freeze mechanism for an address in case of compromised depositor or token abuse +- Priority: Medium +- Difficulty: Advanced +- Labels: "security", "admin", "contract" + +Description + +The current implementation of `No freeze mechanism for an address in case of compromised depositor or token abuse` introduces a contract behavior gap that must be corrected. The contract lacks a depositor freeze capability for compromised or abusive accounts. This reduces admin control and increases risk during fraud or abuse incidents. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +The contract should provide an administrative freeze mechanism for compromised depositor accounts. + +Tasks + +- [ ] Design depositor freeze behavior and admin controls. +- [ ] Implement freeze state tracking in storage helpers. +- [ ] Add tests for freeze and unfreeze scenarios. + +--- +No wallet recovery or migration path for ledger and timestamp deposits simultaneously +- Priority: Medium +- Difficulty: Advanced +- Labels: "security", "upgrades", "admin" + +Description + +The current implementation of `No wallet recovery or migration path for ledger and timestamp deposits simultaneously` introduces a contract behavior gap that must be corrected. The contract lacks a migration or recovery path for mixed ledger and timestamp deposit models. This may complicate future upgrades or user migration flows. Affected files: `contracts/time-lock-vault/src/contract.rs`, repo docs, and migration tooling. + +Expected Behavior + +The repository should add a recovery or migration path that covers both ledger and timestamp-based deposits. + +Tasks + +- [ ] Design upgrade and migration behavior for mixed deposit types. +- [ ] Document the recovery path. +- [ ] Add integration tests for migration scenarios. + +--- +Fee fallback to depositor in `Deposit cancellation` is not clearly documented +- Priority: Low +- Difficulty: Intermediate +- Labels: "security", "contract", "ux" + +Description + +The current implementation of `Fee fallback to depositor in `cancel_deposit` is not clearly documented` introduces a contract behavior gap that must be corrected. The cancel flow does not support ledger-based deposits, creating an inconsistent user experience. Depositors may not be able to cancel deposits they expect to manage, exposing functional gaps in the contract logic. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Cancel deposit should support the same deposit types and allow users to cancel valid ledger-based deposits where appropriate. + +Tasks + +- [ ] Review cancel flow for ledger deposit support. +- [ ] Extend cancel logic to handle ledger-based deposits consistently. +- [ ] Add tests covering cancellation of ledger deposits. + +--- +`Withdraw-to path` allows any recipient address without additional validation +- Priority: Low +- Difficulty: Intermediate +- Labels: "security", "ux", "contract" + +Description + +The current implementation of ``withdraw_to` allows any recipient address without additional validation` introduces a contract behavior gap that must be corrected. The withdrawal implementation does not correctly handle deposits created by ledger-based locks. This inconsistency leaves valid ledger deposits unreachable through the public withdraw API. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +Withdraw actions should support ledger-based deposits and return the correct outcome for both timestamp and ledger locks. + +Tasks + +- [ ] Review `withdraw_to` logic and verify ledger deposit compatibility. +- [ ] Add ledger deposit handling if missing. +- [ ] Add tests that exercise withdrawal of ledger-based deposits. + +--- +`Ledger deposit path` provides a sequence-based lock without cross-checking timestamp conversions +- Priority: Low +- Difficulty: Intermediate +- Labels: "security", "contract", "future-proofing" + +Description + +The current implementation of ``deposit_by_ledger` provides a sequence-based lock without cross-checking timestamp conversions` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +No on-chain key versioning in persistent storage for future contract upgrades +- Priority: Medium +- Difficulty: Advanced +- Labels: "security", "storage", "upgrades" + +Description + +The current implementation of `No on-chain key versioning in persistent storage for future contract upgrades` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +No event emitted when `cancel_transfer_admin` is invoked with no pending admin present +- Priority: Low +- Difficulty: Beginner +- Labels: "security", "events", "admin" + +Description + +The current implementation of `No event emitted when `cancel_transfer_admin` is invoked with no pending admin present` introduces a contract behavior gap that must be corrected. The admin transfer cancellation path does not emit an event when no pending admin exists. This makes off-chain monitoring and auditing less reliable for cancellation actions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/events.rs`. + +Expected Behavior + +The admin transfer cancellation path should emit an event even when no pending admin exists, ensuring off-chain observability. + +Tasks + +- [ ] Add event emission for admin transfer cancellation when no pending admin exists. +- [ ] Update monitoring documentation to include the new event. +- [ ] Add tests ensuring the event is emitted in the expected condition. + +--- +`lock_duration` validation is duplicated in multiple deposit paths, increasing audit surface +- Priority: Low +- Difficulty: Beginner +- Labels: "security", "audit", "refactor" + +Description + +The current implementation of ``lock_duration` validation is duplicated in multiple deposit paths, increasing audit surface` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +`storage::add_depositor` scans the entire depositor list on every deposit +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "storage", "cost" + +Description + +The current implementation of ``storage::add_depositor` scans the entire depositor list on every deposit` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`storage::Depositor removal` rebuilds the depositor list each removal +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "storage", "cost" + +Description + +The current implementation of ``storage::remove_depositor` rebuilds the depositor list each removal` introduces a contract behavior gap that must be corrected. The depositor removal path can remove an address while ledger deposits remain active. This risks leaving orphaned deposit state and breaking retrieval APIs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`. + +Expected Behavior + +Removing a depositor should not break active ledger deposits or leave orphaned state in storage. + +Tasks + +- [ ] Review depositor removal logic and ledger deposit interactions. +- [ ] Prevent removal of a depositor with active ledger deposits or clear related state safely. +- [ ] Add tests for depositor removal under mixed deposit conditions. + +--- +`Deposit ID enumeration` iterates all deposit IDs up to the counter for every call +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "storage", "scalability" + +Description + +The current implementation of ``get_deposit_ids` iterates all deposit IDs up to the counter for every call` introduces a contract behavior gap that must be corrected. The deposit identifier query does not include ledger-based entries, so clients cannot enumerate every deposit. This breaks deposit discovery and any off-chain feature that relies on a complete deposit list. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Deposit ID enumeration should list every deposit, including ledger-based entries, so external indexers can discover all active vaults. + +Tasks + +- [ ] Audit deposit ID enumeration for ledger deposit entries. +- [ ] Update `get_deposit_ids` to include all active deposits. +- [ ] Add tests for ledger deposit ID visibility. + +--- +`get_depositors_page` has no defensive cap on `limit` +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "api", "memory" + +Description + +The current implementation of ``get_depositors_page` has no defensive cap on `limit`` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Event topics include full `Address` values, increasing payload size +- Priority: Low +- Difficulty: Intermediate +- Labels: "performance", "events", "cost" + +Description + +The current implementation of `Event topics include full `Address` values, increasing payload size` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`VaultEntry` stores depositor twice, increasing persistent storage footprint +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "storage", "types" + +Description + +The current implementation of ``VaultEntry` stores depositor twice, increasing persistent storage footprint` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`LedgerVaultEntry` stores depositor twice, increasing persistent storage footprint +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "storage", "types" + +Description + +The current implementation of ``LedgerVaultEntry` stores depositor twice, increasing persistent storage footprint` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`token::Client::new()` is recreated in each function instead of using a helper +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "contract", "refactor" + +Description + +The current implementation of ``token::Client::new()` is recreated in each function instead of using a helper` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Shared deposit validation code is duplicated across paths +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "contract", "refactor" + +Description + +The current implementation of `Shared deposit validation code is duplicated across paths` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`Time remaining query` loads full entry data when only timestamp comparison is required +- Priority: Low +- Difficulty: Intermediate +- Labels: "performance", "storage", "contract" + +Description + +The current implementation of ``time_remaining` loads full entry data when only timestamp comparison is required` introduces a contract behavior gap that must be corrected. The time remaining calculation ignores ledger-based deposits and returns misleading values. This can cause callers to believe a deposit is unlocked when it is still locked by ledger sequence. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +The time remaining query should compute the correct remaining lock interval for ledger-based deposits and not return misleading zero values. + +Tasks + +- [ ] Audit time remaining calculation for ledger deposit entries. +- [ ] Fix the logic so ledger-based deposits produce correct remaining lock values. +- [ ] Add regression tests for ledger-derived remaining times. + +--- +`setup()` test helper re-registers the contract for every test +- Priority: Low +- Difficulty: Intermediate +- Labels: "performance", "testing", "dx" + +Description + +The current implementation of ``setup()` test helper re-registers the contract for every test` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +`advance_time` test helper reconstructs a full ledger snapshot on every call +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "testing", "dx" + +Description + +The current implementation of ``advance_time` test helper reconstructs a full ledger snapshot on every call` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +README lacks concrete Soroban CLI invocation examples for deposit and withdraw +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "dx", "readme" + +Description + +The current implementation of `README lacks concrete Soroban CLI invocation examples for deposit and withdraw` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +CHANGELOG does not clearly document the addition of ledger-based deposits +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "audit" + +Description + +The current implementation of `CHANGELOG does not clearly document the addition of ledger-based deposits` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The repository should maintain appropriate project documentation and governance artifacts for contributors, security, and release history. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +CONTRIBUTING lacks Soroban-specific contribution and testing guidance +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "contributing" + +Description + +The current implementation of `CONTRIBUTING lacks Soroban-specific contribution and testing guidance` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The repository should maintain appropriate project documentation and governance artifacts for contributors, security, and release history. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +SECURITY.md has no responsible disclosure process or severity guidelines +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "security" + +Description + +The current implementation of `SECURITY.md has no responsible disclosure process or severity guidelines` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The repository should maintain appropriate project documentation and governance artifacts for contributors, security, and release history. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`BUMP_THRESHOLD` and `BUMP_TARGET` constants are undocumented in `storage.rs` +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "constants" + +Description + +The current implementation of ``BUMP_THRESHOLD` and `BUMP_TARGET` constants are undocumented in `storage.rs`` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`MAX_DEPOSIT_AMOUNT` comment should clarify units and short/long-scale terminology +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "types" + +Description + +The current implementation of ``MAX_DEPOSIT_AMOUNT` comment should clarify units and short/long-scale terminology` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`VaultEntry` and `LedgerVaultEntry` fields lack unit documentation +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "types", "api" + +Description + +The current implementation of ``VaultEntry` and `LedgerVaultEntry` fields lack unit documentation` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`events.rs` lacks a module-level explanation of event topic conventions +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "events" + +Description + +The current implementation of ``events.rs` lacks a module-level explanation of event topic conventions` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`storage.rs` does not document the complete persistent key layout +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "storage" + +Description + +The current implementation of ``storage.rs` does not document the complete persistent key layout` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`contract.rs` does not explain the security model for `Emergency withdrawal path` +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "admin", "contract" + +Description + +The current implementation of ``contract.rs` does not explain the security model for `emergency_withdraw`` introduces a contract behavior gap that must be corrected. The emergency recovery path only supports timestamp-based deposits and ignores ledger-based vault entries. That exposes a recovery gap where some deposits cannot be recovered by admin functions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Emergency recovery should cover both timestamp and ledger-based deposits so admin recovery is complete. + +Tasks + +- [ ] Review emergency withdrawal paths for ledger and timestamp deposits. +- [ ] Extend `emergency_withdraw` to support ledger-based deposit entries. +- [ ] Add tests that exercise emergency recovery for ledger deposits. + +--- +README does not explain the difference between time-based and ledger-based deposits +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "readme" + +Description + +The current implementation of `README does not explain the difference between time-based and ledger-based deposits` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +README does not document pause semantics for all deposit paths +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "admin", "readme" + +Description + +The current implementation of `README does not document pause semantics for all deposit paths` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +`scripts/deploy_testnet.sh` lacks inline usage examples and default environment assumptions +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "scripts" + +Description + +The current implementation of ``scripts/deploy_testnet.sh` lacks inline usage examples and default environment assumptions` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +README has no local Soroban standalone node integration testing instructions +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "testing" + +Description + +The current implementation of `README has no local Soroban standalone node integration testing instructions` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +plan.md does not define sprint cadence, review process, or branch policies +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "process" + +Description + +The current implementation of `plan.md does not define sprint cadence, review process, or branch policies` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +README does not document when `is_initialized` must be checked before invocation +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "contract" + +Description + +The current implementation of `README does not document when `is_initialized` must be checked before invocation` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +README does not clarify `get_vault` vs `Vault batch query` differences +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "api" + +Description + +The current implementation of `README does not clarify `get_vault` vs `get_vault_batch` differences` introduces a contract behavior gap that must be corrected. The batch vault query currently omits ledger-based deposits, preventing complete client-side vault enumeration. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Batch vault queries should include ledger deposits and return complete vault state for clients. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +lib.rs comment on the storage model is outdated compared to current key definitions +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "lib" + +Description + +The current implementation of `lib.rs comment on the storage model is outdated compared to current key definitions` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +No test verifying `Ledger deposit path` rejects deposits while paused +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "pause" + +Description + +The current implementation of `No test verifying `deposit_by_ledger` rejects deposits while paused` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +No test verifying `Ledger deposit path` rejects too-short ledger lock durations +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "validation" + +Description + +The current implementation of `No test verifying `deposit_by_ledger` rejects too-short ledger lock durations` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +No test verifying `Ledger deposit path` rejects too-long ledger lock durations +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "validation" + +Description + +The current implementation of `No test verifying `deposit_by_ledger` rejects too-long ledger lock durations` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +No test for `Withdraw-to path` with ledger-based deposits +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "contract" + +Description + +The current implementation of `No test for `withdraw_to` with ledger-based deposits` introduces a contract behavior gap that must be corrected. The withdrawal implementation does not correctly handle deposits created by ledger-based locks. This inconsistency leaves valid ledger deposits unreachable through the public withdraw API. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +Withdraw actions should support ledger-based deposits and return the correct outcome for both timestamp and ledger locks. + +Tasks + +- [ ] Review `withdraw_to` logic and verify ledger deposit compatibility. +- [ ] Add ledger deposit handling if missing. +- [ ] Add tests that exercise withdrawal of ledger-based deposits. + +--- +No test for `Emergency withdrawal path` when a ledger-based deposit exists +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "admin" + +Description + +The current implementation of `No test for `emergency_withdraw` when a ledger-based deposit exists` introduces a contract behavior gap that must be corrected. The emergency recovery path only supports timestamp-based deposits and ignores ledger-based vault entries. That exposes a recovery gap where some deposits cannot be recovered by admin functions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Emergency recovery should cover both timestamp and ledger-based deposits so admin recovery is complete. + +Tasks + +- [ ] Review emergency withdrawal paths for ledger and timestamp deposits. +- [ ] Extend `emergency_withdraw` to support ledger-based deposit entries. +- [ ] Add tests that exercise emergency recovery for ledger deposits. + +--- +No test for `Vault query` ledger-deposit visibility +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "api" + +Description + +The current implementation of `No test for `get_vault` ledger-deposit visibility` introduces a contract behavior gap that must be corrected. The vault query API currently omits ledger-based deposits from its results. External clients cannot reliably inspect all active vaults, undermining transparency and off-chain indexing. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +The vault query should return all active deposits regardless of whether they were created by timestamp or ledger lock semantics. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +No test for `Time remaining query` with ledger-based deposits +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "api" + +Description + +The current implementation of `No test for `time_remaining` with ledger-based deposits` introduces a contract behavior gap that must be corrected. The time remaining calculation ignores ledger-based deposits and returns misleading values. This can cause callers to believe a deposit is unlocked when it is still locked by ledger sequence. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +The time remaining query should compute the correct remaining lock interval for ledger-based deposits and not return misleading zero values. + +Tasks + +- [ ] Audit time remaining calculation for ledger deposit entries. +- [ ] Fix the logic so ledger-based deposits produce correct remaining lock values. +- [ ] Add regression tests for ledger-derived remaining times. + +--- +No test for `Deposit ID enumeration` including ledger-based deposit IDs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "storage" + +Description + +The current implementation of `No test for `get_deposit_ids` including ledger-based deposit IDs` introduces a contract behavior gap that must be corrected. The deposit identifier query does not include ledger-based entries, so clients cannot enumerate every deposit. This breaks deposit discovery and any off-chain feature that relies on a complete deposit list. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Deposit ID enumeration should list every deposit, including ledger-based entries, so external indexers can discover all active vaults. + +Tasks + +- [ ] Audit deposit ID enumeration for ledger deposit entries. +- [ ] Update `get_deposit_ids` to include all active deposits. +- [ ] Add tests for ledger deposit ID visibility. + +--- +No test for `Vault batch query` covering ledger deposit paths +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "api" + +Description + +The current implementation of `No test for `get_vault_batch` covering ledger deposit paths` introduces a contract behavior gap that must be corrected. The batch vault query currently omits ledger-based deposits, preventing complete client-side vault enumeration. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Batch vault queries should include ledger deposits and return complete vault state for clients. + +Tasks + +- [ ] Audit vault query implementation for ledger deposit inclusion. +- [ ] Correct query behavior to return both time-based and ledger-based deposits. +- [ ] Add tests for query results with mixed deposit types. + +--- +No test for `Depositor removal` with mixed deposit types +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "storage" + +Description + +The current implementation of `No test for `remove_depositor` with mixed deposit types` introduces a contract behavior gap that must be corrected. The depositor removal path can remove an address while ledger deposits remain active. This risks leaving orphaned deposit state and breaking retrieval APIs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`. + +Expected Behavior + +Removing a depositor should not break active ledger deposits or leave orphaned state in storage. + +Tasks + +- [ ] Review depositor removal logic and ledger deposit interactions. +- [ ] Prevent removal of a depositor with active ledger deposits or clear related state safely. +- [ ] Add tests for depositor removal under mixed deposit conditions. + +--- +No test for `Ledger deposit path` transfer failure rollback +- Priority: Medium +- Difficulty: Advanced +- Labels: "testing", "error-path" + +Description + +The current implementation of `No test for `deposit_by_ledger` transfer failure rollback` introduces a contract behavior gap that must be corrected. The ledger-based deposit path is currently missing validation checks and consistency with the timestamp-based flow. This can lead to paused contracts accepting deposits, invalid lock durations, and a mismatch between ledger state and public API queries. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and README documentation. + +Expected Behavior + +The ledger deposit path should use the same pause and duration validation as the timestamp deposit path, exposing all ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. + +--- +No test for `pause`/`unpause` semantics across both deposit methods +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "admin" + +Description + +The current implementation of `No test for `pause`/`unpause` semantics across both deposit methods` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +No test for `Deposit cancellation` behavior on ledger deposits +- Priority: Low +- Difficulty: Intermediate +- Labels: "testing", "contract" + +Description + +The current implementation of `No test for `cancel_deposit` behavior on ledger deposits` introduces a contract behavior gap that must be corrected. The cancel flow does not support ledger-based deposits, creating an inconsistent user experience. Depositors may not be able to cancel deposits they expect to manage, exposing functional gaps in the contract logic. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Cancel deposit should support the same deposit types and allow users to cancel valid ledger-based deposits where appropriate. + +Tasks + +- [ ] Review cancel flow for ledger deposit support. +- [ ] Extend cancel logic to handle ledger-based deposits consistently. +- [ ] Add tests covering cancellation of ledger deposits. + +--- +No test verifying `get_constants` with custom initialization values +- Priority: Low +- Difficulty: Beginner +- Labels: "testing", "constants" + +Description + +The current implementation of `No test verifying `get_constants` with custom initialization values` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +No test verifying `deposit_for` and `deposit` share the same amount constraints +- Priority: Low +- Difficulty: Beginner +- Labels: "testing", "consistency" + +Description + +The current implementation of `No test verifying `deposit_for` and `deposit` share the same amount constraints` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +No test verifying `Withdraw-to path` event payload values +- Priority: Low +- Difficulty: Intermediate +- Labels: "testing", "events" + +Description + +The current implementation of `No test verifying `withdraw_to` event payload values` introduces a contract behavior gap that must be corrected. The withdrawal implementation does not correctly handle deposits created by ledger-based locks. This inconsistency leaves valid ledger deposits unreachable through the public withdraw API. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. + +Expected Behavior + +Withdraw actions should support ledger-based deposits and return the correct outcome for both timestamp and ledger locks. + +Tasks + +- [ ] Review `withdraw_to` logic and verify ledger deposit compatibility. +- [ ] Add ledger deposit handling if missing. +- [ ] Add tests that exercise withdrawal of ledger-based deposits. + +--- +No test for `get_depositor_count` after mixed deposit removals +- Priority: Low +- Difficulty: Beginner +- Labels: "testing", "storage" + +Description + +The current implementation of `No test for `get_depositor_count` after mixed deposit removals` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +No integration test validating README example flows +- Priority: Medium +- Difficulty: Advanced +- Labels: "testing", "integration" + +Description + +The current implementation of `No integration test validating README example flows` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +No fuzz or boundary tests for minimum and maximum deposit amounts across paths +- Priority: Medium +- Difficulty: Advanced +- Labels: "testing", "fuzzing" + +Description + +The current implementation of `No fuzz or boundary tests for minimum and maximum deposit amounts across paths` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +No stress test for `get_depositors` pagination size and edge behavior +- Priority: Low +- Difficulty: Advanced +- Labels: "testing", "performance" + +Description + +The current implementation of `No stress test for `get_depositors` pagination size and edge behavior` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Extract shared deposit validation logic into a single helper +- Priority: Medium +- Difficulty: Intermediate +- Labels: "refactor", "contract" + +Description + +The current implementation of `Extract shared deposit validation logic into a single helper` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Factor ledger and timestamp deposit storage into separate helper modules +- Priority: Medium +- Difficulty: Intermediate +- Labels: "refactor", "storage" + +Description + +The current implementation of `Factor ledger and timestamp deposit storage into separate helper modules` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Introduce reusable `require_admin` helper to simplify admin checks +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "dx" + +Description + +The current implementation of `Introduce reusable `require_admin` helper to simplify admin checks` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Introduce a shared pause guard helper for deposit entry points +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "admin" + +Description + +The current implementation of `Introduce a shared pause guard helper for deposit entry points` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Extract token transfer operations into a reusable helper +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "contract" + +Description + +The current implementation of `Extract token transfer operations into a reusable helper` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Remove duplicate depositor storage in `VaultEntry` and `LedgerVaultEntry` if possible +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "storage" + +Description + +The current implementation of `Remove duplicate depositor storage in `VaultEntry` and `LedgerVaultEntry` if possible` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Replace `test.rs` 5-tuple setup with a `TestContext` struct +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "testing" + +Description + +The current implementation of `Replace `test.rs` 5-tuple setup with a `TestContext` struct` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +Extract constants like `TEST_MINT_AMOUNT` from repeated test literals +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "testing" + +Description + +The current implementation of `Extract constants like `TEST_MINT_AMOUNT` from repeated test literals` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +Simplify repeated admin authorization pattern in contract.rs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "refactor", "contract" + +Description + +The current implementation of `Simplify repeated admin authorization pattern in contract.rs` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Consolidate `types.rs` and `errors.rs` into a smaller model module for cohesion +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "structure" + +Description + +The current implementation of `Consolidate `types.rs` and `errors.rs` into a smaller model module for cohesion` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Simplify crate exports in `lib.rs` for a cleaner public interface +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "lib" + +Description + +The current implementation of `Simplify crate exports in `lib.rs` for a cleaner public interface` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Update `Makefile` check target to include build verification for parity with CI +- Priority: Medium +- Difficulty: Beginner +- Labels: "refactor", "devops" + +Description + +The current implementation of `Update `Makefile` check target to include build verification for parity with CI` introduces a contract behavior gap that must be corrected. The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration to include the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow by running the relevant job locally if possible. + +--- +Add `top_up(depositor, amount)` to increase a lock without changing unlock time +- Priority: High +- Difficulty: Intermediate +- Labels: "feature", "contract" + +Description + +The current implementation of `Add `top_up(depositor, amount)` to increase a lock without changing unlock time` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add `extend_lock(depositor, new_unlock_time)` to lengthen existing locks +- Priority: High +- Difficulty: Intermediate +- Labels: "feature", "contract" + +Description + +The current implementation of `Add `extend_lock(depositor, new_unlock_time)` to lengthen existing locks` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add `batch_Emergency withdrawal path` to match README and support recovery migration +- Priority: High +- Difficulty: Advanced +- Labels: "feature", "admin", "security" + +Description + +The current implementation of `Add `batch_emergency_withdraw` to match README and support recovery migration` introduces a contract behavior gap that must be corrected. The emergency recovery path only supports timestamp-based deposits and ignores ledger-based vault entries. That exposes a recovery gap where some deposits cannot be recovered by admin functions. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Emergency recovery should cover both timestamp and ledger-based deposits so admin recovery is complete. + +Tasks + +- [ ] Review emergency withdrawal paths for ledger and timestamp deposits. +- [ ] Extend `emergency_withdraw` to support ledger-based deposit entries. +- [ ] Add tests that exercise emergency recovery for ledger deposits. + +--- +Add `batch_withdraw` to withdraw multiple deposits in one call +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "contract", "scalability" + +Description + +The current implementation of `Add `batch_withdraw` to withdraw multiple deposits in one call` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add `deposit_on_behalf` for third-party deposit flow +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "contract", "ux" + +Description + +The current implementation of `Add `deposit_on_behalf` for third-party deposit flow` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add admin-configurable token whitelist for accepted token contracts +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "admin", "security" + +Description + +The current implementation of `Add admin-configurable token whitelist for accepted token contracts` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add `get_all_vaults` or paginated aggregate query for off-chain indexing +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "api", "scalability" + +Description + +The current implementation of `Add `get_all_vaults` or paginated aggregate query for off-chain indexing` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add `get_total_locked(token)` aggregate query for TVL and analytics +- Priority: Medium +- Difficulty: Intermediate +- Labels: "feature", "api", "analytics" + +Description + +The current implementation of `Add `get_total_locked(token)` aggregate query for TVL and analytics` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add runtime update support for `fee_recipient` without redeploying +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "admin", "economics" + +Description + +The current implementation of `Add runtime update support for `fee_recipient` without redeploying` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add admin-managed emergency freeze for specific depositors or tokens +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "admin", "security" + +Description + +The current implementation of `Add admin-managed emergency freeze for specific depositors or tokens` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add configurable deposit penalty caps or fee rules for `Deposit cancellation` +- Priority: Low +- Difficulty: Advanced +- Labels: "feature", "contract", "economics" + +Description + +The current implementation of `Add configurable deposit penalty caps or fee rules for `cancel_deposit`` introduces a contract behavior gap that must be corrected. The cancel flow does not support ledger-based deposits, creating an inconsistent user experience. Depositors may not be able to cancel deposits they expect to manage, exposing functional gaps in the contract logic. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. + +Expected Behavior + +Cancel deposit should support the same deposit types and allow users to cancel valid ledger-based deposits where appropriate. + +Tasks + +- [ ] Review cancel flow for ledger deposit support. +- [ ] Extend cancel logic to handle ledger-based deposits consistently. +- [ ] Add tests covering cancellation of ledger deposits. + +--- +Add a `vault_status` query summarizing contract pause/admin state +- Priority: Low +- Difficulty: Intermediate +- Labels: "feature", "api", "ux" + +Description + +The current implementation of `Add a `vault_status` query summarizing contract pause/admin state` introduces a contract behavior gap that must be corrected. The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding it will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. + +Expected Behavior + +The repository should add the requested feature with a clear API surface and consistent storage behavior. + +Tasks + +- [ ] Design the new API surface in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add storage helpers and type support for the feature. +- [ ] Document usage examples in `README.md`. + +--- +Add `cargo audit` to CI to catch dependency vulnerabilities +- Priority: High +- Difficulty: Intermediate +- Labels: "devops", "ci", "security" + +Description + +The current implementation of `Add `cargo audit` to CI to catch dependency vulnerabilities` introduces a contract behavior gap that must be corrected. The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration to include the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow by running the relevant job locally if possible. + +--- +Add a GitHub Release workflow that builds optimized WASM assets +- Priority: High +- Difficulty: Intermediate +- Labels: "devops", "ci", "release" + +Description + +The current implementation of `Add a GitHub Release workflow that builds optimized WASM assets` introduces a contract behavior gap that must be corrected. The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration to include the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow by running the relevant job locally if possible. + +--- +Add `cargo test --release --features testutils` to CI for optimized build coverage +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "ci", "testing" + +Description + +The current implementation of `Add `cargo test --release --features testutils` to CI for optimized build coverage` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +Add shell syntax and usage validation for `scripts/deploy_testnet.sh` +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "ci", "scripts" + +Description + +The current implementation of `Add shell syntax and usage validation for `scripts/deploy_testnet.sh`` introduces a contract behavior gap that must be corrected. The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration to include the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow by running the relevant job locally if possible. + +--- +Add a `Makefile` target for toolchain and `soroban-cli` bootstrap +- Priority: Medium +- Difficulty: Beginner +- Labels: "devops", "dx", "makefile" + +Description + +The current implementation of `Add a `Makefile` target for toolchain and `soroban-cli` bootstrap` introduces a contract behavior gap that must be corrected. The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration to include the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow by running the relevant job locally if possible. + +--- +Add `.env.example` documenting required environment variables for deployment +- Priority: Medium +- Difficulty: Beginner +- Labels: "devops", "dx", "documentation" + +Description + +The current implementation of `Add `.env.example` documenting required environment variables for deployment` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +Add CI guard for README examples and local integration instructions +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "documentation" + +Description + +The current implementation of `Add CI guard for README examples and local integration instructions` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +Repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + +--- +Add WASM size regression checks across PRs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "ci", "performance" + +Description + +The current implementation of `Add WASM size regression checks across PRs` introduces a contract behavior gap that must be corrected. The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs for common operations. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and test helpers. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded query parameters, and keep public APIs performant. + +Tasks + +- [ ] Review the referenced storage helpers and query functions. +- [ ] Reduce unnecessary scans and limit unbounded parameters. +- [ ] Add targeted performance or boundary tests. + +--- +Add Dependabot or Renovate config for `soroban-sdk` and Rust dependency updates +- Priority: Medium +- Difficulty: Beginner +- Labels: "devops", "dependencies" + +Description + +The current implementation of `Add Dependabot or Renovate config for `soroban-sdk` and Rust dependency updates` introduces a contract behavior gap that must be corrected. The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. + +Expected Behavior + +The CI and repository tooling should enforce the missing validation or documentation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration to include the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow by running the relevant job locally if possible. + +--- +Add a developer quickstart section for contract iteration and local testing +- Priority: Medium +- Difficulty: Beginner +- Labels: "dx", "testing" + +Description + +The current implementation of `Add a developer quickstart section for contract iteration and local testing` introduces a contract behavior gap that must be corrected. The test suite does not cover this behavior, leaving a gap in contract validation and regression protection. Without a dedicated test, future changes can break the contract silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught in continuous integration. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario in test comments. + +--- +Extend issue templates with a Soroban security-contract bug checklist +- Priority: Medium +- Difficulty: Beginner +- Labels: "dx", "github", "security" + +Description + +The current implementation of `Extend issue templates with a Soroban security-contract bug checklist` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Extend PR template with contract-specific testing and audit checklist +- Priority: Medium +- Difficulty: Beginner +- Labels: "dx", "github", "contributing" + +Description + +The current implementation of `Extend PR template with contract-specific testing and audit checklist` introduces a contract behavior gap that must be corrected. The current implementation is missing a required behavior or contains an inconsistency that should be corrected. This issue impacts contract correctness, observability, or developer experience. Affected files include the contract source, storage helpers, and documentation for this feature. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Add a contributor-facing troubleshooting section for Soroban CLI and WASM build issues +- Priority: Low +- Difficulty: Beginner +- Labels: "dx", "documentation" + +Description + +The current implementation of `Add a contributor-facing troubleshooting section for Soroban CLI and WASM build issues` introduces a contract behavior gap that must be corrected. The repository documentation currently lacks the required details, examples, or references for this contract behavior. This gap reduces developer understanding and increases the chance of incorrect integration or audit assumptions. Affected files: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or relevant script docs. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or references that clarify the contract behavior. +- [ ] Validate the documentation changes against current contract APIs. + diff --git a/ISSUES_GITHUB_FORMATTED.md b/ISSUES_GITHUB_FORMATTED.md new file mode 100644 index 0000000..e3df565 --- /dev/null +++ b/ISSUES_GITHUB_FORMATTED.md @@ -0,0 +1,2524 @@ +--- +Ledger deposit path bypasses the paused contract guard +- Priority: Critical +- Difficulty: Advanced +- Labels: "bug", "security", "pause" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Ledger deposit path does not enforce minimum lock duration +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "validation", "contract" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Ledger deposit path does not enforce maximum lock duration +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "validation", "contract" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Withdraw-to path only works for time-based deposits, ignoring ledger deposits +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "contract", "storage" + +Description + +The `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs` currently only supports time-based deposits and ignores ledger-based vault entries. That means valid ledger deposits cannot be withdrawn through this public API, creating a functional gap. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. This inconsistency risks broken withdrawal behavior and poor client interoperability. + +Expected Behavior + +Withdraw-to should support both time-based and ledger-based deposits and return correct results for all active vault entries. + +Tasks + +- [ ] Review `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend withdrawal handling to support ledger-based deposits. +- [ ] Add tests covering withdrawal of ledger deposit entries. + +--- +Emergency withdrawal path only works for time-based deposits, ignoring ledger deposits +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "admin", "recovery" + +Description + +The emergency withdrawal path in `contracts/time-lock-vault/src/contract.rs` does not support ledger-based deposits. As a result, some deposits cannot be recovered by the admin emergency flow, leaving funds stuck. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This undermines recovery guarantees and increases operational risk. + +Expected Behavior + +Emergency withdrawal should recover both timestamp-based and ledger-based deposits so admin recovery flows are complete. + +Tasks + +- [ ] Review emergency withdrawal logic in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend support to ledger-based deposits. +- [ ] Add recovery tests for ledger deposits. + +--- +Vault query does not expose ledger-based deposits +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "api", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Time remaining query ignores ledger-based deposits and returns 0 +- Priority: High +- Difficulty: Advanced +- Labels: "bug", "api", "ux" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Deposit ID enumeration skips ledger-based deposit IDs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "api", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Vault batch query reads only time-based deposits, not ledger-based deposits +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "api", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Cancel deposit cannot cancel ledger-based deposits +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "contract", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Depositor removal can clear an address while ledger deposits remain active +- Priority: Medium +- Difficulty: Intermediate +- Labels: "bug", "storage", "consistency" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +README documents non-existent batch_Emergency withdrawal path API +- Priority: Medium +- Difficulty: Beginner +- Labels: "bug", "documentation", "contract" + +Description + +The emergency withdrawal path in `contracts/time-lock-vault/src/contract.rs` does not support ledger-based deposits. As a result, some deposits cannot be recovered by the admin emergency flow, leaving funds stuck. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This undermines recovery guarantees and increases operational risk. + +Expected Behavior + +Emergency withdrawal should recover both timestamp-based and ledger-based deposits so admin recovery flows are complete. + +Tasks + +- [ ] Review emergency withdrawal logic in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend support to ledger-based deposits. +- [ ] Add recovery tests for ledger deposits. + +--- +README omits Ledger deposit path, Withdraw-to path, and ledger deposit semantics +- Priority: Medium +- Difficulty: Beginner +- Labels: "bug", "documentation", "api" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Ledger deposit path uses a different validation path than deposit/deposit_for +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "refactor", "contract" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Initialize treats zero max_lock_secs as LockDurationTooLong instead of explicit invalid config +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "validation", "contract" + +Description + +The initialization flow in `contracts/time-lock-vault/src/contract.rs` currently handles invalid configuration values ambiguously. This makes it harder to distinguish invalid inputs from actual runtime lock errors. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. This issue can cause misconfiguration and reduce deployment safety. + +Expected Behavior + +Initialization should validate configuration inputs explicitly and fail with appropriate errors for invalid `max_lock_secs` values. + +Tasks + +- [ ] Review `initialize` validation paths in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Improve error handling for invalid `max_lock_secs` values. +- [ ] Add tests for invalid initialization inputs. + +--- +Ledger deposit path does not validate unlock_ledger against network sequence drift +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "validation", "future-proofing" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Get_depositors pagination accepts an unbounded limit, leading to high memory use +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "api", "scalability" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +VaultEntry.depositor duplicates the address available in the storage key +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "storage", "types" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +LedgerVaultEntry.depositor duplicates the address available in the storage key +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "storage", "types" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +README has no explicit example for pause/unpause behavior +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "documentation", "admin" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Ledger-based deposits are not documented as part of Vault query and Time remaining query +- Priority: Low +- Difficulty: Beginner +- Labels: "bug", "documentation", "api" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Advance_time test helper reconstructs ledger state instead of incrementing sequence consistently +- Priority: Low +- Difficulty: Intermediate +- Labels: "bug", "testing", "helpers" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No explicit token contract validation allows malicious token contracts +- Priority: Critical +- Difficulty: Advanced +- Labels: "security", "token", "validation" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Ledger deposit path bypasses pause, weakening emergency shutdown controls +- Priority: High +- Difficulty: Advanced +- Labels: "security", "admin", "pause" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +Emergency withdrawal path does not support ledger deposits, leaving some funds unrecoverable in recovery flow +- Priority: High +- Difficulty: Advanced +- Labels: "security", "admin", "recovery" + +Description + +The emergency withdrawal path in `contracts/time-lock-vault/src/contract.rs` does not support ledger-based deposits. As a result, some deposits cannot be recovered by the admin emergency flow, leaving funds stuck. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This undermines recovery guarantees and increases operational risk. + +Expected Behavior + +Emergency withdrawal should recover both timestamp-based and ledger-based deposits so admin recovery flows are complete. + +Tasks + +- [ ] Review emergency withdrawal logic in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend support to ledger-based deposits. +- [ ] Add recovery tests for ledger deposits. + +--- +Time remaining query returns 0 for ledger deposits, creating a misleading unlocked signal +- Priority: High +- Difficulty: Intermediate +- Labels: "security", "api", "ux" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Vault query and Vault batch query hide ledger deposit state from external indexers +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "transparency", "api" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Cancel deposit inability to cancel ledger deposits weakens depositor control +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "contract", "ux" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Admin storage reads do not bump TTL; admin privilege can expire unintentionally +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "storage", "admin" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Ledger deposit sequence semantics are not documented, raising future validation risk +- Priority: Medium +- Difficulty: Intermediate +- Labels: "security", "documentation", "contract" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +No freeze mechanism for an address in case of compromised depositor or token abuse +- Priority: Medium +- Difficulty: Advanced +- Labels: "security", "admin", "contract" + +Description + +The contract lacks an administrative freeze mechanism for compromised or abusive depositor addresses. That reduces the ability to mitigate fraud or abuse. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This issue weakens incident response and operational security. + +Expected Behavior + +The contract should provide an administrative freeze mechanism for compromised depositor accounts. + +Tasks + +- [ ] Design administratively controlled depositor freeze behavior. +- [ ] Implement freeze state in storage helpers. +- [ ] Add tests for freeze/unfreeze operations. + +--- +No wallet recovery or migration path for ledger and timestamp deposits simultaneously +- Priority: Medium +- Difficulty: Advanced +- Labels: "security", "upgrades", "admin" + +Description + +The repository does not provide a clear recovery or migration path for mixed ledger and timestamp deposit models. This may complicate upgrades and preservation of depositor funds. Affected files include `contracts/time-lock-vault/src/contract.rs` and related documentation. This issue increases upgrade risk and user uncertainty. + +Expected Behavior + +The repository should add a recovery or migration path that covers both ledger-based and timestamp-based deposits. + +Tasks + +- [ ] Define a recovery/migration path for mixed deposit models. +- [ ] Document the recovery behavior and interface. +- [ ] Add integration tests for migration scenarios. + +--- +Fee fallback to depositor in Cancel deposit is not clearly documented +- Priority: Low +- Difficulty: Intermediate +- Labels: "security", "contract", "ux" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Withdraw-to path allows any recipient address without additional validation +- Priority: Low +- Difficulty: Intermediate +- Labels: "security", "ux", "contract" + +Description + +The `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs` currently only supports time-based deposits and ignores ledger-based vault entries. That means valid ledger deposits cannot be withdrawn through this public API, creating a functional gap. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. This inconsistency risks broken withdrawal behavior and poor client interoperability. + +Expected Behavior + +Withdraw-to should support both time-based and ledger-based deposits and return correct results for all active vault entries. + +Tasks + +- [ ] Review `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend withdrawal handling to support ledger-based deposits. +- [ ] Add tests covering withdrawal of ledger deposit entries. + +--- +Ledger deposit path provides a sequence-based lock without cross-checking timestamp conversions +- Priority: Low +- Difficulty: Intermediate +- Labels: "security", "contract", "future-proofing" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +No on-chain key versioning in persistent storage for future contract upgrades +- Priority: Medium +- Difficulty: Advanced +- Labels: "security", "storage", "upgrades" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +No event emitted when cancel_transfer_admin is invoked with no pending admin present +- Priority: Low +- Difficulty: Beginner +- Labels: "security", "events", "admin" + +Description + +The admin transfer cancellation path does not emit an event when no pending admin exists. This reduces off-chain auditability and makes monitoring admin state changes harder. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/events.rs`. This issue weakens operational transparency. + +Expected Behavior + +The admin transfer cancellation path should emit an event in the no-pending-admin case, ensuring off-chain observability. + +Tasks + +- [ ] Add event emission for admin transfer cancellation when no pending admin exists. +- [ ] Update monitoring documentation to include the new event. +- [ ] Add tests verifying the event is emitted. + +--- +Lock_duration validation is duplicated in multiple deposit paths, increasing audit surface +- Priority: Low +- Difficulty: Beginner +- Labels: "security", "audit", "refactor" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Storage::add_depositor scans the entire depositor list on every deposit +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "storage", "cost" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Storage::Depositor removal rebuilds the depositor list each removal +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "storage", "cost" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Deposit ID enumeration iterates all deposit IDs up to the counter for every call +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "storage", "scalability" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Get_depositors_page has no defensive cap on limit +- Priority: Medium +- Difficulty: Intermediate +- Labels: "performance", "api", "memory" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Event topics include full Address values, increasing payload size +- Priority: Low +- Difficulty: Intermediate +- Labels: "performance", "events", "cost" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +VaultEntry stores depositor twice, increasing persistent storage footprint +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "storage", "types" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +LedgerVaultEntry stores depositor twice, increasing persistent storage footprint +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "storage", "types" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Token::Client::new() is recreated in each function instead of using a helper +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "contract", "refactor" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Shared deposit validation code is duplicated across paths +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "contract", "refactor" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Time remaining query loads full entry data when only timestamp comparison is required +- Priority: Low +- Difficulty: Intermediate +- Labels: "performance", "storage", "contract" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Setup() test helper re-registers the contract for every test +- Priority: Low +- Difficulty: Intermediate +- Labels: "performance", "testing", "dx" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Advance_time test helper reconstructs a full ledger snapshot on every call +- Priority: Low +- Difficulty: Beginner +- Labels: "performance", "testing", "dx" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +README lacks concrete Soroban CLI invocation examples for deposit and withdraw +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "dx", "readme" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +CHANGELOG does not clearly document the addition of ledger-based deposits +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "audit" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository should maintain appropriate documentation and governance artifacts for contributors, security, and release history. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +CONTRIBUTING lacks Soroban-specific contribution and testing guidance +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "contributing" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository should maintain appropriate documentation and governance artifacts for contributors, security, and release history. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +SECURITY.md has no responsible disclosure process or severity guidelines +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "security" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository should maintain appropriate documentation and governance artifacts for contributors, security, and release history. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +BUMP_THRESHOLD and BUMP_TARGET constants are undocumented in storage.rs +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "constants" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +MAX_DEPOSIT_AMOUNT comment should clarify units and short/long-scale terminology +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "types" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +VaultEntry and LedgerVaultEntry fields lack unit documentation +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "types", "api" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Events.rs lacks a module-level explanation of event topic conventions +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "events" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Storage.rs does not document the complete persistent key layout +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "storage" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Contract.rs does not explain the security model for Emergency withdrawal path +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "admin", "contract" + +Description + +The emergency withdrawal path in `contracts/time-lock-vault/src/contract.rs` does not support ledger-based deposits. As a result, some deposits cannot be recovered by the admin emergency flow, leaving funds stuck. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This undermines recovery guarantees and increases operational risk. + +Expected Behavior + +Emergency withdrawal should recover both timestamp-based and ledger-based deposits so admin recovery flows are complete. + +Tasks + +- [ ] Review emergency withdrawal logic in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend support to ledger-based deposits. +- [ ] Add recovery tests for ledger deposits. + +--- +README does not explain the difference between time-based and ledger-based deposits +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "readme" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +README does not document pause semantics for all deposit paths +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "admin", "readme" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Scripts/deploy_testnet.sh lacks inline usage examples and default environment assumptions +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "scripts" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +README has no local Soroban standalone node integration testing instructions +- Priority: High +- Difficulty: Beginner +- Labels: "documentation", "testing" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Plan.md does not define sprint cadence, review process, or branch policies +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "process" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +README does not document when is_initialized must be checked before invocation +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "contract" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +README does not clarify Vault query vs Vault batch query differences +- Priority: Low +- Difficulty: Beginner +- Labels: "documentation", "api" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The repository documentation should clearly describe the current contract APIs, ledger vs timestamp deposit behavior, and pause semantics. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Lib.rs comment on the storage model is outdated compared to current key definitions +- Priority: Medium +- Difficulty: Beginner +- Labels: "documentation", "lib" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +No test verifying Ledger deposit path rejects deposits while paused +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "pause" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +No test verifying Ledger deposit path rejects too-short ledger lock durations +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "validation" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +No test verifying Ledger deposit path rejects too-long ledger lock durations +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "validation" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +No test for Withdraw-to path with ledger-based deposits +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "contract" + +Description + +The `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs` currently only supports time-based deposits and ignores ledger-based vault entries. That means valid ledger deposits cannot be withdrawn through this public API, creating a functional gap. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. This inconsistency risks broken withdrawal behavior and poor client interoperability. + +Expected Behavior + +Withdraw-to should support both time-based and ledger-based deposits and return correct results for all active vault entries. + +Tasks + +- [ ] Review `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend withdrawal handling to support ledger-based deposits. +- [ ] Add tests covering withdrawal of ledger deposit entries. + +--- +No test for Emergency withdrawal path when a ledger-based deposit exists +- Priority: High +- Difficulty: Intermediate +- Labels: "testing", "admin" + +Description + +The emergency withdrawal path in `contracts/time-lock-vault/src/contract.rs` does not support ledger-based deposits. As a result, some deposits cannot be recovered by the admin emergency flow, leaving funds stuck. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This undermines recovery guarantees and increases operational risk. + +Expected Behavior + +Emergency withdrawal should recover both timestamp-based and ledger-based deposits so admin recovery flows are complete. + +Tasks + +- [ ] Review emergency withdrawal logic in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend support to ledger-based deposits. +- [ ] Add recovery tests for ledger deposits. + +--- +No test for Vault query ledger-deposit visibility +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "api" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test for Time remaining query with ledger-based deposits +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "api" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test for Deposit ID enumeration including ledger-based deposit IDs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +No test for Vault batch query covering ledger deposit paths +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "api" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test for Depositor removal with mixed deposit types +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +No test for Ledger deposit path transfer failure rollback +- Priority: Medium +- Difficulty: Advanced +- Labels: "testing", "error-path" + +Description + +The ledger deposit path in `contracts/time-lock-vault/src/contract.rs` is currently missing validation rules that other deposit methods enforce. This allows paused contracts to accept deposits and permits ledger-based lock durations that violate the configured min/max bounds. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`, and `README.md`. This gap increases the risk of inconsistent deposit state and incorrect behavior for clients that rely on ledger and timestamp lock types. + +Expected Behavior + +The ledger deposit path should enforce pause state and correct lock-duration validation, matching the timestamp deposit flow and exposing ledger deposits consistently through public queries. + +Tasks + +- [ ] Inspect `deposit_by_ledger` in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Add pause-state validation for ledger deposit entry points. +- [ ] Add minimum and maximum lock duration checks for ledger sequence deposits. +- [ ] Update any API or storage helpers that expose ledger deposits. +- [ ] Add regression tests for paused state and invalid ledger locks. + +--- +No test for pause/unpause semantics across both deposit methods +- Priority: Medium +- Difficulty: Intermediate +- Labels: "testing", "admin" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test for Cancel deposit behavior on ledger deposits +- Priority: Low +- Difficulty: Intermediate +- Labels: "testing", "contract" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test verifying get_constants with custom initialization values +- Priority: Low +- Difficulty: Beginner +- Labels: "testing", "constants" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test verifying deposit_for and deposit share the same amount constraints +- Priority: Low +- Difficulty: Beginner +- Labels: "testing", "consistency" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No test verifying Withdraw-to path event payload values +- Priority: Low +- Difficulty: Intermediate +- Labels: "testing", "events" + +Description + +The `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs` currently only supports time-based deposits and ignores ledger-based vault entries. That means valid ledger deposits cannot be withdrawn through this public API, creating a functional gap. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`. This inconsistency risks broken withdrawal behavior and poor client interoperability. + +Expected Behavior + +Withdraw-to should support both time-based and ledger-based deposits and return correct results for all active vault entries. + +Tasks + +- [ ] Review `withdraw_to` implementation in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend withdrawal handling to support ledger-based deposits. +- [ ] Add tests covering withdrawal of ledger deposit entries. + +--- +No test for get_depositor_count after mixed deposit removals +- Priority: Low +- Difficulty: Beginner +- Labels: "testing", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +No integration test validating README example flows +- Priority: Medium +- Difficulty: Advanced +- Labels: "testing", "integration" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No fuzz or boundary tests for minimum and maximum deposit amounts across paths +- Priority: Medium +- Difficulty: Advanced +- Labels: "testing", "fuzzing" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +No stress test for get_depositors pagination size and edge behavior +- Priority: Low +- Difficulty: Advanced +- Labels: "testing", "performance" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Extract shared deposit validation logic into a single helper +- Priority: Medium +- Difficulty: Intermediate +- Labels: "refactor", "contract" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Factor ledger and timestamp deposit storage into separate helper modules +- Priority: Medium +- Difficulty: Intermediate +- Labels: "refactor", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Introduce reusable require_admin helper to simplify admin checks +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "dx" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Introduce a shared pause guard helper for deposit entry points +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "admin" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Extract token transfer operations into a reusable helper +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "contract" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Remove duplicate depositor storage in VaultEntry and LedgerVaultEntry if possible +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "storage" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Replace test.rs 5-tuple setup with a TestContext struct +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "testing" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +Extract constants like TEST_MINT_AMOUNT from repeated test literals +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "testing" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +Simplify repeated admin authorization pattern in contract.rs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "refactor", "contract" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Consolidate types.rs and errors.rs into a smaller model module for cohesion +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "structure" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Simplify crate exports in lib.rs for a cleaner public interface +- Priority: Low +- Difficulty: Beginner +- Labels: "refactor", "lib" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Update Makefile check target to include build verification for parity with CI +- Priority: Medium +- Difficulty: Beginner +- Labels: "refactor", "devops" + +Description + +The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. This issue impacts release reliability and developer workflows. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration with the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow locally if possible. + +--- +Add top_up(depositor, amount) to increase a lock without changing unlock time +- Priority: High +- Difficulty: Intermediate +- Labels: "feature", "contract" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add extend_lock(depositor, new_unlock_time) to lengthen existing locks +- Priority: High +- Difficulty: Intermediate +- Labels: "feature", "contract" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add batch_Emergency withdrawal path to match README and support recovery migration +- Priority: High +- Difficulty: Advanced +- Labels: "feature", "admin", "security" + +Description + +The emergency withdrawal path in `contracts/time-lock-vault/src/contract.rs` does not support ledger-based deposits. As a result, some deposits cannot be recovered by the admin emergency flow, leaving funds stuck. Affected modules: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/storage.rs`. This undermines recovery guarantees and increases operational risk. + +Expected Behavior + +Emergency withdrawal should recover both timestamp-based and ledger-based deposits so admin recovery flows are complete. + +Tasks + +- [ ] Review emergency withdrawal logic in `contracts/time-lock-vault/src/contract.rs`. +- [ ] Extend support to ledger-based deposits. +- [ ] Add recovery tests for ledger deposits. + +--- +Add batch_withdraw to withdraw multiple deposits in one call +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "contract", "scalability" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add deposit_on_behalf for third-party deposit flow +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "contract", "ux" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add admin-configurable token whitelist for accepted token contracts +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "admin", "security" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add get_all_vaults or paginated aggregate query for off-chain indexing +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "api", "scalability" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add get_total_locked(token) aggregate query for TVL and analytics +- Priority: Medium +- Difficulty: Intermediate +- Labels: "feature", "api", "analytics" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add runtime update support for fee_recipient without redeploying +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "admin", "economics" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add admin-managed emergency freeze for specific depositors or tokens +- Priority: Medium +- Difficulty: Advanced +- Labels: "feature", "admin", "security" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add configurable deposit penalty caps or fee rules for Cancel deposit +- Priority: Low +- Difficulty: Advanced +- Labels: "feature", "contract", "economics" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add a vault_status query summarizing contract pause/admin state +- Priority: Low +- Difficulty: Intermediate +- Labels: "feature", "api", "ux" + +Description + +The contract currently lacks this feature, which would improve usability, scalability, or security for users and administrators. Adding the feature will close a functional gap and align the contract with common vault management expectations. Affected files: `contracts/time-lock-vault/src/contract.rs`, `contracts/time-lock-vault/src/types.rs`, and `README.md` documentation. This issue impacts product capability and UX. + +Expected Behavior + +The repository should implement the requested feature with a consistent API and storage model, including documentation. + +Tasks + +- [ ] Design the feature API and storage support. +- [ ] Implement the contract and type changes. +- [ ] Document usage examples in `README.md`. + +--- +Add cargo audit to CI to catch dependency vulnerabilities +- Priority: High +- Difficulty: Intermediate +- Labels: "devops", "ci", "security" + +Description + +The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. This issue impacts release reliability and developer workflows. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration with the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow locally if possible. + +--- +Add a GitHub Release workflow that builds optimized WASM assets +- Priority: High +- Difficulty: Intermediate +- Labels: "devops", "ci", "release" + +Description + +The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. This issue impacts release reliability and developer workflows. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration with the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow locally if possible. + +--- +Add cargo test --release --features testutils to CI for optimized build coverage +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "ci", "testing" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +Add shell syntax and usage validation for scripts/deploy_testnet.sh +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "ci", "scripts" + +Description + +The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. This issue impacts release reliability and developer workflows. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration with the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow locally if possible. + +--- +Add a Makefile target for toolchain and soroban-cli bootstrap +- Priority: Medium +- Difficulty: Beginner +- Labels: "devops", "dx", "makefile" + +Description + +The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. This issue impacts release reliability and developer workflows. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration with the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow locally if possible. + +--- +Add .env.example documenting required environment variables for deployment +- Priority: Medium +- Difficulty: Beginner +- Labels: "devops", "dx", "documentation" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Add CI guard for README examples and local integration instructions +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "documentation" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + +--- +Add WASM size regression checks across PRs +- Priority: Medium +- Difficulty: Intermediate +- Labels: "devops", "ci", "performance" + +Description + +The current implementation creates unnecessary storage or computation overhead in the contract path. This increases ledger resource usage and may inflate execution costs. Affected files: `contracts/time-lock-vault/src/storage.rs`, `contracts/time-lock-vault/src/contract.rs`, and related test helpers. This issue impacts cost and scalability. + +Expected Behavior + +The contract should minimize storage scans, avoid unbounded parameters, and keep public APIs performant and scalable. + +Tasks + +- [ ] Review the referenced storage and query implementation. +- [ ] Reduce unnecessary scans and unbounded parameters. +- [ ] Add performance or boundary tests. + +--- +Add Dependabot or Renovate config for soroban-sdk and Rust dependency updates +- Priority: Medium +- Difficulty: Beginner +- Labels: "devops", "dependencies" + +Description + +The repository tooling or CI configuration currently omits an important validation or workflow step. This increases the risk of regressions, deployment failures, or unnoticed dependency issues. Affected files: `.github/workflows/ci.yml`, `Makefile`, `scripts/deploy_testnet.sh`, or repo config files. This issue impacts release reliability and developer workflows. + +Expected Behavior + +CI and tooling should enforce the missing workflow, documentation, or validation checks before merges. + +Tasks + +- [ ] Update CI or tooling configuration with the missing validation step. +- [ ] Add documentation or examples for the workflow change. +- [ ] Validate the new CI workflow locally if possible. + +--- +Add a developer quickstart section for contract iteration and local testing +- Priority: Medium +- Difficulty: Beginner +- Labels: "dx", "testing" + +Description + +The test suite does not cover this behavior and leaves a regression gap in contract validation. Without a dedicated test, future changes can break this behavior silently. Affected files: `contracts/time-lock-vault/src/test.rs` and related helpers. This issue impacts release confidence and reliability. + +Expected Behavior + +Add focused tests for the missing behavior so regressions are caught before release. + +Tasks + +- [ ] Add or extend tests to cover the missing behavior. +- [ ] Validate the new tests with the existing suite. +- [ ] Document the new coverage scenario. + +--- +Extend issue templates with a Soroban security-contract bug checklist +- Priority: Medium +- Difficulty: Beginner +- Labels: "dx", "github", "security" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Extend PR template with contract-specific testing and audit checklist +- Priority: Medium +- Difficulty: Beginner +- Labels: "dx", "github", "contributing" + +Description + +The current implementation contains a gap or inconsistency that should be corrected. Affected files include the contract source, storage helpers, and documentation. This issue impacts contract correctness, observability, or developer experience. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Investigate the reported contract behavior. +- [ ] Implement the fix in the relevant source files. +- [ ] Add tests or documentation to lock in the behavior. + +--- +Add a contributor-facing troubleshooting section for Soroban CLI and WASM build issues +- Priority: Low +- Difficulty: Beginner +- Labels: "dx", "documentation" + +Description + +Repository documentation is missing required details, examples, or security guidance for the current contract implementation. That reduces developer understanding and increases the risk of incorrect integration, audits, and contributor onboarding. Affected files may include `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, or script documentation. + +Expected Behavior + +The implementation should be corrected so the contract behaves consistently, safely, and transparently for all affected flows. + +Tasks + +- [ ] Update the relevant documentation file with the missing content. +- [ ] Add examples or guidance that clarify current contract behavior. +- [ ] Validate documentation changes against the current codebase. + diff --git a/SECURITY.md b/SECURITY.md index 4b64225..d77fcb4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -40,3 +40,56 @@ The following are considered in-scope vulnerabilities: ## Disclosure Policy We follow coordinated disclosure. Please allow us reasonable time to patch before any public disclosure. + +### Disclosure Timeline + +| Step | Timeframe | +|------|-----------| +| Acknowledgement of your report | Within 72 hours of receipt | +| Initial triage and severity assessment | Within 5 business days | +| Status update to reporter | Every 7 days until resolved | +| Patch release for Critical/High issues | Within 14 days of confirmation | +| Patch release for Medium/Low issues | Within 60 days of confirmation | +| Public disclosure (coordinated with reporter) | After patch is available, or after 90 days maximum | + +If a fix requires redeployment of the contract (because Soroban contracts are immutable), the disclosure timeline begins from when a migration path is communicated to users. + +## Severity Guidelines + +We use a four-level severity scale aligned with CVSS v3. + +### Critical + +Direct, exploitable fund loss or theft with no prerequisites. + +Examples: +- Logic bug allowing an attacker to withdraw another depositor's funds +- Auth bypass on `emergency_withdraw` sending funds to a non-depositor address +- Re-entrancy enabling double-withdrawal of the same deposit + +### High + +Significant fund loss or lock-up that requires specific conditions or limited attacker control. + +Examples: +- Depositor funds permanently locked due to a storage corruption bug +- Admin privilege escalation enabling unauthorized `emergency_withdraw` calls +- Incorrect penalty calculation causing material fund loss on `cancel_deposit` + +### Medium + +Contract misbehaviour that does not directly cause fund loss but degrades correctness or availability. + +Examples: +- Incorrect event data emitted (wrong amount or deposit_id) +- TTL bump logic failing to extend storage, risking entry expiry before unlock time +- Edge-case overflow in `time_remaining` returning an incorrect value + +### Low / Informational + +Minor issues or improvements with negligible security impact. + +Examples: +- Missing input validation that is harmless in practice +- Documentation inaccuracies about contract behaviour +- Gas/instruction inefficiencies with no exploitable consequence diff --git a/contracts/time-lock-vault/src/constants.rs b/contracts/time-lock-vault/src/constants.rs index cad37b0..3be7422 100644 --- a/contracts/time-lock-vault/src/constants.rs +++ b/contracts/time-lock-vault/src/constants.rs @@ -1,20 +1,4 @@ -// ---------------------------------------------------------------- -// Protocol Constants -// ---------------------------------------------------------------- - -/// Maximum deposit amount (in stroops or token base units). pub const MAX_DEPOSIT_AMOUNT: i128 = 1_000_000_000_000_000; - -/// Maximum lock duration in seconds (~5 years). pub const MAX_LOCK_DURATION_SECS: u64 = 157_788_000; - -/// Minimum lock duration: prevent trivial, pointless vaults that waste storage. pub const MIN_LOCK_DURATION_SECS: u64 = 60; - -/// Maximum depositors per `batch_emergency_withdraw` call. -/// -/// Soroban's per-transaction instruction budget is ~100M instructions. -/// Each iteration performs two persistent-storage removes, one token transfer, -/// and one event publish — roughly 1–2M instructions each. -/// 25 leaves comfortable headroom for the common migration use-case. -pub const MAX_BATCH_SIZE: u32 = 25; +pub const MAX_BATCH_SIZE: u32 = 20; diff --git a/contracts/time-lock-vault/src/contract.rs b/contracts/time-lock-vault/src/contract.rs index 03db732..f364e8e 100644 --- a/contracts/time-lock-vault/src/contract.rs +++ b/contracts/time-lock-vault/src/contract.rs @@ -6,10 +6,9 @@ use soroban_sdk::{contract, contractimpl, token, Address, Env, Vec}; use crate::{ - constants::{MAX_BATCH_SIZE, MAX_DEPOSIT_AMOUNT, MAX_LOCK_DURATION_SECS, MIN_LOCK_DURATION_SECS}, errors::VaultError, events, storage, - types::{VaultEntry, LedgerVaultEntry, MAX_DEPOSIT_AMOUNT, MAX_LOCK_DURATION_SECS, MIN_LOCK_DURATION_SECS, MAX_BATCH_SIZE}, + types::{LedgerVaultEntry, VaultEntry}, }; #[contract] @@ -38,6 +37,9 @@ impl TimeLockVault { storage::set_initialized(&env); storage::set_fee_recipient(&env, &fee_recipient); + if let Some(r) = fee_recipient { + storage::set_fee_recipient(&env, &r); + } if let Some(v) = max_deposit { if v <= 0 { return Err(VaultError::InvalidAmount); @@ -115,7 +117,7 @@ impl TimeLockVault { storage::set_deposit(&env, &depositor, deposit_id, &entry); storage::add_depositor(&env, &depositor); - events::deposit(&env, &depositor, &token, amount, unlock_time); + events::deposit(&env, &depositor, &token, deposit_id, amount, unlock_time); Ok(deposit_id) } @@ -177,13 +179,13 @@ impl TimeLockVault { storage::set_deposit(&env, &depositor, deposit_id, &entry); storage::add_depositor(&env, &depositor); - events::deposit(&env, &depositor, &token, amount, unlock_time); + events::deposit(&env, &depositor, &token, deposit_id, amount, unlock_time); Ok(deposit_id) } // ---------------------------------------------------------------- - // Core: Deposit by Ledger Sequence (Issue #88) + // Core: Deposit by Ledger Sequence // ---------------------------------------------------------------- pub fn deposit_by_ledger( @@ -229,7 +231,7 @@ impl TimeLockVault { storage::set_deposit_by_ledger(&env, &depositor, deposit_id, &entry); storage::add_depositor(&env, &depositor); - events::deposit(&env, &depositor, &token, amount, unlock_ledger as u64); + events::deposit(&env, &depositor, &token, deposit_id, amount, unlock_ledger as u64); Ok(deposit_id) } @@ -245,12 +247,14 @@ impl TimeLockVault { storage::get_deposit(&env, &depositor, deposit_id).ok_or(VaultError::NoDepositFound)?; let now = env.ledger().timestamp(); + // cancel_deposit is only valid *before* the unlock time. + // If the vault has already unlocked, the depositor should use `withdraw` instead. if now >= entry.unlock_time { - return Err(VaultError::FundsStillLocked); + return Err(VaultError::FundsAlreadyUnlocked); } storage::remove_deposit(&env, &depositor, deposit_id); - if storage::get_deposit_ids(&env, &depositor).len() == 0 { + if !storage::has_any_deposit(&env, &depositor) { storage::remove_depositor(&env, &depositor); } @@ -288,14 +292,14 @@ impl TimeLockVault { } storage::remove_deposit(&env, &depositor, deposit_id); - if storage::get_deposit_ids(&env, &depositor).len() == 0 { + if !storage::has_any_deposit(&env, &depositor) { storage::remove_depositor(&env, &depositor); } let token_client = token::Client::new(&env, &entry.token); token_client.transfer(&env.current_contract_address(), &depositor, &entry.amount); - events::withdraw(&env, &depositor, &entry.token, entry.amount); + events::withdraw(&env, &depositor, &entry.token, deposit_id, entry.amount); return Ok(()); } @@ -307,14 +311,14 @@ impl TimeLockVault { } storage::remove_deposit_by_ledger(&env, &depositor, deposit_id); - if storage::get_deposit_ids(&env, &depositor).len() == 0 { + if !storage::has_any_deposit(&env, &depositor) { storage::remove_depositor(&env, &depositor); } let token_client = token::Client::new(&env, &entry.token); token_client.transfer(&env.current_contract_address(), &depositor, &entry.amount); - events::withdraw(&env, &depositor, &entry.token, entry.amount); + events::withdraw(&env, &depositor, &entry.token, deposit_id, entry.amount); return Ok(()); } @@ -338,14 +342,14 @@ impl TimeLockVault { } storage::remove_deposit(&env, &depositor, deposit_id); - if storage::get_deposit_ids(&env, &depositor).len() == 0 { + if !storage::has_any_deposit(&env, &depositor) { storage::remove_depositor(&env, &depositor); } let token_client = token::Client::new(&env, &entry.token); token_client.transfer(&env.current_contract_address(), &recipient, &entry.amount); - events::withdraw_to(&env, &depositor, &recipient, &entry.token, entry.amount); + events::withdraw_to(&env, &depositor, &recipient, &entry.token, deposit_id, entry.amount); Ok(()) } @@ -366,17 +370,78 @@ impl TimeLockVault { .ok_or(VaultError::NoDepositFound)?; storage::remove_deposit(&env, &depositor, deposit_id); - if storage::get_deposit_ids(&env, &depositor).len() == 0 { + if !storage::has_any_deposit(&env, &depositor) { storage::remove_depositor(&env, &depositor); } let token_client = token::Client::new(&env, &entry.token); token_client.transfer(&env.current_contract_address(), &depositor, &entry.amount); - events::emergency_withdraw(&env, &admin, &depositor, &entry.token, entry.amount); + events::emergency_withdraw(&env, &admin, &depositor, &entry.token, deposit_id, entry.amount); Ok(()) } + /// Batch emergency withdrawal — processes multiple depositors in one call. + /// Best-effort: depositors with no active deposit are skipped (success=false). + /// Admin signs once for the entire batch. Max `MAX_BATCH_SIZE` entries. + pub fn batch_emergency_withdraw( + env: Env, + admin: Address, + depositors: Vec<(Address, u32)>, + ) -> Result