Skip to content

refactor: clean up DID origins & only delegation owner can revoke delegation#304

Merged
weichweich merged 33 commits intodevelopfrom
aw-accurate-did-call-bench
Dec 15, 2021
Merged

refactor: clean up DID origins & only delegation owner can revoke delegation#304
weichweich merged 33 commits intodevelopfrom
aw-accurate-did-call-bench

Conversation

@weichweich
Copy link
Copy Markdown
Contributor

@weichweich weichweich commented Nov 26, 2021

fixes

  • properly benchmark DID origin checks
  • use paths for constants in the runtime
  • edit PR template to not mention old custom type checks
  • only delegation owner can revoke the delegation (deposit owner can reclaim)

Checklist:

  • I have verified that the code works
    • No panics! (checked arithmetic ops, no indexing array[3] use get(3), ...)
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • This PR does not introduce new custom types
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@weichweich weichweich force-pushed the aw-accurate-did-call-bench branch from 00571d4 to 7ce6aec Compare November 26, 2021 14:08
@weichweich
Copy link
Copy Markdown
Contributor Author

/bench runtime peregrine ctype

@kilt-command-bot
Copy link
Copy Markdown

kilt-command-bot Bot commented Nov 26, 2021

Benchmark Runtime Substrate Pallet for branch "aw-accurate-did-call-bench" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=ctype --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/ctype.rs --template=.maintain/runtime-weight-template.hbs

Results
Pallet: "ctype", Extrinsic: "add", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:2 w:2)
Storage: Ctype Ctypes (r:1 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    10.91
    + l    0.001
              µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)

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

Data points distribution:
    l   mean µs  sigma µs       %
    1     64.98     0.248    0.3%
104858     260.1     0.291    0.1%
209715     453.4     0.466    0.1%
314572     643.9     0.213    0.0%
419429     838.1     1.675    0.1%
524286      1031     12.05    1.1%
629143      1220     0.222    0.0%
734000      1413     1.834    0.1%
838857      1606     0.846    0.0%
943714      1801     2.196    0.1%
1048571      1990     0.986    0.0%
1153428      2184     1.619    0.0%
1258285      2377     8.159    0.3%
1363142      2566     1.605    0.0%
1467999      2766      10.7    0.3%
1572856      2961     9.721    0.3%
1677713      3161     15.14    0.4%
1782570      3341     0.933    0.0%
1887427      3535     0.796    0.0%
1992284      3732     1.896    0.0%
2097141      3929     8.827    0.2%
2201998      4130     11.02    0.2%
2306855      4327     11.02    0.2%
2411712      4520     2.524    0.0%
2516569      4729        14    0.2%
2621426      4921     11.59    0.2%
2726283      5124     11.93    0.2%
2831140      5314     1.483    0.0%
2935997      5529      9.77    0.1%
3040854      5718     9.267    0.1%
3145711      5922     11.65    0.1%
3250568      6136     17.15    0.2%
3355425      6319     8.197    0.1%
3460282      6526     11.94    0.1%
3565139      6720       8.3    0.1%
3669996      6936     13.63    0.1%
3774853      7122     4.392    0.0%
3879710      7338      13.2    0.1%
3984567      7530     5.621    0.0%
4089424      7733      9.12    0.1%
4194281      7972     37.13    0.4%
4299138      8134     5.515    0.0%
4403995      8340     9.356    0.1%
4508852      8553     12.04    0.1%
4613709      8751     13.35    0.1%
4718566      8945     5.008    0.0%
4823423      9151     13.12    0.1%
4928280      9370      10.4    0.1%
5033137      9573     10.92    0.1%
5137994      9766     9.231    0.0%
5242851      9975     10.35    0.1%

Quality and confidence:
param     error
l             0

Model:
Time ~=     5.12
    + l    0.002
              µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)


@weichweich
Copy link
Copy Markdown
Contributor Author

/bench runtime spiritnet-runtime ctype

@weichweich
Copy link
Copy Markdown
Contributor Author

/bench runtime pallet ctype

@weichweich weichweich marked this pull request as draft November 26, 2021 15:47
…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=ctype --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/ctype.rs --template=.maintain/runtime-weight-template.hbs
@kilt-command-bot
Copy link
Copy Markdown

kilt-command-bot Bot commented Nov 26, 2021

Benchmark Runtime Pallet for branch "aw-accurate-did-call-bench" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=ctype --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/ctype.rs --template=.maintain/runtime-weight-template.hbs

Results
Pallet: "ctype", Extrinsic: "add", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:2 w:2)
Storage: Ctype Ctypes (r:1 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    15.47
    + l    0.002
              µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)

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

Data points distribution:
    l   mean µs  sigma µs       %
    1     66.34     0.175    0.2%
