Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[pallet-staking] Refund unused weight for payout_stakers #8458

Merged
11 commits merged into from
Mar 28, 2021

Conversation

emostov
Copy link
Contributor

@emostov emostov commented Mar 25, 2021

fixes #8428

Overview

This PR enables payout_stakers to refund weight based on how many payout ops where completed. Previously, the validators payout op was not taken into account for the max weight; this updates the logic so the maximum weight reflects payout ops for MaxNominatorRewardedPerValidator + the validator.

Discussion

From the original issue:

Each payout variant should have its own weight benchmark, and we must add them up. So the function will still use the upfront worse case weight, but will refund quite a bit along the way.

The current iteration of this PR does not discriminate weight used based on payout destination variant and instead just assumes worst case for every payout op.

Questions for review:

  • Should we take into account different weights for different reward destinations?
  • The current tests do not rely on hardcoded weights but instead are all relative to WeightInfo::payout_stakers_alive_staked - is this ok?

@emostov emostov added A3-in_progress Pull request is in progress. No review needed at this stage. B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Mar 25, 2021
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Mar 25, 2021
@shawntabrizi
Copy link
Member

Should we take into account different weights for different reward destinations?

IMO, no. If we want this optimization, it can happen in the future.

@shawntabrizi
Copy link
Member

/benchmark runtime pallet pallet_staking

@parity-benchapp
Copy link

parity-benchapp bot commented Mar 25, 2021

Finished benchmark for branch: zeke-staking-payout-fn-refund

Benchmark: Benchmark Runtime Pallet

cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs

Results

Pallet: "pallet_staking", Extrinsic: "bond", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 79.89
µs

Reads = 5
Writes = 4
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 79.89
µs

Reads = 5
Writes = 4
Pallet: "pallet_staking", Extrinsic: "bond_extra", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 60.56
µs

Reads = 3
Writes = 2
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 60.56
µs

Reads = 3
Writes = 2
Pallet: "pallet_staking", Extrinsic: "unbond", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 54.99
µs

Reads = 4
Writes = 3
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 54.99
µs

Reads = 4
Writes = 3
Pallet: "pallet_staking", Extrinsic: "withdraw_unbonded_update", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 56.04
+ s 0.068
µs

Reads = 4 + (0 * s)
Writes = 3 + (0 * s)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
s mean µs sigma µs %
0 55.28 0.162 0.2%
2 55.53 0.2 0.3%
4 56.01 0.081 0.1%
6 56.17 0.103 0.1%
8 56.52 0.124 0.2%
10 56.34 0.1 0.1%
12 56.37 0.131 0.2%
14 57.04 0.131 0.2%
16 57.34 0.23 0.4%
18 57.45 0.13 0.2%
20 57.35 0.133 0.2%
22 57.52 0.184 0.3%
24 57.91 0.145 0.2%
26 58.25 0.141 0.2%
28 58.16 0.088 0.1%
30 58.41 0.15 0.2%
32 58.68 0.152 0.2%
34 58.48 0.181 0.3%
36 58.71 0.085 0.1%
38 58.86 0.109 0.1%
40 59.13 0.172 0.2%
42 58.76 0.089 0.1%
44 59.43 0.11 0.1%
46 59.37 0.192 0.3%
48 59.64 0.109 0.1%
50 59.97 0.158 0.2%
52 59.7 0.191 0.3%
54 59.5 0.339 0.5%
56 59.4 0.344 0.5%
58 60.02 0.152 0.2%
60 60.06 0.108 0.1%
62 60.68 0.116 0.1%
64 60.39 0.305 0.5%
66 60.58 0.215 0.3%
68 60.87 0.243 0.3%
70 61.2 0.203 0.3%
72 60.5 0.411 0.6%
74 60.67 0.58 0.9%
76 60.04 0.417 0.6%
78 61.42 0.131 0.2%
80 61.51 0.105 0.1%
82 61.67 0.13 0.2%
84 61.97 0.121 0.1%
86 62.01 0.14 0.2%
88 61.81 0.074 0.1%
90 62.32 0.134 0.2%
92 62.26 0.083 0.1%
94 62.28 0.104 0.1%
96 61.53 0.258 0.4%
98 62.2 0.587 0.9%
100 62.86 0.152 0.2%

Quality and confidence:
param error
s 0

Model:
Time ~= 56.05
+ s 0.067
µs

Reads = 4 + (0 * s)
Writes = 3 + (0 * s)
Pallet: "pallet_staking", Extrinsic: "withdraw_unbonded_kill", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 90.53
+ s 2.784
µs

Reads = 6 + (0 * s)
Writes = 8 + (1 * s)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
s mean µs sigma µs %
0 84.48 0.2 0.2%
2 95.64 0.122 0.1%
4 101.2 0.157 0.1%
6 106.4 0.09 0.0%
8 112.4 0.135 0.1%
10 118.6 0.292 0.2%
12 123.9 0.156 0.1%
14 129.3 0.192 0.1%
16 134.7 0.105 0.0%
18 140.6 0.22 0.1%
20 146.1 0.184 0.1%
22 151.3 0.136 0.0%
24 158.6 0.27 0.1%
26 164.1 0.276 0.1%
28 169.1 0.197 0.1%
30 174.2 0.26 0.1%
32 180 0.267 0.1%
34 185.1 0.164 0.0%
36 191.6 0.182 0.0%
38 196.1 0.346 0.1%
40 202.1 0.301 0.1%
42 208 0.247 0.1%
44 213.4 0.236 0.1%
46 219 0.309 0.1%
48 225.2 0.265 0.1%
50 230.1 0.11 0.0%
52 235 0.338 0.1%
54 240.5 0.311 0.1%
56 247.2 0.345 0.1%
58 252.5 0.506 0.2%
60 257.1 0.259 0.1%
62 263.5 0.415 0.1%
64 268.7 0.329 0.1%
66 274.4 0.388 0.1%
68 279.6 0.281 0.1%
70 285.2 0.356 0.1%
72 290.5 0.436 0.1%
74 296.7 0.518 0.1%
76 301.9 0.464 0.1%
78 307 0.495 0.1%
80 312.4 0.321 0.1%
82 318.2 0.305 0.0%
84 323.5 0.423 0.1%
86 328.9 0.438 0.1%
88 335.1 0.26 0.0%
90 339.2 0.661 0.1%
92 347.1 0.553 0.1%
94 353 0.397 0.1%
96 358.7 0.679 0.1%
98 363.4 0.324 0.0%
100 367.6 1.225 0.3%

