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:
1 parent
adab264d54
commit
4988693d4b
7 files changed
+430
-9
No files matched your search
@@ -40,8 +40,7 @@ use crate::{
|
||||
};
|
||||
use frame_support::derive_impl;
|
||||
use frame_support::parameter_types;
|
||||
use frame_support::traits::VariantCountOf;
|
||||
use sp_runtime::traits::ConstU32;
|
||||
use frame_support::traits::{ConstBool, ConstU32, ConstU64, VariantCountOf};
|
||||
|
||||
// ============================================================
|
||||
// Canonical constants (per CHN-1/2/8 + SBS-3)
|
||||
@@ -141,7 +140,10 @@ parameter_types! {
|
||||
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = (); // Phase 1.2: Aura wired aquí cuando se integre
|
||||
/// `Aura` wired canonical post Phase 1.4: cada nuevo timestamp triggera el
|
||||
/// Aura slot advance canonical. Materializa el coupling consensus↔clock que
|
||||
/// hace posible 6-segundo block production deterministic canonical.
|
||||
type OnTimestampSet = crate::Aura;
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = pallet_timestamp::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
@@ -168,3 +170,62 @@ impl pallet_transaction_payment::Config for Runtime {
|
||||
type FeeMultiplierUpdate = ();
|
||||
type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// pallet_aura::Config canonical (CHN-1 — block production PoA)
|
||||
// ============================================================
|
||||
|
||||
/// Canonical Aura authority id type. `sr25519` canonical per Substrate
|
||||
/// standard — más eficiente que Ed25519 para slot signing canonical (Schnorr
|
||||
/// signature aggregation futuro). Wallet identity sigue Ed25519 (CHN-7), pero
|
||||
/// validator authority keys sr25519 per Substrate convention canonical.
|
||||
pub type AuraId = sp_consensus_aura::sr25519::AuthorityId;
|
||||
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
/// `DisabledValidators = ()`: Phase 1 PoA simple — no disable mechanism
|
||||
/// canonical. Phase 2 NPoS introduces pallet_session disabling vía slashing.
|
||||
type DisabledValidators = ();
|
||||
/// `MaxAuthorities = 32`: canonical para Phase 1 PoA (5-7 validators
|
||||
/// inaugurales + room para growth pre-NPoS). Aligned con polkadot-stable2512
|
||||
/// solochain-template default canonical.
|
||||
type MaxAuthorities = ConstU32<32>;
|
||||
/// `AllowMultipleBlocksPerSlot = false`: canonical Substrate — un block por
|
||||
/// slot. Disallow multiplicity para deterministic block time canonical Pi 5.
|
||||
type AllowMultipleBlocksPerSlot = ConstBool<false>;
|
||||
/// Slot duration canonical = `pallet_aura::MinimumPeriodTimesTwo<Runtime>` —
|
||||
/// derivado automáticamente del `pallet_timestamp::MinimumPeriod` config
|
||||
/// canonical. Garantiza coupling canonical entre clock + consensus slot.
|
||||
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Runtime>;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// pallet_grandpa::Config canonical (CHN-1 — finality gadget)
|
||||
// ============================================================
|
||||
|
||||
/// Canonical GRANDPA authority id type. `Ed25519` canonical per GRANDPA spec —
|
||||
/// signature aggregation matemáticamente diferente a Aura sr25519 pero
|
||||
/// canonical convention.
|
||||
pub type GrandpaId = sp_consensus_grandpa::AuthorityId;
|
||||
|
||||
impl pallet_grandpa::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
/// `WeightInfo = ()`: Phase 1 PoA simple. Phase 2 NPoS introduces real
|
||||
/// weights para equivocation reporting + on_finalize hooks canonical.
|
||||
type WeightInfo = ();
|
||||
/// `MaxAuthorities = 32`: aligned con Aura canonical para 1:1 mapping
|
||||
/// validator ↔ finalizer Phase 1 PoA (mismo set canonical).
|
||||
type MaxAuthorities = ConstU32<32>;
|
||||
/// `MaxNominators = 0`: Phase 1 PoA simple — no nominators canonical (no
|
||||
/// stake delegation aún). Phase 2 NPoS bump canonical a 256 nominators.
|
||||
type MaxNominators = ConstU32<0>;
|
||||
/// `MaxSetIdSessionEntries = 0`: Phase 1 simple — no historical session
|
||||
/// proofs canonical. Phase 2 NPoS introduces session tracking.
|
||||
type MaxSetIdSessionEntries = ConstU64<0>;
|
||||
/// `KeyOwnerProof = sp_core::Void`: Phase 1 simple — no equivocation proof
|
||||
/// type. Phase 2 NPoS introduces real `MembershipProof` canonical.
|
||||
type KeyOwnerProof = sp_core::Void;
|
||||
/// `EquivocationReportSystem = ()`: Phase 1 PoA simple — equivocation
|
||||
/// reports not handled. Phase 2 NPoS introduces real handler canonical.
|
||||
type EquivocationReportSystem = ();
|
||||
}
|
||||
Reference in new issue
Block a user