Commit graph

3 commits

Author SHA1 Message Date
Gonza Montiel
786ddb39a9
fix: add missing benchmarks and weights (#302)
## Add missing weights
The aim of this PR is to complete our weights by enabling more runtime
benchmarks from the pallets used in DataHaven. I will start this effort
with Storage Hub pallets.

## What's included
- [x] `pallet_nfts`
  - [x] Added signing helper for pallet nfts
  - [x] Add pallet to benchmarks
  - [x] Run benches and generate weights
  - [x] Wire up weights to runtimes  

- [x] `pallet_session`
  - [x] Added a `pallet_session_benchmarking` crate
  - [x] Added signing helpers
  - [x] Add pallet to benchmarks
  - [x] Run benches and generate weights
  - [x] Wire up weights to runtimes  

- [x] `pallet_payment_streams`
  - [x] Add `TreasuryAccount` helper and configure properly
  - [x] Add pallet to benchmarks
  - [x] Run benches and generate weights
  - [x] Wire up weights to runtimes  
  
- [x] `pallet_storage_providers`
  - [x] Add `TreasuryAccount` helper and configure properly
  - [x] Add pallet to benchmarks
  - [x] Run benches and generate weights
  - [x] Wire up weights to runtimes  

- [x] `pallet_file_system`
  - [x] Add pallet to benchmarks and configure properly
  - [ ] Run benches and generate weights
  - [x] Wire up weights to runtimes  

- [x] `pallet_proofs_dealer`
  - [x] Add pallet to benchmarks and configure properly
  - [x] Run benches and generate weights
  - [x] Wire up weights to runtimes  


## What's not included
- `pallet_identity` - We'll enable it once we update to `2506`, that
will allow us to have a BenchmarkHelper in the config on the pallet (see
[here](ac28323e7d/operator/runtime/mainnet/src/configs/mod.rs (L632-L643)))
- `pallet_grandpa` - the upstream pallet defines
[benchmarks](bbc435c766/substrate/frame/grandpa/src/benchmarking.rs (L25))
for `check_equivocation_proof` and `note_stalled`, but the required
weights to be wired are actually `report_equivocation`,
`report_equivocation_unsigned` and `note_stalled`. That means including
`pallet_grandpa` in the benchmarks results in an inconsistent
`WeightInfo` implementation, so further understanding in the pallet's
approach to benchmarking is needed.
- `pallet_file_system` -> Run benches and generate weights. Weights will
fail because of a hardcoded `AccountId32` on the
[benchmarks](57d2a195d5/pallets/file-system/src/benchmark_proofs.rs (L69-L71)).
I'll create a PR for SH soon.

These two are left for a follow up PR.
2026-02-03 17:12:11 +01:00
Gonza Montiel
bd99fb7c4e
fix: pallet collective weights aliases (#337)
We have two instances of `pallet_collective`
- `pallet_collective_treasury_council`
- `pallet_collective_technical_committee`

Our weights template automatically generates an implementation for
`pallet_collective_treasury_council::WeightInfo` or
`pallet_collective_technical_committee::WeightInfo`, which don't exist,
making the compilation fail right after running benches.
I created aliases for both pallet names, and added a small tweak to the
template so it does not break anymore.

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-12-05 14:22:52 +01:00
Federico Rodríguez
843502d21a
test: init benchmark infra (#110)
* Add `run_benchmarks.sh` script to run runtime benchmarks
* Sets up benchmark configs and directory structure to store weights
(`operator/runtime/<RUNTIME>/weights`)
* (naive) fixes to some benchmarks: 
    * `pallet_datahaven_native_transfer`: 
      * use a mock for `NativeTokenId`
* look at the balance difference of the treasury instead of the total
(this makes the benchmark agnostic to genesis setup)
* `snowbridge_pallet_system` / `snowbridge_pallet_system_v2` use native
token xcm location vs relay chain one. Add missing benchmark methods and
update fixture with valid data.
* `snowbridge_pallet_ethereum_client`: update fixtures with valid data
* `snowbrige_pallet_inbound_queue_v2`: set EthereumGatewayAddress when
initializing storage on benchmark and use a mock message processor ( as
fixture has `CreateAsset` payload which is not supported in the
`EigenLayerMessageProcessor`)
* `snowbridge_pallet_outbound_queue_v2`: add missing
`submit_delivery_receipt` benchmark which required a dedicated fixture
(all copied from the upstream pallet)
* `pallet_treasury`: Use an `ExistentialDeposit` of `1` on benchmark,
else payout fails.
* `pallet_transaction_payment`: Use a custom `WeightToFee` that makes
the Fee small, else account in benchmark cannot pay for fees (It is
funded a multiplier of `ExistentialDeposit` and is expected for that to
be enough, but it's not in our particular setup).
* comment out `pallet_identity` and `pallet_im_online` due to
incompatibilities (to be addressed later)
* Basic benchmark run to set `WeightInfo` from `weights` in configs
(real run should be done later using target hardware)

---------

Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
Co-authored-by: Tobi Demeco <50408393+TDemeco@users.noreply.github.com>
Co-authored-by: undercover-cactus <lola@moonsonglabs.com>
Co-authored-by: TDemeco <tdemeco@itba.edu.ar>
2025-08-06 13:44:42 +02:00