Quality and confidence:
param error
s 0.001

Model:
Time ~= 90.26
+ s 2.787
µs

Reads = 6 + (0 * s)
Writes = 8 + (1 * s)
Pallet: "pallet_staking", Extrinsic: "validate", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 16.34
µs

Reads = 1
Writes = 2
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 16.34
µs

Reads = 1
Writes = 2
Pallet: "pallet_staking", Extrinsic: "kick", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 27.86
+ k 18.7
µs

Reads = 1 + (1 * k)
Writes = 0 + (1 * k)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
k mean µs sigma µs %
1 44.79 1.785 3.9%
3 83.63 2.251 2.6%
5 119.4 3.255 2.7%
7 157.6 1.694 1.0%
9 194.7 2.666 1.3%
11 236.6 0.954 0.4%
13 271.7 2.368 0.8%
15 303.6 4.461 1.4%
17 346.2 4.38 1.2%
19 382.9 2.773 0.7%
21 426.5 0.989 0.2%
23 457.5 3.806 0.8%
25 486.2 0.343 0.0%
27 534.2 4.689 0.8%
29 570 3.899 0.6%
31 615.2 1.12 0.1%
33 651.1 9.319 1.4%
35 698.5 1.274 0.1%
37 724.4 4.139 0.5%
39 750.1 1.082 0.1%
41 783.8 1.962 0.2%
43 833.6 3.195 0.3%
45 863.5 2.045 0.2%
47 897.9 3.47 0.3%
49 946.1 8.824 0.9%
51 971.6 6.168 0.6%
53 1021 11.54 1.1%
55 1045 2.669 0.2%
57 1082 2.446 0.2%
59 1117 1.645 0.1%
61 1171 9.148 0.7%
63 1195 9.932 0.8%
65 1237 4.705 0.3%
67 1285 7.723 0.6%
69 1334 11.8 0.8%
71 1359 8.266 0.6%
73 1410 8.139 0.5%
75 1434 2.402 0.1%
77 1502 5.487 0.3%
79 1530 5.166 0.3%
81 1542 10.43 0.6%
83 1586 7.319 0.4%
85 1627 11.97 0.7%
87 1654 3.031 0.1%
89 1703 8.374 0.4%
91 1773 4.646 0.2%
93 1770 16.65 0.9%
95 1792 11.31 0.6%
97 1840 11.17 0.6%
99 1867 7.118 0.3%
101 1901 10.69 0.5%
103 1942 11.34 0.5%
105 1990 11.72 0.5%
107 2033 14.51 0.7%
109 2067 6.991 0.3%
111 2114 14.01 0.6%
113 2147 8.14 0.3%
115 2192 16.27 0.7%
117 2219 11.79 0.5%
119 2259 13.89 0.6%
121 2298 10.95 0.4%
123 2313 10.61 0.4%
125 2371 4.899 0.2%
127 2394 15.54 0.6%

Quality and confidence:
param error
k 0.014

Model:
Time ~= 27.08
+ k 18.73
µs

Reads = 1 + (1 * k)
Writes = 0 + (1 * k)
Pallet: "pallet_staking", Extrinsic: "nominate", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 28.97
+ n 5.691
µs

Reads = 3 + (1 * n)
Writes = 2 + (0 * n)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
n mean µs sigma µs %
1 32.69 0.072 0.2%
2 39.05 0.094 0.2%
3 46.5 0.155 0.3%
4 52.73 0.116 0.2%
5 59.25 0.084 0.1%
6 65.21 0.196 0.3%
7 70.98 0.289 0.4%
8 72.03 0.179 0.2%
9 78.7 0.171 0.2%
10 86.12 0.189 0.2%
11 91.33 0.21 0.2%
12 97.76 0.122 0.1%
13 102.7 0.295 0.2%
14 108.3 0.352 0.3%
15 113.6 0.32 0.2%
16 119.5 0.292 0.2%

Quality and confidence:
param error
n 0.023

Model:
Time ~= 29.1
+ n 5.67
µs

Reads = 3 + (1 * n)
Writes = 2 + (0 * n)
Pallet: "pallet_staking", Extrinsic: "chill", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 15.77
µs

Reads = 1
Writes = 2
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 15.77
µs

Reads = 1
Writes = 2
Pallet: "pallet_staking", Extrinsic: "set_payee", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 13.32
µs

Reads = 1
Writes = 1
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 13.32
µs

Reads = 1
Writes = 1
Pallet: "pallet_staking", Extrinsic: "set_controller", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 29.8
µs

Reads = 3
Writes = 3
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 29.8
µs

Reads = 3
Writes = 3
Pallet: "pallet_staking", Extrinsic: "set_validator_count", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 2.323
µs

Reads = 0
Writes = 1
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 2.323
µs

Reads = 0
Writes = 1
Pallet: "pallet_staking", Extrinsic: "force_no_eras", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 2.528
µs

Reads = 0
Writes = 1
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 2.528
µs

Reads = 0
Writes = 1
Pallet: "pallet_staking", Extrinsic: "force_new_era", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 2.529
µs

Reads = 0
Writes = 1
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 2.529
µs

Reads = 0
Writes = 1
Pallet: "pallet_staking", Extrinsic: "force_new_era_always", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 2.527
µs

Reads = 0
Writes = 1
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 2.527
µs

Reads = 0
Writes = 1
Pallet: "pallet_staking", Extrinsic: "set_invulnerables", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 2.666
+ v 0.034
µs

