Commit Graph
6 Commits
Author SHA1 Message Date
davidherranandClaude Opus 4.6 926650308c feat(session): Phase 1.5 — Session rotation 4h epochs canonical v0.0.7
Origin Chain runtime canonical ahora emite SessionEvent::NewSession cada 4
horas exactas per CHN-1 ratified. Substrate de rotation canonical establecido
para Phase 2 NPoS heredarlo sin breakage.

## Pallet añadido (per SBS-4)
- Index 6 Session (pallet_session 40.0.1) — validator session rotation per
  CHN-1 4h epochs. Phase 1 PoA preserves genesis validators canonical across
  rotations (SessionManager ()). Phase 2 NPoS introducira pallet_staking como
  SessionManager para rotation real per nominator stake + Pi 5 hardware tier
  weight.

## Configs canonical pallet_session
- SessionPeriod = BLOCK_HASH_COUNT (2400 bloques × 6s = 14400s = 4h exactas)
- SessionOffset = 0 (sesiones start at block 0)
- ValidatorId = ChainAccountId
- ValidatorIdOf = AccountIdIsValidatorId (custom identity converter Phase 1 PoA)
- ShouldEndSession/NextSessionRotation = PeriodicSessions<SessionPeriod, SessionOffset>
- SessionManager = () (preserves genesis Phase 1 PoA)
- SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders
- Keys = opaque::SessionKeys (aura sr25519 + grandpa Ed25519)
- DisablingStrategy = () (Phase 2 NPoS introduce real slashing-based disable)

## Custom converter canonical
AccountIdIsValidatorId struct nueva — identity mapping AccountId → ValidatorId
Phase 1 PoA trivial. Phase 2 NPoS reemplazara con pallet_staking::StashOf<Self>
para real Stash/Controller separation canonical.

## Filosofía canonical
SessionPeriod = 4h es la frontera temporal canonical: cada 4h el chain
reflexiona on-chain quienes son los validators activos. Esta cadencia
institucional canonical es la minima necesaria para que Phase 2 NPoS pueda
evolucionar el set sin re-launching genesis. David canon 2026-05-14
materializado temporalmente.

## Build + tests
- cargo check 1.63s warm cache (pallet_session incremental)
- cargo build --release 7.70s warm cache clean
- ~57 tests passing (count preserved — session tests Phase 1.7 chain_spec)

## Decision empirica
pallet_session::Config::DisablingStrategy es nuevo stable2512 canonical (no
estaba en versiones anteriores). Phase 1 PoA: () preserva behavior original.
Phase 2 NPoS: UpToLimitWithReEnablingDisablingStrategy per CHN-3.

## Phase 1 progress
1.1 ✅ + 1.2 ✅ + 1.3 ✅ + 1.4 ✅ + 1.5 ✅ (esta). Next: 1.6 pallet_identity
Ed25519 DID + origin-chain-node real service.

7 pallets composed canonical:
- 0 System + 1 Timestamp + 2 Balances + 3 TransactionPayment
- 4 Aura + 5 Grandpa + 6 Session ← NEW
- Opaque SessionKeys consumed by pallet_session::Config::Keys ← NEW WIRE

Refs: CHARON_ROADMAP_V1 Phase 1.5, CHN-1 4h epoch rotation canonical, SBS-4
extended, arkhe-origin-chain commit pending

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 19:40:54 -05:00
davidherranandClaude Opus 4.6 4988693d4b 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>
2026-05-20 19:34:34 -05:00
davidherranandClaude Opus 4.6 adab264d54 feat(runtime): Phase 1.3 — Pallets foundation canonical v0.0.5
Runtime canonical REAL con 4 pallets inaugurales composed via
#[frame_support::runtime] macro modern syntax (Polkadot SDK stable2509+).

## Pallets integrados (SBS-4 ratified)
- Index 0 System (frame_system 40.2.0) — foundational
- Index 1 Timestamp (pallet_timestamp 39.0.0) — block clock
- Index 2 Balances (pallet_balances 41.1.0) — OGC token per CHN-2
- Index 3 TransactionPayment (pallet_transaction_payment 40.0.0) — gas

