opentensor / subtensor

Bittensor Blockchain Layer
The Unlicense
145 stars 149 forks source link

Weights dont match benchmarks #418

Closed distributedstatemachine closed 4 months ago

distributedstatemachine commented 4 months ago

From DMs with @JohnReedV :

Hey, I added benchmakrs for commit/reveal. While I was doing so I noticed a lot of the existing benchmarks in the subtensor pallet don't work or have different results than what is set above their function signature. Might be something we should look at.

For example add stake is defined as

        #[pallet::call_index(2)]
        #[pallet::weight((Weight::from_parts(65_000_000, 0)
        .saturating_add(T::DbWeight::get().reads(8))
        .saturating_add(T::DbWeight::get().writes(6)), DispatchClass::Normal, Pays::No))]
        pub fn add_stake(
            origin: OriginFor<T>,
            hotkey: T::AccountId,
            amount_staked: u64,
        ) -> DispatchResult {
            Self::do_add_stake(origin, hotkey, amount_staked)
        } 

but the benchmark result is


========
-- Extrinsic Time --

Model:
Time ~=       85
              µs

Reads = 10
Writes = 7
Recorded proof Size = 1064

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=       85
              µs

Reads = 10
Writes = 7
Recorded proof Size = 1064```