Reads = 0 + (0 * v)
Writes = 1 + (0 * v)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
v mean µs sigma µs %
0 2.54 0.017 0.6%
20 3.374 0.016 0.4%
40 4.135 0.014 0.3%
60 4.874 0.028 0.5%
80 5.53 0.018 0.3%
100 6.31 0.023 0.3%
120 6.958 0.019 0.2%
140 7.618 0.029 0.3%
160 8.261 0.029 0.3%
180 8.995 0.021 0.2%
200 9.681 0.023 0.2%
220 10.4 0.033 0.3%
240 11.02 0.03 0.2%
260 11.72 0.014 0.1%
280 12.36 0.017 0.1%
300 13.1 0.028 0.2%
320 13.76 0.03 0.2%
340 14.51 0.025 0.1%
360 15.17 0.027 0.1%
380 15.88 0.031 0.1%
400 16.52 0.031 0.1%
420 17.34 0.055 0.3%
440 17.96 0.05 0.2%
460 18.71 0.024 0.1%
480 19.25 0.025 0.1%
500 19.97 0.024 0.1%
520 20.73 0.024 0.1%
540 21.38 0.017 0.0%
560 22.27 0.039 0.1%
580 22.9 0.024 0.1%
600 23.61 0.035 0.1%
620 24.27 0.018 0.0%
640 25.02 0.048 0.1%
660 25.65 0.031 0.1%
680 26.36 0.04 0.1%
700 27.02 0.021 0.0%
720 27.78 0.031 0.1%
740 28.54 0.034 0.1%
760 29.19 0.029 0.0%
780 29.93 0.021 0.0%
800 30.74 0.024 0.0%
820 31.4 0.028 0.0%
840 32.08 0.029 0.0%
860 32.81 0.025 0.0%
880 33.4 0.018 0.0%
900 34.09 0.029 0.0%
920 34.83 0.025 0.0%
940 35.43 0.026 0.0%
960 36.27 0.027 0.0%
980 36.92 0.035 0.0%
1000 37.58 0.021 0.0%

Quality and confidence:
param error
v 0

Model:
Time ~= 2.661
+ v 0.035
µs

Reads = 0 + (0 * v)
Writes = 1 + (0 * v)
Pallet: "pallet_staking", Extrinsic: "force_unstake", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 64.98
+ s 2.751
µs

Reads = 4 + (0 * s)
Writes = 8 + (1 * s)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
s mean µs sigma µs %
0 59.23 0.183 0.3%
2 68.89 0.197 0.2%
4 75.13 0.149 0.1%
6 80.65 0.218 0.2%
8 86.25 0.294 0.3%
10 91.71 0.141 0.1%
12 97.88 0.231 0.2%
14 103.8 0.217 0.2%
16 109.3 0.189 0.1%
18 114.8 0.24 0.2%
20 120.2 0.191 0.1%
22 126.1 0.207 0.1%
24 132.5 0.123 0.0%
26 137.9 0.249 0.1%
28 142.9 0.119 0.0%
30 148 0.354 0.2%
32 153.5 0.28 0.1%
34 158.9 0.179 0.1%
36 164.6 0.206 0.1%
38 169.8 0.24 0.1%
40 175.4 0.396 0.2%
42 181.1 0.273 0.1%
44 186.5 0.408 0.2%
46 191.6 0.43 0.2%
48 197.4 0.266 0.1%
50 202 0.533 0.2%
52 207 0.492 0.2%
54 212.9 0.341 0.1%
56 219.3 0.746 0.3%
58 224.5 0.501 0.2%
60 229.1 0.435 0.1%
62 236.2 0.907 0.3%
64 240.8 0.937 0.3%
66 246.3 0.492 0.1%
68 252.4 0.5 0.1%
70 256.6 0.788 0.3%
72 262.1 0.381 0.1%
74 269.2 0.848 0.3%
76 272.5 0.612 0.2%
78 280 0.835 0.2%
80 284.3 0.816 0.2%
82 290.5 0.973 0.3%
84 294.9 0.624 0.2%
86 299.8 0.562 0.1%
88 306.9 0.995 0.3%
90 311.5 0.702 0.2%
92 318.4 0.576 0.1%
94 323.3 0.86 0.2%
96 329.1 0.744 0.2%
98 336.3 0.499 0.1%
100 340.2 0.513 0.1%

Quality and confidence:
param error
s 0.001

Model:
Time ~= 64.65
+ s 2.755
µs

Reads = 4 + (0 * s)
Writes = 8 + (1 * s)
Pallet: "pallet_staking", Extrinsic: "cancel_deferred_slash", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 6689
+ s 34.74
µs

Reads = 1 + (0 * s)
Writes = 1 + (0 * s)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
s mean µs sigma µs %
1 418.3 1.392 0.3%
20 1711 5.669 0.3%
39 2985 13.17 0.4%
58 4236 8.648 0.2%
77 5453 0.832 0.0%
96 6646 6.711 0.1%
115 7826 12.19 0.1%
134 8973 19.56 0.2%
153 10080 14.1 0.1%
172 11180 21.32 0.1%
191 12250 8.348 0.0%
210 13300 14.61 0.1%
229 14320 11.17 0.0%
248 15320 12.19 0.0%
267 16330 10.69 0.0%
286 17280 18.56 0.1%
305 18180 17.54 0.0%
324 19080 17.78 0.0%
343 19950 12.34 0.0%
362 20810 19.33 0.0%
381 21600 11.13 0.0%
400 22430 40.54 0.1%
419 23540 16.34 0.0%
438 23940 18.59 0.0%
457 24640 13.88 0.0%
476 25360 18.82 0.0%
495 26020 15.99 0.0%
514 26700 37.63 0.1%
533 27290 20.64 0.0%
552 27890 19.98 0.0%
571 28480 23.2 0.0%
590 29010 20.68 0.0%
609 29630 14.08 0.0%
628 30070 16.94 0.0%
647 30550 26.34 0.0%
666 31010 11.51 0.0%
685 31940 159.8 0.5%
704 31800 38.2 0.1%
723 32140 34.82 0.1%
742 32510 37.06 0.1%
761 32830 24.7 0.0%
780 33130 20.48 0.0%
799 33410 29.84 0.0%
818 33660 23.19 0.0%
837 33880 31.18 0.0%
856 34080 37.7 0.1%
875 34230 17.16 0.0%
894 34380 21.58 0.0%
913 34540 45.79 0.1%
932 34640 18.04 0.0%
951 34700 25.73 0.0%
970 34770 20.08 0.0%
989 34810 37.21 0.1%

Quality and confidence:
param error
s 0.393

Model:
Time ~= 5904
+ s 34.81
µs

Reads = 1 + (0 * s)
Writes = 1 + (0 * s)
Pallet: "pallet_staking", Extrinsic: "payout_stakers_dead_controller", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 127.3
+ n 52.6
µs

