frequency-chain / frequency

Frequency: A Polkadot Parachain
https://www.frequency.xyz
Apache License 2.0
49 stars 18 forks source link

Chores/update capacity benchmarks #1949 #1966

Closed shannonwells closed 4 months ago

shannonwells commented 4 months ago

Goal

The goal of this PR is to update the benchmark for on_initialize to include the weight when a new RewardEra must be created.

Closes #1949

Discussion

Separates the benchmark for on_initialize into two, start_new_epoch_if_needed and start_new_reward_era_if_needed. Those functions return the WeightInfo for their respective benchmarks.

For start_new_reward_era_if_needed, fills up the reward pool history and sets up the block and era to ensure that a new RewardEra will be created during the benchmark.

Results: The new weights are a lot larger, 19M as compared to 4M, 6 reads as compared to 2, 4 writes as compared to 1, so there's some optimization work to be done. Filed new Issue #1967

Checklist

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

shannonwells commented 4 months ago

You are correct, I'd completely overlooked that it was doing that, and I'm not sure why it was set up that way.