Commit Graph
14 Commits
Author SHA1 Message Date
davidherranandClaude Fable 5 3364994cce feat(fees): FIX-6 Stage 2a — fee unificado (cierra V2-CA3)
Pone la fórmula OCAFB-5 en el fee-path VIVO: OriginFeeAdapter
(OnChargeTransaction custom) reemplaza al FungibleAdapter tier-blind.
El firmante paga su fracción según (HardwareTier × ChainAction ×
SubscriptionTier, tiers leídos ON-CHAIN de TierProfiles — jamás
caller-supplied), y el subsidy pool og/subsy (alimentado por la
emisión Stage 1) cubre la fracción subsidiada. Inmutable #16 en cada
transacción. OU=() = burn 100% gas fees (matriz CHN-2).

unified_fee (u128, outcome tipado FeeOutcome — sin el sentinel
u64::MAX in-band): user = fórmula vendor Mathi byte-fiel (test de
paridad grid contra ce4fafb); pool = net × subsidy_bp/1e4 sobre el
COSTO BASE (anti-regresivo, sub_mult ORTOGONAL: un Ultra NO drena el
pool más que un Free — el premium lo paga el usuario, no el commons).

Hallazgos de la verificación adversarial (workflow ultracode, 4
lentes) cerrados de raíz:
- HIGH: clasificador cubre eth_instantiate_with_code (call_index 10)
  — evadía el entitlement-gate DeployContract vía fallback Write.
- MEDIUM ledger envenenable: removido el dispatchable legacy
  compute_fee_for_action (tiers caller-supplied, escribía AccountFees
  sin cobrar). AccountFees ahora escrito SOLO por el fee-path vivo
  (note_settlement). Eventos que nunca se emitían eliminados; el
  preview read-only vive en query_fee / FeesApi.
- MEDIUM drenaje del pool por sub_mult: pool sobre net, no sobre el
  precio premium (Opción B anti-regresiva).
- Dev UX: GenesisConfig siembra perfiles iniciales; dev/local
  arrancan Ultra (los Slices 3.x de contracts no se bloquean por
  Free+DeployContract); mainnet vacío (Default conservador hasta
  attestation).

Decisión de diseño (autoridad Pilar 4): replay de attestation =
RECHAZO explícito, no dedup silencioso (notificado a Ergon para el
reference impl). Orden OCAFB-5 subsidy-antes-de-entitlement preservado
byte-fiel + notificado a Mathi para el ratify 2026-06-21.

set_tier_profile Root-only interim (sunset a attestation-driven vía
Mathi PerceptionAdapter + DID binding FIX-3/FIX-4). spec_version 1→2
(formato de extrinsic intacto, TRANSACTION_VERSION=1).

Tests: 49 crate fees (paridad grid + lobo blanco ortogonalidad +
refund + pool seco + tip passthrough + entitlement blocked) + 21
suites workspace verde. Toolchain cargo +1.88.

Nota WASM: el build local del runtime WASM falla en la
post-validación del substrate-wasm-builder con UnknownOpcode(252)
— límite del toolchain (Rust 1.88 emite opcodes 0xFC que el parser
del builder de stable2509 no deserializa). Reproducido idéntico en
el HEAD intacto (v0.0.57): es ambiental, no de este cambio. El node
real + WASM artifact siguen VPS-gated (toolchain alineado /
wasm32v1-none cuando el wasm-builder lo soporte).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 20:22:14 -05:00
davidherranandClaude Opus 4.8 e6a803b54f feat(emission): FIX-6 Stage 1 — emision que paga validadores (V2-CA2) + remover APR falso
Build + tests verde: emission pallet 5 + runtime 28 (incl. emission_pallet_index_13)
+ staking contract 4. Verificacion adversarial ultracode (2 skeptics): correctitud
+ seguridad CONFIRMADAS (split exacto, sin overflow, autor solo-desde-Aura sin
input de usuario, mint-None-seguro, sin dispatchable explotable, APR removal
honesto). 'partial' solo por cobertura de tests en ramas triviales (None /
reward==0), NO por vulnerabilidad.