Reads = 10 + (3 * n)
Writes = 2 + (1 * n)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
n mean µs sigma µs %
1 170 1.301 0.7%
6 436.3 0.582 0.1%
11 700.2 1.047 0.1%
16 966.8 1.065 0.1%
21 1235 10.88 0.8%
26 1496 10.2 0.6%
31 1752 12.13 0.6%
36 2040 12.32 0.6%
41 2286 11.24 0.4%
46 2543 9.9 0.3%
51 2806 13.31 0.4%
56 3064 9.057 0.2%
61 3331 10.12 0.3%
66 3592 11.88 0.3%
71 3912 31.75 0.8%
76 4145 12.34 0.2%
81 4399 9.692 0.2%
86 4659 6.654 0.1%
91 4903 15.07 0.3%
96 5169 8.711 0.1%
101 5452 14.51 0.2%
106 5715 14.39 0.2%
111 5972 13.8 0.2%
116 6221 8.234 0.1%
121 6554 43.96 0.6%
126 6774 11.07 0.1%
131 7010 11.98 0.1%
136 7284 13.61 0.1%
141 7529 12.86 0.1%
146 7797 9.2 0.1%
151 8075 8.452 0.1%
156 8319 11.46 0.1%
161 8589 10.23 0.1%
166 8910 18.61 0.2%
171 9156 20.66 0.2%
176 9399 15.22 0.1%
181 9661 19.05 0.1%
186 9963 13.37 0.1%
191 10160 13.28 0.1%
196 10480 23.42 0.2%
201 10680 18.74 0.1%
206 10970 14.85 0.1%
211 11240 17.63 0.1%
216 11450 14.9 0.1%
221 11750 12.25 0.1%
226 12050 80.08 0.6%
231 12290 15.85 0.1%
236 12530 26.25 0.2%
241 12780 30.06 0.2%
246 13000 23.86 0.1%
251 13340 30.57 0.2%
256 13590 49.34 0.3%

Quality and confidence:
param error
n 0.017

Model:
Time ~= 131.3
+ n 52.61
µs

Reads = 10 + (3 * n)
Writes = 2 + (1 * n)
Pallet: "pallet_staking", Extrinsic: "payout_stakers_alive_staked", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 165.4
+ n 66.71
µs

Reads = 11 + (5 * n)
Writes = 3 + (3 * n)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
n mean µs sigma µs %
1 212.9 0.518 0.2%
6 554.7 4.685 0.8%
11 899 6.455 0.7%
16 1232 4.167 0.3%
21 1576 12.21 0.7%
26 1900 12.09 0.6%
31 2230 14.91 0.6%
36 2577 11.27 0.4%
41 2907 12.74 0.4%
46 3263 16.32 0.5%
51 3576 10.33 0.2%
56 3916 14.02 0.3%
61 4259 13.78 0.3%
66 4546 11.91 0.2%
71 4883 10.79 0.2%
76 5221 11.45 0.2%
81 5521 11.54 0.2%
86 5894 26.27 0.4%
91 6242 13.26 0.2%
96 6584 11.47 0.1%
101 6891 16.28 0.2%
106 7250 10.83 0.1%
111 7609 14.94 0.1%
116 7909 14.9 0.1%
121 8269 11.71 0.1%
126 8650 38.3 0.4%
131 8915 22.7 0.2%
136 9197 19.67 0.2%
141 9575 15.15 0.1%
146 9877 15.75 0.1%
151 10180 16.35 0.1%
156 10480 18.65 0.1%
161 10890 22.94 0.2%
166 11310 78.37 0.6%
171 11560 19.8 0.1%
176 11910 22.74 0.1%
181 12260 39.23 0.3%
186 12550 13.71 0.1%
191 12910 26.4 0.2%
196 13290 22.98 0.1%
201 13570 33.83 0.2%
206 14010 30.56 0.2%
211 14300 34.98 0.2%
216 14590 21.97 0.1%
221 14930 29.04 0.1%
226 15150 18.04 0.1%
231 15460 44.25 0.2%
236 15980 15.38 0.0%
241 16300 24.81 0.1%
246 16540 66.2 0.4%
251 16890 17.49 0.1%
256 17240 42.21 0.2%

Quality and confidence:
param error
n 0.027

Model:
Time ~= 165
+ n 66.74
µs

Reads = 11 + (5 * n)
Writes = 3 + (3 * n)
Pallet: "pallet_staking", Extrinsic: "rebond", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 37.02
+ l 0.093
µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
l mean µs sigma µs %
1 37.05 0.088 0.2%
2 36.96 0.087 0.2%
3 36.82 0.13 0.3%
4 37.02 0.119 0.3%
5 37.37 0.063 0.1%
6 37.44 0.081 0.2%
7 37.48 0.103 0.2%
8 37.52 0.147 0.3%
9 37.96 0.063 0.1%
10 37.97 0.124 0.3%
11 38.13 0.142 0.3%
12 38.38 0.067 0.1%
13 38.7 0.161 0.4%
14 38.68 0.286 0.7%
15 38.33 0.081 0.2%
16 38.48 0.091 0.2%
17 39.15 0.1 0.2%
18 39.11 0.066 0.1%
19 39.23 0.089 0.2%
20 39.25 0.079 0.2%
21 39.4 0.11 0.2%
22 39.58 0.227 0.5%
23 39.38 0.156 0.3%
24 39.56 0.119 0.3%
25 39.46 0.064 0.1%
26 39.38 0.113 0.2%
27 39.49 0.095 0.2%
28 39.41 0.081 0.2%
29 39.37 0.056 0.1%
30 39.23 0.084 0.2%
31 39.39 0.058 0.1%
32 39.53 0.085 0.2%

Quality and confidence:
param error
l 0.002

Model:
Time ~= 37.03
+ l 0.093
µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)
Pallet: "pallet_staking", Extrinsic: "set_history_depth", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 0
+ e 34.13
µs

