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

+6
View File
@@ -8,6 +8,7 @@ import os
from pathlib import Path
from django.core.exceptions import ImproperlyConfigured
from plm_engine.network import get_profile as network_profile
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -159,6 +160,11 @@ if LEDGER_BACKEND not in ("simulated", "chain"):
raise ImproperlyConfigured(f"LEDGER_BACKEND must be 'simulated' or 'chain', not {LEDGER_BACKEND!r}")
if LEDGER_BACKEND == "simulated" and PLM_NETWORK == "mainnet":
raise ImproperlyConfigured("the simulated ledger cannot run on mainnet (ADR-59)")
# ADR-58: mainnet is forbidden until the checks of phase C are closed; starting on it takes an explicit,
# separate confirmation, so a copied or mistyped PLM_NETWORK alone can never put real funds at stake.
if PLM_NETWORK == "mainnet" and os.environ.get("PLM_MAINNET_CONFIRMED", "") != "yes":
raise ImproperlyConfigured("PLM_NETWORK=mainnet needs PLM_MAINNET_CONFIRMED=yes (ADR-58): real funds are at stake")
PLM_PROFILE = network_profile(PLM_NETWORK)
# The simulated chain (ADR-59): a block every N seconds and a confirmation after M, so a whole round
# runs in a few minutes on localhost. Real chains ignore both.