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

feat: generic access control #316

Merged
merged 73 commits into from
Mar 17, 2022
Merged

feat: generic access control #316

merged 73 commits into from
Mar 17, 2022

Conversation

weichweich
Copy link
Contributor

@weichweich weichweich commented Jan 20, 2022

fixes KILTProtocol/ticket#1697

  • Use generic AuthorizationId in attestation
  • add AuthorizationId enum to runtime-common
    • each authorization method has it's own variant
    • first and only variant is the delegation pallet
  • add AccessControl trait

todo

  • add AccessControl weight to attestation extrinsic
  • Keep track of delegated attestations (add created_attestation, revoked_attestation, removed_attestation, storage in the attestation pallet itself)
  • benchmark delegation AC weight
  • Is the ExternalAttestation entry enough?
    • Maps from AuthorizationId -> ClaimHash -> True
    • Do we need a map from ClaimHash -> AuthorizationId?
    • Discussion here
  • Delegation hierarchy was deleted but (delegated) attestation remains? Discussion here
    • Option A: accept that there are attestations that cannot be removed/revoked since the delegation node was gone (only deposit owner can remove attestation)
    • Option B: Just check in the attestation pallet? We don't know how the AuthorizationId looks like in the attestation pallet.
  • verify that no migrations are needed
    • write migrations to clear old storage

How to test:

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
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@weichweich weichweich changed the title feat: generic access controll feat: generic access control Jan 21, 2022
@weichweich weichweich requested review from wischli and ntn-x2 and removed request for wischli January 24, 2022 11:55
@weichweich

This comment has been minimized.

@weichweich

This comment has been minimized.

@weichweich
Copy link
Contributor Author

/bench runtime peregrine delegation

@kilt-command-bot
Copy link

kilt-command-bot bot commented Jan 25, 2022

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

Results
Pallet: "delegation", Extrinsic: "create_hierarchy", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationHierarchies (r:1 w:1)
Storage: Ctype Ctypes (r:1 w:0)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationNodes (r:0 w:1)

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

Model:
Time ~=    45.65
              µs

Reads = 3
Writes = 3

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

Model:
Time ~=    45.65
              µs

Reads = 3
Writes = 3

Pallet: "delegation", Extrinsic: "add_delegation", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)

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

Model:
Time ~=    54.26
              µs

Reads = 3
Writes = 3

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

Model:
Time ~=    54.26
              µs

Reads = 3
Writes = 3

Pallet: "delegation", Extrinsic: "revoke_delegation_root_child", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    21.91
    + r    17.28
    + c        0
              µs