Reads = 2 + (0 * e)
Writes = 4 + (7 * e)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
e mean µs sigma µs %
1 41.66 0.098 0.2%
2 68.67 0.193 0.2%
3 93.74 0.082 0.0%
4 123.1 0.245 0.1%
5 147.6 0.495 0.3%
6 172 0.464 0.2%
7 198.4 0.274 0.1%
8 226.1 1.045 0.4%
9 249.1 0.305 0.1%
10 277.4 0.606 0.2%
11 304 0.459 0.1%
12 329.6 0.583 0.1%
13 357.3 0.647 0.1%
14 388.5 0.522 0.1%
15 414.9 1.041 0.2%
16 441.8 1.838 0.4%
17 474.2 1.653 0.3%
18 500.5 0.741 0.1%
19 532 0.854 0.1%
20 554.6 0.724 0.1%
21 583.3 0.889 0.1%
22 616.4 1.465 0.2%
23 645.7 1.07 0.1%
24 675.5 1.008 0.1%
25 717.9 2.115 0.2%
26 745.6 3.36 0.4%
27 774.2 2.348 0.3%
28 804.7 1.909 0.2%
29 835.6 1.281 0.1%
30 862.5 1.037 0.1%
31 904.8 2.174 0.2%
32 933.2 1.111 0.1%
33 959.4 1.28 0.1%
34 992.8 3.748 0.3%
35 1033 2.152 0.2%
36 1067 3.863 0.3%
37 1080 3.838 0.3%
38 1111 4.878 0.4%
39 1153 3.913 0.3%
40 1182 2.805 0.2%
41 1210 6.063 0.5%
42 1239 8.69 0.7%
43 1277 1.06 0.0%
44 1310 8.255 0.6%
45 1346 2.3 0.1%
46 1384 5.185 0.3%
47 1413 2.359 0.1%
48 1438 4.863 0.3%
49 1476 2.473 0.1%
50 1511 4.032 0.2%
51 1544 2.712 0.1%
52 1579 7.317 0.4%
53 1623 7.243 0.4%
54 1650 7.193 0.4%
55 1691 5.609 0.3%
56 1743 10.15 0.5%
57 1769 5.799 0.3%
58 1814 9.002 0.4%
59 1828 10.71 0.5%
60 1869 8.333 0.4%
61 1897 8.992 0.4%
62 1944 12.44 0.6%
63 1960 7.759 0.3%
64 2007 12.51 0.6%
65 2034 7.176 0.3%
66 2072 10.13 0.4%
67 2104 10.93 0.5%
68 2154 9.979 0.4%
69 2178 9.078 0.4%
70 2227 7.682 0.3%
71 2266 7.547 0.3%
72 2312 12.29 0.5%
73 2360 9.19 0.3%
74 2382 9.37 0.3%
75 2411 11.09 0.4%
76 2487 20.21 0.8%
77 2527 4.489 0.1%
78 2592 7.333 0.2%
79 2610 7.224 0.2%
80 2613 9.834 0.3%
81 2634 12.07 0.4%
82 2704 11.82 0.4%
83 2703 5.867 0.2%
84 2785 6.833 0.2%
85 2835 12.41 0.4%
86 2878 9.153 0.3%
87 2928 13.99 0.4%
88 2981 3.739 0.1%
89 3023 5.537 0.1%
90 3043 10.52 0.3%
91 3029 10.31 0.3%
92 3134 7.358 0.2%
93 3146 14.7 0.4%
94 3189 14.86 0.4%
95 3222 7.131 0.2%
96 3262 11.77 0.3%
97 3310 10.63 0.3%
98 3346 16.76 0.5%
99 3381 10.81 0.3%
100 3406 11.65 0.3%

Quality and confidence:
param error
e 0.071

Model:
Time ~= 0
+ e 34.4
µs

Reads = 2 + (0 * e)
Writes = 4 + (7 * e)
Pallet: "pallet_staking", Extrinsic: "reap_stash", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 67.53
+ s 2.766
µs

Reads = 4 + (0 * s)
Writes = 8 + (1 * s)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
s mean µs sigma µs %
1 68.75 0.13 0.1%
2 71.58 0.131 0.1%
3 74.43 0.131 0.1%
4 78.29 0.134 0.1%
5 80.8 0.083 0.1%
6 83.66 0.196 0.2%
7 86.17 0.116 0.1%
8 89.12 0.125 0.1%
9 91.77 0.221 0.2%
10 94.49 0.134 0.1%
11 97.08 0.222 0.2%
12 100.8 0.66 0.6%
13 103.5 0.314 0.3%
14 105.9 0.184 0.1%
15 108.9 0.24 0.2%
16 111.5 0.212 0.1%
17 114.3 0.232 0.2%
18 117.3 0.158 0.1%
19 120.1 0.181 0.1%
20 122.7 0.165 0.1%
21 126.3 0.166 0.1%
22 128.7 0.331 0.2%
23 131.7 0.192 0.1%
24 134.5 0.18 0.1%
25 137.8 0.349 0.2%
26 140.4 0.182 0.1%
27 142.8 0.164 0.1%
28 145.5 0.282 0.1%
29 148.3 0.188 0.1%
30 150.9 0.381 0.2%
31 154.1 0.212 0.1%
32 156.6 0.321 0.2%
33 159.3 0.273 0.1%
34 162.1 0.23 0.1%
35 164.6 0.328 0.1%
36 167.1 0.379 0.2%
37 170.1 0.197 0.1%
38 173.6 1.229 0.7%
39 176.3 0.318 0.1%
40 178.2 0.518 0.2%
41 181.6 0.261 0.1%
42 184.2 0.362 0.1%
43 187 0.228 0.1%
44 189.9 0.356 0.1%
45 192.5 0.121 0.0%
46 195.5 0.249 0.1%
47 197.7 0.282 0.1%
48 201.1 0.24 0.1%
49 204.2 0.846 0.4%
50 205.1 0.213 0.1%
51 208.2 0.388 0.1%
52 210.2 0.385 0.1%
53 214 0.272 0.1%
54 216.8 0.376 0.1%
55 220 0.482 0.2%
56 222.8 0.225 0.1%
57 226.3 0.753 0.3%
58 228.1 0.245 0.1%
59 231.2 0.344 0.1%
60 232.6 0.392 0.1%
61 236.6 0.254 0.1%
62 239.6 0.507 0.2%
63 241.8 0.259 0.1%
64 244.1 0.287 0.1%
65 247.5 0.361 0.1%
66 249.9 0.283 0.1%
67 252.5 0.591 0.2%
68 255.3 0.247 0.0%
69 257.8 0.185 0.0%
70 260.8 0.306 0.1%
71 264.1 0.391 0.1%
72 266.2 0.174 0.0%
73 268.8 0.404 0.1%
74 272.9 0.513 0.1%
75 275 0.332 0.1%
76 277.7 0.862 0.3%
77 279.8 0.238 0.0%
78 282.9 0.348 0.1%
79 286.2 0.643 0.2%
80 288.5 0.428 0.1%
81 291 0.847 0.2%
82 293.5 0.354 0.1%
83 296.6 0.567 0.1%
84 299.1 0.356 0.1%
85 302.2 0.819 0.2%
86 304.3 0.369 0.1%
87 307.8 0.54 0.1%
88 310 0.756 0.2%
89 313.5 0.471 0.1%
90 315.3 0.723 0.2%
91 318.1 0.274 0.0%
92 322.5 0.397 0.1%
93 325.5 0.59 0.1%
94 327.8 0.543 0.1%
95 328.3 0.515 0.1%
96 333.1 0.518 0.1%
97 335.6 0.896 0.2%
98 338.8 0.774 0.2%
99 342.4 0.343 0.1%
100 345.4 0.666 0.1%

