feat(consensus): Phase 1.4 — Consensus PoA canonical Aura+GRANDPA v0.0.6

Origin Chain runtime canonical ahora produces blocks + finalizes via
Aura+GRANDPA per CHN-1 ratified. PoA Phase 1 substrate fundación bien anclada.

## Pallets añadidos canonical (per SBS-4)

- Index 4 Aura (pallet_aura 39.0.0) — block production canonical PoA per CHN-1
  Round-Robin 6-segundo slots alineados Pi 5 + NVMe SSD. AuraId sr25519.
- Index 5 Grandpa (pallet_grandpa 40.0.0) — finality gadget per CHN-1
  2/3 honest majority irreversible confirmation. GrandpaId Ed25519.

## Primitives consumidas
- sp-consensus-aura 0.42.0 (feature serde canonical)
- sp-consensus-grandpa 23.0.0 → 23.1.0 (feature serde canonical)

## Configs canonical
- pallet_aura::Config: MaxAuthorities 32 + AllowMultipleBlocksPerSlot false
  + SlotDuration = MinimumPeriodTimesTwo (clock↔consensus coupling canonical)
- pallet_grandpa::Config: MaxAuthorities 32 + MaxNominators 0 + KeyOwnerProof
  Void + EquivocationReportSystem () (Phase 1 simple, real Phase 2 NPoS)

## Wiring canonical clock↔consensus
pallet_timestamp::OnTimestampSet = crate::Aura (was ()) — cada nuevo
timestamp triggera Aura slot advance canonical. Materializa 6-segundo block
production deterministic Pi 5.

## Opaque SessionKeys canonical (nuevo opaque.rs module)
impl_opaque_keys! con aura (sr25519) + grandpa (Ed25519) — substrate canonical
pattern para forkless runtime upgrades. Cada validator posee 2 keys canonical.
Pre-Phase 1.5: static keys en genesis chain_spec. Phase 1.5: pallet_session
introduces rotation 4h epochs per CHN-1.

## Filosofía canonical
opaque.rs cita David canon 2026-05-14 "la libertad infinita acota solo donde
empieza la del otro" — opaque types son la frontera canonical entre node
sovereignty + runtime sovereignty. Each layer respeta la libertad del otro.

## Build + tests
- cargo check 6.17s warm cache (Aura+Grandpa deps incremental)
- cargo build --release 8.64s warm cache clean
- ~57 tests passing (count preserved — Aura/Grandpa tests llegan Phase 1.5+)

## Edge case empírico
pallet-aura 39.0.0 + pallet-grandpa 40.0.0 NO exponen feature
runtime-benchmarks en stable2512 canonical. Wire-up benchmark scaffolding
land Phase 1.5+ cuando pallet_session se integre.

## Phase 1 progress
1.1 ✅ + 1.2 ✅ + 1.3 ✅ + 1.4 ✅ (esta). Next: 1.5 pallet_session validator
rotation 4h epochs per CHN-1.

Origin Chain runtime composition canonical actual (6 pallets):
- 0 System + 1 Timestamp + 2 Balances + 3 TransactionPayment
- 4 Aura + 5 Grandpa
- Opaque SessionKeys: aura sr25519 + grandpa Ed25519

Refs: CHARON_ROADMAP_V1 Phase 1.4, CHN-1 ratified Aura+GRANDPA canonical,
SBS-4 ratified extended pallet set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
davidherranandClaude Opus 4.6 committed 2026-05-20 19:34:34 -05:00
1 parent adab264d54
commit 4988693d4b
7 files changed
+430 -9

No files matched your search

+16 -3
View File
@@ -44,6 +44,7 @@
extern crate alloc;
pub mod configs;
pub mod opaque;
// Re-export canonical traits + types desde origin-chain-types (single-crate surface).
pub use origin_chain_types::{
@@ -56,12 +57,12 @@ pub use origin_chain_types::{
// Substrate canonical types re-export para runtime consumers + node binary.
pub use sp_core::H256;
pub use sp_runtime::traits::{BlakeTwo256, IdentifyAccount, Verify};
pub use sp_runtime::{generic, MultiAddress, MultiSignature};
pub use sp_runtime::{generic, impl_opaque_keys, MultiAddress, MultiSignature};
// Re-export configs canonical para downstream consumers + node binary.
pub use configs::{
BLOCK_HASH_COUNT, EXISTENTIAL_DEPOSIT, MILLI_OGC, MILLISECS_PER_BLOCK, OGC, SLOT_DURATION,
SS58_PREFIX,
AuraId, GrandpaId, BLOCK_HASH_COUNT, EXISTENTIAL_DEPOSIT, MILLI_OGC, MILLISECS_PER_BLOCK,
OGC, SLOT_DURATION, SS58_PREFIX,
};
/// Canonical block number type. `u32` canonical: 6-second blocks × 4B = 817+ años
@@ -204,6 +205,18 @@ mod runtime {
/// — Phase 2.4 refactor canonical para integrar `OriginFees` multi-tier).
#[runtime::pallet_index(3)]
pub type TransactionPayment = pallet_transaction_payment::Pallet<Runtime>;
/// Aura pallet canonical (block production PoA per CHN-1). 6-segundo slots
/// canonical Round-Robin selección validators. Pi 5 + NVMe SSD hardware
/// target canonical (Inmutable #16 anti-clasista from block 0).
#[runtime::pallet_index(4)]
pub type Aura = pallet_aura::Pallet<Runtime>;
/// GRANDPA pallet canonical (finality gadget per CHN-1). 2/3 honest majority
/// canonical para irreversible block confirmation. Separa production cadence
/// (Aura ~6s) de finality cadence (canonical ~6-12s combined).
#[runtime::pallet_index(5)]
pub type Grandpa = pallet_grandpa::Pallet<Runtime>;
}
#[cfg(test)]