Commit Graph
55 Commits
Author SHA1 Message Date
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 13db9a0698 feat(types): Phase 2/3 prep — 3 custom Charon pallet traits v0.0.3
Day 1 unblock surface extended con custom pallet traits para Phase 2-3 work
all Substrate-free (no Substrate deps pulled yet, that's Phase 1.2).

## New trait surface (origin-chain-types::pallets)

### OriginProvenance (Phase 2.1, CHN-7)
- attest_validator_signed: institutional/Foundation wallet attestation
- batch_attest: bounded 64-item batch (Pi 5 block-weight aware)
- provenance_exists: cheap duplicate-check query (no full fetch)

### OriginFees (Phase 2.4, CHN-8)
- fee_for_extrinsic: storage-aware fee computation (uses tier_assertion)
- estimate_fee: pure off-chain RPC dry-run helper
- burn_basis_points: per-operation burn rate canonical (CHN-2 matrix)

### OriginValidatorEconomy (Phase 3.5, CHN-3)
- distribute_rewards: epoch-based pro-rata desde 40% Ecosystem Pool
- slash_validator: SlashReason taxonomy canonical
- validator_commission_bps: nominator delegation read

### SlashReason enum
- Downtime | DoubleSign | Equivocation | TierFraud
- TierFraud variant enforces Inmutable #16 anti-clasista ON-CHAIN

## Workspace stats
- 46 tests passing (was 44, +3 SlashReason serde + distinctness +
  inmutable_16 enforcement)
- Build release clean
- origin-chain-runtime re-exports extended

Refs: CHN-3/7/8, Phase 2.1/2.4/3.5 of CHARON_ROADMAP_V1, Inmutable #16

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 08:08:28 -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