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

Add ClassAccount storage to unique pallet #9940

Merged
merged 16 commits into from
Dec 18, 2021

Conversation

hamidra
Copy link
Contributor

@hamidra hamidra commented Oct 6, 2021

The changes addresses #9777 by adding a storage to unique pallet to keep classes that are owned by an account. The current Account storage keeps the instances that are owned by an account but currently the only way to query the classes that an account owns is by iterating through all asset classes. Having the account classes indexed seems to be very useful for NFT UXs which the user creates a collection of NFTs, and then needs to make changes to those collections in future.
[fixes #9777 ]

@hamidra hamidra added A0-please_review Pull request needs code review. B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Oct 6, 2021
@hamidra hamidra changed the title Add ClassAccount storage to uniques Add ClassAccount storage to unique pallet Oct 6, 2021
@xlc
Copy link
Contributor

xlc commented Oct 6, 2021

this requires migration

@gavofyork
Copy link
Member

Not against this going in but it will need the migration.

@hamidra
Copy link
Contributor Author

hamidra commented Oct 14, 2021

Migration code was missing. Also we would need to run benchmark to update the weights. Will add the storage version and migration logic to the pallet and will run the benchmark to fix.

@hamidra
Copy link
Contributor Author

hamidra commented Oct 31, 2021

2021-11-02 16:26:04 ⚠️ System declares internal migrations (which might execute). On-chain StorageVersion(0) vs current storage version StorageVersion(0)
2021-11-02 16:26:04 ✅ no migration for BagsList
2021-11-02 16:26:04 ✅ no migration for TransactionStorage
2021-11-02 16:26:04 ⚠️ Uniques declares internal migrations (which might execute). On-chain StorageVersion(0) vs current storage version StorageVersion(0)
2021-11-02 16:26:04 Running migration storage v1 for uniques with storage version StorageVersion(0)
2021-11-02 16:26:04 Running migration storage v1 for uniques with storage version StorageVersion(0) was complete
2021-11-02 16:26:04 ✅ no migration for Gilt

if on_chain_storage_version < 1 {
let mut count = 0;
for (class, detail) in Class::<T, I>::iter() {
ClassAccount::<T, I>::insert(&detail.owner, &class, ());
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 migration might be very big and cause issues on a parachain.

Copy link
Contributor Author

@hamidra hamidra Oct 31, 2021

Choose a reason for hiding this comment

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

What is the best practice to bound the migrations. do we just set an upper limit?! Currently there are only 5-6 classes on statemine that this will run for. I assume any other parachain which launches after this will start from storage version 1, hence won't run this migration.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

Looks overall good to me. To test the migration properly with try-runtime you need to integrate it in cumulus, but I think the logic of the migration is pretty trivial. I am just worried about the size of migration.

@kianenigma
Copy link
Contributor

Try-runtime was ran against a substrate node with some unique classes and assets and the migration result was complete with no errors:

2021-10-31 15:52:22 ✅ no migration for TransactionStorage 2021-10-31 15:52:22 ⚠️ Uniques declares internal migrations (which might execute). On-chain <wasm:stripped> vs current storage version <wasm:stripped> 2021-10-31 15:52:22 Running migration storage v1 for uniques with storage version wasm:stripped 2021-10-31 15:52:22 Running migration storage v1 for uniques with storage version wasm:stripped was complete 2021-10-31 15:52:22 ✅ no migration for Gilt

run this with --execution Native

@shawntabrizi
Copy link
Member

Looks overall good to me. To test the migration properly with try-runtime you need to integrate it in cumulus, but I think the logic of the migration is pretty trivial. I am just worried about the size of migration.

I think there are very few classes actually, so this should be fine?

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
@hamidra
Copy link
Contributor Author

hamidra commented Oct 31, 2021

Looks overall good to me. To test the migration properly with try-runtime you need to integrate it in cumulus, but I think the logic of the migration is pretty trivial. I am just worried about the size of migration.

I think there are very few classes actually, so this should be fine?

currently there are 7 classes. so it will be a light migration.

@hamidra
Copy link
Contributor Author

hamidra commented Nov 2, 2021

/benchmark runtime pallet pallet_uniques

@parity-benchapp
Copy link

parity-benchapp bot commented Nov 2, 2021

Benchmark Runtime Pallet for branch "hamidra/class-account-storage" with command cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

Results
Pallet: "pallet_uniques", Extrinsic: "create", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques ClassAccount (r:0 w:1)

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

Model:
Time ~=     41.1
              µs

Reads = 1
Writes = 2

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

Model:
Time ~=     41.1
              µs

Reads = 1
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "force_create", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques ClassAccount (r:0 w:1)

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

Model:
Time ~=    22.98
              µs

Reads = 1
Writes = 2

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

Model:
Time ~=    22.98
              µs

Reads = 1
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "destroy", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques Asset (r:1 w:0)
Storage: Uniques ClassAccount (r:0 w:1)
Storage: Uniques Attribute (r:0 w:1000)
Storage: Uniques ClassMetadataOf (r:0 w:1)
Storage: Uniques InstanceMetadataOf (r:0 w:1000)
Storage: Uniques Account (r:0 w:20)

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

Model:
Time ~=        0
    + n    14.71
    + m    1.114
    + a    1.067
              µs

Reads = 2 + (1 * n) + (0 * m) + (0 * a)
Writes = 3 + (2 * n) + (1 * m) + (1 * a)

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

Data points distribution:
    n     m     a   mean µs  sigma µs       %
    0  1000  1000      1696     10.99    0.6%
   20  1000  1000      1955     10.66    0.5%
   40  1000  1000      2225     12.32    0.5%
   60  1000  1000      2504        12    0.4%
   80  1000  1000      2768     12.73    0.4%
  100  1000  1000      3044     20.74    0.6%
  120  1000  1000      3305     25.91    0.7%
  140  1000  1000      3629     7.986    0.2%
  160  1000  1000      3875     18.45    0.4%
  180  1000  1000      4159     10.73    0.2%
  200  1000  1000      4466     7.328    0.1%
  220  1000  1000      4716     6.096    0.1%
  240  1000  1000      4974     13.53    0.2%
  260  1000  1000      5275     12.52    0.2%
  280  1000  1000      5633     29.69    0.5%
  300  1000  1000      5846     22.27    0.3%
  320  1000  1000      6178     14.82    0.2%
  340  1000  1000      6562     23.35    0.3%
  360  1000  1000      6721     12.85    0.1%
  380  1000  1000      6985     21.99    0.3%
  400  1000  1000      7280     34.32    0.4%
  420  1000  1000      7501     30.24    0.4%
  440  1000  1000      7978     43.11    0.5%
  460  1000  1000      8261     29.58    0.3%
  480  1000  1000      8523     38.36    0.4%
  500  1000  1000      8870     18.54    0.2%
  520  1000  1000      9130     24.92    0.2%
  540  1000  1000      9558     33.86    0.3%
  560  1000  1000      9702      36.9    0.3%
  580  1000  1000     10010     32.95    0.3%
  600  1000  1000     10220     44.93    0.4%
  620  1000  1000     10590     33.21    0.3%
  640  1000  1000     11020      40.1    0.3%
  660  1000  1000     11110     44.17    0.3%
  680  1000  1000     11510      55.6    0.4%
  700  1000  1000     11890     68.65    0.5%
  720  1000  1000     12190     31.56    0.2%
  740  1000  1000     12390     26.85    0.2%
  760  1000  1000     12850     36.44    0.2%
  780  1000  1000     13110     50.11    0.3%
  800  1000  1000     13310     37.46    0.2%
  820  1000  1000     13590     42.76    0.3%
  840  1000  1000     13980     32.79    0.2%
  860  1000  1000     14190     53.24    0.3%
  880  1000  1000     14410     37.25    0.2%
  900  1000  1000     14860     27.62    0.1%
  920  1000  1000     15080     44.42    0.2%
  940  1000  1000     15260     76.07    0.4%
  960  1000  1000     15670     49.35    0.3%
  980  1000  1000     15920     70.45    0.4%
 1000     0  1000     15400     55.18    0.3%
 1000    20  1000     15460     41.72    0.2%
 1000    40  1000     15350     42.35    0.2%
 1000    60  1000     15360     87.91    0.5%
 1000    80  1000     15390     36.43    0.2%
 1000   100  1000     15460     81.28    0.5%
 1000   120  1000     15420     22.69    0.1%
 1000   140  1000     15380     35.84    0.2%
 1000   160  1000     15570      66.6    0.4%
 1000   180  1000     15390     52.83    0.3%
 1000   200  1000     15200     51.59    0.3%
 1000   220  1000     15410     63.62    0.4%
 1000   240  1000     15680     58.96    0.3%
 1000   260  1000     15560     53.19    0.3%
 1000   280  1000     15520     57.47    0.3%
 1000   300  1000     15390     32.48    0.2%
 1000   320  1000     15590     55.86    0.3%
 1000   340  1000     15580     63.97    0.4%
 1000   360  1000     15600     65.55    0.4%
 1000   380  1000     15550     60.89    0.3%
 1000   400  1000     15840     50.27    0.3%
 1000   420  1000     15850     65.68    0.4%
 1000   440  1000     15790     38.27    0.2%
 1000   460  1000     15910      83.9    0.5%
 1000   480  1000     15740     59.24    0.3%
 1000   500  1000     15880     38.12    0.2%
 1000   520  1000     15640     64.22    0.4%
 1000   540  1000     15990     54.02    0.3%
 1000   560  1000     15900      65.4    0.4%
 1000   580  1000     15880     47.19    0.2%
 1000   600  1000     16160     57.39    0.3%
 1000   620  1000     16010     61.79    0.3%
 1000   640  1000     15740     34.03    0.2%
 1000   660  1000     15860     47.53    0.2%
 1000   680  1000     16110     37.69    0.2%
 1000   700  1000     15840     68.46    0.4%
 1000   720  1000     16180     60.13    0.3%
 1000   740  1000     16160      33.5    0.2%
 1000   760  1000     16070      45.1    0.2%
 1000   780  1000     15890     17.69    0.1%
 1000   800  1000     16330     55.74    0.3%
 1000   820  1000     16250     47.64    0.2%
 1000   840  1000     16170     67.08    0.4%
 1000   860  1000     16330     42.11    0.2%
 1000   880  1000     16070     69.08    0.4%
 1000   900  1000     16240     44.63    0.2%
 1000   920  1000     16260     60.05    0.3%
 1000   940  1000     16350     48.73    0.2%
 1000   960  1000     16570      59.7    0.3%
 1000   980  1000     16450     48.21    0.2%
 1000  1000     0     15370     47.78    0.3%
 1000  1000    20     15550      45.6    0.2%
 1000  1000    40     15490     77.73    0.5%
 1000  1000    60     15520     45.33    0.2%
 1000  1000    80     15430     89.56    0.5%
 1000  1000   100     15520     53.32    0.3%
 1000  1000   120     15570     48.61    0.3%
 1000  1000   140     15590     49.12    0.3%
 1000  1000   160     15320     59.99    0.3%
 1000  1000   180     15280     59.89    0.3%
 1000  1000   200     15580     59.84    0.3%
 1000  1000   220     15520     64.88    0.4%
 1000  1000   240     15700      51.8    0.3%
 1000  1000   260     15610      45.4    0.2%
 1000  1000   280     15630     53.11    0.3%
 1000  1000   300     15560     38.35    0.2%
 1000  1000   320     15560     39.38    0.2%
 1000  1000   340     15810     46.63    0.2%
 1000  1000   360     15530     56.81    0.3%
 1000  1000   380     15750     28.58    0.1%
 1000  1000   400     15780     40.52    0.2%
 1000  1000   420     15880     39.28    0.2%
 1000  1000   440     15820     29.47    0.1%
 1000  1000   460     15680     48.17    0.3%
 1000  1000   480     16000     36.69    0.2%
 1000  1000   500     15700     49.34    0.3%
 1000  1000   520     16090     42.97    0.2%
 1000  1000   540     15980     58.44    0.3%
 1000  1000   560     15980     33.18    0.2%
 1000  1000   580     15720     44.21    0.2%
 1000  1000   600     15970     71.01    0.4%
 1000  1000   620     16260     70.97    0.4%
 1000  1000   640     15970     57.85    0.3%
 1000  1000   660     16100     53.81    0.3%
 1000  1000   680     16140     70.67    0.4%
 1000  1000   700     16130     65.16    0.4%
 1000  1000   720     16200     74.16    0.4%
 1000  1000   740     16120     78.51    0.4%
 1000  1000   760     16030     76.52    0.4%
 1000  1000   780     16390      46.1    0.2%
 1000  1000   800     16320     52.53    0.3%
 1000  1000   820     16230     36.65    0.2%
 1000  1000   840     16440     72.76    0.4%
 1000  1000   860     16000     68.01    0.4%
 1000  1000   880     16300     88.98    0.5%
 1000  1000   900     16130     68.15    0.4%
 1000  1000   920     16300     43.96    0.2%
 1000  1000   940     16560      61.9    0.3%
 1000  1000   960     16190     65.12    0.4%
 1000  1000   980     16610     48.01    0.2%
 1000  1000  1000     16360     71.04    0.4%

Quality and confidence:
param     error
n         0.014
m         0.014
a         0.014

Model:
Time ~=        0
    + n    14.87
    + m    1.058
    + a    0.956
              µs

Reads = 2 + (1 * n) + (0 * m) + (0 * a)
Writes = 3 + (2 * n) + (1 * m) + (1 * a)

Pallet: "pallet_uniques", Extrinsic: "mint", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Asset (r:1 w:1)
Storage: Uniques Class (r:1 w:1)
Storage: Uniques Account (r:0 w:1)

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

Model:
Time ~=    51.24
              µs

Reads = 2
Writes = 3

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

Model:
Time ~=    51.24
              µs

Reads = 2
Writes = 3

Pallet: "pallet_uniques", Extrinsic: "burn", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques Asset (r:1 w:1)
Storage: Uniques Account (r:0 w:1)

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

Model:
Time ~=    53.17
              µs

Reads = 2
Writes = 3

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

Model:
Time ~=    53.17
              µs

Reads = 2
Writes = 3

Pallet: "pallet_uniques", Extrinsic: "transfer", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:0)
Storage: Uniques Asset (r:1 w:1)
Storage: Uniques Account (r:0 w:2)

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

Model:
Time ~=    39.68
              µs

Reads = 2
Writes = 3

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

Model:
Time ~=    39.68
              µs

Reads = 2
Writes = 3

Pallet: "pallet_uniques", Extrinsic: "redeposit", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques Asset (r:100 w:100)

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

Model:
Time ~=        0
    + i    22.71
              µs

Reads = 1 + (1 * i)
Writes = 1 + (1 * i)

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

Data points distribution:
    i   mean µs  sigma µs       %
    0     23.43      0.08    0.3%
  100      2159     10.85    0.5%
  200      4317     18.98    0.4%
  300      6522     30.67    0.4%
  400      8710      26.1    0.2%
  500     10890     20.33    0.1%
  600     13100     14.59    0.1%
  700     15360     26.32    0.1%
  800     17490     38.66    0.2%
  900     19820     46.76    0.2%
 1000     21880     50.09    0.2%
 1100     24270     45.59    0.1%
 1200     26650     50.08    0.1%
 1300     28760     34.42    0.1%
 1400     30970      35.7    0.1%
 1500     33090     66.99    0.2%
 1600     35370     56.74    0.1%
 1700     37530      79.7    0.2%
 1800     40030     65.62    0.1%
 1900     42160     85.99    0.2%
 2000     44530     36.65    0.0%
 2100     46500     39.37    0.0%
 2200     48770     58.75    0.1%
 2300     51460     70.63    0.1%
 2400     53540     26.09    0.0%
 2500     55590     61.35    0.1%
 2600     57810     48.17    0.0%
 2700     59910     54.54    0.0%
 2800     62430     113.3    0.1%
 2900     64470       116    0.1%
 3000     67520     105.7    0.1%
 3100     69940     78.56    0.1%
 3200     72100     98.17    0.1%
 3300     74340     144.5    0.1%
 3400     76530     50.72    0.0%
 3500     78970     171.5    0.2%
 3600     81270     73.12    0.0%
 3700     83630     114.3    0.1%
 3800     85600     122.6    0.1%
 3900     87590     79.51    0.0%
 4000     90100     81.31    0.0%
 4100     92420     120.1    0.1%
 4200     94630     103.5    0.1%
 4300     96980        76    0.0%
 4400     99260     84.82    0.0%
 4500    102500     130.4    0.1%
 4600    104300     119.3    0.1%
 4700    106600     103.8    0.0%
 4800    108600       177    0.1%
 4900    111500     111.4    0.0%
 5000    114000     132.1    0.1%

Quality and confidence:
param     error
i         0.012

Model:
Time ~=        0
    + i    22.75
              µs

Reads = 1 + (1 * i)
Writes = 1 + (1 * i)

Pallet: "pallet_uniques", Extrinsic: "freeze", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Asset (r:1 w:1)
Storage: Uniques Class (r:1 w:0)

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

Model:
Time ~=    27.83
              µs

Reads = 2
Writes = 1

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

Model:
Time ~=    27.83
              µs

Reads = 2
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "thaw", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Asset (r:1 w:1)
Storage: Uniques Class (r:1 w:0)

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

Model:
Time ~=    27.73
              µs

Reads = 2
Writes = 1

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

Model:
Time ~=    27.73
              µs

Reads = 2
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "freeze_class", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)

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

Model:
Time ~=    20.89
              µs

Reads = 1
Writes = 1

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

Model:
Time ~=    20.89
              µs

Reads = 1
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "thaw_class", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)

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