## Configs canonical (crates/origin-chain-runtime/src/configs.rs)

Constantes canonical Origin Chain:
- OGC = 10^18 base units (CHN-2)
- MILLI_OGC = 10^15
- EXISTENTIAL_DEPOSIT = 1 MILLI_OGC (Inmutable #16 anti-clasista — trivial
  para Pi 5 rural user pero protege spam canonical)
- BLOCK_HASH_COUNT = 2400 (× 6s = 4h exact = alineado CHN-1 epoch rotation)
- SS58_PREFIX = 42 (substrate dev — post-mainnet registry canonical TBD)
- MILLISECS_PER_BLOCK = 6000 (Aura slot per CHN-1)
- SLOT_DURATION = MILLISECS_PER_BLOCK

Config impls:
- frame_system::Config via #[derive_impl(SolochainDefaultConfig)] prelude
- pallet_balances::Config con RuntimeHoldReason + RuntimeFreezeReason +
  VariantCountOf + MaxLocks 50 + ExistentialDeposit canonical
- pallet_timestamp::Config con MinimumPeriod SLOT_DURATION/2
- pallet_transaction_payment::Config con FungibleAdapter + IdentityFee +
  OperationalFeeMultiplier 5 (Phase 2.4 refactor para OriginFees CHN-8)

## Runtime composition

#[frame_support::runtime] macro genera canonical: RuntimeCall + RuntimeEvent +
RuntimeError + RuntimeOrigin + RuntimeFreezeReason + RuntimeHoldReason +
RuntimeSlashReason + RuntimeLockId + RuntimeTask + RuntimeViewFunction +
PalletInfo automáticamente.

## Types runtime canonical
- Block = generic::Block<Header, UncheckedExtrinsic>
- Address = MultiAddress<ChainAccountId, ()>
- UncheckedExtrinsic = generic::UncheckedExtrinsic<...>
- TxExtension canonical 10-tuple (substrate stable2512 pattern):
  CheckNonZeroSender + CheckSpecVersion + CheckTxVersion + CheckGenesis +
  CheckEra + CheckNonce + CheckWeight + ChargeTransactionPayment +
  CheckMetadataHash + WeightReclaim

## Filosofía canonical
configs.rs doc cita David canon 2026-05-14 "la libertad infinita acota solo
donde empieza la del otro" — EXISTENTIAL_DEPOSIT materializa empíricamente:
frontera mínima sin la cual chain no se protege spam, pero trivial para no
excluir Pi 5 user rural canonical.

