feat(runtime-apis): Phase 1.6 — Runtime APIs canonical foundation v0.0.8

Runtime canonical ahora expone 11 APIs foundational via impl_runtime_apis!
macro necesarias para origin-chain-node binary interactuar via sc-service.

## Decisión canonical empírica: pallet_identity DEFERRED a Phase 2.7

pallet-identity 41.0.0 (stable2512) usa ReservableCurrency trait deprecated en
stable2512 (replaced por fungible::Mutate). Compat work es scope Phase 2.7
cuando custom pallet_agent_identity introduce AGI DIDs (Inmutable #41).

Wallet creation FREE perpetua per Inmutable #37 YA materializado via
pallet_balances — account existe con 1 MILLI_OGC EXISTENTIAL_DEPOSIT.
Identity metadata (name + email + GitHub + avatar) viene Phase 2.7.

## 11 APIs canonical implementadas
- sp_api::Core (version + execute_block + initialize_block)
- sp_api::Metadata (runtime metadata canonical)
- sp_block_builder::BlockBuilder (apply_extrinsic + finalize_block + inherents)
- sp_transaction_pool::TaggedTransactionQueue (validate_transaction)
- sp_offchain::OffchainWorkerApi (offchain_worker)
- sp_session::SessionKeys (generate + decode_into_raw_public_keys)
- sp_consensus_aura::AuraApi (slot_duration + authorities)
- sp_consensus_grandpa::GrandpaApi (grandpa_authorities + current_set_id +
  equivocation stubs Phase 1 PoA returning None)
- frame_system_rpc_runtime_api::AccountNonceApi (account_nonce)
- pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi
  (query_info + query_fee_details + query_weight_to_fee + query_length_to_fee)
- sp_genesis_builder::GenesisBuilder (build_state + get_preset + preset_names)

## Foundation types nuevos canonical
- pub const VERSION: RuntimeVersion canonical (consumed por sp_api::Core::version)
  - spec_name "origin-chain" + impl_name "origin-chain-charon"
  - apis RUNTIME_API_VERSIONS auto-generado por macro
  - state_version 1 (stable2509+ canonical)
- pub type Executive = frame_executive::Executive<...> wrapper canonical

## Compile fix iteración
EquivocationProof type signature: cambió de <Hash, Header> a <Hash, BlockNumber>
canonical per trait signature stable2512. Doc clarifies Phase 1 PoA equivocation
returns None — Phase 2 NPoS introduce real per CHN-3 slashing.

## Build + tests
- cargo check 0.75s warm cache (impl_runtime_apis incremental)
- cargo build --release 9.23s warm cache clean
- ~57 tests passing

## Filosofía canonical
Doc impl_runtime_apis cita David canon 2026-05-14 "la libertad infinita acota
solo donde empieza la del otro" — APIs son la frontera canonical entre runtime
sovereignty + node sovereignty. Forkless upgrades materializados.

## Phase 1 progress
1.1 ✅ + 1.2 ✅ + 1.3 ✅ + 1.4 ✅ + 1.5 ✅ + 1.6 ✅ (esta). Next: 1.7
genesis chain_spec.rs BM V2 allocation (40/25/15/15/5) + origin-chain-node
real Substrate service multi-session work.

Origin Chain runtime canonical actual: 7 pallets + 11 Runtime APIs + Executive
+ RuntimeVersion + opaque SessionKeys = foundation completa para node binary.

Refs: CHARON_ROADMAP_V1 Phase 1.6, Decisión empírica pallet_identity defer,
SBS-4 ratified, arkhe-origin-chain commit pending tag v0.0.8

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
davidherranandClaude Opus 4.6 committed 2026-05-20 19:54:46 -05:00
1 parent 926650308c
commit 4286b8d9e8
6 files changed
+450 -1

No files matched your search

+123
View File
@@ -6,6 +6,129 @@ by [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow
## [Unreleased]
## [0.0.8] — 2026-05-21 — Phase 1.6 "Runtime APIs canonical foundation"
Charon sesión 1 continuación. **Runtime APIs canonical implementadas via
`impl_runtime_apis!` macro** — el runtime canonical ahora expone 11 APIs
foundational necesarias para que el `origin-chain-node` binary canonical
pueda interactuar canonical via sc-service cuando Phase 1.6+ se complete.
### Decisión canonical empírica documentada — pallet_identity DEFERRED
`pallet-identity 41.0.0` (stable2512 canonical) usa `ReservableCurrency`
trait que está deprecated en stable2512 canonical (replaced canonical por
`fungible::Mutate`). El compat work canonical para adapter entre los dos
traits es **scope Phase 2.7** cuando se introduce custom `pallet_agent_identity`
canonical (per Inmutable #41 Cross-Species Co-authorship — AGI DIDs).
**Wallet creation FREE perpetua per Inmutable #37 ya está materializado vía
`pallet_balances`** — un account existe simplemente con 1 MILLI_OGC
EXISTENTIAL_DEPOSIT canonical. Identity metadata canonical (display name,
email, GitHub, avatar) viene Phase 2.7 con el custom pallet.
### 11 APIs canonical implementadas
| API canonical | Purpose canonical | Consumer canonical |
|---------------|-------------------|---------------------|
| `sp_api::Core` | version + execute_block + initialize_block | node binary core |
| `sp_api::Metadata` | runtime metadata canonical | client + node introspection |
| `sp_block_builder::BlockBuilder` | apply_extrinsic + finalize_block + check_inherents | node block production |
| `sp_transaction_pool::TaggedTransactionQueue` | validate_transaction canonical | pool filtering |
| `sp_offchain::OffchainWorkerApi` | offchain_worker canonical | offchain processing |
| `sp_session::SessionKeys` | generate + decode session keys canonical | node session management |
| `sp_consensus_aura::AuraApi` | slot_duration + authorities canonical | Aura block production |
| `sp_consensus_grandpa::GrandpaApi` | grandpa_authorities + current_set_id canonical | GRANDPA finality |
| `frame_system_rpc_runtime_api::AccountNonceApi` | account_nonce canonical | RPC nonce queries |
| `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi` | query_info + query_fee_details canonical | RPC fee queries |
| `sp_genesis_builder::GenesisBuilder` | build_state + get_preset + preset_names canonical | genesis chain_spec |
### Foundation canonical types añadidos
```rust
/// Canonical RuntimeVersion consumed por sp_api::Core::version()
pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed(SPEC_NAME), // "origin-chain"
impl_name: alloc::borrow::Cow::Borrowed(IMPL_NAME), // "origin-chain-charon"
authoring_version: AUTHORING_VERSION, // 1
spec_version: RUNTIME_VERSION, // 1
impl_version: IMPL_VERSION, // 1
apis: RUNTIME_API_VERSIONS, // auto-generated por macro
transaction_version: TRANSACTION_VERSION, // 1
system_version: STATE_VERSION, // 1 (stable2509+)
};
/// Canonical FRAME Executive wrapper canonical
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(),
>;
```
### Phase 1 Phase 2 boundary canonical
Equivocation proof handlers canonical son `None` Phase 1 PoA — Phase 2 NPoS
introduce real handlers per CHN-3 slashing canonical. Esto está documentado
canonical en los stub implementations canonical.
### Build performance
- `cargo check --workspace`: **0.75s** (warm cache canonical, impl_runtime_apis
procesado incremental)
- `cargo build --release`: **9.23s** (warm cache canonical clean)
- ~57 tests passing (runtime APIs son trait impls — tests específicos van en
node-side integration Phase 1.6+)
### Filosofía canonical incorporada
Doc `impl_runtime_apis!` cita David canon 2026-05-14:
> *"la libertad infinita acota solo donde empieza la del otro"*
El macro `impl_runtime_apis!` materializa canonical **la frontera canonical
entre runtime sovereignty + node sovereignty** — cada API canonical es un
contrato canonical que el node binary canonical puede llamar sin importarle
qué pallets specific componen el runtime canonical. **Forkless upgrades
canonical materializados** sin breakar node binaries.
### Phase 1 progress canonical
- ✅ **1.1** Scaffold (v0.0.2)
- ✅ **1.2** Substrate foundation (v0.0.4)
- ✅ **1.3** Pallets foundation (v0.0.5)
- ✅ **1.4** Consensus PoA Aura+GRANDPA (v0.0.6)
- ✅ **1.5** Session rotation 4h epochs (v0.0.7)
- ✅ **1.6** **Runtime APIs foundation** (v0.0.8) ← **ESTA**
- pallet_identity DEFERRED a Phase 2.7 (canonical decision empírica)
- 11 APIs canonical impl_runtime_apis! shipped
- ⏳ **1.7** Genesis `chain_spec.rs` BM V2 allocation (40/25/15/15/5)
- ⏳ **1.6+** `origin-chain-node` real Substrate service (sc-service builder
+ JSON-RPC + CLI) — substantial scope multi-session
### Tour canonical de Origin Chain runtime composition (7 pallets + 11 APIs)
```
┌────────────────────────────────────────────────────────────────────┐
│ Origin Chain Runtime v0.0.8 — Substrate canonical │
├────────────────────────────────────────────────────────────────────┤
│ Pallets (frame_support::runtime macro): │
│ Index 0 System Index 1 Timestamp Index 2 Balances │
│ Index 3 TransactionPayment Index 4 Aura Index 5 Grandpa │
│ Index 6 Session │
│ │
│ Runtime APIs (impl_runtime_apis! macro): │ ← NEW
│ Core + Metadata + BlockBuilder + TaggedTransactionQueue + │
│ OffchainWorkerApi + SessionKeys + AuraApi + GrandpaApi + │
│ AccountNonceApi + TransactionPaymentApi + GenesisBuilder │
│ │
│ Opaque SessionKeys: aura (sr25519) + grandpa (Ed25519) │
│ Executive: frame_executive::Executive wrapper canonical │ ← NEW
│ RuntimeVersion: spec=origin-chain impl=origin-chain-charon │ ← NEW
└────────────────────────────────────────────────────────────────────┘
```
## [0.0.7] — 2026-05-20 — Phase 1.5 "Session rotation canonical (4h epochs)"
Charon sesión 1 continuación. **Session pallet canonical integrado** — Origin