B3: attach to the local regtest node and Fulcrum; smoke tests, helper script and fixtures
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c832fd3d2
commit
0092596b07
9 files changed
+273
-6
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
## Project status (old stack)
|
||||
|
||||
All 10 stages of the original build order are code-complete and unit-tested — 1181 tests, the old stack's under `tests/unit/` and the Django ones under `tests/django/` (`tests/integration/` is an empty package). Beyond them: Docker + Caddy deployment, admin dashboard (`/admin`), static test UI (`/`), pending-inclusive balance display, an SSE push channel layered over the original polling, self-service password change + admin password reset, and the reconciliation/corroboration machinery below.
|
||||
All 10 stages of the original build order are code-complete and unit-tested — 1187 tests, the old stack's under `tests/unit/` and the Django ones under `tests/django/` (`tests/integration/` needs the local regtest node and skips itself without it). Beyond them: Docker + Caddy deployment, admin dashboard (`/admin`), static test UI (`/`), pending-inclusive balance display, an SSE push channel layered over the original polling, self-service password change + admin password reset, and the reconciliation/corroboration machinery below.
|
||||
|
||||
Verified on mainnet with real money: registration + address derivation, deposit crediting (at the time, 1-conf; deposits now need `deposit_confirmations`), a real 10 PLM bet (broadcast → confirmed → change credited back), and one full round cycle (close → draw on a real block hash → 70/30 payout with sat math checked against the broadcast tx → confirmation → close → next round auto-opened). **Withdrawal and the RBF bump path have never been exercised against a live broadcast** — unit-tested only.
|
||||
|
||||
@@ -30,7 +30,7 @@ PYTHONPATH=. python scripts/decrypt_master_key.py # ops recovery: decrypt+pr
|
||||
PYTHONPATH=. python scripts/encrypt_master_key.py # ops bootstrap: import an externally-generated xprv (--overwrite to replace)
|
||||
PYTHONPATH=. python scripts/electrum_smoke_test.py # manual check: connect, handshake, subscribe to headers, print the tip
|
||||
|
||||
python -m pytest # all 1181 tests
|
||||
python -m pytest # all 1187 tests
|
||||
python -m pytest tests/unit/test_hd.py # one file
|
||||
python -m pytest tests/unit/test_hd.py::test_derivation_is_deterministic # one test
|
||||
```
|
||||
@@ -253,6 +253,6 @@ Accepted **by design** — distinct from the audit findings above (all fixed), w
|
||||
- **Admin auth is one shared bearer token** (`ADMIN_TOKEN`) with no per-admin identity: `audit_log` records *what* changed (config edits as `config_updated`, with before/after) but never *who* did it. It gates the user list, privkey export, password resets and history, so a leak is high-blast-radius.
|
||||
- **No rate limiting on bet, withdrawal, admin or SSE.** Login has a per-username + per-IP failure throttle and registration a per-IP quota of 5 accounts/hour (`app/auth/rate_limit.py`: `RateLimiter` for failed guesses at a secret, `RollingQuota` for "how many of these may one source create" — B-33, B-58); everything else is unlimited.
|
||||
- **`/guida` is a placeholder** (`app/static/guida.html`) — the link works, the content is "coming soon". `/report-bug` is *not*: it is fully implemented and translated, with admin triage (see Frontends).
|
||||
- **No integration tests against a live Electrum connection.** `tests/integration/` is empty; live verification has all been manual (`scripts/electrum_smoke_test.py`, ad hoc scripts, real mainnet txs).
|
||||
- **No integration tests against a live Electrum connection.** the old stack has none (since B3 `tests/integration/` holds smoke tests against a local regtest, not against the old code); live verification has all been manual (`scripts/electrum_smoke_test.py`, ad hoc scripts, real mainnet txs).
|
||||
- **Single-process assumptions**: the SSE broadcaster and the per-user locks are in-process only. A multi-worker deployment needs a shared channel and a DB/Redis lock. The round-uniqueness invariant is *not* in this category — it's a DB index.
|
||||
|
||||
@@ -23,6 +23,19 @@ docker compose up -d --build
|
||||
5. Verifica a mano su telefono e desktop: [checklist-verifica-sito.md](checklist-verifica-sito.md). Test automatici: `python -m pytest`.
|
||||
6. Spegnere: `docker compose down` (i dati restano in `data/db`).
|
||||
|
||||
### Regtest per i test di integrazione (da B3)
|
||||
|
||||
Nodo e Fulcrum in regtest stanno nella cartella `plm-regtest` accanto al repository (`docker compose up -d` lì); il sito non li avvia. I test sotto `tests/integration/` si agganciano a loro e **si saltano** se non rispondono. Per default cercano l'RPC su `http://127.0.0.1:18332` (credenziali da `plm-regtest/node/palladium.conf`) e Fulcrum su `127.0.0.1:50001`; si cambiano con `PLM_REGTEST_RPC_URL`, `PLM_REGTEST_RPC_USER`, `PLM_REGTEST_RPC_PASSWORD`, `PLM_REGTEST_CONF` e `PLM_REGTEST_ELECTRUM`.
|
||||
|
||||
```bash
|
||||
python scripts/regtest.py status # catena, altezza, saldo del portafoglio del nodo, Fulcrum
|
||||
python scripts/regtest.py mine 10 # mina 10 blocchi
|
||||
python scripts/regtest.py fund rplm1… 5 # manda 5 PLM a un indirizzo e mina un blocco
|
||||
python -m pytest tests/integration # i test sulla catena vera
|
||||
```
|
||||
|
||||
Lo script e i test rifiutano di agire su una catena che non sia regtest.
|
||||
|
||||
---
|
||||
|
||||
> **Nota (migrazione a Django).** Il resto di questa guida descrive il vecchio stack FastAPI, non più nel `docker-compose.yml`.
|
||||
|
||||
Reference in new issue
Block a user