fix(slice-4): service.rs/rpc.rs corrected (Block root + verbatim CIDP) + §11 honest finding

Slice 4 checkpoint tras intentar Opción C (David: stack consistente del tag).
Build verde, 213 tests, sin regresiones. Node sigue CLI+chain_spec (mods off).

=== Correcciones a service.rs/rpc.rs (preservadas para wire-in) ===
- Block root (no opaque::Block): el runtime expone impl_runtime_apis! sobre el
  Block root con UncheckedExtrinsic, no un opaque block separado. rpc.rs igual.
- CIDP verbatim del template restaurado: standalone::slot_duration_at +
  inherents::InherentDataProvider::from_timestamp_and_slot_duration. AMBOS existen
  en sp-consensus-aura 0.45.0 PUBLICADO (verificado inherents.rs:61). Mi 'fix'
  v0.0.49 (Slot::from_timestamp) era incorrecto — revertido.

=== §11 corrige §10.2 (diagnóstico honesto) ===
El problema NO era API gap (las APIs existen) ni elegir bien versiones publicadas.
Es estructural del ecosistema: polkadot-sdk publica sus ~15 sub-crates sc-* en
cadencias distintas → NO existe isla de versiones publicadas internamente
consistente que reproduzca el tag. Verificado vía sparse index:
- sc-consensus-aura 0.52.0 → sp-consensus-aura ^0.44; 0.53.0/0.53.1 → ^0.45;
  0.54.0 → ^0.44 (oscila entre generaciones en patches consecutivos)
- sc-service 0.54.1 (versión del tag) NO publicada en crates.io
El tag solo es consistente vía su Cargo.lock commiteado en el monorepo git.

=== Recomendación senior para David (§11.4) ===
Diferir node service real al setup de infra Phase 4 testnet (que necesita build
env con red git de todos modos). NO seguir adivinando versiones publicadas (no
convergen). Firmes: WASM export (v0.0.48) + core2 unblock (v0.0.49) +
service.rs/rpc.rs correctos. Wire-in ~1 sesión cuando haya env con git fetch
O un Cargo.lock del monorepo stable2509-3.

Verificación: cargo check -p origin-chain-node verde (mods off) + 213 tests verde.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
davidherranandClaude Opus 4.8 committed 2026-05-30 11:54:32 -05:00
1 parent 980bd7d961
commit 4485bb8683
3 files changed
+65 -13

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
use std::sync::Arc;
use jsonrpsee::RpcModule;
use origin_chain_runtime::{opaque::Block, AccountId, Balance, Nonce};
use origin_chain_runtime::{AccountId, Balance, Block, Nonce};
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
+14 -11
View File
@@ -12,7 +12,11 @@ use sc_consensus_grandpa::SharedVoterState;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncConfig};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use origin_chain_runtime::{opaque::Block, RuntimeApi};
// El runtime implementa `impl_runtime_apis!` sobre el `Block` root (con
// UncheckedExtrinsic), no sobre un opaque block separado → el node usa ese mismo
// tipo para que `RuntimeApi` matchee. (El template solochain usa `opaque::Block`
// porque su runtime expone las APIs así; el nuestro las expone sobre root Block.)
use origin_chain_runtime::{Block, RuntimeApi};
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration};
@@ -96,20 +100,17 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
create_inherent_data_providers: move |parent_hash, _| {
let cidp_client = cidp_client.clone();
async move {
// sc-consensus-aura 0.52: slot_duration_at vive en el root del
// crate (no en `standalone::`, que es de versiones posteriores).
let slot_duration = sc_consensus_aura::slot_duration_at(
let slot_duration = sc_consensus_aura::standalone::slot_duration_at(
&*cidp_client,
parent_hash,
)?;
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
// crates.io sp-consensus-aura 0.45: el slot se deriva del
// timestamp vía `Slot::from_timestamp` (no existe
// `inherents::InherentDataProvider::from_timestamp_and_slot_duration`,
// que es de un snapshot git posterior con la misma versión).
let slot =
sp_consensus_aura::Slot::from_timestamp(*timestamp, slot_duration);
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
}
@@ -264,9 +265,11 @@ pub fn new_full<
create_inherent_data_providers: move |_, ()| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
// Mismo patrón que el import_queue CIDP (crates.io 0.45 API).
let slot =
sp_consensus_aura::Slot::from_timestamp(*timestamp, slot_duration);
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);
Ok((slot, timestamp))
},