docs: translate all code comments to English (language policy)

Translate every Italian /// XML doc comment, <!-- --> XAML comment, and
// inline comment to English across all source files (Core, App, tests).
Add the language policy to CLAUDE.md (conversation Italian; all code
and docs English). Update one test assertion that checked an Italian
exception message that was also translated.
This commit is contained in:
2026-06-16 14:40:06 +02:00
parent 4b82a0852c
commit 3d5a226a5a
59 changed files with 721 additions and 716 deletions
+32 -32
View File
@@ -1,7 +1,7 @@
namespace PalladiumWallet.Core.Chain;
/// <summary>
/// Tipo di rete supportato (selettore unico per tutto il wallet, blueprint §3).
/// Supported network type (single selector for the whole wallet, blueprint §3).
/// </summary>
public enum NetKind
{
@@ -11,7 +11,7 @@ public enum NetKind
}
/// <summary>
/// Tipo di script/indirizzo supportato (blueprint §4.3).
/// Supported script/address type (blueprint §4.3).
/// </summary>
public enum ScriptKind
{
@@ -21,7 +21,7 @@ public enum ScriptKind
/// <summary>P2SH-P2WPKH (segwit wrapped).</summary>
WrappedSegwit,
/// <summary>P2WPKH (native segwit) — default consigliato.</summary>
/// <summary>P2WPKH (native segwit) — recommended default.</summary>
NativeSegwit,
/// <summary>P2SH-P2WSH (multisig wrapped).</summary>
@@ -35,15 +35,15 @@ public enum ScriptKind
}
/// <summary>
/// Coppia di header di versione BIP32 (4 byte big-endian) per serializzare
/// xprv/xpub e varianti SLIP-132 (y/z/Y/Z) — blueprint §3.
/// Pair of BIP32 version headers (4-byte big-endian) to serialize
/// xprv/xpub and SLIP-132 variants (y/z/Y/Z) — blueprint §3.
/// </summary>
public readonly record struct ExtKeyHeaders(uint Private, uint Public)
{
/// <summary>Header privato come 4 byte big-endian (da anteporre al payload BIP32).</summary>
/// <summary>Private header as 4 big-endian bytes (to prepend to the BIP32 payload).</summary>
public byte[] PrivateBytes() => ToBytes(Private);
/// <summary>Header pubblico come 4 byte big-endian.</summary>
/// <summary>Public header as 4 big-endian bytes.</summary>
public byte[] PublicBytes() => ToBytes(Public);
internal static byte[] ToBytes(uint header) =>
@@ -56,82 +56,82 @@ public readonly record struct ExtKeyHeaders(uint Private, uint Public)
}
/// <summary>
/// Server di indicizzazione di bootstrap: host + porta TCP + porta SSL (blueprint §3/§9).
/// Bootstrap indexing server: host + TCP port + SSL port (blueprint §3/§9).
/// </summary>
public readonly record struct ServerEndpoint(string Host, int TcpPort, int SslPort);
/// <summary>
/// Checkpoint di catena: ancora la fiducia quando la verifica PoW è disattivata
/// (blueprint §7.3). Target serializzato come "bits" compatti.
/// Chain checkpoint: anchors trust when PoW validation is disabled
/// (blueprint §7.3). Target serialized as compact "bits".
/// </summary>
public readonly record struct Checkpoint(int Height, string BlockHash, uint Bits);
/// <summary>
/// Profilo di rete/catena (blueprint §3): tutte le costanti specifiche della catena,
/// centralizzate in un solo punto. Nessun magic number altrove nel codice.
/// Network/chain profile (blueprint §3): all chain-specific constants,
/// centralized in one place. No magic numbers elsewhere in the code.
/// </summary>
public sealed record ChainProfile
{
public required NetKind Kind { get; init; }
/// <summary>Nome rete, usato anche come sottocartella dati.</summary>
/// <summary>Network name, also used as the data subfolder.</summary>
public required string NetName { get; init; }
/// <summary>Simbolo dell'unità (es. PLM).</summary>
/// <summary>Unit symbol (e.g. PLM).</summary>
public required string CoinUnit { get; init; }
/// <summary>Prefisso WIF delle chiavi private.</summary>
/// <summary>WIF prefix for private keys.</summary>
public required byte WifPrefix { get; init; }
/// <summary>Byte di versione indirizzi P2PKH.</summary>
/// <summary>Version byte for P2PKH addresses.</summary>
public required byte AddrP2pkh { get; init; }
/// <summary>Byte di versione indirizzi P2SH.</summary>
/// <summary>Version byte for P2SH addresses.</summary>
public required byte AddrP2sh { get; init; }
/// <summary>Human-readable part bech32/bech32m.</summary>
public required string SegwitHrp { get; init; }
/// <summary>HRP fatture BOLT11 (Lightning, fase successiva — §11).</summary>
/// <summary>HRP for BOLT11 invoices (Lightning, later phase — §11).</summary>
public required string Bolt11Hrp { get; init; }
/// <summary>Hash del blocco genesi (hex, byte order da explorer).</summary>
/// <summary>Genesis block hash (hex, explorer byte order).</summary>
public required string GenesisHash { get; init; }
/// <summary>Porta TCP del server di indicizzazione (non è la porta P2P del nodo).</summary>
/// <summary>TCP port of the indexing server (not the node's P2P port).</summary>
public required int DefaultTcpPort { get; init; }
/// <summary>Porta SSL del server di indicizzazione.</summary>
/// <summary>SSL port of the indexing server.</summary>
public required int DefaultSslPort { get; init; }
/// <summary>Porta P2P del nodo — solo informativa: il wallet SPV non la usa.</summary>
/// <summary>Node's P2P port — informational only: the SPV wallet does not use it.</summary>
public required int NodeP2pPort { get; init; }
/// <summary>Coin type SLIP-0044 nei derivation path (convenzione wallet).</summary>
/// <summary>SLIP-0044 coin type in derivation paths (wallet convention).</summary>
public required int Bip44CoinType { get; init; }
/// <summary>Schema URI pagamenti BIP21 (senza i due punti).</summary>
/// <summary>BIP21 payment URI scheme (without the colon).</summary>
public required string UriScheme { get; init; }
/// <summary>Block explorer di default.</summary>
/// <summary>Default block explorer.</summary>
public required string ExplorerUrl { get; init; }
/// <summary>
/// La catena usa LWMA (retargeting per-blocco, 2 minuti): un client SPV non può
/// ricalcolarla, quindi la verifica bits/target va saltata e la fiducia ancorata
/// ai checkpoint (§3/§7). Per la catena di riferimento è sempre true.
/// The chain uses LWMA (per-block retargeting, 2 minutes): an SPV client cannot
/// recompute it, so bits/target validation must be skipped and trust anchored
/// to checkpoints (§3/§7). For the reference chain it is always true.
/// </summary>
public required bool SkipPowValidation { get; init; }
/// <summary>Tempo di blocco target in secondi (LWMA v2: 120s).</summary>
/// <summary>Target block time in seconds (LWMA v2: 120s).</summary>
public required int BlockTimeSeconds { get; init; }
/// <summary>Header BIP32/SLIP-132 per ciascun tipo di script.</summary>
/// <summary>BIP32/SLIP-132 headers for each script type.</summary>
public required IReadOnlyDictionary<ScriptKind, ExtKeyHeaders> ExtKeyHeaders { get; init; }
/// <summary>Server di indicizzazione per il primo contatto (bootstrap).</summary>
/// <summary>Indexing servers for first contact (bootstrap).</summary>
public required IReadOnlyList<ServerEndpoint> BootstrapServers { get; init; }
/// <summary>Checkpoint hardcoded, aggiornati a ogni release (§7.3).</summary>
/// <summary>Hardcoded checkpoints, updated at every release (§7.3).</summary>
public required IReadOnlyList<Checkpoint> Checkpoints { get; init; }
}
+14 -14
View File
@@ -1,8 +1,8 @@
namespace PalladiumWallet.Core.Chain;
/// <summary>
/// I tre profili di rete del wallet (blueprint §3). Valori mainnet verificati
/// contro il sorgente del nodo (chainparams.cpp / pow.cpp) secondo il blueprint.
/// The wallet's three network profiles (blueprint §3). Mainnet values verified
/// against the node source (chainparams.cpp / pow.cpp) per the blueprint.
/// </summary>
public static class ChainProfiles
{
@@ -12,11 +12,11 @@ public static class ChainProfiles
NetName = "mainnet",
CoinUnit = "PLM",
WifPrefix = 0x80,
AddrP2pkh = 55, // indirizzi che iniziano con 'P'
AddrP2sh = 5, // indirizzi che iniziano con '3'
AddrP2pkh = 55, // addresses starting with 'P'
AddrP2sh = 5, // addresses starting with '3'
SegwitHrp = "plm",
Bolt11Hrp = "plm",
// La mainnet riusa la genesi di Bitcoin (blueprint §3).
// Mainnet reuses Bitcoin's genesis (blueprint §3).
GenesisHash = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
DefaultTcpPort = 50001,
DefaultSslPort = 50002,
@@ -33,11 +33,11 @@ public static class ChainProfiles
[ScriptKind.WrappedSegwitMultisig] = new(0x0295b005, 0x0295b43f), // Yprv / Ypub
[ScriptKind.NativeSegwit] = new(0x04b2430c, 0x04b24746), // zprv / zpub
[ScriptKind.NativeSegwitMultisig] = new(0x02aa7a99, 0x02aa7ed3), // Zprv / Zpub
// Nessun SLIP-132 per P2TR: il contesto è dato dal path m/86'/…
// No SLIP-132 for P2TR: the context is given by the m/86'/… path
[ScriptKind.Taproot] = new(0x0488ade4, 0x0488b21e), // xprv / xpub (BIP32 standard)
},
// Server di indicizzazione noti per il primo contatto (§3/§9); altri
// peer vengono scoperti via server.peers.subscribe.
// Known indexing servers for first contact (§3/§9); other
// peers are discovered via server.peers.subscribe.
BootstrapServers =
[
new ServerEndpoint("173.212.224.67", 50001, 50002),
@@ -45,7 +45,7 @@ public static class ChainProfiles
new ServerEndpoint("66.94.115.80", 50001, 50002),
new ServerEndpoint("89.117.149.130", 50001, 50002),
],
// TODO: popolare con [hash, bits] reali della catena (§7.3) prima della release.
// TODO: populate with the chain's real [hash, bits] (§7.3) before release.
Checkpoints = [],
};
@@ -58,15 +58,15 @@ public static class ChainProfiles
AddrP2sh = 115,
SegwitHrp = "tplm",
Bolt11Hrp = "tplm",
// TODO: verificare contro chainparams.cpp del nodo (il blueprint non la riporta;
// qui si assume la genesi di Bitcoin testnet3, da confermare).
// TODO: verify against the node's chainparams.cpp (the blueprint does not report it;
// here Bitcoin testnet3 genesis is assumed, to be confirmed).
GenesisHash = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
NodeP2pPort = 12333,
Bip44CoinType = 1,
ExtKeyHeaders = new Dictionary<ScriptKind, ExtKeyHeaders>
{
// tprv/tpub dal blueprint; le varianti SLIP-132 testnet (u/v/U/V) sono
// i valori standard Electrum.
// tprv/tpub from the blueprint; the testnet SLIP-132 variants (u/v/U/V) are
// the standard Electrum values.
[ScriptKind.Legacy] = new(0x04358394, 0x043587cf), // tprv / tpub
[ScriptKind.WrappedSegwit] = new(0x044a4e28, 0x044a5262), // uprv / upub
[ScriptKind.WrappedSegwitMultisig] = new(0x024285b5, 0x024289ef), // Uprv / Upub
@@ -84,7 +84,7 @@ public static class ChainProfiles
NetName = "regtest",
SegwitHrp = "rplm",
Bolt11Hrp = "rplm",
// TODO: verificare contro chainparams.cpp del nodo (assunta genesi regtest Bitcoin).
// TODO: verify against the node's chainparams.cpp (Bitcoin regtest genesis assumed).
GenesisHash = "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206",
NodeP2pPort = 28444,
Checkpoints = [],
+16 -16
View File
@@ -4,13 +4,13 @@ using NBitcoin.DataEncoders;
namespace PalladiumWallet.Core.Chain;
/// <summary>
/// Costruisce e registra le <see cref="Network"/> NBitcoin di Palladium a partire dai
/// <see cref="ChainProfiles"/> (blueprint §19.3). Tutto il resto del codice ottiene la
/// rete da qui, mai da costanti sparse.
/// Builds and registers the Palladium NBitcoin <see cref="Network"/> instances from the
/// <see cref="ChainProfiles"/> (blueprint §19.3). All other code obtains the network
/// from here — never from scattered constants.
/// </summary>
/// <summary>
/// Identità della moneta per NBitcoin: raggruppa le tre reti sotto il codice PLM.
/// I getter sono lazy, quindi nessuna ricorsione durante la costruzione.
/// Coin identity for NBitcoin: groups the three networks under the PLM code.
/// Getters are lazy, so no recursion occurs during construction.
/// </summary>
public sealed class PalladiumNetworkSet : INetworkSet
{
@@ -34,13 +34,13 @@ public sealed class PalladiumNetworkSet : INetworkSet
public static class PalladiumNetworks
{
// Blocco genesi di Bitcoin (la mainnet Palladium lo riusa, blueprint §3).
// Bitcoin genesis block (Palladium mainnet reuses it, blueprint §3).
private const string MainGenesisHex =
"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c" +
Coinbase;
// Genesi testnet3/regtest di Bitcoin: stessa coinbase, cambiano time/bits/nonce.
// TODO: confermare contro chainparams.cpp del nodo (vedi ChainProfiles).
// Bitcoin testnet3/regtest genesis: same coinbase, different time/bits/nonce.
// TODO: confirm against the node's chainparams.cpp (see ChainProfiles).
private const string TestGenesisHex =
"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18" +
Coinbase;
@@ -81,9 +81,9 @@ public static class PalladiumNetworks
NetKind.Testnet => ChainName.Testnet,
_ => ChainName.Regtest,
})
// Magic P2P solo segnaposto: il wallet SPV non apre mai connessioni P2P
// (parla solo col server di indicizzazione, §3). Serve a NBitcoin per
// distinguere le reti registrate.
// P2P magic is a placeholder only: the SPV wallet never opens P2P connections
// (it only talks to the indexing server, §3). Required by NBitcoin to
// distinguish registered networks.
.SetMagic(magic)
.SetPort(p.NodeP2pPort)
.SetRPCPort(p.NodeP2pPort + 1)
@@ -91,9 +91,9 @@ public static class PalladiumNetworks
.SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, [p.AddrP2pkh])
.SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, [p.AddrP2sh])
.SetBase58Bytes(Base58Type.SECRET_KEY, [p.WifPrefix])
// NBitcoin gestisce una sola coppia di header BIP32 per rete: quella
// standard xprv/xpub. Le varianti SLIP-132 (y/z/Y/Z) si serializzano
// a mano con ChainProfile.ExtKeyHeaders quando servono.
// NBitcoin handles only one BIP32 header pair per network: the standard
// xprv/xpub. SLIP-132 variants (y/z/Y/Z) are serialised manually via
// ChainProfile.ExtKeyHeaders when needed.
.SetBase58Bytes(Base58Type.EXT_SECRET_KEY, legacy.PrivateBytes())
.SetBase58Bytes(Base58Type.EXT_PUBLIC_KEY, legacy.PublicBytes())
.SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, Encoders.Bech32(p.SegwitHrp))
@@ -102,8 +102,8 @@ public static class PalladiumNetworks
.SetUriScheme(p.UriScheme)
.SetConsensus(new Consensus
{
// Valori usati solo dalle API NBitcoin che li richiedono: la validazione
// header reale è custom (Core/Spv) con skip PoW + checkpoint (§7).
// Values used only by NBitcoin APIs that require them: real header
// validation is custom (Core/Spv) with PoW skip + checkpoints (§7).
PowLimit = new Target(new uint256("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
PowTargetSpacing = TimeSpan.FromSeconds(p.BlockTimeSeconds),
PowTargetTimespan = TimeSpan.FromDays(14),