Reads = 1 + (1 * r) + (0 * c)
Writes = 0 + (1 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5      37.4     0.131    0.3%
    2     5     56.98     0.235    0.4%
    3     5     74.48     0.268    0.3%
    4     5     91.19     0.224    0.2%
    5     1     107.9     0.227    0.2%
    5     2     107.8     0.171    0.1%
    5     3     107.8     0.241    0.2%
    5     4       108     0.229    0.2%
    5     5     107.8     0.215    0.1%

Quality and confidence:
param     error
r         0.055
c         0.055

Model:
Time ~=    20.66
    + r     17.4
    + c    0.121
              µs

Reads = 1 + (1 * r) + (0 * c)
Writes = 0 + (1 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "revoke_delegation_leaf", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:6 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    38.29
    + r        0
    + c    5.476
              µs

Reads = 2 + (0 * r) + (1 * c)
Writes = 1 + (0 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     65.46      0.16    0.2%
    2     5      65.9     0.435    0.6%
    3     5      65.3     0.184    0.2%
    4     5     65.24     0.189    0.2%
    5     1     42.89     0.129    0.3%
    5     2     49.32     0.175    0.3%
    5     3     54.99      0.27    0.4%
    5     4     59.79     0.144    0.2%
    5     5      65.2      0.19    0.2%

Quality and confidence:
param     error
r         0.032
c         0.032

Model:
Time ~=    38.36
    + r        0
    + c    5.464
              µs

Reads = 2 + (0 * r) + (1 * c)
Writes = 1 + (0 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "remove_delegation", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:1)

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

Model:
Time ~=    62.19
    + r    31.97
              µs

Reads = 3 + (1 * r)
Writes = 3 + (1 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    1     93.43      0.35    0.3%
    2     126.8     0.222    0.1%
    3     158.9     0.322    0.2%
    4       190     0.508    0.2%
    5     221.5     0.442    0.1%

Quality and confidence:
param     error
r         0.074

Model:
Time ~=    62.33
    + r    31.93
              µs

Reads = 3 + (1 * r)
Writes = 3 + (1 * r)

Pallet: "delegation", Extrinsic: "reclaim_deposit", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:0 w:1)

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

Model:
Time ~=    52.91
    + r    32.12
              µs

Reads = 2 + (1 * r)
Writes = 3 + (1 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    1     84.39     0.222    0.2%
    2     118.3     0.404    0.3%
    3     149.3     0.265    0.1%
    4     181.5     0.342    0.1%
    5     213.1      0.43    0.2%

Quality and confidence:
param     error
r         0.072

Model:
Time ~=    53.13
    + r    32.08
              µs

Reads = 2 + (1 * r)
Writes = 3 + (1 * r)

Pallet: "delegation", Extrinsic: "can_attest", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:6 w:0)

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

Model:
Time ~=    8.809
    + r    0.003
    + c    5.365
              µs

Reads = 1 + (0 * r) + (1 * c)
Writes = 0 + (0 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     35.64     0.277    0.7%
    2     5     35.58     0.158    0.4%
    3     5     35.65       0.1    0.2%
    4     5     35.66     0.136    0.3%
    5     1     13.77     0.054    0.3%
    5     2     19.97     0.089    0.4%
    5     3     25.19     0.091    0.3%
    5     4     30.45     0.123    0.4%
    5     5     35.63     0.106    0.2%

Quality and confidence:
param     error
r          0.02
c          0.02

Model:
Time ~=     8.62
    + r    0.039
    + c    5.387
              µs

Reads = 1 + (0 * r) + (1 * c)
Writes = 0 + (0 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "can_revoke", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:6 w:0)

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

Model:
Time ~=    9.038
    + r        0
    + c    5.346
              µs

Reads = 1 + (0 * r) + (1 * c)
Writes = 0 + (0 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     35.74     0.158    0.4%
    2     5      35.7     0.115    0.3%
    3     5     35.56     0.157    0.4%
    4     5     35.73     0.109    0.3%
    5     1     13.93     0.074    0.5%
    5     2     19.93     0.133    0.6%
    5     3     25.39     0.153    0.6%
    5     4     30.47     0.057    0.1%
    5     5      35.6     0.134    0.3%

Quality and confidence:
param     error
r          0.02
c          0.02

Model:
Time ~=    8.913
    + r    0.013
    + c    5.351
              µs

Reads = 1 + (0 * r) + (1 * c)
Writes = 0 + (0 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "can_remove", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:6 w:0)

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

Model:
Time ~=    9.005
    + r        0
    + c    5.355
              µs

Reads = 1 + (0 * r) + (1 * c)
Writes = 0 + (0 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     35.75     0.134    0.3%
    2     5     35.77     0.117    0.3%
    3     5     35.59     0.173    0.4%
    4     5     35.71      0.12    0.3%
    5     1     13.97     0.082    0.5%
    5     2     19.92     0.112    0.5%
    5     3     25.51      0.06    0.2%
    5     4     30.52     0.088    0.2%
    5     5     35.67      0.22    0.6%

Quality and confidence:
param     error
r         0.021
c         0.021

Model:
Time ~=    8.903
    + r    0.022
    + c    5.356
              µs

Reads = 1 + (0 * r) + (1 * c)
Writes = 0 + (0 * r) + (0 * c)


@weichweich
Copy link
Contributor Author

/bench runtime spiritnet-runtime delegation

@weichweich
Copy link
Contributor Author

/bench runtime pallet delegation

…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=delegation --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/delegation.rs --template=.maintain/runtime-weight-template.hbs
@weichweich
Copy link
Contributor Author

/bench runtime pallet delegation

@weichweich
Copy link
Contributor Author

/bench runtime spiritnet-runtime delegation

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

kilt-command-bot bot commented Feb 22, 2022

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

Results
Pallet: "delegation", Extrinsic: "create_hierarchy", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationHierarchies (r:1 w:1)
Storage: Ctype Ctypes (r:1 w:0)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationNodes (r:0 w:1)

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

Model:
Time ~=    37.01
              µs

Reads = 3
Writes = 3

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

Model:
Time ~=    37.01
              µs

Reads = 3
Writes = 3

Pallet: "delegation", Extrinsic: "add_delegation", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)

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

Model:
Time ~=    44.98
              µs

Reads = 3
Writes = 3

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

Model:
Time ~=    44.98
              µs

Reads = 3
Writes = 3

Pallet: "delegation", Extrinsic: "revoke_delegation_root_child", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    19.76
    + r    13.36
    + c    0.079
              µs

Reads = 1 + (1 * r) + (0 * c)
Writes = 0 + (1 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5      32.2     0.174    0.5%
    2     5     47.42     0.243    0.5%
    3     5     60.97     0.244    0.4%
    4     5     73.44     0.176    0.2%
    5     1     86.29     0.279    0.3%
    5     2     86.26     0.232    0.2%
    5     3     86.01     0.285    0.3%
    5     4     86.23     0.314    0.3%
    5     5     86.57     0.353    0.4%

Quality and confidence:
param     error
r         0.051
c         0.051

Model:
Time ~=    19.08
    + r    13.36
    + c    0.169
              µs

Reads = 1 + (1 * r) + (0 * c)
Writes = 0 + (1 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "revoke_delegation_leaf", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:6 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    33.02
    + r        0
    + c    5.084
              µs

Reads = 2 + (0 * r) + (1 * c)
Writes = 1 + (0 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     58.45     0.217    0.3%
    2     5     58.22     0.197    0.3%
    3     5     58.16     0.369    0.6%
    4     5      58.1      0.36    0.6%
    5     1     37.11     0.124    0.3%
    5     2     43.69     0.248    0.5%
    5     3     48.81     0.292    0.5%
    5     4     53.28     0.115    0.2%
    5     5     58.18      0.34    0.5%

Quality and confidence:
param     error
r         0.041
c         0.041

Model:
Time ~=    32.78
    + r    0.013
    + c    5.095
              µs

Reads = 2 + (0 * r) + (1 * c)
Writes = 1 + (0 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "remove_delegation", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:1)

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

Model:
Time ~=    51.97
    + r    23.19
              µs

Reads = 3 + (1 * r)
Writes = 3 + (1 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    1     74.45     0.275    0.3%
    2     98.92     0.223    0.2%
    3       122     0.452    0.3%
    4     144.5     0.195    0.1%
    5     167.8     0.433    0.2%

Quality and confidence:
param     error
r         0.059

Model:
Time ~=    51.86
    + r    23.23
              µs

Reads = 3 + (1 * r)
Writes = 3 + (1 * r)

Pallet: "delegation", Extrinsic: "reclaim_deposit", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:0 w:1)

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

Model:
Time ~=    44.78
    + r     23.1
              µs

Reads = 2 + (1 * r)
Writes = 3 + (1 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    1     67.11      0.17    0.2%
    2     91.59     0.214    0.2%
    3     114.4     0.284    0.2%
    4     137.1     0.267    0.1%
    5       160     0.311    0.1%

Quality and confidence:
param     error
r         0.056

Model:
Time ~=    44.66
    + r    23.13
              µs

Reads = 2 + (1 * r)
Writes = 3 + (1 * r)

Pallet: "delegation", Extrinsic: "can_attest", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:1 w:0)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    12.48
              µs

Reads = 2
Writes = 0

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

Model:
Time ~=    12.48
              µs

Reads = 2
Writes = 0

Pallet: "delegation", Extrinsic: "can_revoke", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:0)

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

Model:
Time ~=    8.012
    + c     5.18
              µs

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

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

Data points distribution:
    c   mean µs  sigma µs       %
    1     12.87     0.132    1.0%
    2     18.76     0.132    0.7%
    3     23.96     0.328    1.3%
    4      28.8     0.217    0.7%
    5     33.67      0.25    0.7%

Quality and confidence:
param     error
c         0.038

Model:
Time ~=    8.127
    + c    5.164
              µs

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

Pallet: "delegation", Extrinsic: "can_remove", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:0)

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

Model:
Time ~=    8.098
    + c    5.177
              µs

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

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

Data points distribution:
    c   mean µs  sigma µs       %
    1     12.77     0.115    0.9%
    2     18.72      0.12    0.6%
    3     23.85     0.146    0.6%
    4     28.81     0.234    0.8%
    5     33.69     0.237    0.7%

Quality and confidence:
param     error
c         0.035

Model:
Time ~=    7.991
    + c    5.193
              µs

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


…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=delegation --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/delegation/src/default_weights.rs --template=.maintain/weight-template.hbs
@kilt-command-bot
Copy link

kilt-command-bot bot commented Feb 22, 2022

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

Results
Pallet: "delegation", Extrinsic: "create_hierarchy", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationHierarchies (r:1 w:1)
Storage: Ctype Ctypes (r:1 w:0)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationNodes (r:0 w:1)

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

Model:
Time ~=    37.92
              µs

Reads = 3
Writes = 3

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

Model:
Time ~=    37.92
              µs

Reads = 3
Writes = 3

Pallet: "delegation", Extrinsic: "add_delegation", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)

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

Model:
Time ~=    45.37
              µs

Reads = 3
Writes = 3

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

Model:
Time ~=    45.37
              µs

Reads = 3
Writes = 3

Pallet: "delegation", Extrinsic: "revoke_delegation_root_child", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    20.31
    + r    13.34
    + c    0.029
              µs

Reads = 1 + (1 * r) + (0 * c)
Writes = 0 + (1 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     32.29     0.106    0.3%
    2     5     47.73      0.32    0.6%
    3     5     60.84     0.228    0.3%
    4     5     74.14     0.352    0.4%
    5     1     86.72     0.318    0.3%
    5     2     86.79     0.465    0.5%
    5     3     86.75     0.415    0.4%
    5     4      87.2     0.432    0.4%
    5     5     86.85     0.289    0.3%

Quality and confidence:
param     error
r         0.051
c         0.051

Model:
Time ~=    19.13
    + r    13.47
    + c    0.148
              µs

Reads = 1 + (1 * r) + (0 * c)
Writes = 0 + (1 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "revoke_delegation_leaf", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:6 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    32.37
    + r    0.027
    + c    5.204
              µs

Reads = 2 + (0 * r) + (1 * c)
Writes = 1 + (0 * r) + (0 * c)

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

Data points distribution:
    r     c   mean µs  sigma µs       %
    1     5     58.34     0.577    0.9%
    2     5     58.59     0.499    0.8%
    3     5     58.44      0.17    0.2%
    4     5     58.33     0.334    0.5%
    5     1     37.31     0.226    0.6%
    5     2     43.67     0.301    0.6%
    5     3      48.7     0.361    0.7%
    5     4     53.54     0.137    0.2%
    5     5     58.53     0.385    0.6%

Quality and confidence:
param     error
r         0.039
c         0.039

Model:
Time ~=    32.41
    + r    0.071
    + c    5.175
              µs

Reads = 2 + (0 * r) + (1 * c)
Writes = 1 + (0 * r) + (0 * c)

Pallet: "delegation", Extrinsic: "remove_delegation", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:1 w:1)

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

Model:
Time ~=    52.51
    + r    22.99
              µs

Reads = 3 + (1 * r)
Writes = 3 + (1 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    1     75.12     0.277    0.3%
    2     98.77     0.461    0.4%
    3     122.9     0.399    0.3%
    4     144.4     0.645    0.4%
    5     167.1      0.42    0.2%

Quality and confidence:
param     error
r         0.083

Model:
Time ~=    52.77
    + r    22.97
              µs

Reads = 3 + (1 * r)
Writes = 3 + (1 * r)

Pallet: "delegation", Extrinsic: "reclaim_deposit", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:2)
Storage: System Account (r:1 w:1)
Storage: Delegation DelegationHierarchies (r:0 w:1)

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

Model:
Time ~=    44.93
    + r    23.18
              µs

Reads = 2 + (1 * r)
Writes = 3 + (1 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    1     67.39     0.331    0.4%
    2      91.8     0.345    0.3%
    3     114.7     0.517    0.4%
    4     138.1     0.397    0.2%
    5       160     0.676    0.4%

Quality and confidence:
param     error
r         0.078

Model:
Time ~=    44.95
    + r    23.16
              µs

Reads = 2 + (1 * r)
Writes = 3 + (1 * r)

Pallet: "delegation", Extrinsic: "can_attest", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:1 w:0)
Storage: Delegation DelegationHierarchies (r:1 w:0)

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

Model:
Time ~=    12.36
              µs

Reads = 2
Writes = 0

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

Model:
Time ~=    12.36
              µs

Reads = 2
Writes = 0

Pallet: "delegation", Extrinsic: "can_revoke", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:0)

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

Model:
Time ~=    8.192
    + c    5.134
              µs

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

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

Data points distribution:
    c   mean µs  sigma µs       %
    1     12.82      0.15    1.1%
    2     18.89     0.208    1.1%
    3     23.84     0.271    1.1%
    4     29.03     0.365    1.2%
    5     33.51     0.187    0.5%

Quality and confidence:
param     error
c         0.045

Model:
Time ~=    8.163
    + c    5.153
              µs

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

Pallet: "delegation", Extrinsic: "can_remove", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Delegation DelegationNodes (r:2 w:0)

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

Model:
Time ~=    8.538
    + c    5.012
              µs

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

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

Data points distribution:
    c   mean µs  sigma µs       %
    1     13.38     0.242    1.8%
    2     18.57     0.212    1.1%
    3     24.01     0.197    0.8%
    4     28.62     0.129    0.4%
    5     33.48     0.191    0.5%

Quality and confidence:
param     error
c         0.029

Model:
Time ~=    8.543
    + c    5.026
              µs

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


kiltbot and others added 2 commits February 22, 2022 11:42
…hmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=delegation --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/delegation.rs --template=.maintain/runtime-weight-template.hbs
@tjwelde
Copy link
Contributor

tjwelde commented Feb 28, 2022

AFAICS, it would be hard to identify the pallet which was used for access control here. Can we add something like a prefix or struct identifier to the Access Control, which would be added to the authorization id, e.g.?

@weichweich
Copy link
Contributor Author

AFAICS, it would be hard to identify the pallet which was used for access control here. Can we add something like a prefix or struct identifier to the Access Control, which would be added to the authorization id, e.g.?

We already have something like that. The authorization ID is defined here. You should be able to use the enum on the SDK side right?

@ntn-x2
Copy link
Member

ntn-x2 commented Feb 28, 2022

I think the point is that an AttestationDetails struct has pub authorization_id: Option<AuthorizationIdOf<T>>, which is simply Parameter + MaxEncodedLen. So it might not be possible to understand whether the given attestation was issued under a delegation or under some other access control logic.

@weichweich
Copy link
Contributor Author

So it might not be possible to understand whether the given attestation was issued under a delegation or under some other access control logic.

That is the point of this PR. The attestation pallet should not care about that. But since the authorization_id is actually an Enum, you should be able to distinguish where the attestation was authorized in the SDK.

Copy link
Member

@ntn-x2 ntn-x2 left a comment

Choose a reason for hiding this comment

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

Nothing major changed since last time, so I would be in favour of merging this and fix anything else in a different PR, so that we can start working on supporting this in the SDK.

Copy link
Member

@ntn-x2 ntn-x2 left a comment

Choose a reason for hiding this comment

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

@weichweich weichweich enabled auto-merge (squash) March 17, 2022 13:35
@weichweich weichweich merged commit b7493b5 into develop Mar 17, 2022
@weichweich weichweich deleted the aw-delegation-rework branch March 17, 2022 15:07
@ntn-x2 ntn-x2 mentioned this pull request Mar 25, 2022
ntn-x2 pushed a commit that referenced this pull request Jun 23, 2022
Co-authored-by: William Freudenberger <[email protected]>
(cherry picked from commit b7493b5)
ntn-x2 added a commit that referenced this pull request Jun 24, 2022
* Adds two more relaychain bootnodes for staging environment  (#334)

* chore: reset peregrine stg (#335)

* ci: use custom ci image (#336)

* Optimizes docker layer (#337)

* fix: add did lookup pallet to DID authorization logic + reverse lookup index (#343)

* chore: update toolchain version to nightly 1.59 (#339)

* feat: proxy type for disableling deposit claiming (#341)

* fix: rococo protocol id (#369)

* feat: generic access control (#316)

* Updates toolchain version (#345)

* refactor: enforce no runtime in pallet (#349)

* fix: features (#353)

* feat: add tips pallet (#352)

* feat: upgrade to Polkadot v0.9.19 (#357)

* chore: upgrade and clean up (#360)

* Adds the new rococo chainspec (#363)

* feat: add launch pallet removal migration (#359)

* refactor: update rilt para id from 2015 to 2108 (#364)

* fix: rilt para id (#365)

* feat: upgrade to Polkadot v0.9.23 (#366)

* use ci-linx:production base image (#368)

* feat: upgrade to Polkadot v0.9.24 (#370)

* fix: fix CI builders compilation errors and pin to a specific hash (#372)
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.

4 participants