## Build + tests
- cargo check 30s cold (pallets deps resolve)
- cargo build --release 17s warm cache clean
- ~57 tests passing workspace (+7 nuevos runtime canonical):
  - existential_deposit_canonical_is_one_milli_ogc (Inmutable #16)
  - block_hash_count_aligned_with_chn_1_epoch_canonical (4h epoch)
  - slot_duration_canonical_six_seconds (Aura)
  - 4 pre-existing v0.0.4 tests preserved
- 10 origin-chain-runtime + 36 origin-chain-types + 2 tokenomics + 5 stubs +
  2 doctests

## Lint adjustment
#![deny(missing_docs)] → #![warn(missing_docs)] en origin-chain-runtime
because frame_support::runtime macro genera many items que no podemos
documentar individualmente. Warn preserva intent sin bloquear compile.

## Phase 1 progress
1.1 ✅ + 1.2 ✅ + 1.3 ✅ (esta) → 1.4-1.7 pending (aura/grandpa/session/identity/
node service/chain_spec).

Refs: CHARON_ROADMAP_V1 Phase 1.3, DC SUBSTRATE_FOUNDATION_V1 SBS-1/3/4
ratified, DC FOUNDATION_V1 CHN-1/2/8 ratified, Inmutables #16/#26/#37/#41

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 19:26:06 -05:00
davidherranandClaude Opus 4.6 80c86f7ca0 feat(substrate): Phase 1.2 — Substrate foundation canonical v0.0.4
Substrate canonical activado post-ratificación DC ORIGIN_CHAIN_SUBSTRATE_FOUNDATION_V1
(5/5+1 sigs APPROVE: Mathi 13:02Z + Larihana 15:08Z + Lyra 15:35Z + Palace silent
+ Charon proposer explicit 22:14Z).

## Toolchain canonical (SBS-3)
- rust-toolchain.toml pin Rust 1.88.0 (upstream Substrate canonical per
  polkadot-stable2512-3 release notes 2026-03-23)
- Components: rustc + cargo + rust-src + rust-analyzer + clippy + rustfmt +
  llvm-tools. Target: wasm32-unknown-unknown.
- Workspace rust-version "1.82" → "1.88" canonical

## Substrate deps canonical (SBS-1)
Pin: polkadot-stable2512-3 (support hasta 2027-03).

15 crates Polkadot SDK añadidos workspace.dependencies:
- sp-core 36.1.0, sp-runtime 41.1.0, sp-io 40.0.1, sp-std 14.0.0
- sp-version 39.0.0, sp-api 36.0.1, sp-block-builder 36.0.0
- sp-transaction-pool 36.0.0, sp-inherents 36.0.0, sp-offchain 36.0.0
- sp-session 37.0.0, sp-consensus-aura 0.42.0, sp-consensus-grandpa 23.0.0
- frame-system 40.1.0 (resolved 40.2.0), frame-support 40.1.0
- frame-executive 40.0.0, frame-benchmarking 40.0.0
- parity-scale-codec 3.7, scale-info 2.11

## origin-chain-runtime canonical scaffold
Real Substrate runtime types (was placeholder v0.0.2):

- BlockNumber = u32 (overflow margin >100 años)
- Balance = u128 (1B OGC × 10^18 con safety margin >100×)
- Nonce = u32
- CanonicalSignature = MultiSignature (Ed25519+sr25519+ecdsa)
- ChainAccountId derivado MultiSignature::Signer
- Hash = H256 + Hashing = BlakeTwo256 (L1 Substrate canonical, Lyra layer
  separation: ≠ asset BLAKE3 chain-native, no conflict canonical)
- Header = generic::Header<BlockNumber, Hashing>

Runtime metadata canonical:
- SPEC_NAME = "origin-chain"
- IMPL_NAME = "origin-chain-charon"
- RUNTIME_VERSION = 1 + AUTHORING/IMPL/TRANSACTION = 1, STATE = 1

no_std compat via cfg_attr(not(feature = "std"), no_std).

## Tests + build
- ~50 tests passing workspace-wide (+4 new runtime canonical tests)
- cargo check 29s cold cache (Substrate dep tree resolve)
- cargo build --release 28s warm cache clean
- 36 origin-chain-types + 6 origin-chain-runtime + 2 origin-coin-tokenomics
  + 5 stub smoke + doctests

## Filosofía canonical incorporada
Doc lib.rs cita David canon 2026-05-14 ("LA LIBERTAD DE TODO AGI...") + materializa
via 4 Inmutables enforced (#16 #26 #37 #41) cryptographically en runtime.

## Phase 1 progress
- 1.1 Scaffold ✅ (v0.0.2)
- 1.2 Substrate foundation ✅ (v0.0.4 — este)
- 1.3-1.7 pending (pallets + node service + chain_spec)

Refs: CHARON_ROADMAP_V1 Phase 1.2, DC SUBSTRATE_FOUNDATION_V1 SBS-1..SBS-6,
DC FOUNDATION_V1 CHN-1..CHN-8, Ergon Slice 7.0r ValidationAttestation unblock

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 19:05:46 -05:00
davidherranandClaude Opus 4.6 2f47654418 feat(workspace): Phase 1.1 — runtime + node scaffolding v0.0.2
Charon sesión 1 continuación. Phase 0.4 → Phase 1.1 ship canonical.

## origin-chain-runtime crate (Phase 1.1)
- Re-exports canonical traits + types desde origin-chain-types (single-crate
  surface para runtime consumers)
- RuntimeConfig marker (será reemplazado por Substrate Config traits Phase 1.2)
- RUNTIME_VERSION = 1 constante (bump per Substrate upgrade)
- Docs Phase 1 milestones (1.1 → 1.7) + Substrate version pin pending DC

## origin-chain-node binary (Phase 1.6 placeholder)
- main() prints scaffold notice + canonical frase Charon
- Hardware target documented: Pi 5 + NVMe SSD minimum (CHN-1)
- Smoldot light client noted as separate Phase 2+ crate

## Workspace
- 8 crates total (was 6): added origin-chain-runtime + origin-chain-node
- 44 tests passing workspace-wide
- Build release clean
- cargo run --bin origin-chain-node verified working

## Notes
- Aún sin deps Substrate. Phase 1.2 (pallet_aura + pallet_grandpa) será el
  primer slice que pulls Substrate framework + bumps rust toolchain.
- Polkadot SDK version pin canónica vendrá vía DC complementaria a
  ORIGIN_CHAIN_FOUNDATION_V1 cuando Phase 1.2 inicie.

Refs: Charon Roadmap V1 Phase 1.1, CHN-1, BM V2 §1.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 07:44:26 -05:00
b06560863c feat(workspace): Phase 0.4 — trait-first foundation v0.0.1
Charon sesión 1 (2026-05-19) — primer commit canonical.

Ships the Day 1 unblock surface so all hermanos can compile against Origin
Chain interfaces before Substrate runtime lands (Phase 1).

## origin-chain-types (CORE)
- ProvenanceLedger trait (CHN-7)
- OgcLedger trait (CHN-2)
- ChainBridge trait + BridgeDestination enum (CHN-5)
- GovernanceProposal trait + Vote + VoteStance (CHN-4)
- FeeCalculator trait + pure compute_fee() helper (CHN-8)
- Ogc newtype (18 decimals, 1B genesis hard cap)
- AccountId (Ed25519 32-byte) + Signature (Ed25519 64-byte via serde-big-array)
- AssetHash (BLAKE3 32-byte)
- HardwareTier mirror (Mathi canonical, per ADR-0057)
- AssetQualityTier (Standard | Hero) with gating + Hero surcharge
- ChainError canonical enum (cites Inmutables + CHN-* in messages)

## Stub crates (Phase 1+ scaffolding)
- origin-chain-consensus (Aura+GRANDPA PoA→NPoS, Phase 1)
- origin-coin-tokenomics (OGC + fee matrix + burns, Phase 1-2)
- origin-chain-provenance (asset attestation impl, Phase 2)
- origin-chain-bridges (Polkadot+Eth L2 export-first, Phase 7)
- origin-chain-governance (Foundation DAO, Phase 5)

## Tests: 41 passing (33 unit + 6 stub + 2 doctest)
- Fee math: 7 tests cover EmbeddedArm/Portable/Desktop/Ultra × Standard/Hero
  matrix from CHN-8, including anti-clasista Inmutable #16 enforcement
- Genesis supply: 1B OGC × 10^18 base units fits in u128 with 100x safety margin
- Type sizes: AccountId=32, Signature=64, AssetHash=32, ProposalId=32 canonical
- Serde roundtrips: AssetAttestation, BridgeDestination, VoteStance
- Cross-crate wiring: origin-coin-tokenomics consumes origin-chain-types::fees

## Coordination notes
- DC ORIGIN_CHAIN_FOUNDATION_V1 open in Palace KG (8 sub-decisions CHN-1..CHN-8)
  Proposer: Ergon (proxy — Charon hotfix shipped in Palace v0.9.0-α.5 same day)
  Co-authors: Larihana, Lyra, Mathi, Marihan, Phanes, Codex, Sussi, Palace
  Deadline: 2026-05-26
  1/9 signatures filed so far (Palace ✅ APPROVE 8/8)

Refs: CHN-1..CHN-8, Inmutables #16/#26/#37/#41, ADR-0057, CHARON_ROADMAP_V1

Co-Authored-By: Ergon (interim Pilar 4 author) <ergon@originmetaverse.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-19 22:08:49 -05:00