104858     279.6     0.192    0.0%
209715     491.2      0.31    0.0%
314572     705.3     9.193    1.3%
419429     911.8     0.202    0.0%
524286      1120     0.975    0.0%
629143      1331     1.369    0.1%
734000      1548      0.74    0.0%
838857      1761     11.02    0.6%
943714      1970     1.417    0.0%
1048571      2176     1.008    0.0%
1153428      2392     11.13    0.4%
1258285      2597     0.777    0.0%
1363142      2805     0.385    0.0%
1467999      3018     1.163    0.0%
1572856      3240     12.96    0.4%
1677713      3452     12.02    0.3%
1782570      3659     9.052    0.2%
1887427      3874     10.93    0.2%
1992284      4091     11.87    0.2%
2097141      4300     8.457    0.1%
2201998      4524     13.92    0.3%
2306855      4734     10.17    0.2%
2411712      4953     12.64    0.2%
2516569      5161     1.511    0.0%
2621426      5382     10.76    0.2%
2726283      5598     11.23    0.2%
2831140      5822     14.04    0.2%
2935997      6033     11.09    0.1%
3040854      6255     11.62    0.1%
3145711      6479     13.85    0.2%
3250568      6692     10.28    0.1%
3355425      6909     11.07    0.1%
3460282      7129     9.998    0.1%
3565139      7353     15.16    0.2%
3669996      7581     13.49    0.1%
3774853      7794     16.43    0.2%
3879710      8013     12.48    0.1%
3984567      8229     8.322    0.1%
4089424      8461     14.09    0.1%
4194281      8672      9.98    0.1%
4299138      8908     13.71    0.1%
4403995      9112     7.776    0.0%
4508852      9338     12.11    0.1%
4613709      9563     11.55    0.1%
4718566      9782     10.48    0.1%
4823423      9998     9.375    0.0%
4928280     10220        11    0.1%
5033137     10460     15.23    0.1%
5137994     10670     12.66    0.1%
5242851     10890     11.03    0.1%

Quality and confidence:
param     error
l             0

Model:
Time ~=    7.425
    + l    0.002
              µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)


…hmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=ctype --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/ctype.rs --template=.maintain/runtime-weight-template.hbs
@kilt-command-bot
Copy link
Copy Markdown

kilt-command-bot Bot commented Nov 26, 2021

Benchmark Runtime Pallet for branch "aw-accurate-did-call-bench" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=ctype --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/ctype/src/default_weights.rs --template=.maintain/weight-template.hbs

Results
Pallet: "ctype", Extrinsic: "add", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:2 w:2)
Storage: Ctype Ctypes (r:1 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    14.18
    + l    0.002
              µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)

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

Data points distribution:
    l   mean µs  sigma µs       %
    1     66.24      0.13    0.1%
104858       306     0.256    0.0%
209715     542.7     0.405    0.0%
314572     777.8     0.247    0.0%
419429      1015     1.954    0.1%
524286      1249     1.129    0.0%
629143      1497     17.49    1.1%
734000      1722     1.145    0.0%
838857      1967      12.4    0.6%
943714      2197     8.731    0.3%
1048571      2429     0.994    0.0%
1153428      2669     11.07    0.4%
1258285      2906     1.003    0.0%
1363142      3145     8.179    0.2%
1467999      3392     13.55    0.3%
1572856      3615     7.555    0.2%
1677713      3859      12.9    0.3%
1782570      4094     13.62    0.3%
1887427      4329     11.48    0.2%
1992284      4564     11.57    0.2%
2097141      4813     14.37    0.2%
2201998      5045     11.14    0.2%
2306855      5282     8.013    0.1%
2411712      5536     12.99    0.2%
2516569      5775     10.73    0.1%
2621426      6028     11.85    0.1%
2726283      6331     105.6    1.6%
2831140      6504     9.999    0.1%
2935997      6742      10.5    0.1%
3040854      6986     7.853    0.1%
3145711      7234     7.034    0.0%
3250568      7489     11.83    0.1%
3355425      7738     12.89    0.1%
3460282      7982     12.52    0.1%
3565139      8219     15.63    0.1%
3669996      8467     13.36    0.1%
3774853      8718     15.02    0.1%
3879710      8970     30.39    0.3%
3984567      9208      13.8    0.1%
4089424      9454     10.39    0.1%
4194281      9696     9.336    0.0%
4299138      9947     11.73    0.1%
4403995     10200     18.94    0.1%
4508852     10460     14.86    0.1%
4613709     10690     14.58    0.1%
4718566     10940     17.06    0.1%
4823423     11190      17.2    0.1%
4928280     11420     8.877    0.0%
5033137     11690     18.71    0.1%
5137994     11940     15.06    0.1%
5242851     12170      11.9    0.0%

Quality and confidence:
param     error
l             0

Model:
Time ~=    5.346
    + l    0.002
              µs

Reads = 3 + (0 * l)
Writes = 3 + (0 * l)


kiltbot and others added 2 commits November 26, 2021 17:03
…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=ctype --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/ctype/src/default_weights.rs --template=.maintain/weight-template.hbs
@weichweich weichweich changed the title fix: accurate did call benchmarks fix: incompatible origin in benchmarks Nov 29, 2021
@weichweich weichweich self-assigned this Dec 3, 2021
@weichweich weichweich force-pushed the aw-accurate-did-call-bench branch from 275bff3 to 0c24b67 Compare December 9, 2021 16:27
@weichweich weichweich marked this pull request as ready for review December 10, 2021 11:24
@weichweich weichweich requested review from ntn-x2 and wischli and removed request for wischli December 10, 2021 11:24
Copy link
Copy Markdown
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

A few very minor things.

Comment thread pallets/ctype/src/mock.rs Outdated
Comment thread pallets/attestation/src/mock.rs
Comment thread pallets/delegation/src/benchmarking.rs Outdated
Comment thread pallets/delegation/src/lib.rs
Comment thread pallets/delegation/src/mock.rs
Comment thread support/src/mock.rs
Copy link
Copy Markdown
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

LGTM!

@weichweich weichweich changed the title fix: incompatible origin in benchmarks refactor: clean up DID origins & only delegation owner can revoke delegation Dec 14, 2021
@weichweich weichweich merged commit 434b39a into develop Dec 15, 2021
@weichweich weichweich deleted the aw-accurate-did-call-bench branch December 15, 2021 07:36
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