Quality and confidence:
param error
s 0

Model:
Time ~= 67.56
+ s 2.766
µs

Reads = 4 + (0 * s)
Writes = 8 + (1 * s)
Pallet: "pallet_staking", Extrinsic: "new_era", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 0
+ v 366.3
+ n 63.51
µs

Reads = 10 + (3 * v) + (3 * n)
Writes = 9 + (3 * v) + (0 * n)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
v n mean µs sigma µs %
1 100 3773 13.22 0.3%
2 100 4155 12.29 0.2%
3 100 4450 12.2 0.2%
4 100 4747 8.859 0.1%
5 100 5080 8.926 0.1%
6 100 5465 19.25 0.3%
7 100 5842 9.749 0.1%
8 100 6171 14.21 0.2%
9 100 6732 10.52 0.1%
10 1 854.1 2.406 0.2%
10 2 923.6 4.157 0.4%
10 3 996.5 4.738 0.4%
10 4 1056 2.116 0.2%
10 5 1117 2.518 0.2%
10 6 1204 4.754 0.3%
10 7 1248 7.766 0.6%
10 8 1317 7.811 0.5%
10 9 1374 4.723 0.3%
10 10 1441 1.371 0.0%
10 11 1517 9.007 0.5%
10 12 1562 8.42 0.5%
10 13 1646 10.13 0.6%
10 14 1717 6.202 0.3%
10 15 1756 3.41 0.1%
10 16 1818 2.37 0.1%
10 17 1891 8.487 0.4%
10 18 1963 11.53 0.5%
10 19 2012 5.135 0.2%
10 20 2082 8.374 0.4%
10 21 2114 6.574 0.3%
10 22 2181 14.74 0.6%
10 23 2284 9.642 0.4%
10 24 2333 11.51 0.4%
10 25 2394 10.55 0.4%
10 26 2456 8.208 0.3%
10 27 2524 12.29 0.4%
10 28 2598 9.488 0.3%
10 29 2678 10.23 0.3%
10 30 2739 12.37 0.4%
10 31 2775 12.53 0.4%
10 32 2884 9.91 0.3%
10 33 2947 7.487 0.2%
10 34 2977 11.2 0.3%
10 35 3080 4.727 0.1%
10 36 3147 8.453 0.2%
10 37 3171 13.63 0.4%
10 38 3240 13.09 0.4%
10 39 3310 10.98 0.3%
10 40 3367 6.508 0.1%
10 41 3441 12.24 0.3%
10 42 3495 7.761 0.2%
10 43 3571 6.395 0.1%
10 44 3641 9.57 0.2%
10 45 3682 11.82 0.3%
10 46 3732 11.26 0.3%
10 47 3812 10.33 0.2%
10 48 3892 7.702 0.1%
10 49 3907 17.91 0.4%
10 50 3991 5.623 0.1%
10 51 4010 7.594 0.1%
10 52 4082 2.792 0.0%
10 53 4190 10.6 0.2%
10 54 4231 17.54 0.4%
10 55 4324 12.52 0.2%
10 56 4460 8.492 0.1%
10 57 4485 8.945 0.1%
10 58 4557 11 0.2%
10 59 4597 7.421 0.1%
10 60 4665 4.441 0.0%
10 61 4744 10.42 0.2%
10 62 4770 8.875 0.1%
10 63 4855 5.966 0.1%
10 64 4935 7.89 0.1%
10 65 4997 13.23 0.2%
10 66 5061 10.71 0.2%
10 67 5142 13.75 0.2%
10 68 5178 7.859 0.1%
10 69 5198 7.176 0.1%
10 70 5299 12.48 0.2%
10 71 5351 19.61 0.3%
10 72 5426 9.877 0.1%
10 73 5478 13.39 0.2%
10 74 5521 11.28 0.2%
10 75 5608 13.37 0.2%
10 76 5649 10.51 0.1%
10 77 5719 22.12 0.3%
10 78 5841 7.979 0.1%
10 79 5798 9.85 0.1%
10 80 5942 20.7 0.3%
10 81 5986 11.25 0.1%
10 82 6074 18.07 0.2%
10 83 6107 5.963 0.0%
10 84 6139 5.025 0.0%
10 85 6179 8.945 0.1%
10 86 6243 18.62 0.2%
10 87 6329 8.156 0.1%
10 88 6375 12.35 0.1%
10 89 6381 11.29 0.1%
10 90 6512 10.46 0.1%
10 91 6538 5.39 0.0%
10 92 6644 10.27 0.1%
10 93 6721 8.767 0.1%
10 94 6753 19.16 0.2%
10 95 6812 15.07 0.2%
10 96 6904 10.34 0.1%
10 97 6990 6.776 0.0%
10 98 6977 8.063 0.1%
10 99 7070 16.25 0.2%
10 100 7079 12.18 0.1%

Quality and confidence:
param error
v 1.016
n 0.051

Model:
Time ~= 0
+ v 389.9
+ n 63.2
µs

Reads = 10 + (3 * v) + (3 * n)
Writes = 9 + (3 * v) + (0 * n)
Pallet: "pallet_staking", Extrinsic: "get_npos_voters", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 0
+ v 26.1
+ n 28.94
+ s 14.02
µs

