Los 19 extrinsics de provenance/fees/agent-identity/emission/governance pasan de weights placeholder `from_parts(10_000, 0)` (proof_size=0, sin contar reads/writes de DB — vector de DoS real) a weights INTERIM hand-derived DB-aware vía el trait `WeightInfo`. Cierra el mispricing de DoS en TODOS los extrinsics del chain. Cada pallet gana: - weights.rs: trait WeightInfo + SubstrateWeight<T> (DB-aware vía T::DbWeight) + impl () - benchmarking.rs: benchmarks FRAME v2, VERIFICADOS por impl_benchmark_test_suite! (19 benchmarks ejecutan+pasan en los mocks — cargo test --features runtime-benchmarks) - Config: `type WeightInfo` + swap de los `#[pallet::weight]` Runtime: - define_benchmarks! con los 5 pallets + runtime API Benchmark (inerte sin la feature) - WeightInfo cableado a SubstrateWeight<Runtime> en cada Config - RUNTIME_VERSION 8→9 (weights = consenso-relevante: fee + llenado de bloque; las firmas de los extrinsics NO cambian ⇒ TRANSACTION_VERSION intacto) 3 bugs latentes cerrados (territorio virgen — el runtime NUNCA se compiló con runtime-benchmarks; las dimensiones nuevas cazan lo que no se había visto): - pallet-grandpa/try-runtime mal ubicado en la feature runtime-benchmarks (copy-paste erróneo: features ortogonales; NUNCA activaba los benchmarks de grandpa) - feature runtime-benchmarks incompleta → E0046 en OriginFeeAdapter (métodos benchmark-gated de OnChargeTransaction) + pallet-staking (StakingUnchecked::migrate_to_direct_staker); ahora lista TODOS los pallets como un runtime de producción Substrate - pallet-revive/runtime-benchmarks omitido a propósito (fixtures RISC-V/PolkaVM indisponibles; ReviveApi deferred, no benchmarkeado) emission: mock extraído del `mod tests` inline a `pub mod mock` (reuso del test-suite, sin duplicar el scaffold; los 15 tests existentes + el benchmark verdes). GATED (documentado en el §Estado de cada weights.rs): la generación de números CANÓNICOS por CLI requiere el node sc-service o omni-bencher+WASM (ambos bloqueados hace sesiones). Los weights interinos son DB-aware/DoS-safe y regenerables de forma mecánica cuando aterrice el HW de referencia (Pi5/VPS) — benchmarking.rs es la fuente de verdad de la FORMA. Verificado: 5 test-suites de pallet verdes (con y sin runtime-benchmarks) + runtime compila en ambos modos + workspace sin regresión + 40 tests de runtime (incl. v9). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
65 lines
2.1 KiB
TOML
65 lines
2.1 KiB
TOML
[package]
|
|
name = "origin-chain-governance"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
homepage.workspace = true
|
|
description = "Foundation governance on-chain canonical: Proposal + Vote + Tally per CHN-4 AI-Driven Human-Guarded. Phase 5.1 v0.0.28 scaffold — humans-only vote enforced canonical, 5 AI advisor agents advise-only canonical."
|
|
|
|
[dependencies]
|
|
# Origin Chain canonical types (ProposalId + VoteStance + Vote source-of-truth)
|
|
origin-chain-types = { workspace = true }
|
|
|
|
# FRAME canonical pallet macro + storage + dispatch + events + errors
|
|
frame-support = { workspace = true }
|
|
frame-system = { workspace = true }
|
|
|
|
# Runtime API canonical (v0.0.31 — GovernanceApi.query_proposal read-only RPC)
|
|
sp-api = { workspace = true }
|
|
|
|
# Substrate primitives canonical (BLAKE2 hashing canonical para derive_proposal_id)
|
|
sp-core = { workspace = true }
|
|
sp-runtime = { workspace = true }
|
|
|
|
# SCALE codec canonical
|
|
parity-scale-codec = { workspace = true }
|
|
scale-info = { workspace = true }
|
|
|
|
# Benchmarking canonical (FRAME v2) — optional, solo activo bajo runtime-benchmarks.
|
|
frame-benchmarking = { workspace = true, optional = true }
|
|
|
|
[dev-dependencies]
|
|
# Mock runtime canonical para integration tests v0.0.30 — Pattern v0.0.26 mirror.
|
|
sp-core = { workspace = true, default-features = true }
|
|
sp-io = { workspace = true, default-features = true }
|
|
sp-runtime = { workspace = true, default-features = true }
|
|
# FIX-6: pallet_balances en el mock para testear la tesorería real (transfers).
|
|
pallet-balances = { workspace = true, default-features = true }
|
|
|
|
[features]
|
|
default = ["std"]
|
|
std = [
|
|
"origin-chain-types/std",
|
|
"frame-support/std",
|
|
"frame-system/std",
|
|
"sp-api/std",
|
|
"sp-core/std",
|
|
"sp-runtime/std",
|
|
"parity-scale-codec/std",
|
|
"scale-info/std",
|
|
"frame-benchmarking?/std",
|
|
]
|
|
runtime-benchmarks = [
|
|
"dep:frame-benchmarking",
|
|
"frame-benchmarking/runtime-benchmarks",
|
|
"frame-support/runtime-benchmarks",
|
|
"frame-system/runtime-benchmarks",
|
|
]
|
|
try-runtime = [
|
|
"frame-support/try-runtime",
|
|
"frame-system/try-runtime",
|
|
]
|