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

+12 -1
View File
@@ -45,7 +45,8 @@ sp-block-builder = { version = "36.0.0", default-features = false }
sp-transaction-pool = { version = "36.0.0", default-features = false }
sp-inherents = { version = "36.0.0", default-features = false }
sp-offchain = { version = "36.0.0", default-features = false }
sp-session = { version = "37.0.0", default-features = false }
sp-session = { version = "38.1.0", default-features = false }
sp-genesis-builder = { version = "0.17.0", default-features = false }
sp-consensus-aura = { version = "0.42.0", default-features = false, features = ["serde"] }
sp-consensus-grandpa = { version = "23.1.0", default-features = false, features = ["serde"] }
@@ -68,6 +69,16 @@ pallet-grandpa = { version = "40.0.0", default-features = false }
# FRAME pallets canonical Phase 1.5 — Session rotation per CHN-1 4h epochs
pallet-session = { version = "40.0.1", default-features = false }
# pallet-identity DEFERRED a Phase 2.7 — canonical decision empírica 2026-05-21:
# pallet-identity 41.0.0 usa ReservableCurrency trait (deprecated en stable2512,
# replaced por fungible::Mutate). Compat work canonical es scope Phase 2.7 cuando
# se introduce `pallet_agent_identity` custom canonical (Inmutable #41 AGI DID).
# pallet-identity = { version = "41.0.0", default-features = false }
# RuntimeAPI canonical (consumed by node binary + RPC server Phase 1.6+)
frame-system-rpc-runtime-api = { version = "36.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "40.0.0", default-features = false }
# SCALE codec canonical (canonical Substrate serialization)
parity-scale-codec = { version = "3.7", default-features = false, features = ["derive"] }
scale-info = { version = "2.11", default-features = false, features = ["derive"] }