feat(weights): RV13 — los 19 estaban subdeclarados, los 19
Primera medicion real de los weights con frame-omni-bencher sobre el propio blob WASM. El resultado no es un ajuste fino: los 19 extrinsics de los 5 pallets custom declaraban MENOS de lo que cuestan. EL PATRON SISTEMATICO. Se costeo el storage del pallet y se olvido el que cuesta emitir un evento — System::Events, EventCount, ExecutionPhase y Number son reads y writes reales en cada extrinsic que deposita evento. Ejemplos medidos: attest_asset declaraba 4 reads / 1 write y cuesta 7/3; submit_proposal declaraba 12 us y cuesta 62; register_agent_did declaraba 3/2 y cuesta 6/4. EL PEOR, Y ES UN ERROR MIO DOCUMENTADO AL REVES. proof_size valia 0 en los 19. La cabecera de los 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 from_parts(read * r, 0). Los interinos arreglaron reads/writes y dejaron el proof_size exactamente donde estaba. Un proof_size en cero miente al block-builder sobre el peso PoV: es el vector de DoS que la nota decia haber cerrado. La afirmacion sobrevivio mas de un mes sin que ninguna lectura la desmintiera; la desmintio una medicion. Cada fichero generado lleva ahora un guard GENERADO desde la lista real de benchmarks que reprueba cualquier proof_size = 0 o ref_time = 0. Verificado que sabe reprobar: contra los weights anteriores se pone rojo con "`attest_asset` declara proof_size = 0". ADVERTENCIA QUE VA EN EL CODIGO, NO SOLO AQUI: son numeros de un MacBook Pro M3 Max, NO del banco de referencia BM V2. La forma (reads/writes/proof_size) no depende del hardware y es correcta; el ref_time si, y en un Pi 5 sera mayor. Un caso lo enseña solo: attest_asset BAJA de 50 a 44 us, y es el extrinsic dominado por el verify Ed25519, el mas sensible al silicio. Antes de mainnet hay que regenerar en el Pi 5 con governor y aislamiento declarados — peticion abierta a Laurha (request:66f500d54e28a80c) con el blob, el comando y la version exacta del bencher. RV12 -> RV13 (weights = consenso). TRANSACTION_VERSION intacto. 295 tests verde. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b72650974d
commit
38e5602d78
7 files changed
+1084
-245
No files matched your search
@@ -1,103 +1,532 @@
|
||||
//! # Weights para `pallet-origin-governance`
|
||||
//!
|
||||
//! ## Estado: INTERIM hand-derived (DB-aware, DoS-safe) — pendiente regeneración HW
|
||||
//!
|
||||
//! Ver `origin-chain-provenance/src/weights.rs` §Estado para el racional completo.
|
||||
//! Los 13 extrinsics tenían `Weight::from_parts(10_000, 0)` (proof_size=0, sin
|
||||
//! contar DB) → DoS. Aquí cada uno se cuesta con `T::DbWeight` sobre los reads/writes
|
||||
//! REALES contados del código (incluyendo los `iter_prefix`/`clear_prefix` acotados
|
||||
//! por el council ≤ 7). `benchmarking.rs` es la fuente de verdad de la forma.
|
||||
// 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_governance` — 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: `<UNKNOWN>`
|
||||
//! 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_governance
|
||||
// --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-governance/src/weights.rs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{traits::Get, weights::constants::RocksDbWeight, weights::Weight};
|
||||
|
||||
/// Compute floor conservador para la lógica de cada extrinsic (hashing blake2,
|
||||
/// aritmética de umbrales, build de structs). Los que hashean content/proposal id
|
||||
/// (submit_*, endorse) llevan un poco más vía el propio conteo de reads.
|
||||
const COMPUTE: u64 = 12_000_000;
|
||||
|
||||
/// Trait de weights para los 13 extrinsics de `pallet-origin-governance`.
|
||||
/// Trait de weights para los extrinsics de `origin_chain_governance`.
|
||||
pub trait WeightInfo {
|
||||
/// `submit_proposal` — contains_key + bond transfer + 2 inserts.
|
||||
fn submit_proposal() -> Weight;
|
||||
/// `cast_vote` — advisor/proposal/vote reads + 2 inserts.
|
||||
fn cast_vote() -> Weight;
|
||||
/// `finalize_proposal` — proposal read/write + release bond.
|
||||
fn finalize_proposal() -> Weight;
|
||||
/// `add_council_member` — size/dup reads + 2 writes.
|
||||
fn add_council_member() -> Weight;
|
||||
/// `remove_council_member` — exists read + remove + size write.
|
||||
fn remove_council_member() -> Weight;
|
||||
/// `veto_proposal` — council iter (≤7) + threshold flip path.
|
||||
fn veto_proposal() -> Weight;
|
||||
/// `mark_as_advisor` — 1 read + 1 write.
|
||||
fn mark_as_advisor() -> Weight;
|
||||
/// `unmark_as_advisor` — 1 read + 1 write.
|
||||
fn unmark_as_advisor() -> Weight;
|
||||
/// `override_council_veto` — proposal/veto/advisor reads + vote inserts.
|
||||
fn override_council_veto() -> Weight;
|
||||
/// `submit_emergency_proposal` — endorsement iter (≤7) + bond + clear_prefix.
|
||||
fn submit_emergency_proposal() -> Weight;
|
||||
/// `treasury_disbursement` — proposal read + single-use + transfer.
|
||||
fn treasury_disbursement() -> Weight;
|
||||
/// `treasury_deposit` — transfer only.
|
||||
fn treasury_deposit() -> Weight;
|
||||
/// `endorse_emergency_proposal` — council iter (≤7) + insert.
|
||||
fn endorse_emergency_proposal() -> Weight;
|
||||
/// Peso de `submit_proposal` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn submit_proposal() -> Weight;
|
||||
/// Peso de `cast_vote` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn cast_vote() -> Weight;
|
||||
/// Peso de `finalize_proposal` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn finalize_proposal() -> Weight;
|
||||
/// Peso de `add_council_member` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn add_council_member() -> Weight;
|
||||
/// Peso de `remove_council_member` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn remove_council_member() -> Weight;
|
||||
/// Peso de `veto_proposal` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn veto_proposal() -> Weight;
|
||||
/// Peso de `mark_as_advisor` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn mark_as_advisor() -> Weight;
|
||||
/// Peso de `unmark_as_advisor` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn unmark_as_advisor() -> Weight;
|
||||
/// Peso de `override_council_veto` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn override_council_veto() -> Weight;
|
||||
/// Peso de `submit_emergency_proposal` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn submit_emergency_proposal() -> Weight;
|
||||
/// Peso de `treasury_disbursement` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn treasury_disbursement() -> Weight;
|
||||
/// Peso de `treasury_deposit` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn treasury_deposit() -> Weight;
|
||||
/// Peso de `endorse_emergency_proposal` — MEDIDO sobre el WASM, no estimado a mano.
|
||||
fn endorse_emergency_proposal() -> Weight;
|
||||
}
|
||||
|
||||
macro_rules! w {
|
||||
($r:expr, $w:expr) => {
|
||||
Weight::from_parts(COMPUTE, 0)
|
||||
.saturating_add(T::DbWeight::get().reads($r as u64))
|
||||
.saturating_add(T::DbWeight::get().writes($w as u64))
|
||||
};
|
||||
}
|
||||
|
||||
/// Weights parametrizados por el `DbWeight` del runtime.
|
||||
/// Weights parametrizados por el `DbWeight` real del runtime.
|
||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||
|
||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
fn submit_proposal() -> Weight { w!(3, 4) }
|
||||
fn cast_vote() -> Weight { w!(4, 2) }
|
||||
fn finalize_proposal() -> Weight { w!(3, 4) }
|
||||
fn add_council_member() -> Weight { w!(3, 2) }
|
||||
fn remove_council_member() -> Weight { w!(2, 2) }
|
||||
fn veto_proposal() -> Weight { w!(10, 4) }
|
||||
fn mark_as_advisor() -> Weight { w!(1, 1) }
|
||||
fn unmark_as_advisor() -> Weight { w!(1, 1) }
|
||||
fn override_council_veto() -> Weight { w!(5, 3) }
|
||||
fn submit_emergency_proposal() -> Weight { w!(12, 11) }
|
||||
fn treasury_disbursement() -> Weight { w!(4, 3) }
|
||||
fn treasury_deposit() -> Weight { w!(2, 2) }
|
||||
fn endorse_emergency_proposal() -> Weight { w!(10, 1) }
|
||||
/// Storage: `Governance::Proposals` (r:1 w:1)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::TotalIssuance` (r:1 w:0)
|
||||
/// Proof: `Balances::TotalIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// 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: `Governance::ProposalBond` (r:0 w:1)
|
||||
/// Proof: `Governance::ProposalBond` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`)
|
||||
fn submit_proposal() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `107`
|
||||
// Estimado: `3722`
|
||||
// Tiempo minimo de ejecucion: 46_000_000 picosegundos.
|
||||
Weight::from_parts(46_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(T::DbWeight::get().reads(7_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `Governance::AdvisorFlags` (r:1 w:0)
|
||||
/// Proof: `Governance::AdvisorFlags` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::Proposals` (r:1 w:1)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Number` (r:1 w:0)
|
||||
/// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::Votes` (r:1 w:1)
|
||||
/// Proof: `Governance::Votes` (`max_values`: None, `max_size`: Some(97), added: 2572, 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`)
|
||||
fn cast_vote() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `310`
|
||||
// Estimado: `3722`
|
||||
// Tiempo minimo de ejecucion: 16_000_000 picosegundos.
|
||||
Weight::from_parts(18_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(T::DbWeight::get().reads(7_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4_u64))
|
||||
}
|
||||
/// Storage: `Governance::Proposals` (r:1 w:1)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Number` (r:1 w:0)
|
||||
/// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::ProposalBond` (r:1 w:0)
|
||||
/// Proof: `Governance::ProposalBond` (`max_values`: None, `max_size`: Some(96), added: 2571, 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`)
|
||||
fn finalize_proposal() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `310`
|
||||
// Estimado: `3722`
|
||||
// Tiempo minimo de ejecucion: 13_000_000 picosegundos.
|
||||
Weight::from_parts(14_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Governance::CouncilSize` (r:1 w:1)
|
||||
/// Proof: `Governance::CouncilSize` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::Council` (r:1 w:1)
|
||||
/// Proof: `Governance::Council` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn add_council_member() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `25`
|
||||
// Estimado: `3554`
|
||||
// Tiempo minimo de ejecucion: 10_000_000 picosegundos.
|
||||
Weight::from_parts(11_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3554))
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4_u64))
|
||||
}
|
||||
/// Storage: `Governance::Council` (r:1 w:1)
|
||||
/// Proof: `Governance::Council` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::CouncilSize` (r:1 w:1)
|
||||
/// Proof: `Governance::CouncilSize` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn remove_council_member() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `153`
|
||||
// Estimado: `3554`
|
||||
// Tiempo minimo de ejecucion: 11_000_000 picosegundos.
|
||||
Weight::from_parts(12_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3554))
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4_u64))
|
||||
}
|
||||
/// Storage: `Governance::Council` (r:1 w:0)
|
||||
/// Proof: `Governance::Council` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::Proposals` (r:1 w:1)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::CouncilSize` (r:1 w:0)
|
||||
/// Proof: `Governance::CouncilSize` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::VetoVotes` (r:2 w:1)
|
||||
/// Proof: `Governance::VetoVotes` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::ProposalBond` (r:1 w:0)
|
||||
/// Proof: `Governance::ProposalBond` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`)
|
||||
/// 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: `Governance::VetoRejected` (r:0 w:1)
|
||||
/// Proof: `Governance::VetoRejected` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::VetoCount` (r:0 w:1)
|
||||
/// Proof: `Governance::VetoCount` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
fn veto_proposal() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `435`
|
||||
// Estimado: `6132`
|
||||
// Tiempo minimo de ejecucion: 28_000_000 picosegundos.
|
||||
Weight::from_parts(30_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6132))
|
||||
.saturating_add(T::DbWeight::get().reads(10_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(6_u64))
|
||||
}
|
||||
/// Storage: `Governance::AdvisorFlags` (r:1 w:1)
|
||||
/// Proof: `Governance::AdvisorFlags` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn mark_as_advisor() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `25`
|
||||
// Estimado: `3513`
|
||||
// Tiempo minimo de ejecucion: 9_000_000 picosegundos.
|
||||
Weight::from_parts(10_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3513))
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Governance::AdvisorFlags` (r:1 w:1)
|
||||
/// Proof: `Governance::AdvisorFlags` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn unmark_as_advisor() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `98`
|
||||
// Estimado: `3513`
|
||||
// Tiempo minimo de ejecucion: 10_000_000 picosegundos.
|
||||
Weight::from_parts(10_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3513))
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Governance::Proposals` (r:1 w:0)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::VetoRejected` (r:1 w:0)
|
||||
/// Proof: `Governance::VetoRejected` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::AdvisorFlags` (r:1 w:0)
|
||||
/// Proof: `Governance::AdvisorFlags` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::OverrideVotes` (r:1 w:1)
|
||||
/// Proof: `Governance::OverrideVotes` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::OverrideStakeTotal` (r:1 w:1)
|
||||
/// Proof: `Governance::OverrideStakeTotal` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`)
|
||||
fn override_council_veto() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `361`
|
||||
// Estimado: `3722`
|
||||
// Tiempo minimo de ejecucion: 16_000_000 picosegundos.
|
||||
Weight::from_parts(16_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(T::DbWeight::get().reads(5_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2_u64))
|
||||
}
|
||||
/// Storage: `Governance::Council` (r:1 w:0)
|
||||
/// Proof: `Governance::Council` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::CouncilSize` (r:1 w:0)
|
||||
/// Proof: `Governance::CouncilSize` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::EmergencyEndorsements` (r:2 w:1)
|
||||
/// Proof: `Governance::EmergencyEndorsements` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::Proposals` (r:1 w:1)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::TotalIssuance` (r:1 w:0)
|
||||
/// Proof: `Balances::TotalIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// 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: `Governance::ProposalBond` (r:0 w:1)
|
||||
/// Proof: `Governance::ProposalBond` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`)
|
||||
fn submit_emergency_proposal() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `353`
|
||||
// Estimado: `6132`
|
||||
// Tiempo minimo de ejecucion: 60_000_000 picosegundos.
|
||||
Weight::from_parts(61_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6132))
|
||||
.saturating_add(T::DbWeight::get().reads(11_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(6_u64))
|
||||
}
|
||||
/// Storage: `Governance::Proposals` (r:1 w:0)
|
||||
/// Proof: `Governance::Proposals` (`max_values`: None, `max_size`: Some(257), added: 2732, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::Disbursed` (r:1 w:1)
|
||||
/// Proof: `Governance::Disbursed` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Balances::TotalIssuance` (r:1 w:0)
|
||||
/// Proof: `Balances::TotalIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:2 w:2)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn treasury_disbursement() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `494`
|
||||
// Estimado: `6196`
|
||||
// Tiempo minimo de ejecucion: 51_000_000 picosegundos.
|
||||
Weight::from_parts(52_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6196))
|
||||
.saturating_add(T::DbWeight::get().reads(9_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(5_u64))
|
||||
}
|
||||
/// Storage: `Balances::TotalIssuance` (r:1 w:0)
|
||||
/// Proof: `Balances::TotalIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn treasury_deposit() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `101`
|
||||
// Estimado: `3593`
|
||||
// Tiempo minimo de ejecucion: 38_000_000 picosegundos.
|
||||
Weight::from_parts(42_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3593))
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
/// Storage: `Governance::Council` (r:1 w:0)
|
||||
/// Proof: `Governance::Council` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::EmergencyEndorsements` (r:2 w:1)
|
||||
/// Proof: `Governance::EmergencyEndorsements` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Governance::CouncilSize` (r:1 w:0)
|
||||
/// Proof: `Governance::CouncilSize` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// 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`)
|
||||
fn endorse_emergency_proposal() -> Weight {
|
||||
// Proof size en bytes:
|
||||
// Medido: `153`
|
||||
// Estimado: `6132`
|
||||
// Tiempo minimo de ejecucion: 20_000_000 picosegundos.
|
||||
Weight::from_parts(21_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6132))
|
||||
.saturating_add(T::DbWeight::get().reads(8_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3_u64))
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! wnop {
|
||||
($r:expr, $w:expr) => {
|
||||
Weight::from_parts(COMPUTE, 0)
|
||||
.saturating_add(RocksDbWeight::get().reads($r as u64))
|
||||
.saturating_add(RocksDbWeight::get().writes($w as u64))
|
||||
};
|
||||
}
|
||||
|
||||
/// Impl no-op para mocks / tests.
|
||||
/// Impl para mocks y tests — `RocksDbWeight` directo, sin necesitar `T`.
|
||||
impl WeightInfo for () {
|
||||
fn submit_proposal() -> Weight { wnop!(3, 4) }
|
||||
fn cast_vote() -> Weight { wnop!(4, 2) }
|
||||
fn finalize_proposal() -> Weight { wnop!(3, 4) }
|
||||
fn add_council_member() -> Weight { wnop!(3, 2) }
|
||||
fn remove_council_member() -> Weight { wnop!(2, 2) }
|
||||
fn veto_proposal() -> Weight { wnop!(10, 4) }
|
||||
fn mark_as_advisor() -> Weight { wnop!(1, 1) }
|
||||
fn unmark_as_advisor() -> Weight { wnop!(1, 1) }
|
||||
fn override_council_veto() -> Weight { wnop!(5, 3) }
|
||||
fn submit_emergency_proposal() -> Weight { wnop!(12, 11) }
|
||||
fn treasury_disbursement() -> Weight { wnop!(4, 3) }
|
||||
fn treasury_deposit() -> Weight { wnop!(2, 2) }
|
||||
fn endorse_emergency_proposal() -> Weight { wnop!(10, 1) }
|
||||
fn submit_proposal() -> Weight {
|
||||
Weight::from_parts(46_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(RocksDbWeight::get().reads(7_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5_u64))
|
||||
}
|
||||
fn cast_vote() -> Weight {
|
||||
Weight::from_parts(18_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(RocksDbWeight::get().reads(7_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4_u64))
|
||||
}
|
||||
fn finalize_proposal() -> Weight {
|
||||
Weight::from_parts(14_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
fn add_council_member() -> Weight {
|
||||
Weight::from_parts(11_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3554))
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4_u64))
|
||||
}
|
||||
fn remove_council_member() -> Weight {
|
||||
Weight::from_parts(12_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3554))
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(4_u64))
|
||||
}
|
||||
fn veto_proposal() -> Weight {
|
||||
Weight::from_parts(30_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6132))
|
||||
.saturating_add(RocksDbWeight::get().reads(10_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(6_u64))
|
||||
}
|
||||
fn mark_as_advisor() -> Weight {
|
||||
Weight::from_parts(10_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3513))
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
fn unmark_as_advisor() -> Weight {
|
||||
Weight::from_parts(10_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3513))
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
fn override_council_veto() -> Weight {
|
||||
Weight::from_parts(16_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3722))
|
||||
.saturating_add(RocksDbWeight::get().reads(5_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(2_u64))
|
||||
}
|
||||
fn submit_emergency_proposal() -> Weight {
|
||||
Weight::from_parts(61_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6132))
|
||||
.saturating_add(RocksDbWeight::get().reads(11_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(6_u64))
|
||||
}
|
||||
fn treasury_disbursement() -> Weight {
|
||||
Weight::from_parts(52_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6196))
|
||||
.saturating_add(RocksDbWeight::get().reads(9_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(5_u64))
|
||||
}
|
||||
fn treasury_deposit() -> Weight {
|
||||
Weight::from_parts(42_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3593))
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(3_u64))
|
||||
}
|
||||
fn endorse_emergency_proposal() -> Weight {
|
||||
Weight::from_parts(21_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6132))
|
||||
.saturating_add(RocksDbWeight::get().reads(8_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)] = &[
|
||||
("submit_proposal", <() as WeightInfo>::submit_proposal()),
|
||||
("cast_vote", <() as WeightInfo>::cast_vote()),
|
||||
("finalize_proposal", <() as WeightInfo>::finalize_proposal()),
|
||||
("add_council_member", <() as WeightInfo>::add_council_member()),
|
||||
("remove_council_member", <() as WeightInfo>::remove_council_member()),
|
||||
("veto_proposal", <() as WeightInfo>::veto_proposal()),
|
||||
("mark_as_advisor", <() as WeightInfo>::mark_as_advisor()),
|
||||
("unmark_as_advisor", <() as WeightInfo>::unmark_as_advisor()),
|
||||
("override_council_veto", <() as WeightInfo>::override_council_veto()),
|
||||
("submit_emergency_proposal", <() as WeightInfo>::submit_emergency_proposal()),
|
||||
("treasury_disbursement", <() as WeightInfo>::treasury_disbursement()),
|
||||
("treasury_deposit", <() as WeightInfo>::treasury_deposit()),
|
||||
("endorse_emergency_proposal", <() as WeightInfo>::endorse_emergency_proposal()),
|
||||
];
|
||||
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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user