Model:
Time ~=    20.84
              µs

Reads = 1
Writes = 1

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

Model:
Time ~=    20.84
              µs

Reads = 1
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "transfer_ownership", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: System Account (r:1 w:1)
Storage: Uniques ClassAccount (r:0 w:2)

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

Model:
Time ~=    51.52
              µs

Reads = 2
Writes = 4

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

Model:
Time ~=    51.52
              µs

Reads = 2
Writes = 4

Pallet: "pallet_uniques", Extrinsic: "set_team", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)

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

Model:
Time ~=    22.03
              µs

Reads = 1
Writes = 1

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

Model:
Time ~=    22.03
              µs

Reads = 1
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "force_asset_status", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques ClassAccount (r:0 w:1)

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

Model:
Time ~=    25.87
              µs

Reads = 1
Writes = 2

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

Model:
Time ~=    25.87
              µs

Reads = 1
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "set_attribute", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques InstanceMetadataOf (r:1 w:0)
Storage: Uniques Attribute (r:1 w:1)

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

Model:
Time ~=    63.36
              µs

Reads = 3
Writes = 2

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

Model:
Time ~=    63.36
              µs

Reads = 3
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "clear_attribute", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques InstanceMetadataOf (r:1 w:0)
Storage: Uniques Attribute (r:1 w:1)

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