Reads = 3 + (3 * v) + (3 * n) + (1 * s)
Writes = 0 + (0 * v) + (0 * n) + (0 * s)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
v n s mean µs sigma µs %
200 400 20 16870 83.31 0.4%
204 400 20 16800 31.06 0.1%
208 400 20 16970 33.84 0.1%
212 400 20 16940 37.48 0.2%
216 400 20 17020 49.06 0.2%
220 400 20 17060 63.62 0.3%
224 400 20 17310 91.4 0.5%
228 400 20 17580 34.5 0.1%
232 400 20 17530 46.07 0.2%
236 400 20 17530 49.37 0.2%
240 400 20 17590 65.98 0.3%
244 400 20 17860 62.63 0.3%
248 400 20 17970 56.6 0.3%
252 400 20 17970 58.69 0.3%
256 400 20 17790 52.89 0.2%
260 400 20 18260 79.1 0.4%
264 400 20 17910 78.59 0.4%
268 400 20 18440 80.8 0.4%
272 400 20 18550 58.99 0.3%
276 400 20 18700 43.67 0.2%
280 400 20 18750 68.67 0.3%
284 400 20 19030 55.24 0.2%
288 400 20 18940 78.77 0.4%
292 400 20 18850 74 0.3%
296 400 20 19260 92.27 0.4%
300 400 20 19290 77.51 0.4%
304 400 20 19630 44.15 0.2%
308 400 20 19500 53.98 0.2%
312 400 20 19650 47.47 0.2%
316 400 20 19680 43.38 0.2%
320 400 20 19950 58.84 0.2%
324 400 20 20110 95.6 0.4%
328 400 20 20210 96.21 0.4%
332 400 20 20030 86.45 0.4%
336 400 20 20470 77.93 0.3%
340 400 20 20380 66.28 0.3%
344 400 20 20260 53.5 0.2%
348 400 20 20640 75.56 0.3%
352 400 20 20450 31.13 0.1%
356 400 20 20690 60.81 0.2%
360 400 20 21070 107.9 0.5%
364 400 20 20810 43.33 0.2%
368 400 20 21310 33.49 0.1%
372 400 20 21270 65.93 0.3%
376 400 20 21340 44.91 0.2%
380 400 20 21580 107 0.4%
384 400 20 21590 83.71 0.3%
388 400 20 21480 169.8 0.7%
392 400 20 21830 82.82 0.3%
396 400 20 21690 60.23 0.2%
400 200 20 16210 56.5 0.3%
400 204 20 16040 64.54 0.4%
400 208 20 16190 46.75 0.2%
400 212 20 16580 68.61 0.4%
400 216 20 16480 80.32 0.4%
400 220 20 16860 72.72 0.4%
400 224 20 16970 46.99 0.2%
400 228 20 16670 44.1 0.2%
400 232 20 17120 34.51 0.2%
400 236 20 17320 35.74 0.2%
400 240 20 17150 91.98 0.5%
400 244 20 17400 70.31 0.4%
400 248 20 17170 57.41 0.3%
400 252 20 17770 57.87 0.3%
400 256 20 17800 40.96 0.2%
400 260 20 17860 78.77 0.4%
400 264 20 18020 62.26 0.3%
400 268 20 18100 49.76 0.2%
400 272 20 18370 41.2 0.2%
400 276 20 18210 66.02 0.3%
400 280 20 18400 43.84 0.2%
400 284 20 18510 68.9 0.3%
400 288 20 18620 57.29 0.3%
400 292 20 18860 55.02 0.2%
400 296 20 18810 79.89 0.4%
400 300 20 19230 67.29 0.3%
400 304 20 19430 56.27 0.2%
400 308 20 19300 60.27 0.3%
400 312 20 19340 73 0.3%
400 316 20 19740 102 0.5%
400 320 20 19800 69.36 0.3%
400 324 20 19360 85.55 0.4%
400 328 20 19730 66.19 0.3%
400 332 20 19980 99.07 0.4%
400 336 20 20210 60.73 0.3%
400 340 20 20430 43.57 0.2%
400 344 20 20510 63.18 0.3%
400 348 20 20620 55.23 0.2%
400 352 20 20800 93.01 0.4%
400 356 20 20820 106.1 0.5%
400 360 20 20710 77.09 0.3%
400 364 20 20820 73.21 0.3%
400 368 20 20980 73.56 0.3%
400 372 20 21170 69.07 0.3%
400 376 20 21030 122.5 0.5%
400 380 20 21130 58.77 0.2%
400 384 20 21700 81.24 0.3%
400 388 20 21640 67.3 0.3%
400 392 20 21640 136.2 0.6%
400 396 20 21800 38.53 0.1%
400 400 1 21360 78.64 0.3%
400 400 2 21250 67.76 0.3%
400 400 3 21820 92.22 0.4%
400 400 4 21420 78.07 0.3%
400 400 5 21700 66.49 0.3%
400 400 6 21660 140.3 0.6%
400 400 7 21680 46.97 0.2%
400 400 8 21540 42.64 0.1%
400 400 9 21640 56.59 0.2%
400 400 10 21930 48.69 0.2%
400 400 11 21830 81.39 0.3%
400 400 12 21700 64.26 0.2%
400 400 13 21770 63.65 0.2%
400 400 14 21850 62.38 0.2%
400 400 15 21970 89.06 0.4%
400 400 16 21830 69.89 0.3%
400 400 17 21720 87.8 0.4%
400 400 18 21860 125.2 0.5%
400 400 19 21780 98.11 0.4%
400 400 20 21670 70.35 0.3%

Quality and confidence:
param error
v 0.095
n 0.095
s 1.305

Model:
Time ~= 0
+ v 26.41
+ n 29.03
+ s 23.68
µs

Reads = 3 + (3 * v) + (3 * n) + (1 * s)
Writes = 0 + (0 * v) + (0 * n) + (0 * s)
Pallet: "pallet_staking", Extrinsic: "get_npos_targets", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 0
+ v 11.3
µs