Cierra V2-CA2 (la cadena no tenia emision -> los validadores ganaban 0 OGC):

NUEVO pallet origin-chain-emission (Index 13):
- on_initialize cada bloque: identifica al autor Aura (FindAuthor =
  pallet_session::FindAccountFromAuthorIndex<Runtime, Aura>), mintea un
  BlockReward (10 OGC, ~5.26% inflacion anual) y lo reparte:
  - 70% al autor (el validador que produjo el bloque).
  - 20% al treasury (og/gvtry — la MISMA cuenta-vault de governance FIX-6).
  - 10% al subsidy pool (og/subsy — proof-of-equity que financia el subsidio
    de hardware anti-clasista #16).
- El residual del split va al subsidy (no pierde unidades por redondeo de bps).
- TotalEmitted trackea la inflacion acumulada on-chain. mint_into (fungible::
  Mutate) = emision real (aumenta total issuance).
- El autor viene SOLO de FindAuthor/Aura (no de input de usuario) -> nadie puede
  mintear a una cuenta arbitraria. Si FindAuthor devuelve None, no mintea. Sin
  overflow (saturating_mul/div, 10^19 << u128::MAX).

sub_mult ORTOGONAL (David 2026-06-10): el subsidy pool financia el subsidio de
hardware SIN importar la suscripcion premium. Esta emision lo alimenta; el
OnChargeTransaction de Stage 2 lo consumira.

Remover APR falso (V1/V2 fake APR): staking contract default_chn3 reward rates
8/5/3% -> 0. Era enganoso (no habia motor que los pagara; los campos
reward_rate_bps se almacenaban pero NUNCA se leian, rewards_accumulated jamas se
acreditaba). Los validadores ahora cobran via la emision real; las tasas de
staking reales las define Stage 2 (NPoS por stake).

FIX-6 Stage 1 COMPLETO (con v0.0.56 treasury real): emision + treasury real +
APR removido. Stage 2: NPoS (pallet_staking + EraPayout) + fee unificado
(OnChargeTransaction con sub_mult ortogonal).

FOLLOW-UPS (low, documentados): anadir tests de cobertura para las ramas
FindAuthor==None (no mintea) y reward==0 (requieren un 2o mock runtime);
BlockReward fijo (decay schedule = Stage 2); el subsidy pool acumula pero no se
consume hasta el OnChargeTransaction de Stage 2; genesis mainnet del treasury
vault (pre-launch).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 06:06:21 -05:00
davidherranandClaude Opus 4.8 1a9e37021d fix(governance): FIX-6 Stage 1 — tesoreria real Currency (cierra hallazgo de FIX-5)
Build + tests verde: governance 42 + runtime 27. Verificacion adversarial
ultracode (2 skeptics): 2 confirmed/low, sin blockers.

Cierra el hallazgo HIGH de FIX-5: treasury_disbursement era simbolico (solo
decrementaba un contador u128 desconectado de pallet_balances). Ahora:
- governance Config: type Currency (fungible Inspect+Mutate) + type
  TreasuryPalletId (pallet::constant).
- Eliminado el contador Treasury<StorageValue<u128>> (0 referencias colgantes).
- treasury_account() = PalletId.into_account_truncating() — vault keyless
  deterministico (nadie lo controla por wallet; honor Inmutable #16).
- treasury_balance() lee el balance REAL (Inspect::balance), no un contador.
- treasury_disbursement: T::Currency::transfer real desde el vault al recipient
  (ensure_root + proposal Approved). treasury_deposit: signed, dona del propio
  balance del caller (cualquiera fondea, no requiere Root, imposible robar).
- runtime configs.rs: Currency=Balances + GovernanceTreasuryPalletId(og/gvtry).
- mock con pallet_balances + scenario_4 prueba que el RECIPIENT recibe OGC REAL
  en pallet_balances (bob 100M -> 100M+300k), no solo que el contador baja.

Decision constitucional (FIX-6 V2-CA3): David ratifico sub_mult = ORTOGONALES
(la suscripcion premium NO reduce el subsidio anti-clasista de hardware, #16).
Input para el OnChargeTransaction de Stage 2. Registrado en KG.

FOLLOW-UPS (low, documentados, no bloquean):
- genesis mainnet: rutear los 250M Foundation a la cuenta og/gvtry (hoy van a
  FNDT) — detalle de pre-launch que David ratifica. El vault arranca en 0 hasta
  fondear.
- treasury_disbursement no vincula amount/recipient al proposal Approved, y el
  mismo proposal es reusable (no se marca disbursed). Check ceremonial, no
  autorizacion per-desembolso. Sin escalada nueva (Root ya puede todo via sudo).
  Endurecer antes del sunset sudo->governance.

FIX-6 Stage 1 restante (next): emision que paga Aura authors (cierra V2-CA2) +
remover APR falso del staking contract. Stage 2: NPoS + fee unificado
(OnChargeTransaction con el sub_mult ortogonal).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 05:36:31 -05:00
davidherranandClaude Opus 4.8 8a1f779c32 fix(runtime): FIX-5 governability (pallet-sudo to Root) + FIX-2 StorageVersion (4 pallets)
Build + tests verde (exit 0, runtime 27 tests incl. sudo_pallet_index_12).
Verificacion adversarial ultracode (5 skeptics): 4 confirmed + 1 partial.

FIX-5 — governability (audit V2-CA1):
- pallet-sudo 43.0.0 wired Index 12 (workspace + runtime Cargo.toml + std).
- impl pallet_sudo::Config (RuntimeEvent/RuntimeCall/WeightInfo) en configs.rs.
- genesis: sudo key en los 3 presets — dev/local=Alice, mainnet=foundation_treasury
  (NO una dev key; el verificador confirmo que no hay backdoor critico).
- Da Root origin -> las dispatchables ensure_root de Governance (add/remove
  council, mark/unmark advisor, treasury_disbursement) dejan de ser
  no-invocables. Verificado extremo-a-extremo: sudo() despacha RawOrigin::Root,
  que es exactamente lo que ensure_root acepta.
- Sunset documentado (codigo + doc): sudo -> governance real (pallet-collective/
  referenda) ANTES de mainnet. Sudo key unica = riesgo de centralizacion
  aceptable solo como interim/testnet.

FIX-2 — lifecycle (audit V1-H2/V2-CA2):
- StorageVersion::new(0) + pallet::storage_version en los 4 pallets
  (provenance/fees/agent-identity/governance). Aditivo, in-code==on-chain==0,
  sin migracion forzada. Habilita migraciones futuras.

CAVEAT honesto (hallazgo high del red-team, NO defecto de FIX-5/FIX-2):
treasury_disbursement solo DECREMENTA un contador u128 (Treasury StorageValue),
NO mueve OGC real via pallet_balances. FIX-5 restaura la GOBERNABILIDAD (la
dispatchable es invocable), pero mover los 250M reales es FIX-6: anadir
type Currency al Config + T::Currency::transfer desde una cuenta-tesoreria
derivada (PalletId) + financiarla en genesis + test del free_balance. NO se
afirma "tesoreria descongelada de verdad" — solo "gobernabilidad restaurada".

PENDIENTE:
- FIX-2 AGI key recovery (rotate/revoke/active en agent-identity): diferido —
  necesita un DC de semantica de recovery #41 (single-sig vs multisig threshold,
  DID estable vs rota, recovery de agent_chain vacio). No se construye contra
  spec no-ratificada.
- pallet-sudo no en feature runtime-benchmarks (inerte hoy: el runtime no impl
  el Benchmark API). Follow-up con weights benchmarking.
- mainnet Foundation sudo key (FNDT placeholder): David ratifica la key real
  (multisig) pre-launch Q1 2027 (documentado).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 22:55:21 -05:00
davidherran 86d9251908 feat(revive): v0.0.39 — pallet-revive wired runtime Index 11 (22 Config types + GenesisConfig + WASM rebuild) 🎉🎉
Ship 2 v0.0.39 SHIPPED — pallet-revive 0.10.1 integration end-to-end post
Ship 1.5 v0.0.38 workspace bump stable2509-3 atómico. SBS-5 ratificado
(supersedes CHN-6 v1.0): smart contracts PolkaVM RISC-V + ink! v6 + Solidity
deployables canonical post Slice 3.1 SCAFFOLD COMPLETE pending Ship 3+4
(v0.0.40 integration tests + v0.0.41 ReviveApi).

Cambios:
- Cargo.toml workspace.dependencies: pallet-revive 0.10.1 crates.io
  (NOT git source — git source pulled duplicate frame-system/sp-runtime copies
  rompiendo trait bounds canonical. Crates.io 0.10.1 deps match workspace
  bumped stable2509-3 generation clean canonical empírico).
- crates/origin-chain-runtime/Cargo.toml: pallet-revive added dep + features.std.
- crates/origin-chain-runtime/src/lib.rs: Runtime macro Index 11 added
  `pub type Revive = pallet_revive::Pallet<Runtime>` canonical.
- crates/origin-chain-runtime/src/configs.rs: pallet_revive::Config impl con
  22 associated types per pallet-revive 0.10.1 docs.rs canonical surface:
  * Runtime types: RuntimeEvent, RuntimeCall, RuntimeHoldReason
  * Currency/Balance: Currency=Balances, Time=Timestamp, WeightPrice=TransactionPayment
  * Storage/Deposit: DepositPerByte=MILLI_OGC, DepositPerItem=OGC,
    CodeHashLockupDepositPercent=30%
  * EVM/Mapping: AddressMapper=AccountId32Mapper, ChainId=9_120_005 (EIP-155
    unique Origin Metaverse), NativeToEthRatio=1_000_000 (OGC 12 dec → ETH 18),
    AllowEVMBytecode=true, EthGasEncoder=()
  * Precompiles=() Slice 3.1 SCAFFOLD interim
  * Limits: WeightInfo=SubstrateWeight, RuntimeMemory=128 MB, PVFMemory=2 GB
    (per integrity_test formula `storage_limit = (PVFMemory-RuntimeMemory)/2`
    needed PVFMemory > 1.5 GB para pass max_storage_size ~650 MB check)
  * Access Control: UploadOrigin=EnsureSigned, InstantiateOrigin=EnsureSigned
  * Safety: FindAuthor=() (no pallet_authorship), UnsafeUnstableInterface=false
- crates/origin-chain-runtime/src/genesis_config_presets.rs: ReviveConfig::default()
  added a build_genesis canonical (Slice 3.1 SCAFFOLD: no pre-mapped accounts,
  no genesis contracts — Phase 3.x maduración añade dev mapped_accounts +
  templates contracts Slices 3.2-3.6).

API diffs encontrados empírico pallet-revive 0.10.1 vs 0.12.2 audit inicial:
- 0.10.1 NO expone: RuntimeOrigin, DebugEnabled, FeeInfo, MaxEthExtrinsicWeight,
  GasScale, DepositPerChildTrieItem (todos added en 0.12+ Asset Hub generation).
- 0.10.1 SÍ require: WeightPrice (Convert<Weight, Balance>) + EthGasEncoder
  (gas conversion helper) — NO en 0.12.2 audit anterior.

Verificación:
- cargo check --workspace clean (warnings pre-existentes deprecated patterns)
- cargo test --workspace: 203 tests verde 0 failures NO regresiones
- cargo build --features wasm-build: WASM_BINARY 2.8 MB shipped clean
  (grew from 1.8 MB v0.0.36 baseline — +1 MB pallet-revive PolkaVM bytecode)
- Runtime integrity test (__construct_runtime_integrity_test) PASS post memory
  tuning empírico-validated (16/16 runtime tests verde).

Próximo Ship 3 v0.0.40: pallet-revive real impl + 10 integration tests E2E
(upload_code + instantiate + bare_call + storage deposit + AddressMapper +
gas metering + access control + ChainId EIP-155 + contract destruction).

⚓ Phase 3 Slice 3.1 Ship 2/4 SHIPPED. La nave entra zone canonical smart contracts.

🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 08:36:24 -05:00
davidherran ebe09f1b2e feat(substrate-bump): v0.0.38 — Substrate workspace bump stable2509-3 (Phase 3 precondition) 🎉
Ship 1.5 v0.0.38 SHIPPED — Substrate workspace bump empírico audit-validated
post Ship 1 v0.0.37 pallet-revive scaffold. Phase 3 pallet-revive integration
revealed SBS-1 ratificado label "stable2512-3" sesión 1 awakening era audit
calibration error — workspace pre-bump era generation híbrida stable2506-ish
con pins inconsistentes (sp-runtime 41.1.0 + sp-core 36.1.0 + frame-support
40.1.0 = no clean-match ningún polkadot-stable tag publicado).

Audit empírico Ship 2 v0.0.38 attempted 3 tags polkadot-stable (2512-3 + 2509-3
+ 2506-2) — todos fallaron por version mismatch transitive deps (alloy-* rustc
1.91 + CheckMortality vs CheckEra + sp-runtime version drift). Honest disclosure
pattern aplicado per memory directive — revert + audit + reshuffle plan.

Solución canonical: workspace bump atómico a polkadot-stable2509-3 generation
puro (pallet-revive 0.10.1 disponible + rustc 1.88 compat preserved + WASM build
Slice 2e preserved).

Cambios:
- Cargo.toml workspace.dependencies: ALL sp-* + frame-* + pallet-* + sc-* bumped
  a stable2509-3 versions verified empírico via WebFetch per-crate Cargo.toml:
  * sp-core 36.1.0 → 38.1.0
  * sp-runtime 41.1.0 → 44.0.0
  * sp-io 40.0.1 → 43.0.0
  * sp-api 36.0.1 → 39.0.0
  * sp-version 39.0.0 → 42.0.0
  * frame-system 40.1.0 → 43.0.1
  * frame-support 40.1.0 → 43.0.0
  * frame-executive 40.0.0 → 43.0.1
  * pallet-balances 41.1.0 → 44.0.0
  * pallet-timestamp 39.0.0 → 42.0.0
  * pallet-transaction-payment 40.0.0 → 43.0.0
  * pallet-aura 39.0.0 → 42.0.0
  * pallet-grandpa 40.0.0 → 43.0.0
  * pallet-session 40.0.1 → 43.0.0
  * sc-* (cli/service/network/consensus/etc) bumped proporcional
  * substrate-wasm-builder 26.0.1 → 29.0.0
  * frame-system-rpc-runtime-api 36.0.0 → 39.0.0
  * pallet-transaction-payment-rpc-runtime-api 40.0.0 → 43.0.0
  * sp-genesis-builder 0.17.0 → 0.20.0
  * sp-consensus-aura 0.42.0 → 0.45.0
  * sp-consensus-grandpa 23.1.0 → 26.0.0
  * sp-session 38.1.0 → 41.0.0
  * frame-benchmarking 40.0.0 → 43.0.0
  * frame-metadata-hash-extension 0.8.0 → 0.11.0
- Cargo.toml workspace.dependencies: serde pin relajado =1.0.217 → 1.0.219
  (Slice 2b workaround obsoleto post-Slice 2e RESUELTO Layer 4 sp-io std leak
  fix vía default-features=false discipline — strict pin causaba parity-scale-codec
  3.7.5 conflict requiriendo ^1.0.219).
- crates/origin-chain-runtime/src/configs.rs: pallet_session::Config Stable2509-3
  API additions — Currency type (= crate::Balances) + KeyDeposit (= ConstU128<0>)
  para session key registration deposit economy. Phase 1 PoA simple: zero deposit
  canonical (genesis validators static). Phase 2 NPoS introduces real deposit.

Verificación:
- cargo check --workspace clean (26 warnings pre-existentes deprecated patterns)
- cargo test --workspace: 203 tests verde 0 failures NO regresiones
- cargo build --features wasm-build: WASM_BINARY 1.5 MB shipped clean post-bump
  (Slice 2e infrastructure CC=LLVM + WASM_BUILD_STD=0 preserved canonical)
- Cargo.lock: +511 lines (new transitive deps for stable2509-3 ecosystem)

Próximo Ship 2 v0.0.39: pallet-revive 0.10.1 from stable2509-3 source wired
runtime Index 11 (27 Config types per Asset Hub Westend reference). Workspace
bump DESBLOQUEA Phase 3 integration end-to-end canonical.

Audit calibration update: SBS-1 ratificado labeling error documentado para
sesión seal CHARON_ROADMAP_V1.3 refresh — Phase 0 awakening cold-start
assumption error preserved transparency canonical.

⚓ Ship 1.5 SHIPPED. Phase 3 UNBLOCKED. La nave continúa con generation purificada.

🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 08:23:09 -05:00
davidherranandClaude Opus 4.7 2a700ee6ca feat(runtime): v0.0.29 — Governance pallet wired runtime composition Index 10
Phase 5.1 GOVERNANCE pallet wired canonical en frame_support::runtime macro como
Index 10 (post-AgentIdentity Index 9). 10 → 11 pallets composed canonical. Config
trait RuntimeEvent association wired canonical (pattern Provenance + Fees +
AgentIdentity mirror).

## Changes

- crates/origin-chain-runtime/src/lib.rs:315 — Index 10 pub type Governance = origin_chain_governance::Pallet<Runtime>
- crates/origin-chain-runtime/src/configs.rs:382 — impl origin_chain_governance::Config for Runtime
- crates/origin-chain-runtime/Cargo.toml — origin-chain-governance workspace dep + std feature
- Cargo.toml — origin-chain-governance workspace dep default-features = false (no_std-compat)
- crates/origin-chain-node/src/main.rs — 10 → 11 pallets listed + Governance Index 10 highlighted

## Verification

- cargo build -p origin-chain-runtime 15.69s clean
- cargo test --workspace — 165 tests passing, 0 failures
- origin-chain-node info muestra 11 pallets canonical

🔌 Phase 5.1 wired canonical. Real impl v0.0.30 next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 12:43:30 -05:00
davidherranandClaude Opus 4.7 46a0188a1d feat(runtime): v0.0.25 — AgentIdentity pallet wired runtime composition Index 9
Phase 2.7 AGENT IDENTITY pallet wired canonical en frame_support::runtime macro
como Index 9 (post-Fees Index 8). 9 → 10 pallets composed canonical. Config trait
RuntimeEvent association wired canonical (pattern Provenance + Fees mirror).

## Changes

- crates/origin-chain-runtime/src/lib.rs:298 — Index 9 pub type AgentIdentity = origin_chain_agent_identity::Pallet<Runtime>
- crates/origin-chain-runtime/src/configs.rs:362 — impl origin_chain_agent_identity::Config for Runtime { type RuntimeEvent = RuntimeEvent }
- crates/origin-chain-runtime/Cargo.toml — origin-chain-agent-identity workspace dep + std feature
- crates/origin-chain-node/src/main.rs — 9 → 10 pallets listed + AgentIdentity Index 9 highlighted [Phase 2.7 scaffold v0.0.25]
- crates/origin-chain-agent-identity/src/lib.rs — Config constraint AccountId = origin_chain_types::AccountId REMOVED (usa T::AccountId generic compatible runtime ChainAccountId AccountId32) + storage updated + events updated

## Verification

- cargo build -p origin-chain-runtime 5.26s clean
- cargo test --workspace — 149 tests passing, 0 failures
- cargo build --release -p origin-chain-node 3.96s clean
- origin-chain-node info muestra 10 pallets canonical

🔌 Phase 2.7 wired canonical. Real impl v0.0.26 next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 06:40:29 -05:00
davidherranandClaude Opus 4.7 0a83395a16 feat(runtime): v0.0.21 — Fees pallet wired runtime composition Index 8
Phase 2.4 FEES pallet wired canonical en `frame_support::runtime` macro como
Index 8 (post-Provenance Index 7). 8 → 9 pallets composed canonical. Config
trait RuntimeEvent association wired canonical en configs.rs (pattern Provenance
Phase 2.1 mirror).

## Changes

- crates/origin-chain-runtime/src/lib.rs:285 — Index 8 pub type Fees = origin_chain_fees::Pallet<Runtime>
- crates/origin-chain-runtime/src/configs.rs:347 — impl origin_chain_fees::Config for Runtime { type RuntimeEvent = RuntimeEvent }
- crates/origin-chain-runtime/Cargo.toml — origin-chain-fees workspace dep + std feature
- Cargo.toml — origin-chain-fees workspace dependency
- crates/origin-chain-node/src/main.rs — 8 → 9 pallets listed + Fees Index 8 highlighted + Provenance status updated v0.0.15 → v0.0.17

## Verification

- cargo build -p origin-chain-runtime 13.63s clean
- cargo test --workspace — 123 tests passing, 0 failures
- cargo build --release -p origin-chain-node 4.39s clean
- origin-chain-node info muestra 9 pallets canonical

🔌 Phase 2.4 wired canonical. Real impl v0.0.22 next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:50:52 -05:00
davidherranandClaude Opus 4.7 e0c5e8be18 feat(runtime): Phase 2.1 v0.0.15 — Provenance pallet wired runtime + BoundedVec agent_chain
8 pallets composed total (Provenance Index 7 wired canonical). DC PROVENANCE_PALLET_V1
5/10 firmas en ratificación — procediendo paralelo per "notify and continue" canonical.

Deliverables canonical:
- Pallet wire: configs.rs Config impl + lib.rs runtime composition macro pallet_index(7) Provenance
- Alias `Provenance` (NO OriginProvenance que conflictaría con trait existente)
- BoundedVec<AccountId, ConstU32<10>> replace Vec en AssetAttestation.agent_chain
- Inmutable #41 pragmatic bound canonical: max 10 AGI co-authors per asset
- Removed #[pallet::without_storage_info] (MaxEncodedLen ahora satisfied)
- AccountId + Signature: DecodeWithMemTracking derive added (FRAME stable2512+ requirement)
- AssetAttestation: Encode/Decode/DecodeWithMemTracking/MaxEncodedLen/TypeInfo SCALE derives
- 4 nuevos tests boundary canonical (max 10 enforce + boundary accepted + SCALE roundtrip)

Verification end-to-end:
- cargo check workspace verde 2.14s
- 82+ tests pass workspace
- cargo build release 5.57s clean
- info subcommand muestra 8 pallets (Provenance index 7)
- build-spec subcommand NO regression Slice 3 mock-WASM chain_spec

Roadmap canonical post-v0.0.15:
- v0.0.16 Real Ed25519 verify (post Ergon Cap 42+ sub-crate)
- v0.0.17 Runtime API verify_provenance PROV-8
- v0.1.0 Full integration testnet Q3 2026

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 14:07:19 -05:00
davidherranandClaude Opus 4.6 4286b8d9e8 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>
2026-05-20 19:54:46 -05:00
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