Model:
Time ~=    56.84
              µs

Reads = 3
Writes = 2

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

Model:
Time ~=    56.84
              µs

Reads = 3
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "set_metadata", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques InstanceMetadataOf (r:1 w:1)

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

Model:
Time ~=    47.98
              µs

Reads = 2
Writes = 2

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

Model:
Time ~=    47.98
              µs

Reads = 2
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "clear_metadata", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques InstanceMetadataOf (r:1 w:1)

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

Model:
Time ~=    47.34
              µs

Reads = 2
Writes = 2

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

Model:
Time ~=    47.34
              µs

Reads = 2
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "set_class_metadata", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:1)
Storage: Uniques ClassMetadataOf (r:1 w:1)

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

Model:
Time ~=    46.89
              µs

Reads = 2
Writes = 2

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

Model:
Time ~=    46.89
              µs

Reads = 2
Writes = 2

Pallet: "pallet_uniques", Extrinsic: "clear_class_metadata", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:0)
Storage: Uniques ClassMetadataOf (r:1 w:1)

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

Model:
Time ~=    41.74
              µs

Reads = 2
Writes = 1

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

Model:
Time ~=    41.74
              µs

Reads = 2
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "approve_transfer", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:0)
Storage: Uniques Asset (r:1 w:1)

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