Reads = 1 + (1 * v)
Writes = 0 + (0 * v)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
v mean µs sigma µs %
200 2178 29.54 1.3%
204 2244 22.96 1.0%
208 2211 11.98 0.5%
212 2267 14.36 0.6%
216 2365 13.96 0.5%
220 2424 22.1 0.9%
224 2436 21.76 0.8%
228 2510 15.81 0.6%
232 2490 14.09 0.5%
236 2572 18.72 0.7%
240 2630 15.72 0.5%
244 2642 6.683 0.2%
248 2677 18.39 0.6%
252 2713 17.07 0.6%
256 2806 12.09 0.4%
260 2886 26.63 0.9%
264 2852 20.55 0.7%
268 2967 18.09 0.6%
272 3010 12.75 0.4%
276 3016 22.76 0.7%
280 3162 23.73 0.7%
284 3170 10.73 0.3%
288 3175 20.38 0.6%
292 3199 13.81 0.4%
296 3213 22.95 0.7%
300 3310 10.97 0.3%
304 3344 13.01 0.3%
308 3432 23.47 0.6%
312 3399 16.5 0.4%
316 3497 19.48 0.5%
320 3515 23.49 0.6%
324 3604 17.55 0.4%
328 3627 28.95 0.7%
332 3639 22.92 0.6%
336 3630 19.62 0.5%
340 3745 24.11 0.6%
344 3784 22.56 0.5%
348 3855 44.24 1.1%
352 3926 23.72 0.6%
356 3885 23.54 0.6%
360 4068 23.61 0.5%
364 3979 20.93 0.5%
368 3987 9.841 0.2%
372 4141 15.79 0.3%
376 4177 25.81 0.6%
380 4229 16.67 0.3%
384 4185 26.36 0.6%
388 4272 22.54 0.5%
392 4311 24.37 0.5%
396 4443 23.37 0.5%
400 4477 29.16 0.6%

Quality and confidence:
param error
v 0.032

Model:
Time ~= 0
+ v 11.31
µs

Reads = 1 + (1 * v)
Writes = 0 + (0 * v)

Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

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

looks right to me besides the nits above

Parity Benchmarking Bot and others added 5 commits March 25, 2021 23:31
…/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs
ensure!(era >= current_era.saturating_sub(history_depth), Error::<T>::InvalidEraToReward);
ensure!(
era <= current_era && era >= current_era.saturating_sub(history_depth),
Error::<T>::InvalidEraToReward.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this is not really accurate, because by this point you've done 2 DB reads and almost nothing more, while T::WeightInfo::payout_stakers_alive_staked(0) is probably a lot more.

I am fine with this, since it is still a worse case, which is good.

Also fine with Error::<T>::InvalidEraToReward.with_weight(T::DbWeight::get().read(X))

Copy link
Member

Choose a reason for hiding this comment

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

I think incorrect extrinsics are perfectly fine to overcharge a bit. A simplification like the one you are mentioning risks being under valued, and thus opens an attack.

@@ -269,6 +269,8 @@ where
}

pub type Extrinsic = TestXt<Call, ()>;
pub(crate) type StakingCall = crate::Call<Test>;
pub(crate) type TestRuntimeCall = <Test as frame_system::Config>::Call;
Copy link
Contributor

Choose a reason for hiding this comment

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

we should really just rename the Call generated by the construct_runtime! to OuterCall.

Copy link
Contributor

Choose a reason for hiding this comment

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

(not realted to this PR, I am just ranting)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there an issue open for this / should we open an issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

no issue afaik.

@@ -2976,6 +2978,9 @@ fn claim_reward_at_the_last_era_and_no_double_claim_and_invalid_claim() {
// * an invalid era to claim doesn't update last_reward
// * double claim of one era fails
ExtBuilder::default().nominate(true).build_and_execute(|| {
// Consumed weight for all payout_stakers dispatches that fail
let err_weight = weights::SubstrateWeight::<Test>::payout_stakers_alive_staked(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

you should do the same patter in the main function as well, the code there is quite verbose.

Copy link
Member

Choose a reason for hiding this comment

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

technically, it would be one more computation that is not needed if the 0 weight is not used...

@kianenigma
Copy link
Contributor

Should we take into account different weights for different reward destinations?

Not for now, that would be a lot of gas-metering-like detailed code for very little benefit.

The current tests do not rely on hardcoded weights but instead are all relative to WeightInfo::payout_stakers_alive_staked - is this ok?

See my comment above -- I think it is fine, since it is always an overestimate.

@emostov
Copy link
Contributor Author

emostov commented Mar 26, 2021

@kianenigma I added in the debug_assert but otherwise no changes since your review. Are we ok to merge?

@shawntabrizi shawntabrizi self-requested a review March 27, 2021 16:55
@shawntabrizi
Copy link
Member

shawntabrizi commented Mar 27, 2021

@kianenigma you happy? (about this pr and in general)

@kianenigma
Copy link
Contributor

bot merge

@ghost
Copy link

ghost commented Mar 28, 2021

Trying merge.

@ghost ghost merged commit ec8a661 into master Mar 28, 2021
@ghost ghost deleted the zeke-staking-payout-fn-refund branch March 28, 2021 08:09
ordian added a commit that referenced this pull request Mar 31, 2021
* master: (84 commits)
  Duplicate logging to stdout (#8495)
  Fix sync restart (#8497)
  client: fix justifications migration (#8489)
  helper macro to create storage types on the fly (#8456)
  Make `BlockImport` and `Verifier` async (#8472)
  Get rid of `test-helpers` feature in sc-consensus-babe (#8486)
  Enhancement on Substrate Node Template (#8473)
  Add Social Network (#8065)
  Prepare UI tests for Rust 1.51 & new CI image (#8474)
  Benchmarking pallet-example (#8301)
  Use pathbuf for remote externalities (#8480)
  Bring back the on_finalize weight of staking. (#8463)
  Implement `fungible::*` for Balances (#8454)
  make types within `generate_solution_type` macro explicit (#8447)
  [pallet-staking] Refund unused weight for `payout_stakers` (#8458)
  Use `async_trait` in sc-consensus-slots (#8461)
  Repot frame_support::traits; introduce some new currency stuff (#8435)
  Fix &mut self -> &self in add_known_address (#8468)
  Add NetworkService::add_known_address (#8467)
  Fix companion check (#8464)
  ...
hirschenberger pushed a commit to hirschenberger/substrate that referenced this pull request Apr 14, 2021
…h#8458)

* [pallet-staking] Refund unused weight for `payout_stakers` 

fixes paritytech#8428

* Use periods in comments

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Address Shawn's Feedback

* Assert monotomic weights && improve test note

* Remove stray new line

* debug_assert payout_count <= max

* Only track payouts to nominators; not validators

* Trivial comment update

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
@viniul viniul added D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels May 5, 2021
shawntabrizi pushed a commit that referenced this pull request Jun 17, 2021
* [pallet-staking] Refund unused weight for `payout_stakers` 

fixes #8428

* Use periods in comments

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Address Shawn's Feedback

* Assert monotomic weights && improve test note

* Remove stray new line

* debug_assert payout_count <= max

* Only track payouts to nominators; not validators

* Trivial comment update

Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Payout function should refund
4 participants