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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions tests/backend-e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,15 @@ ctx().await --> OnceCell::get_or_init(BackendTestContext::init)
testnet with SPV running
- **`framework_wallet_hash`** -- the `WalletSeedHash` of the "bank" wallet used
to fund per-test wallets
- **`_workdir`** -- path to a persistent temp directory keyed by git revision
(e.g., `/tmp/dash-evo-e2e-testnet-abc1234`)
- **`_workdir`** -- path to a persistent temp directory (e.g.,
`/tmp/dash-evo-e2e-testnet`, or a numbered fallback slot; see "Persistent
workdir" below -- not git-rev-keyed)

### Initialization sequence

1. Initialize tracing subscriber for structured log output.
2. Create a persistent workdir under `/tmp/` keyed by `git rev-parse --short HEAD`.
2. Create a persistent workdir under `/tmp/` (deterministic path, with numbered
fallback slots guarded by a `.lock` file -- see "Persistent workdir" below).
3. Copy `.env.example` into the workdir via `ensure_env_file()`.
4. Create a SQLite database and `AppContext` for `Network::Testnet`, passing the workdir as `data_dir`.
5. Start SPV in light-client mode and wait for peer connections (60s timeout).
Expand All @@ -110,18 +112,22 @@ ctx().await --> OnceCell::get_or_init(BackendTestContext::init)

### Persistent workdir

The workdir survives across test runs for the same git revision. This means:
The workdir is deterministic, not git-rev-keyed: it's always
`<tmp>/dash-evo-e2e-testnet` (slot 0), with numbered fallback slots
(`dash-evo-e2e-testnet-1`, `-2`, ...) that `pick_available_workdir` cycles
through via a per-slot `.lock` file when an earlier slot is still locked by
another process (see `framework/harness.rs`). This means:

- The SQLite database is reused, so wallets registered in prior runs are already
present.
- The SQLite database is reused across runs, so wallets registered previously
are already present, regardless of which commit produced them.
- The framework wallet registration handles the "already imported" case
gracefully.
- SPV sync is faster on repeat runs because prior state may be cached.

Clean the workdir manually if you need a fresh start:

```bash
rm -rf /tmp/dash-evo-e2e-testnet-*
rm -rf /tmp/dash-evo-e2e-testnet*
```

## Wallet architecture
Expand Down Expand Up @@ -182,14 +188,32 @@ Located in `tests/backend-e2e/framework/`:

## Test modules

Registered in `tests/backend-e2e/main.rs` -- that file is the authoritative
list; keep this table in sync when adding or removing a module.

| Module | What it tests |
|---|---|
| `spv_wallet` | SPV sync, wallet creation and registration, DB persistence |
| `send_funds` | Core payment between two wallets (send and return) |
| `cleanup_only` | Standalone cleanup -- sweeps orphaned test wallets on init |
| `fetch_contract` | Platform contract queries (DashPay, non-existent ID, with descriptions) |
| `identity_create` | Identity registration funded from a wallet |
| `register_dpns` | Full flow: identity creation, DPNS name registration, name search verification |
| `identity_masternode_withdraw` | Headless masternode/evonode load + credit withdrawal |
| `identity_withdraw` | Identity credit withdrawal to a Core address |
| `register_dpns` | Full flow: identity creation, DPNS name registration, name search verification |
| `send_funds` | Core payment between two wallets (send and return) |
| `spv_wallet` | SPV sync, wallet creation and registration, DB persistence |
| `tx_is_ours` | `is_ours` flag correctness for SPV transactions |
| `identity_cold_boot` | Identity funding on a cold-booted watch-only wallet (scenarios C/D) |
| `spv_reconnect` | SPV reconnect regression (`stop_spv` + `ensure_wallet_backend_and_start_spv`) |
| `core_tasks` | `CoreTask` variants (TC-001 to TC-012) |
| `cross_wallet_topup` | Cross-wallet identity top-up, including spent-lock reuse rejection (#954/#956) |
| `event_bridge_live` | Live `EventBridge` wiring: SPV sync -> `ConnectionStatus` -> frame-loop repaint |
| `identity_in_vault_sign` | TS-SIGN-E2E-01 -- state transition signed by a migrated `InVault` identity key |
| `identity_tasks` | `IdentityTask` variants (TC-020 to TC-030) |
| `shielded_tasks` | `ShieldedTask` variants (TC-074 to TC-083); skippable via `E2E_SKIP_SHIELDED` |
| `token_tasks` | Full token lifecycle: registration, query, mint, burn (TC-045 to TC-065) |
| `wallet_reregistration` | Wallets re-register with upstream SPV so received funds stay visible |
| `wallet_tasks` | `WalletTask` variants (TC-012 to TC-019) |
| `z_broadcast_st_tasks` | `BroadcastStateTransition` (TC-066, TC-067) |

## Writing new tests

Expand Down
35 changes: 7 additions & 28 deletions tests/backend-e2e/core_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::framework::fixtures;
use crate::framework::harness::ctx;
use crate::framework::task_runner::run_task;
use crate::framework::task_runner::{expect_asset_lock_broadcast, run_task};
use dash_evo_tool::backend_task::core::{CoreTask, PaymentRecipient, WalletPaymentRequest};
use dash_evo_tool::backend_task::{BackendTask, BackendTaskSuccessResult};
use dash_evo_tool::model::wallet::single_key::SingleKeyWallet;
Expand Down Expand Up @@ -140,15 +140,8 @@ async fn test_tc004_create_registration_asset_lock() {
.await
.expect("CreateRegistrationAssetLock should succeed");

match result {
BackendTaskSuccessResult::Message(msg) => {
tracing::info!("TC-004: asset lock broadcast message: {}", msg);
}
other => panic!(
"TC-004: expected Message from CreateRegistrationAssetLock, got: {:?}",
other
),
}
let txid = expect_asset_lock_broadcast(result, "TC-004");
tracing::info!("TC-004: asset lock broadcast in {}", txid);
}

// TC-005: CreateTopUpAssetLock
Expand Down Expand Up @@ -181,15 +174,8 @@ async fn test_tc005_create_top_up_asset_lock() {
.await
.expect("CreateTopUpAssetLock should succeed");

match result {
BackendTaskSuccessResult::Message(msg) => {
tracing::info!("TC-005: asset lock broadcast message: {}", msg);
}
other => panic!(
"TC-005: expected Message from CreateTopUpAssetLock, got: {:?}",
other
),
}
let txid = expect_asset_lock_broadcast(result, "TC-005");
tracing::info!("TC-005: asset lock broadcast in {}", txid);
}

// TC-006: RecoverAssetLocks — REMOVED (Decision #8: hard-removed; upstream
Expand Down Expand Up @@ -431,13 +417,6 @@ async fn test_tc012_create_registration_asset_lock_late_added_wallet() {
.await
.expect("CreateRegistrationAssetLock should succeed for a freshly-added, funded wallet");

match result {
BackendTaskSuccessResult::Message(msg) => {
tracing::info!("TC-012: asset lock broadcast message: {}", msg);
}
other => panic!(
"TC-012: expected Message from CreateRegistrationAssetLock, got: {:?}",
other
),
}
let txid = expect_asset_lock_broadcast(result, "TC-012");
tracing::info!("TC-012: asset lock broadcast in {}", txid);
}
Loading
Loading