// SPDX-License-Identifier: Apache-2.0 // Origin Chain — Pilar 4 · Charon // // ATENCION AL LEER ESTOS NUMEROS: un weight es una LATENCIA, y una latencia sin // el hardware y el perfil de potencia que la produjeron no se puede reproducir. // La cabecera dice HOSTNAME y CPU: creele a eso y a nada mas. Un weight medido // en un portatil y cobrado en un Pi 5 es mispricing estructural, solo que // invisible. Los numeros CANONICOS de mainnet salen del banco de referencia // (Pi 5, governor y aislamiento declarados), no de la maquina de quien compila. //! Weights AUTOGENERADOS para `origin_chain_fees` — NO editar a mano. //! //! Regenerar: `scripts/bench/regen-weights.sh` (ver ese script para el //! procedimiento completo y el hardware al que hay que creerle). //! //! GENERADO POR SUBSTRATE BENCHMARK CLI VERSION 51.0.0 //! FECHA: 2026-09-09, STEPS: `50`, REPEAT: `20` //! HOSTNAME: `MacBookProM3Max.local`, CPU: `` //! WASM-EXECUTION: `Compiled`, DB CACHE: 1024 // Comando ejecutado: // /Users/davidherran/.cargo/bin/frame-omni-bencher // v1 // benchmark // pallet // --runtime // /Users/davidherran/originmetaverse/artifacts/origin-chain/origin_chain_runtime_rv12_bench.compact.compressed.wasm // --genesis-builder-preset // development // --pallet // origin_chain_fees // --extrinsic // // --steps // 50 // --repeat // 20 // --template // /Users/davidherran/originmetaverse/external/arkhe-origin-chain/scripts/bench/origin-weights-template.hbs // --header // /Users/davidherran/originmetaverse/external/arkhe-origin-chain/scripts/bench/HEADER.txt // --output // /Users/davidherran/originmetaverse/external/arkhe-origin-chain/crates/origin-chain-fees/src/weights.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] use core::marker::PhantomData; use frame_support::{traits::Get, weights::constants::RocksDbWeight, weights::Weight}; /// Trait de weights para los extrinsics de `origin_chain_fees`. pub trait WeightInfo { /// Peso de `set_tier_profile` — MEDIDO sobre el WASM, no estimado a mano. fn set_tier_profile() -> Weight; } /// Weights parametrizados por el `DbWeight` real del runtime. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { /// Storage: `System::Number` (r:1 w:0) /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::ExecutionPhase` (r:1 w:0) /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `System::EventCount` (r:1 w:1) /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::Events` (r:1 w:1) /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Fees::TierProfiles` (r:0 w:1) /// Proof: `Fees::TierProfiles` (`max_values`: None, `max_size`: Some(50), added: 2525, mode: `MaxEncodedLen`) fn set_tier_profile() -> Weight { // Proof size en bytes: // Medido: `19` // Estimado: `1504` // Tiempo minimo de ejecucion: 6_000_000 picosegundos. Weight::from_parts(7_000_000, 0) .saturating_add(Weight::from_parts(0, 1504)) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } } /// Impl para mocks y tests — `RocksDbWeight` directo, sin necesitar `T`. impl WeightInfo for () { fn set_tier_profile() -> Weight { Weight::from_parts(7_000_000, 0) .saturating_add(Weight::from_parts(0, 1504)) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } } #[cfg(test)] mod guard { use super::*; /// NINGUN EXTRINSIC PUEDE DECLARAR `proof_size = 0`. /// /// El `proof_size` es lo que el block-builder usa para no pasarse del limite /// de PoV. Un cero no dice «este extrinsic no toca storage»: dice «miento /// sobre lo que va a ocupar la prueba», y con eso entra en un bloque mucho /// mas de lo que cabe. /// /// El test nace de un error propio y de la peor clase: la cabecera de los /// weights interinos afirmaba que `T::DbWeight` «puebla tanto ref_time como /// proof_size … cerrando el hueco». Es falso y se comprueba en la fuente — /// `sp_weights::RuntimeDbWeight` solo tiene los campos `read` y `write`, y /// `reads(r)` devuelve `Weight::from_parts(read * r, 0)`. Los interinos /// arreglaron reads/writes y dejaron el proof_size donde estaba: en 0. La /// afirmacion de haberlo cerrado sobrevivio mas de un mes sin que ninguna /// lectura la desmintiera; la desmintio una medicion. /// /// Esta lista la GENERA la plantilla a partir de los benchmarks reales, asi /// que no puede quedarse corta cuando se anada un extrinsic nuevo. #[test] fn ningun_weight_declara_proof_size_cero() { let casos: &[(&str, Weight)] = &[ ("set_tier_profile", <() as WeightInfo>::set_tier_profile()), ]; for (nombre, w) in casos { assert!( w.proof_size() > 0, "`{nombre}` declara proof_size = 0: miente al block-builder sobre el peso PoV" ); assert!( w.ref_time() > 0, "`{nombre}` declara ref_time = 0: el extrinsic saldria gratis" ); } } }