feat(npos): FIX-6 Stage 2b Paso A — pallet_staking Config cableado (infra dormida)
Materializa la infra NPoS DORMIDA del DC ORIGIN_CHAIN_NPOS_V1 (decisiones de fundador ratificadas). pallet_staking 43.0.0 wired como Index 14: los 31 associated types cableados contra el tren stable2509-3 (mapeo quirúrgico audit-before-claims; compiló en 2 iteraciones). Piezas (crates/origin-chain-runtime/src/staking.rs, nuevo): - OriginEraPayout: emisión por-era LINEAL que preserva EXACTAMENTE la tasa de FIX-6 Stage 1 (BlockReward 10 OGC/bloque, 70% validadores / 30% rest). NO la curva ideal-staking-rate de Polkadot (ignora total_staked/issuance a propósito). - DealWithEraRemainder (RewardRemainder): reparte el rest 2/3 treasury (og/gvtry) + 1/3 subsidy (og/subsy) = 20%/10% del total. CRÍTICO #16: mantiene og/subsy alimentado bajo NPoS (sin él, el OriginFeeAdapter de Stage 2a degradaría a pool_covered=0 y el usuario pagaría el 100%). - OnChainExecution<OnChainSeqPhragmen> como (Genesis)ElectionProvider (dormido: ForceNone no dispara elección). VoterList=UseNominatorsAndValidatorsMap + TargetList=UseValidatorsMap (Scores distintos, evitan bags-list + sus asserts). - Params ratificados: MaxValidatorSet=150 (NPoS-6) · SessionsPerEra=6 (era 24h) · BondingDuration=7 eras=7d (NPoS-8) · SlashDeferDuration=0 (sin slashes dormido). - fungible::hold (NPoS-10): Currency/OldCurrency=Balances; el RuntimeHoldReason agregado del macro absorbe HoldReason::Staking automáticamente. Estado: staking PRESENTE pero INERTE — SessionInterface/NextNewSession=() (no avanza eras), genesis force_era=ForceNone sin stakers (PoA-equivalente, cero regresión). El emission pallet Index 13 sigue siendo la fuente de emisión. NO hay doble-emisión (staking no emite mientras no avance eras). Pendiente (sesión fresca, encienden NPoS de verdad → verificación adversarial): Paso B genesis poblado (invulnerables+stakers, asserts-trampa) · Paso C SessionManager=Staking + historical (enciende EraPayout) · Paso D emission on_initialize off (kill-switch anti-doble-emisión) · Paso E tests E2E. spec_version 2→3 (nuevo pallet ⇒ metadata; TRANSACTION_VERSION=1 intacto). 21 suites workspace verde. cargo +1.88. WASM VPS-gated (UnknownOpcode 252). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
440135293e
commit
1f0122beda
5 files changed
+313
-9
No files matched your search
@@ -45,6 +45,8 @@ extern crate alloc;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
pub mod configs;
|
||||
/// FIX-6 Stage 2b NPoS — pallet_staking config (infra dormida).
|
||||
pub mod staking;
|
||||
#[cfg(feature = "std")]
|
||||
pub mod genesis_config_presets;
|
||||
pub mod opaque;
|
||||
@@ -225,7 +227,9 @@ pub const IMPL_NAME: &str = "origin-chain-charon";
|
||||
/// v2: FIX-6 Stage 2a — fee unificado (OriginFeeAdapter reemplaza al
|
||||
/// FungibleAdapter: cambia el COMPORTAMIENTO del cobro de fees, no el formato
|
||||
/// de extrinsic — TRANSACTION_VERSION intacto).
|
||||
pub const RUNTIME_VERSION: u32 = 2;
|
||||
/// v3: FIX-6 Stage 2b NPoS Paso A — pallet_staking Index 14 cableado (infra
|
||||
/// DORMIDA: presente pero inerte; nuevo pallet ⇒ cambia metadata del runtime).
|
||||
pub const RUNTIME_VERSION: u32 = 3;
|
||||
|
||||
/// Canonical authoring version per Substrate semver canonical.
|
||||
pub const AUTHORING_VERSION: u32 = 1;
|
||||
@@ -387,6 +391,15 @@ mod runtime {
|
||||
#[runtime::pallet_index(13)]
|
||||
pub type Emission = origin_chain_emission::Pallet<Runtime>;
|
||||
|
||||
/// Staking pallet (FIX-6 Stage 2b NPoS, DC ORIGIN_CHAIN_NPOS_V1). **Infra
|
||||
/// DORMIDA**: la maquinaria NPoS está cableada pero el set de validadores
|
||||
/// arranca fijo (invulnerables + ForceEra::ForceNone) — la cadena corre
|
||||
/// PoA-equivalente hasta los 5 criterios de Phase 2 (CHN-1). La emisión
|
||||
/// migra a EraPayout (preserva la tasa de Stage 1). Activación de la
|
||||
/// elección-por-stake = governance flag (ForceNew) post-gates.
|
||||
#[runtime::pallet_index(14)]
|
||||
pub type Staking = pallet_staking::Pallet<Runtime>;
|
||||
|
||||
// Substrate pallet-identity DEFERRED canonical (decision empírica
|
||||
// 2026-05-21 documentada en configs.rs). pallet-identity 41.0.0 ReservableCurrency
|
||||
// compat work canonical hereda al custom `pallet_agent_identity` Phase 2.7
|
||||
@@ -797,13 +810,22 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn runtime_version_v2_fee_unificado() {
|
||||
// v2 = FIX-6 Stage 2a (fee unificado). El formato de extrinsic NO
|
||||
// cambió: solo el associated type OnChargeTransaction.
|
||||
assert_eq!(RUNTIME_VERSION, 2);
|
||||
fn runtime_version_v3_npos_staking_dormant() {
|
||||
// v3 = FIX-6 Stage 2b NPoS Paso A (pallet_staking Index 14, infra
|
||||
// dormida). El formato de extrinsic NO cambió.
|
||||
assert_eq!(RUNTIME_VERSION, 3);
|
||||
assert_eq!(TRANSACTION_VERSION, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn staking_pallet_index_14_npos_dormant() {
|
||||
use frame_support::traits::PalletInfoAccess;
|
||||
// FIX-6 Stage 2b: Staking=14 (post Emission=13). Infra NPoS dormida —
|
||||
// presente pero el set sigue fijo (PoA-equivalente) hasta los gates CHN-1.
|
||||
assert_eq!(<crate::Staking as PalletInfoAccess>::index(), 14);
|
||||
assert_eq!(<crate::Staking as PalletInfoAccess>::name(), "Staking");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn canonical_spec_name_origin_chain() {
|
||||
assert_eq!(SPEC_NAME, "origin-chain");
|
||||
|
||||
Reference in new issue
Block a user