Model:
Time ~=    29.82
              µs

Reads = 2
Writes = 1

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

Model:
Time ~=    29.82
              µs

Reads = 2
Writes = 1

Pallet: "pallet_uniques", Extrinsic: "cancel_approval", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Uniques Class (r:1 w:0)
Storage: Uniques Asset (r:1 w:1)

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

Model:
Time ~=    29.75
              µs

Reads = 2
Writes = 1

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

Model:
Time ~=    29.75
              µs

Reads = 2
Writes = 1


Parity Bot and others added 5 commits November 2, 2021 15:00
…path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs
@hamidra
Copy link
Contributor Author

hamidra commented Dec 6, 2021

Looks overall good to me. To test the migration properly with try-runtime you need to integrate it in cumulus, but I think the logic of the migration is pretty trivial. I am just worried about the size of migration.

Now that try-runtime is added to cumulus I also tried the runtime upgrade on cumulus and it was successful against the current statemine state:

2021-12-06 13:17:07 ✅ no migration for Proxy
2021-12-06 13:17:07 ✅ no migration for Assets
2021-12-06 13:17:07 ⚠️ Uniques declares internal migrations (which might execute). On-chain StorageVersion(0) vs current storage version StorageVersion(0)
2021-12-06 13:17:07 Running migration storage v1 for uniques with storage version StorageVersion(0)
2021-12-06 13:17:07 Running migration storage v1 for uniques with storage version StorageVersion(0) was complete
2021-12-06 13:17:10 proof: 9f06aa394eea5630e07c48ae0c9558cef7398f80688cf08b3f5dffa06d8e56ec0c3e65686b6b969ae836a98cfb64a6c690e48d488020721217d71a031cd2d75e12e6279a0869341eccdb5269c5bad2615450113c4d505f0e7b9012096b41c4eb3aaf947f6ea4290800004c5f0684a022a34dd8bfa2baaf44f172b71004018032e57306806680739e8d0bb9146bfb4ece88127889eccc82c5b3bb4ca18a6f088091c51caec933f99099d9533a10fff9fa19d95981a63b7caf99ad17f14b7d606a80b87a3952cfb2e514fbb79173aa18e5bf21c6a3b2fd27f70d42dde0dacda0ea8780366d0f60b7986a88ffd219874f0ac04eb0344850c3d0c775e93ac27702ce4045785f09cce9c888469bb1a0dceaa129672ef83065092473746174656d696e659f02f224bb127609e7cebd7d411456bd968a6e806d47c287ea48da6148df16f6021539c89aaab786440ff04a34cea13547c7a395805e531b65407ddd65eb11aa12fc4ea7a958040c314a558180143e7f8d8890952e80ecdd9dd5efdab70a1f5946a274ab5dc208e9345ccfdf3efe8ff58f44d47367d280da166af004aa5ce308ca55b9499480f7afa7f72bbdff23d94e9e7cef79f4a14480245647965fd6c1cddfb5e109c6c951421cba9bff690e40850b907f387b1cc2b780491cc11505735d5484f305ec4ef0d3e13d42858060f976b6a918b333a3ffb95380bc0550ea9c...27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31ac69961f64020000000000000000000000610000006100000000000000006623b1a14cb49e4d32c1f7dff3396751450000007902ce10c51e89ab2907983cc8b846d9d1afa2f9700db18e176c7fcfe709d0406339ce10c51e89ab2907983cc8b846d9d1afa2f9700db18e176c7fcfe709d0406339ce10c51e89ab2907983cc8b846d9d1afa2f9700db18e176c7fcfe709d0406339ce10c51e89ab2907983cc8b846d9d1afa2f9700db18e176c7fcfe709d04063396ca55f4aee000000000000000000000000010000000100000000000000006619bf46066d74446ee15c8c2715f7030d0000007902c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b31c6fd5cedb58f27615450c9c7ac04323db766688b2d8112c4aa008c6b63f80b3192b9626480030000000000000000000000aa000000aa0000000000000001 / 36 nodes
2021-12-06 13:17:10 proof size: 626.45 KB (641488 bytes)
2021-12-06 13:17:10 compact proof size: 625.35 KB (640360 bytes)
2021-12-06 13:17:10 zstd-compressed compact proof 625.37 KB (640381 bytes)
2021-12-06 13:17:10 TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = 2325000000, total weight = 500000000000 (0.00465)

@shawntabrizi
Copy link
Member

bot merge

@paritytech-processbot paritytech-processbot bot merged commit efa4dfa into master Dec 18, 2021
@paritytech-processbot paritytech-processbot bot deleted the hamidra/class-account-storage branch December 18, 2021 15:41
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* add ClassAccount to uniques storage

* add tests for Class and ClassAccount storage

* fix format

* fix description

* add migration

* remove extra iteration

* Update frame/uniques/src/migration.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

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

* fix format

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* add ClassAccount to uniques storage

* add tests for Class and ClassAccount storage

* fix format

* fix description

* add migration

* remove extra iteration

* Update frame/uniques/src/migration.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

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

* fix format

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
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. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: Storage query of uniques classes by account
5 participants