Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Add Funding and Dispenser weights #297

Merged
merged 4 commits into from
May 16, 2024
Merged

🔧 Add Funding and Dispenser weights #297

merged 4 commits into from
May 16, 2024

Conversation

lrazovic
Copy link
Member

@lrazovic lrazovic commented May 14, 2024

What?

Add Funding and Dispenser weights

Todo

  • Use the new weights in the Runtime.

@lrazovic lrazovic self-assigned this May 14, 2024
@JuaniRios
Copy link
Contributor

~/Documents/Projects/polimec-node git:[leo/more-weights]
subweight --verbose compare files --old ~/Desktop/weights.rs --new pallets/funding/src/weights.rs --method guess-worst --unit time
+------------+--------------------------------------------------------+----------+----------+----------------+
| File       | Extrinsic                                              | Old      | New      | Change [%]     |
+============================================================================================================+
| weights.rs | settle_successful_evaluation                           | 0ps      | 736.99us |  +inf   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | settle_successful_contribution                         | 0ps      | 1.30ms   |  +inf   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | settle_successful_bid                                  | 0ps      | 1.28ms   |  +inf   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | settle_failed_evaluation                               | 0ps      | 481.87us |  +inf   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | settle_failed_contribution                             | 0ps      | 740.78us |  +inf   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | settle_failed_bid                                      | 0ps      | 740.77us |  +inf   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | start_community_funding                                | 144.28ms | 269.51ms | +86.80  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | start_evaluation                                       | 323.78us | 461.38us | +42.50  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | contribution                                           | 1.10ms   | 1.56ms   | +41.64  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | end_funding_awaiting_decision_evaluators_unchanged     | 320.99us | 426.56us | +32.89  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | end_funding_awaiting_decision_evaluators_slashed       | 321.39us | 426.99us | +32.86  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | end_funding_automatically_rejected_evaluators_slashed  | 326.04us | 428.59us | +31.45  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | bid                                                    | 1.11ms   | 1.42ms   | +28.32  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | evaluation                                             | 723.94us | 881.81us | +21.81  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | end_funding_automatically_accepted_evaluators_rewarded | 614.57us | 705.70us | +14.83  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | end_evaluation_success                                 | 3.09ms   | 2.92ms   | -5.72   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | project_decision                                       | 294.00us | 269.31us | -8.40   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | end_evaluation_failure                                 | 285.00us | 237.02us | -16.84  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | decide_project_outcome                                 | 512.33us | 345.42us | -32.58  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | start_auction_manually                                 | 11.26ms  | 3.09ms   | -72.57  |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | edit_metadata                                          | 194.00us |          | Removed |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | create                                                 | 769.00us |          | Removed |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | remove_project                                         |          | 579.14us | Added   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | edit_project                                           |          | 482.43us | Added   |
|------------+--------------------------------------------------------+----------+----------+----------------|
| weights.rs | create_project                                         |          | 863.11us | Added   |
+------------+--------------------------------------------------------+----------+----------+----------------+

@JuaniRios
Copy link
Contributor

JuaniRios commented May 16, 2024

~/Documents/Projects/polimec-node git:[leo/more-weights]
subweight --verbose compare files --old ~/Desktop/weights.rs --new pallets/funding/src/weights.rs --method guess-worst --unit proof 
+------------+--------------------------------+-----------+-----------+----------------+
| File       | Extrinsic                      | Old       | New       | Change [%]     |
+======================================================================================+
| weights.rs | settle_successful_evaluation   | 0B        | 6.32KiB   |  +inf   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | settle_successful_contribution | 0B        | 6.32KiB   |  +inf   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | settle_successful_bid          | 0B        | 6.32KiB   |  +inf   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | settle_failed_evaluation       | 0B        | 4.51KiB   |  +inf   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | settle_failed_contribution     | 0B        | 6.06KiB   |  +inf   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | settle_failed_bid              | 0B        | 6.06KiB   |  +inf   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | project_decision               | 5.85KiB   | 3.75KiB   | -35.85  |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | decide_project_outcome         | 409.34KiB | 245.55KiB | -40.01  |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | end_evaluation_failure         | 11.98KiB  | 3.75KiB   | -68.66  |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | start_auction_manually         | 990.30KiB | 245.55KiB | -75.20  |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | edit_metadata                  | 3.72KiB   |           | Removed |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | create                         | 3.51KiB   |           | Removed |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | remove_project                 |           | 3.75KiB   | Added   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | edit_project                   |           | 3.75KiB   | Added   |
|------------+--------------------------------+-----------+-----------+----------------|
| weights.rs | create_project                 |           | 3.51KiB   | Added   |
+------------+--------------------------------+-----------+-----------+----------------+

@JuaniRios
Copy link
Contributor

Our biggest benchmark is the WAP calculation.
Running it with the max values of x=99, y=512, z=512:

[runtimes/polimec/src/lib.rs:304] weights::pallet_funding::WeightInfo::<Runtime>::start_community_funding(99,
    512, 512) = Weight {
    ref_time: 425075813897,
    proof_size: 3531038,
}

This are the operational block weights defined in the Polimec runtime:

    operational: {
      baseExtrinsic: {
        refTime: 125,000,000
        proofSize: 0
      }
      maxExtrinsic: {
        refTime: 474,875,000,000
        proofSize: 4,980,736
      }
      maxTotal: {
        refTime: 500,000,000,000
        proofSize: 5,242,880
      }
      reserved: {
        refTime: 125,000,000,000
        proofSize: 1,310,720
      }
    }
    
  

We are dangerously close...

@JuaniRios JuaniRios marked this pull request as ready for review May 16, 2024 10:22
Copy link
Member Author

@lrazovic lrazovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't officially approve since it's technically my PR, but it LGTM. Thanks for the weight comparison and the heads-up about the WAP calculation. Let's work on improving that now that we have a baseline weight/proof for comparison.

@JuaniRios JuaniRios merged commit 73d796e into main May 16, 2024
@JuaniRios JuaniRios deleted the leo/more-weights branch May 16, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants