B2: network profile for mainnet and regtest, explicit confirmation for mainnet (ADR-58, ELC-30)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5.5 committed 2026-11-16 15:38:29 +01:00
1 parent 3ee60a23da
commit 9c832fd3d2
16 files changed
+261 -36

No files matched your search

@@ -34,4 +34,7 @@ resta vietato finché le verifiche della Fase C non sono chiuse: l'avvio con
- I test di integrazione automatici possono usare il regtest locale.
- Requisiti: `ELC` e `REG` da aggiornare con l'implementazione.
*Codice:* da implementare · *Test:* da implementare
*Codice:* `plm_engine/network.py:Profile`, `MAINNET`, `REGTEST`, `plm_engine/address.py:is_valid_address`, `plm_engine/hd.py`, `config/settings.py` (`PLM_NETWORK`, `PLM_MAINNET_CONFIRMED`, `PLM_PROFILE`) ·
*Test:* `tests/django/test_network_profile.py`
*Stato (B2):* il profilo esiste e governa indirizzi, derivazione, genesis dell'handshake e soglia di lavoro; `mainnet` si avvia solo con `PLM_MAINNET_CONFIRMED=yes` e mai con il ledger simulato. Il nodo regtest vero arriva con B3.
+7 -3
View File
@@ -69,9 +69,13 @@ Le difese sono cinque.
supererebbe ogni controllo sugli header di [ELC-11]; solo il genesis lo
distingue. Un genesis diverso o assente, o un errore alla richiesta, fa
fallire la connessione come un server irraggiungibile ([ELC-02]); vale anche
per le connessioni del quorum ([ELC-14]).
*Codice:* `plm_engine/electrum/client.py:ElectrumClient._check_genesis`, `plm_engine/network.py:GENESIS_HASH` ·
*Test:* `tests/unit/test_electrum_client.py`
per le connessioni del quorum ([ELC-14]). Il genesis atteso è quello del
**profilo di rete** ([ADR-58](adr/ADR-58-alfa-su-regtest-profilo-di-rete-configurabile.md)):
`000000000019d668…ce26f` per `mainnet`, `0f9188f1…2206` per `regtest`
(`ElectrumClient(genesis_hash=…)`); il profilo fissa anche hrp, prefissi,
`powLimit` e coin type, e l'hrp è quello con cui si validano gli indirizzi.
*Codice:* `plm_engine/electrum/client.py:ElectrumClient._check_genesis`, `plm_engine/network.py:MAINNET`, `REGTEST` (profili) ·
*Test:* `tests/unit/test_electrum_client.py`, `tests/django/test_network_profile.py::test_the_handshake_expects_the_genesis_of_its_profile`
## 2. Richieste con limite di tempo
+2 -2
View File
@@ -4,7 +4,7 @@
## Project status (old stack)
All 10 stages of the original build order are code-complete and unit-tested — 1168 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 — 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.
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 1168 tests
python -m pytest # all 1181 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
```