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

Upgradable contracts using set_code function #10690

Merged
merged 33 commits into from
Feb 11, 2022

Conversation

yarikbratashchuk
Copy link
Contributor

This pr is a follow up for #10567.

The question that naturally comes to mind:

  • Do we need to check if there is deployed contract behind the hash that is being set?

That would give us a little bit for of certainty when calling set_code function. On the other hand we won't be able to set hash for the contract that has not been deployed yet. As for me it doesn't make much sense considering that we don't make full check of what we're setting with this call anyways.

Thoughts and comments are required and welcome.

@athei athei added A0-please_review Pull request needs code review. B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. labels Jan 18, 2022
@athei
Copy link
Member

athei commented Jan 18, 2022

I think we need to check whether the code hash already exists. It is necessary because we need to increase the ref count of the code that we are switching to. This will prevent the code from being deleted. The reason for that is that we don't want the owner of a code being able to delete it when it is in use.

We could of course get rid of the ref counting and let the owner always delete the code. Anyone who still needs the code would then need to re-upload the code (they can get it from an archive node). However, this can lead to intermediate breakage and might prevent people from sharing code.

@yarikbratashchuk
Copy link
Contributor Author

Makes sense. Will add the check using contains_storage method.

- increment/decrement codehash refcount
@yarikbratashchuk
Copy link
Contributor Author

@athei, please take a look at what has been done, and let me know what you think

Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

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

Apart from my code comments I have the follwing:

We should think about making seal_set_code always stop the execution of a contract (like seal_terminate). Reason is because we can get confusing interactions otherwise: Imagine a contract that calls into itself after changing its code. The new call would use the new code but when the original caller panics after returning from the sub call it would revert the changes made by set_code and the next caller would use the old code. I am not sure if this is necessarily a bad thing but it just feels much safer.

Also, we should emit an event in case the code of a contract changes.

frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/code_cache.rs Outdated Show resolved Hide resolved
frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/benchmarking/mod.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
- comment errors: ReturnCodes
- update mock ext implementation
- return Error::CodeNotFound when no code for such hash
@yarikbratashchuk
Copy link
Contributor Author

yarikbratashchuk commented Jan 20, 2022

@athei, please take a look at the updates.
I'm not sure how to stop execution of the contract though, what are your thoughts on this?

athei
athei previously requested changes Jan 21, 2022
Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

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

Gets better. Regarding the termination: I need to think about that and need to come back to you.

frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
frame/contracts/src/lib.rs Outdated Show resolved Hide resolved
frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/exec.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/code_cache.rs Outdated Show resolved Hide resolved
@athei
Copy link
Member

athei commented Feb 9, 2022

You changed the benchmark so that you set it to the same code multiple times. This won't work out because this will repeatedly read from the same OwnerInfo and hence will still yield too few reads. You need to keep the original structure of setting it to different code hashes.

@yarikbratashchuk
Copy link
Contributor Author

yarikbratashchuk commented Feb 9, 2022

@athei, this is what i'm getting on my machine (without #[skip_meta]):

        // Storage: System Account (r:1 w:0)
        // Storage: Contracts ContractInfoOf (r:1 w:1)
        // Storage: Contracts CodeStorage (r:1 w:0)
        // Storage: Timestamp Now (r:1 w:0)
        // Storage: Contracts OwnerInfoOf (r:36 w:36)
        fn seal_set_code_hash(r: u32, ) -> Weight {
                (0 as Weight)
                        // Standard Error: 7_683_000
                        .saturating_add((1_705_926_000 as Weight).saturating_mul(r as Weight))
                        .saturating_add(T::DbWeight::get().reads((99 as Weight).saturating_mul(r as Weight)))
                        .saturating_add(T::DbWeight::get().writes((99 as Weight).saturating_mul(r as Weight)))
        }

Can we run it using bot and see what we get, please?

Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

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

We can run the bot once the skip meta situation is sorted.

frame/contracts/src/benchmarking/mod.rs Outdated Show resolved Hide resolved
frame/contracts/src/benchmarking/mod.rs Outdated Show resolved Hide resolved
@athei
Copy link
Member

athei commented Feb 10, 2022

/benchmark runtime pallet pallet_contracts

@parity-benchapp
Copy link

parity-benchapp bot commented Feb 10, 2022

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

Toolchain: stable-x86_64-unknown-linux-gnu (default)
rustc 1.57.0 (f1edd0429 2021-11-29)

Results
Pallet: "pallet_contracts", Extrinsic: "on_initialize", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts DeletionQueue (r:1 w:0)

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

Model:
Time ~=     1.59
              µs

Reads = 1
Writes = 0

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

Model:
Time ~=     1.59
              µs

Reads = 1
Writes = 0

Pallet: "pallet_contracts", Extrinsic: "on_initialize_per_trie_key", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=      9.4
    + k    0.725
              µs

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

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

Data points distribution:
    k   mean µs  sigma µs       %
    0     9.945     0.077    0.7%
   20     26.21     0.154    0.5%
   40     40.83     0.074    0.1%
   60     52.45     0.219    0.4%
   80     64.25     0.202    0.3%
  100     79.08     0.207    0.2%
  120     92.49     0.341    0.3%
  140     107.8     0.248    0.2%
  160     122.6     0.501    0.4%
  180     138.3     0.267    0.1%
  200     151.6     0.783    0.5%
  220     166.5      0.39    0.2%
  240     181.7     0.639    0.3%
  260     196.8     0.483    0.2%
  280     210.6     0.518    0.2%
  300     225.4     0.712    0.3%
  320     240.9     0.582    0.2%
  340       256     0.632    0.2%
  360     271.6     0.523    0.1%
  380     288.9     0.718    0.2%
  400     302.8     0.344    0.1%
  420     317.4     1.087    0.3%
  440     331.6      0.36    0.1%
  460     344.9     0.951    0.2%
  480     360.8     2.068    0.5%
  500     375.3     0.745    0.1%
  520     391.7     0.579    0.1%
  540     406.6      2.25    0.5%
  560     421.1     3.058    0.7%
  580       435     1.737    0.3%
  600     450.6     2.892    0.6%
  620     459.8     1.002    0.2%
  640     473.7     1.581    0.3%
  660     488.8     1.085    0.2%
  680     503.4     0.866    0.1%
  700     518.3     2.411    0.4%
  720     530.9     1.987    0.3%
  740     546.3     1.933    0.3%
  760     559.8      1.45    0.2%
  780     572.9     1.853    0.3%
  800     590.7     4.254    0.7%
  820     604.3     2.447    0.4%
  840     620.2     1.181    0.1%
  860       635     3.629    0.5%
  880     646.3      1.53    0.2%
  900     658.5     1.709    0.2%
  920     682.2     7.573    1.1%
  940     685.2     1.874    0.2%
  960     698.2     2.979    0.4%
  980     713.6     2.399    0.3%
 1000     728.7     1.803    0.2%
 1020     745.8      2.19    0.2%

Quality and confidence:
param     error
k             0

Model:
Time ~=    9.975
    + k    0.724
              µs

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

Pallet: "pallet_contracts", Extrinsic: "on_initialize_per_queue_item", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts DeletionQueue (r:1 w:0)

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

Model:
Time ~=    12.77
    + q    2.297
              µs

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

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

Data points distribution:
    q   mean µs  sigma µs       %
    0     1.574     0.026    1.6%
   20     57.21     0.592    1.0%
   40     104.3     0.371    0.3%
   60     153.5     0.692    0.4%
   80     199.5     1.193    0.5%
  100     241.3     2.061    0.8%
  120     300.3      1.74    0.5%
  140     335.6       2.9    0.8%
  160       383      1.61    0.4%
  180     421.8     2.291    0.5%
  200     471.1      3.36    0.7%
  220     509.8     2.528    0.4%
  240     579.3     4.734    0.8%
  260     621.1     3.324    0.5%
  280     670.3     4.036    0.6%
  300     700.5     4.151    0.5%
  320     754.2     6.597    0.8%
  340     800.4     9.313    1.1%
  360     839.2     5.607    0.6%
  380     887.4     8.029    0.9%
  400     916.4      4.97    0.5%
  420     965.2     9.684    1.0%
  440      1024     3.769    0.3%
  460      1084     11.73    1.0%
  480      1118     11.86    1.0%
  500      1137     8.046    0.7%
  520      1217     4.894    0.4%
  540      1243     8.776    0.7%
  560      1318     9.769    0.7%
  580      1293     9.711    0.7%
  600      1367     9.413    0.6%
  620      1380     6.611    0.4%
  640      1496      13.6    0.9%
  660      1473     11.66    0.7%
  680      1582     9.142    0.5%
  700      1595     11.82    0.7%
  720      1641     12.51    0.7%
  740      1652      9.95    0.6%
  760      1753     10.34    0.5%
  780      1792     13.78    0.7%
  800      1833     10.33    0.5%
  820      1834     15.47    0.8%
  840      1958     12.19    0.6%
  860      1996     18.69    0.9%
  880      1989     15.08    0.7%
  900      2125     14.57    0.6%
  920      2134     22.69    1.0%
  940      2202     15.67    0.7%
  960      2264     14.77    0.6%
  980      2230     11.35    0.5%
 1000      2354     12.33    0.5%
 1020      2460     13.84    0.5%

Quality and confidence:
param     error
q         0.004

Model:
Time ~=    7.415
    + q    2.303
              µs

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

Pallet: "pallet_contracts", Extrinsic: "reinstrument", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts PristineCode (r:1 w:0)
Storage: Contracts CodeStorage (r:0 w:1)

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

Model:
Time ~=    23.63
    + c    66.58
              µs

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

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

Data points distribution:
    c   mean µs  sigma µs       %
    0     25.32     0.187    0.7%
    2     159.1     1.722    1.0%
    4     290.4     1.022    0.3%
    6     418.2     0.674    0.1%
    8     555.4     8.142    1.4%
   10     692.6     13.01    1.8%
   12       816     12.51    1.5%
   14     965.4     12.72    1.3%
   16      1101     13.82    1.2%
   18      1226     13.76    1.1%
   20      1355     14.43    1.0%
   22      1476     14.75    0.9%
   24      1604     13.59    0.8%
   26      1755     9.614    0.5%
   28      1891     12.59    0.6%
   30      2024     11.55    0.5%
   32      2154     12.32    0.5%
   34      2301     4.517    0.1%
   36      2409      8.54    0.3%
   38      2544     15.52    0.6%
   40      2679     4.548    0.1%
   42      2803     14.31    0.5%
   44      2938     11.08    0.3%
   46      3069     7.866    0.2%
   48      3182      14.1    0.4%
   50      3371     12.63    0.3%
   52      3508     11.65    0.3%
   54      3625     7.446    0.2%
   56      3754     15.63    0.4%
   58      3890     12.37    0.3%
   60      4123     19.73    0.4%
   62      4142     15.95    0.3%
   64      4271     21.28    0.4%
   66      4421     15.32    0.3%
   68      4577     8.962    0.1%
   70      4696     28.89    0.6%
   72      4804     9.121    0.1%
   74      4938     8.841    0.1%
   76      5056     19.53    0.3%
   78      5189     17.41    0.3%
   80      5308      19.9    0.3%
   82      5425     15.45    0.2%
   84      5604     40.76    0.7%
   86      5705     12.78    0.2%
   88      5839     20.63    0.3%
   90      5967     22.38    0.3%
   92      6078     11.96    0.1%
   94      6241     13.29    0.2%
   96      6353     19.59    0.3%
   98      6599     14.02    0.2%
  100      6733     13.78    0.2%
  102      6846     11.54    0.1%
  104      6989     17.14    0.2%
  106      7120     17.85    0.2%
  108      7258     30.49    0.4%
  110      7374     23.69    0.3%
  112      7544      30.1    0.3%
  114      7645     25.42    0.3%
  116      7788     20.24    0.2%
  118      7900     31.17    0.3%
  120      8020     17.74    0.2%
  122      8152     18.59    0.2%
  124      8266     16.68    0.2%
  126      8393     11.94    0.1%
  128      8542     28.87    0.3%

Quality and confidence:
param     error
c         0.036

Model:
Time ~=    18.51
    + c    66.66
              µs

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

Pallet: "pallet_contracts", Extrinsic: "call_with_code_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)
Storage: System Account (r:1 w:1)

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

Model:
Time ~=    221.8
    + c    54.71
              µs

Reads = 4 + (0 * c)
Writes = 2 + (0 * c)

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

Data points distribution:
    c   mean µs  sigma µs       %
    0     229.4      0.13    0.0%
    2     340.7     0.627    0.1%
    4     445.8     0.634    0.1%
    6     548.6     1.164    0.2%
    8     666.5     10.26    1.5%
   10     769.9     7.906    1.0%
   12     869.4     6.583    0.7%
   14     999.7     9.617    0.9%
   16      1100     7.368    0.6%
   18      1204     14.06    1.1%
   20      1297     1.765    0.1%
   22      1414     14.52    1.0%
   24      1514     11.65    0.7%
   26      1662     11.67    0.7%
   28      1768     10.95    0.6%
   30      1853     2.511    0.1%
   32      1971     12.21    0.6%
   34      2073      8.35    0.4%
   36      2186     14.84    0.6%
   38      2269     4.339    0.1%
   40      2390     11.84    0.4%
   42      2493     11.44    0.4%
   44      2586     12.99    0.5%
   46      2692     13.62    0.5%
   48      2796     7.995    0.2%
   50      2991     10.77    0.3%
   52      3100     13.37    0.4%
   54      3188     13.74    0.4%
   56      3296     10.07    0.3%
   58      3410      16.1    0.4%
   60      3483     6.547    0.1%
   62      3617     16.29    0.4%
   64      3718      7.38    0.1%
   66      3832     11.91    0.3%
   68      3932     13.98    0.3%
   70      4036     18.85    0.4%
   72      4142     11.91    0.2%
   74      4240     8.934    0.2%
   76      4328     16.77    0.3%
   78      4449     5.676    0.1%
   80      4558     22.46    0.4%
   82      4668     12.51    0.2%
   84      4764     5.925    0.1%
   86      4857     12.78    0.2%
   88      4974     10.88    0.2%
   90      5067     26.47    0.5%
   92      5196      22.9    0.4%
   94      5265     18.05    0.3%
   96      5373     15.88    0.2%
   98      5656      11.5    0.2%
  100      5765      17.1    0.2%
  102      5874     21.86    0.3%
  104      5954     11.22    0.1%
  106      6063     13.43    0.2%
  108      6182     16.32    0.2%
  110      6301     16.66    0.2%
  112      6393     12.32    0.1%
  114      6484     8.057    0.1%
  116      6575     13.13    0.1%
  118      6682     14.46    0.2%
  120      6814     29.25    0.4%
  122      6924     26.34    0.3%
  124      7012     14.71    0.2%
  126      7095      19.9    0.2%
  128      7218      14.5    0.2%

Quality and confidence:
param     error
c         0.041

Model:
Time ~=    210.3
    + c     54.8
              µs

Reads = 4 + (0 * c)
Writes = 2 + (0 * c)

Pallet: "pallet_contracts", Extrinsic: "instantiate_with_code", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts CodeStorage (r:1 w:1)
Storage: Contracts AccountCounter (r:1 w:1)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Timestamp Now (r:1 w:0)
Storage: System Account (r:1 w:1)
Storage: Contracts PristineCode (r:0 w:1)
Storage: Contracts OwnerInfoOf (r:0 w:1)

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

Model:
Time ~=      259
    + c    145.2
    + s    1.729
              µs

Reads = 5 + (0 * c) + (0 * s)
Writes = 6 + (0 * c) + (0 * s)

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

Data points distribution:
    c     s   mean µs  sigma µs       %
    0  1024      2056     2.718    0.1%
    1  1024      2215     13.59    0.6%
    2  1024      2356     6.593    0.2%
    3  1024      2320     9.903    0.4%
    4  1024      2639     15.31    0.5%
    5  1024      2788     9.336    0.3%
    6  1024      2754      14.1    0.5%
    7  1024      3076     12.69    0.4%
    8  1024      3213     5.262    0.1%
    9  1024      3193     9.129    0.2%
   10  1024      3509     16.49    0.4%
   11  1024      3646      22.9    0.6%
   12  1024      3595        11    0.3%
   13  1024      3945     12.31    0.3%
   14  1024      4089     21.81    0.5%
   15  1024      4060     13.68    0.3%
   16  1024      4334     9.034    0.2%
   17  1024      4532      17.9    0.3%
   18  1024      4503     17.06    0.3%
   19  1024      4813     15.69    0.3%
   20  1024      4934     9.236    0.1%
   21  1024      4923     18.93    0.3%
   22  1024      5210     14.51    0.2%
   23  1024      5359     17.17    0.3%
   24  1024      5327     25.21    0.4%
   25  1024      5686     10.24    0.1%
   26  1024      5824     18.63    0.3%
   27  1024      5851     30.73    0.5%
   28  1024      6196     21.65    0.3%
   29  1024      6241     20.09    0.3%
   30  1024      6197     13.94    0.2%
   31  1024      6532     17.68    0.2%
   32  1024      6668     12.05    0.1%
   33  1024      6735      36.2    0.5%
   34  1024      7041     30.83    0.4%
   35  1024      7177     23.15    0.3%
   36  1024      7126     20.84    0.2%
   37  1024      7471     14.01    0.1%
   38  1024      7561     28.07    0.3%
   39  1024      7571      17.5    0.2%
   40  1024      7898     35.13    0.4%
   41  1024      8017     24.69    0.3%
   42  1024      7970     26.46    0.3%
   43  1024      8276     30.86    0.3%
   44  1024      8430     34.33    0.4%
   45  1024      8385     18.61    0.2%
   46  1024      8696     33.12    0.3%
   47  1024      8843     35.55    0.4%
   48  1024      8826     25.62    0.2%
   49  1024      9224     24.97    0.2%
   50  1024      9396     24.58    0.2%
   51  1024      9336     24.11    0.2%
   52  1024      9651     29.93    0.3%
   53  1024      9751     16.59    0.1%
   54  1024      9768     28.91    0.2%
   55  1024     10050     28.45    0.2%
   56  1024     10220     27.23    0.2%
   57  1024     10160     49.86    0.4%
   58  1024     10510     30.22    0.2%
   59  1024     10600     9.482    0.0%
   60  1024     10580     24.25    0.2%
   61  1024     10890     32.59    0.2%
   62     0      9160     13.92    0.1%
   62    20      9269     35.12    0.3%
   62    40      9297     26.24    0.2%
   62    60      9318     27.89    0.2%
   62    80      9343     31.65    0.3%
   62   100      9400      30.9    0.3%
   62   120      9482     32.62    0.3%
   62   140      9522     42.18    0.4%
   62   160      9514     20.01    0.2%
   62   180      9544     29.76    0.3%
   62   200      9562     17.37    0.1%
   62   220      9590     31.79    0.3%
   62   240      9619     26.63    0.2%
   62   260      9690     26.85    0.2%
   62   280      9699     21.68    0.2%
   62   300      9740     19.74    0.2%
   62   320      9817     16.55    0.1%
   62   340      9823     35.48    0.3%
   62   360      9836     20.55    0.2%
   62   380      9883     34.05    0.3%
   62   400      9904     27.36    0.2%
   62   420      9963     38.23    0.3%
   62   440      9947      17.8    0.1%
   62   460     10010      25.9    0.2%
   62   480     10030     19.08    0.1%
   62   500     10080     14.45    0.1%
   62   520     10120     25.41    0.2%
   62   540     10230     59.44    0.5%
   62   560     10160     32.57    0.3%
   62   580     10200     35.69    0.3%
   62   600     10240     25.36    0.2%
   62   620     10280     38.81    0.3%
   62   640     10310     38.53    0.3%
   62   660     10360     52.33    0.5%
   62   680     10370     24.97    0.2%
   62   700     10410      28.1    0.2%
   62   720     10430      28.4    0.2%
   62   740     10610      97.1    0.9%
   62   760     10550     40.26    0.3%
   62   780     10580     26.87    0.2%
   62   800     10620     38.61    0.3%
   62   820     10610     26.05    0.2%
   62   840     10670     34.53    0.3%
   62   860     10670     26.56    0.2%
   62   880     10720     17.85    0.1%
   62   900     10770     30.79    0.2%
   62   920     10800     33.29    0.3%
   62   940     10830     25.76    0.2%
   62   960     10850     33.82    0.3%
   62   980     10930     32.76    0.2%
   62  1000     10940     24.62    0.2%
   62  1020     11000     31.95    0.2%
   62  1024     11060     20.15    0.1%

Quality and confidence:
param     error
c         0.129
s         0.008

Model:
Time ~=    220.3
    + c    145.1
    + s    1.741
              µs

Reads = 5 + (0 * c) + (0 * s)
Writes = 6 + (0 * c) + (0 * s)

Pallet: "pallet_contracts", Extrinsic: "instantiate", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts CodeStorage (r:1 w:1)
Storage: Contracts AccountCounter (r:1 w:1)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Timestamp Now (r:1 w:0)
Storage: System Account (r:1 w:1)
Storage: Contracts OwnerInfoOf (r:1 w:1)

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

Model:
Time ~=    172.4
    + s    1.702
              µs

Reads = 6 + (0 * s)
Writes = 5 + (0 * s)

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

Data points distribution:
    s   mean µs  sigma µs       %
    0     170.9      0.24    0.1%
   20     205.7     0.227    0.1%
   40     240.8     0.342    0.1%
   60     274.9     0.177    0.0%
   80     308.9     0.784    0.2%
  100       343     0.465    0.1%
  120       376     0.274    0.0%
  140     410.8     0.455    0.1%
  160     446.1     3.481    0.7%
  180     479.4      0.64    0.1%
  200     512.6     0.505    0.0%
  220     548.8     4.577    0.8%
  240     587.2     13.88    2.3%
  260     614.3     0.523    0.0%
  280       659      15.1    2.2%
  300     688.2     6.973    1.0%
  320     719.6     9.134    1.2%
  340     751.2     3.894    0.5%
  360     794.1      10.2    1.2%
  380     816.3     0.989    0.1%
  400     860.3     12.89    1.4%
  420     894.8     15.85    1.7%
  440     932.6     14.47    1.5%
  460     963.8     13.78    1.4%
  480      1002     15.31    1.5%
  500      1038      16.7    1.6%
  520      1061     11.19    1.0%
  540      1093     11.51    1.0%
  560      1147     1.918    0.1%
  580      1173     15.68    1.3%
  600      1200     15.16    1.2%
  620      1238     15.16    1.2%
  640      1278     14.39    1.1%
  660      1306     15.48    1.1%
  680      1344     16.04    1.1%
  700      1372     15.22    1.1%
  720      1407     13.76    0.9%
  740      1451     13.95    0.9%
  760      1482     14.23    0.9%
  780      1505     11.55    0.7%
  800      1564     4.022    0.2%
  820      1574     11.57    0.7%
  840      1616     15.64    0.9%
  860      1663     15.53    0.9%
  880      1677     13.79    0.8%
  900      1709     11.57    0.6%
  920      1747     13.46    0.7%
  940      1785      13.8    0.7%
  960      1818     14.09    0.7%
  980      1851     14.58    0.7%
 1000      1891     12.18    0.6%
 1020      1936     7.608    0.3%

Quality and confidence:
param     error
s         0.001

Model:
Time ~=    171.4
    + s    1.721
              µs

Reads = 6 + (0 * s)
Writes = 5 + (0 * s)

Pallet: "pallet_contracts", Extrinsic: "call", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)
Storage: System Account (r:1 w:1)

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

Model:
Time ~=    139.5
              µs

Reads = 4
Writes = 2

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

Model:
Time ~=    139.5
              µs

Reads = 4
Writes = 2

Pallet: "pallet_contracts", Extrinsic: "upload_code", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts CodeStorage (r:1 w:1)
Storage: Contracts PristineCode (r:0 w:1)
Storage: Contracts OwnerInfoOf (r:0 w:1)

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

Model:
Time ~=    52.26
    + c    65.75
              µs

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

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

Data points distribution:
    c   mean µs  sigma µs       %
    0     49.23      0.25    0.5%
    1     117.1     0.277    0.2%
    2     184.3     0.212    0.1%
    3     250.2     0.646    0.2%
    4     311.9     0.336    0.1%
    5       375     0.506    0.1%
    6     440.1      2.33    0.5%
    7     510.8      0.39    0.0%
    8     573.2      0.98    0.1%
    9     637.6      4.03    0.6%
   10     699.6     1.104    0.1%
   11     770.7     11.53    1.4%
   12     831.7     12.83    1.5%
   13     915.4     14.26    1.5%
   14     971.9     3.877    0.3%
   15      1041     14.78    1.4%
   16      1117     12.07    1.0%
   17      1170     13.02    1.1%
   18      1239     14.33    1.1%
   19      1302     13.99    1.0%
   20      1360     15.66    1.1%
   21      1444     5.792    0.4%
   22      1498     13.56    0.9%
   23      1566     8.208    0.5%
   24      1621     12.89    0.7%
   25      1730     11.85    0.6%
   26      1785     4.387    0.2%
   27      1857     11.46    0.6%
   28      1907     8.668    0.4%
   29      1976     8.128    0.4%
   30      2027     10.54    0.5%
   31      2083      13.3    0.6%
   32      2157     11.85    0.5%
   33      2229     17.18    0.7%
   34      2303     18.41    0.7%
   35      2374     11.89    0.5%
   36      2416     15.49    0.6%
   37      2492     9.856    0.3%
   38      2547     13.64    0.5%
   39      2599     12.95    0.4%
   40      2668     18.93    0.7%
   41      2743     10.97    0.3%
   42      2814     13.85    0.4%
   43      2876     10.38    0.3%
   44      2925     9.763    0.3%
   45      2992     3.971    0.1%
   46      3054     8.854    0.2%
   47      3118     19.52    0.6%
   48      3179     6.964    0.2%
   49      3306     16.86    0.5%
   50      3365     17.49    0.5%
   51      3427     11.17    0.3%
   52      3501     17.52    0.5%
   53      3563      19.3    0.5%
   54      3622     16.51    0.4%
   55      3678     18.43    0.5%
   56      3752     11.93    0.3%
   57      3815     14.83    0.3%
   58      3868     11.28    0.2%
   59      3937     9.386    0.2%
   60      3999     16.65    0.4%
   61      4072     11.22    0.2%
   62      4137     16.56    0.4%
   63      4189     9.511    0.2%
   64      4256     11.61    0.2%

Quality and confidence:
param     error
c         0.038

Model:
Time ~=    51.04
    + c    65.88
              µs

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

Pallet: "pallet_contracts", Extrinsic: "remove_code", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Contracts OwnerInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:0 w:1)
Storage: Contracts PristineCode (r:0 w:1)

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

Model:
Time ~=    24.34
              µs

Reads = 1
Writes = 3

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

Model:
Time ~=    24.34
              µs

Reads = 1
Writes = 3

Pallet: "pallet_contracts", Extrinsic: "seal_caller", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    218.4
    + r    47.66
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.3     0.293    0.1%
    1     265.9     0.217    0.0%
    2     314.8     0.447    0.1%
    3     361.5     0.367    0.1%
    4       410     0.652    0.1%
    5     457.3     1.643    0.3%
    6       503     0.541    0.1%
    7     554.4     2.059    0.3%
    8     603.2     9.174    1.5%
    9     654.7     9.995    1.5%
   10       697     8.751    1.2%
   11     744.5     8.547    1.1%
   12     790.1     4.169    0.5%
   13     835.6     1.793    0.2%
   14     886.5     1.572    0.1%
   15     935.7     6.111    0.6%
   16     987.8     9.345    0.9%
   17      1028     4.517    0.4%
   18      1088     16.62    1.5%
   19      1132     11.91    1.0%
   20      1176     12.81    1.0%

Quality and confidence:
param     error
r         0.089

Model:
Time ~=    217.1
    + r    48.02
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_is_contract", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    89.17
    + r    365.3
              µs

Reads = 4 + (100 * r)
Writes = 1 + (0 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.4     0.239    0.1%
    1       525     2.037    0.3%
    2     853.5     8.119    0.9%
    3      1182     16.15    1.3%
    4      1524     11.91    0.7%
    5      1900     8.712    0.4%
    6      2229     10.08    0.4%
    7      2595     17.95    0.6%
    8      2970      17.1    0.5%
    9      3396     15.25    0.4%
   10      3716     18.55    0.4%
   11      4063     13.25    0.3%
   12      4469     8.969    0.2%
   13      4760     8.376    0.1%
   14      5181     11.22    0.2%
   15      5559     16.75    0.3%
   16      5959     16.99    0.2%
   17      6260      21.8    0.3%
   18      6898     46.99    0.6%
   19      7091     22.28    0.3%
   20      7519     30.26    0.4%

Quality and confidence:
param     error
r         0.847

Model:
Time ~=    81.53
    + r    367.4
              µs

Reads = 4 + (100 * r)
Writes = 1 + (0 * r)

Pallet: "pallet_contracts", Extrinsic: "seal_caller_is_origin", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    214.7
    + r    20.95
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     212.3     0.249    0.1%
    1     235.1     0.269    0.1%
    2     256.3     0.149    0.0%
    3     277.3     0.254    0.0%
    4     299.1     0.868    0.2%
    5     319.3     0.445    0.1%
    6     345.2     0.641    0.1%
    7       362     0.687    0.1%
    8     382.4     0.686    0.1%
    9     403.1     0.855    0.2%
   10       428     5.034    1.1%
   11     448.8     2.622    0.5%
   12     468.1     2.089    0.4%
   13     491.8     7.733    1.5%
   14       508     0.832    0.1%
   15       537     11.95    2.2%
   16     557.7      7.03    1.2%
   17       570     1.842    0.3%
   18     595.2     6.411    1.0%
   19     611.1      0.91    0.1%
   20     632.7     3.166    0.5%

Quality and confidence:
param     error
r         0.056

Model:
Time ~=    214.7
    + r     21.1
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_address", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    218.6
    + r    47.67
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.6     0.174    0.0%
    1       267     1.185    0.4%
    2     314.8     0.317    0.1%
    3     361.9     0.511    0.1%
    4     410.6     2.167    0.5%
    5     456.1     0.655    0.1%
    6     503.8     0.382    0.0%
    7     554.4      0.87    0.1%
    8     603.3     5.047    0.8%
    9     647.1     1.294    0.1%
   10     696.1     5.383    0.7%
   11     742.7     2.273    0.3%
   12     790.6     2.888    0.3%
   13     836.2     5.136    0.6%
   14     886.3     0.828    0.0%
   15       939     10.88    1.1%
   16     983.2      6.21    0.6%
   17      1034     8.941    0.8%
   18      1077     3.165    0.2%
   19      1133      13.7    1.2%
   20      1186     12.97    1.0%

Quality and confidence:
param     error
r         0.075

Model:
Time ~=    216.6
    + r    48.05
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_gas_left", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    218.9
    + r    47.27
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     214.9     0.202    0.0%
    1     265.8     0.326    0.1%
    2     313.9     0.276    0.0%
    3     360.7     0.707    0.1%
    4     410.7     3.674    0.8%
    5     455.1     0.733    0.1%
    6     502.6     1.797    0.3%
    7     551.8     1.126    0.2%
    8     599.1     6.833    1.1%
    9     651.1     9.449    1.4%
   10       691     3.021    0.4%
   11     737.2      2.81    0.3%
   12     789.5     11.68    1.4%
   13     835.5     10.89    1.3%
   14     883.9     5.831    0.6%
   15     937.5     11.67    1.2%
   16     983.7     11.04    1.1%
   17      1027     8.526    0.8%
   18      1071     6.608    0.6%
   19      1128     12.64    1.1%
   20      1162     2.459    0.2%

Quality and confidence:
param     error
r         0.087

Model:
Time ~=      218
    + r    47.59
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_balance", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    222.5
    + r    135.2
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.2     0.159    0.0%
    1     356.7     1.803    0.5%
    2     495.5     6.715    1.3%
    3     631.2     8.334    1.3%
    4     763.6     5.455    0.7%
    5     904.8     7.693    0.8%
    6      1035     7.571    0.7%
    7      1173     8.576    0.7%
    8      1310     8.722    0.6%
    9      1455     10.28    0.7%
   10      1583     10.39    0.6%
   11      1715     8.257    0.4%
   12      1839     10.46    0.5%
   13      1973     12.78    0.6%
   14      2111     9.034    0.4%
   15      2245     9.757    0.4%
   16      2388     15.34    0.6%
   17      2525     10.81    0.4%
   18      2671      9.84    0.3%
   19      2800     14.69    0.5%
   20      2944     14.96    0.5%

Quality and confidence:
param     error
r         0.135

Model:
Time ~=    221.9
    + r    135.6
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_value_transferred", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    218.9
    + r    47.27
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0       215     0.091    0.0%
    1     266.1      1.36    0.5%
    2     314.2     0.344    0.1%
    3     360.7     0.267    0.0%
    4     410.3     4.192    1.0%
    5     454.9     0.729    0.1%
    6     501.3     0.867    0.1%
    7     559.3     3.968    0.7%
    8     603.2      9.39    1.5%
    9     642.7     0.569    0.0%
   10     693.7     8.072    1.1%
   11     738.5     1.836    0.2%
   12     783.1     2.608    0.3%
   13       833     4.782    0.5%
   14     883.6     2.802    0.3%
   15     931.4     7.442    0.7%
   16     981.9     10.36    1.0%
   17      1026     8.674    0.8%
   18      1086     12.35    1.1%
   19      1124     11.96    1.0%
   20      1166     10.74    0.9%

Quality and confidence:
param     error
r         0.086

Model:
Time ~=    217.6
    + r    47.65
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_minimum_balance", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    218.9
    + r     47.2
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.4     0.205    0.0%
    1     266.3     0.388    0.1%
    2     313.5     0.229    0.0%
    3     361.1     0.546    0.1%
    4     407.7     0.517    0.1%
    5     454.9     1.053    0.2%
    6     500.7     0.703    0.1%
    7     550.1     0.651    0.1%
    8     600.5     5.708    0.9%
    9       645     5.916    0.9%
   10     690.1     2.406    0.3%
   11     743.8     8.547    1.1%
   12     784.1     3.219    0.4%
   13     829.1     2.529    0.3%
   14     897.2     13.88    1.5%
   15     926.4     1.893    0.2%
   16     977.4     9.629    0.9%
   17      1024     8.279    0.8%
   18      1066     2.549    0.2%
   19      1124     12.22    1.0%
   20      1178     10.84    0.9%

Quality and confidence:
param     error
r         0.088

Model:
Time ~=    216.8
    + r    47.64
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_block_number", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    219.1
    + r    46.93
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.2     0.248    0.1%
    1     265.4     0.227    0.0%
    2     313.4      1.75    0.5%
    3     359.3     0.703    0.1%
    4     412.5     4.853    1.1%
    5       455     4.406    0.9%
    6     506.2      9.32    1.8%
    7     549.5     1.033    0.1%
    8     597.2     3.286    0.5%
    9     651.2     9.041    1.3%
   10     688.6     0.875    0.1%
   11     736.5     8.682    1.1%
   12     781.6     3.322    0.4%
   13     830.5     5.777    0.6%
   14     883.2      7.43    0.8%
   15       924     1.937    0.2%
   16     974.4     11.26    1.1%
   17      1031     12.11    1.1%
   18      1060     4.618    0.4%
   19      1122     12.74    1.1%
   20      1155     2.959    0.2%

Quality and confidence:
param     error
r          0.09

Model:
Time ~=    219.4
    + r    47.16
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_now", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    219.1
    + r    47.21
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.2      0.28    0.1%
    1     265.3     0.205    0.0%
    2       314     0.166    0.0%
    3     360.9     0.766    0.2%
    4     411.2     4.394    1.0%
    5     455.7     2.244    0.4%
    6     501.6     0.817    0.1%
    7     564.3     14.63    2.5%
    8     597.3      1.56    0.2%
    9     643.8     0.841    0.1%
   10     693.5     8.615    1.2%
   11       741     5.864    0.7%
   12     781.8     1.905    0.2%
   13     832.5     9.612    1.1%
   14     882.5     2.461    0.2%
   15     932.9     8.495    0.9%
   16     986.4     14.71    1.4%
   17      1026      6.62    0.6%
   18      1072      8.57    0.7%
   19      1118     10.49    0.9%
   20      1165     11.63    0.9%

Quality and confidence:
param     error
r         0.095

Model:
Time ~=    218.9
    + r    47.45
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_weight_to_fee", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)
Storage: TransactionPayment NextFeeMultiplier (r:1 w:0)

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

Model:
Time ~=    221.4
    + r    119.7
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.5     0.161    0.0%
    1     339.9     0.245    0.0%
    2     466.7     13.06    2.7%
    3     580.6     1.773    0.3%
    4     707.9     9.308    1.3%
    5     825.5      11.5    1.3%
    6       940     6.052    0.6%
    7      1058     9.958    0.9%
    8      1176      9.03    0.7%
    9      1301     14.05    1.0%
   10      1420     14.93    1.0%
   11      1559     10.69    0.6%
   12      1656     8.821    0.5%
   13      1786     13.45    0.7%
   14      1896     12.08    0.6%
   15      2021     19.37    0.9%
   16      2155     3.807    0.1%
   17      2278     3.588    0.1%
   18      2384     13.79    0.5%
   19      2505     15.25    0.6%
   20      2623     10.82    0.4%

Quality and confidence:
param     error
r         0.144

Model:
Time ~=    220.1
    + r    120.3
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_gas", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=      128
    + r    23.88
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0       124     0.101    0.0%
    1     150.4     0.152    0.1%
    2     178.4     0.142    0.0%
    3     199.8     0.258    0.1%
    4     223.1     0.248    0.1%
    5     246.4      0.32    0.1%
    6     271.6     0.236    0.0%
    7     295.9     1.144    0.3%
    8     325.6     6.612    2.0%
    9     341.8     0.786    0.2%
   10     365.6     0.922    0.2%
   11     392.3     0.571    0.1%
   12     416.1     0.462    0.1%
   13     438.4     0.519    0.1%
   14     463.5     2.055    0.4%
   15     486.1      0.77    0.1%
   16       509     0.893    0.1%
   17     543.8     13.02    2.3%
   18     560.8     8.505    1.5%
   19     584.1     6.004    1.0%
   20     602.1     1.025    0.1%

Quality and confidence:
param     error
r         0.056

Model:
Time ~=    127.4
    + r    24.01
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_input", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    219.1
    + r    46.59
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.3     0.152    0.0%
    1     264.8     0.188    0.0%
    2     312.9     0.404    0.1%
    3     358.6     0.543    0.1%
    4     416.3      14.5    3.4%
    5     454.1     2.991    0.6%
    6     496.7     0.946    0.1%
    7     560.1     15.74    2.8%
    8     592.2     0.878    0.1%
    9     637.8     1.149    0.1%
   10     693.4      13.5    1.9%
   11     735.2     11.25    1.5%
   12     774.3     1.773    0.2%
   13     822.7     5.142    0.6%
   14     883.8     12.67    1.4%
   15     924.4     8.676    0.9%
   16     973.4     10.96    1.1%
   17      1014     8.621    0.8%
   18      1065     11.65    1.0%
   19      1107     8.515    0.7%
   20      1149     4.798    0.4%

Quality and confidence:
param     error
r         0.112

Model:
Time ~=    220.3
    + r     46.8
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_input_per_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=      301
    + n    10.53
              µs

Reads = 4 + (0 * n)
Writes = 1 + (0 * n)

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

Data points distribution:
    n   mean µs  sigma µs       %
    0     265.2     0.397    0.1%
   20     482.1     3.969    0.8%
   40     702.6     10.61    1.5%
   60     928.6     21.65    2.3%
   80      1142     18.04    1.5%
  100      1350      17.7    1.3%
  120      1573     12.39    0.7%
  140      1798      14.6    0.8%
  160      2018     20.12    0.9%
  180      2195     18.06    0.8%
  200      2404     20.15    0.8%
  220      2633     29.67    1.1%
  240      2829     13.64    0.4%
  260      3115     22.75    0.7%
  280      3272     19.07    0.5%
  300      3486     33.49    0.9%
  320      3665      27.3    0.7%
  340      3891     32.78    0.8%
  360      4104     31.43    0.7%
  380      4303     49.11    1.1%
  400      4543     55.45    1.2%
  420      4713        32    0.6%
  440      4903     23.32    0.4%
  460      5198     49.97    0.9%
  480      5374     59.69    1.1%
  500      5567     29.92    0.5%
  520      5780     43.26    0.7%
  540      6002     22.29    0.3%
  560      6171     14.52    0.2%
  580      6416     53.88    0.8%
  600      6700      54.2    0.8%
  620      6847     65.14    0.9%
  640      7014     34.87    0.4%
  660      7240     58.96    0.8%
  680      7462     68.23    0.9%
  700      7674     42.92    0.5%
  720      7836     33.39    0.4%
  740      8109     74.49    0.9%
  760      8347     89.16    1.0%
  780      8589     89.93    1.0%
  800      8737     59.29    0.6%
  820      9027     115.5    1.2%
  840      9175     41.78    0.4%
  860      9350     75.47    0.8%
  880      9588     75.55    0.7%
  900      9751      58.2    0.5%
  920      9960     52.16    0.5%
  940     10190     65.19    0.6%
  960     10480     65.77    0.6%
  980     10660     111.9    1.0%
 1000     10790     63.03    0.5%
 1020     11090     90.87    0.8%

Quality and confidence:
param     error
n         0.008

Model:
Time ~=    300.9
    + n    10.55
              µs

Reads = 4 + (0 * n)
Writes = 1 + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_return", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    211.7
    + r    1.735
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     211.8     0.258    0.1%
    1     213.5     0.326    0.1%

Quality and confidence:
param     error
r         0.138

Model:
Time ~=    211.8
    + r    1.698
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_return_per_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    213.9
    + n    0.171
              µs

Reads = 4 + (0 * n)
Writes = 1 + (0 * n)

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

Data points distribution:
    n   mean µs  sigma µs       %
    0     213.5     0.161    0.0%
   20     217.3     0.227    0.1%
   40     220.8     0.171    0.0%
   60     224.4     0.298    0.1%
   80     228.5     1.552    0.6%
  100     231.8     1.072    0.4%
  120     234.5     0.432    0.1%
  140     238.1     0.553    0.2%
  160     241.5     0.621    0.2%
  180     245.6     0.942    0.3%
  200     251.2     1.974    0.7%
  220     252.3     1.046    0.4%
  240     254.7     0.291    0.1%
  260     263.7     3.617    1.3%
  280     261.8     0.156    0.0%
  300     266.9     1.826    0.6%
  320     270.1     1.727    0.6%
  340     273.9     2.193    0.8%
  360     278.5     2.587    0.9%
  380     279.6     1.362    0.4%
  400     283.7     2.578    0.9%
  420       286     1.469    0.5%
  440     295.8     2.743    0.9%
  460     294.1      2.42    0.8%
  480     297.3     2.398    0.8%
  500     305.8     7.942    2.5%
  520     304.2     2.917    0.9%
  540     306.9      2.14    0.6%
  560     313.8     5.191    1.6%
  580     314.6     3.319    1.0%
  600     318.6     6.897    2.1%
  620     323.1     4.498    1.3%
  640     325.1     3.549    1.0%
  660       333     4.591    1.3%
  680     333.9      4.58    1.3%
  700     338.3     4.639    1.3%
  720       342      5.08    1.4%
  740     343.8     4.484    1.3%
  760       348     4.946    1.4%
  780     351.7     5.199    1.4%
  800     355.8     8.386    2.3%
  820     361.6     4.211    1.1%
  840       365     2.466    0.6%
  860     367.9     5.473    1.4%
  880     371.2     6.793    1.8%
  900     372.7     5.802    1.5%
  920     375.7     3.769    1.0%
  940     378.5     5.837    1.5%
  960     380.9     5.781    1.5%
  980     385.7     3.886    1.0%
 1000     388.9      6.52    1.6%
 1020     392.4     6.046    1.5%

Quality and confidence:
param     error
n             0

Model:
Time ~=    213.9
    + n    0.176
              µs

Reads = 4 + (0 * n)
Writes = 1 + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_terminate", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)
Storage: Contracts DeletionQueue (r:1 w:1)
Storage: Contracts OwnerInfoOf (r:1 w:1)

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

Model:
Time ~=    215.1
    + r    51.68
              µs

Reads = 4 + (4 * r)
Writes = 1 + (5 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.1     0.158    0.0%
    1     267.6     2.119    0.7%

Quality and confidence:
param     error
r         0.708

Model:
Time ~=    215.1
    + r     52.5
              µs

Reads = 4 + (4 * r)
Writes = 1 + (5 * r)

Pallet: "pallet_contracts", Extrinsic: "seal_random", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)
Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0)

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

Model:
Time ~=      220
    + r    155.8
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.1     0.201    0.0%
    1     375.4     0.695    0.1%
    2     531.9     1.371    0.2%
    3     695.6     15.31    2.2%
    4     846.5     11.62    1.3%
    5      1000     8.427    0.8%
    6      1167     13.54    1.1%
    7      1312     11.15    0.8%
    8      1472     15.09    1.0%
    9      1626     15.21    0.9%
   10      1790     11.69    0.6%
   11      1929     12.87    0.6%
   12      2081     15.71    0.7%
   13      2243     10.34    0.4%
   14      2383     8.575    0.3%
   15      2570     21.32    0.8%
   16      2709     16.88    0.6%
   17      2883     12.23    0.4%
   18      3034     8.797    0.2%
   19      3197     11.71    0.3%
   20      3351     12.96    0.3%

Quality and confidence:
param     error
r         0.171

Model:
Time ~=    219.5
    + r    156.2
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_deposit_event", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    226.5
    + r      285
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     211.9     0.247    0.1%
    1     519.2     11.76    2.2%
    2     790.3     1.433    0.1%
    3      1088     10.01    0.9%
    4      1371     13.39    0.9%
    5      1652     14.75    0.8%
    6      1934     13.89    0.7%
    7      2227     10.91    0.4%
    8      2490      16.3    0.6%
    9      2805     10.74    0.3%
   10      3079     20.54    0.6%
   11      3370     14.74    0.4%
   12      3657     8.245    0.2%
   13      3939     10.63    0.2%
   14      4230     21.33    0.5%
   15      4510     20.31    0.4%
   16      4792     11.42    0.2%
   17      5055      22.7    0.4%
   18      5352     10.67    0.1%
   19      5629     14.32    0.2%
   20      5932      12.6    0.2%

Quality and confidence:
param     error
r         0.193

Model:
Time ~=    227.6
    + r      285
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_deposit_event_per_topic_and_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)
Storage: System EventTopics (r:100 w:100)

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

Model:
Time ~=    512.5
    + t    293.7
    + n    80.35
              µs

Reads = 4 + (100 * t) + (0 * n)
Writes = 1 + (100 * t) + (0 * n)

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

Data points distribution:
    t     n   mean µs  sigma µs       %
    0    16      1771     16.87    0.9%
    1    16      2110     8.145    0.3%
    2    16      2375     10.24    0.4%
    3    16      2693     8.624    0.3%
    4     0      1673     11.21    0.6%
    4     1      1776     16.93    0.9%
    4     2      1818      16.8    0.9%
    4     3      1900     13.07    0.6%
    4     4      1980     15.43    0.7%
    4     5      2033     12.85    0.6%
    4     6      2116     14.66    0.6%
    4     7      2209     15.84    0.7%
    4     8      2309     19.44    0.8%
    4     9      2351     13.31    0.5%
    4    10      2463     19.36    0.7%
    4    11      2534     9.204    0.3%
    4    12      2603     16.51    0.6%
    4    13      2699     14.72    0.5%
    4    14      2796     14.43    0.5%
    4    15      2872     19.01    0.6%
    4    16      2962     16.27    0.5%

Quality and confidence:
param     error
t         1.729
n          0.34

Model:
Time ~=    503.3
    + t      288
    + n    80.93
              µs

Reads = 4 + (100 * t) + (0 * n)
Writes = 1 + (100 * t) + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_debug_message", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: System Account (r:1 w:0)
Storage: Contracts ContractInfoOf (r:1 w:1)
Storage: Contracts CodeStorage (r:1 w:0)
Storage: Timestamp Now (r:1 w:0)

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

Model:
Time ~=    133.5
    + r    40.04
              µs

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

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     131.3     0.259    0.1%
    1     174.9     0.256    0.1%
    2     214.5     0.285    0.1%
    3     254.7     0.394    0.1%
    4       293     0.282    0.0%
    5     331.1     0.281    0.0%
    6     374.3     0.683    0.1%
    7     412.9     0.993    0.2%
    8     451.3     0.404    0.0%
    9     494.5     3.345    0.6%
   10     532.3     1.801    0.3%
   11     577.1     1.659    0.2%
   12     615.2     1.349    0.2%
   13     661.4     10.58    1.5%
   14     694.1     1.727    0.2%
   15     744.6     13.27    1.7%
   16     777.2     7.474    0.9%
   17     813.6     1.095    0.1%
   18     854.9     5.084    0.5%
   19     905.2     12.33    1.3%
   20     935.6     9.515    1.0%

Quality and confidence:
param     error
r         0.073

Model:
Time ~=      132
    + r    40.33
              µs

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

Pallet: "pallet_contracts", Extrinsic: "seal_set_storage", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    70.39
    + r    401.3
              µs

Reads = 4 + (100 * r)
Writes = 1 + (100 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.7     0.156    0.0%
    1     552.8     2.464    0.4%
    2     907.3     5.804    0.6%
    3      1294     9.168    0.7%
    4      1659     6.174    0.3%
    5      2054     16.12    0.7%
    6      2435      13.3    0.5%
    7      2826     21.21    0.7%
    8      3162     18.07    0.5%
    9      3653     17.67    0.4%
   10      4040     19.12    0.4%
   11      4484     12.33    0.2%
   12      4833     12.56    0.2%
   13      5239     16.79    0.3%
   14      5634     31.38    0.5%
   15      6068     31.13    0.5%
   16      6514     64.32    0.9%
   17      6877     37.41    0.5%
   18      7477     40.41    0.5%
   19      7903     20.93    0.2%
   20      8258     27.23    0.3%

Quality and confidence:
param     error
r         1.006

Model:
Time ~=    52.62
    + r    404.7
              µs

Reads = 4 + (100 * r)
Writes = 1 + (100 * r)

Pallet: "pallet_contracts", Extrinsic: "seal_set_storage_per_new_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    610.1
    + n    27.02
              µs

Reads = 105 + (0 * n)
Writes = 103 + (0 * n)

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

Data points distribution:
    n   mean µs  sigma µs       %
    0     556.8     1.639    0.2%
    1     638.5       1.3    0.2%
    2     670.5     9.881    1.4%
    3     694.7     2.689    0.3%
    4     719.5     3.226    0.4%
    5     759.7     11.79    1.5%
    6     776.2     6.082    0.7%
    7     798.7     2.046    0.2%
    8     829.6     8.148    0.9%
    9     851.8     7.612    0.8%
   10     869.1     0.682    0.0%
   11       900      3.67    0.4%
   12     930.7     12.43    1.3%
   13       947     5.479    0.5%
   14      1008     1.693    0.1%
   15      1032     16.24    1.5%
   16      1038     7.974    0.7%

Quality and confidence:
param     error
n         0.264

Model:
Time ~=    601.3
    + n    27.94
              µs

Reads = 105 + (0 * n)
Writes = 103 + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_set_storage_per_old_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    641.2
    + n    9.518
              µs

Reads = 105 + (0 * n)
Writes = 103 + (0 * n)

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

Data points distribution:
    n   mean µs  sigma µs       %
    0     568.1     11.06    1.9%
    1     636.4     6.369    1.0%
    2     670.1     5.483    0.8%
    3       672     0.864    0.1%
    4       690     9.531    1.3%
    5     692.9     1.927    0.2%
    6     697.9     3.501    0.5%
    7     712.7     3.117    0.4%
    8     715.2      3.11    0.4%
    9     719.5     2.624    0.3%
   10     732.4     7.955    1.0%
   11     736.2       4.6    0.6%
   12     738.2      1.54    0.2%
   13     759.5     10.27    1.3%
   14     773.1     2.202    0.2%
   15     791.3     3.435    0.4%
   16     792.1     1.946    0.2%

Quality and confidence:
param     error
n         0.292

Model:
Time ~=    626.7
    + n    10.61
              µs

Reads = 105 + (0 * n)
Writes = 103 + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_clear_storage", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    98.94
    + r    379.3
              µs

Reads = 5 + (100 * r)
Writes = 3 + (100 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.5      0.32    0.1%
    1     556.8     1.745    0.3%
    2     899.2     8.083    0.8%
    3      1247     5.939    0.4%
    4      1594     9.627    0.6%
    5      1984     13.05    0.6%
    6      2334      13.9    0.5%
    7      2701     9.961    0.3%
    8      3060      18.1    0.5%
    9      3496     16.71    0.4%
   10      3841     21.26    0.5%
   11      4249     18.51    0.4%
   12      4638     16.53    0.3%
   13      4979      18.5    0.3%
   14      5376     30.47    0.5%
   15      5751     18.49    0.3%
   16      6148      27.9    0.4%
   17      6541      30.9    0.4%
   18      7119     21.72    0.3%
   19      7504     28.54    0.3%
   20      7861     29.24    0.3%

Quality and confidence:
param     error
r         0.933

Model:
Time ~=    80.13
    + r    382.9
              µs

Reads = 5 + (100 * r)
Writes = 3 + (100 * r)

Pallet: "pallet_contracts", Extrinsic: "seal_clear_storage_per_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    612.7
    + n    9.944
              µs

Reads = 105 + (0 * n)
Writes = 103 + (0 * n)

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

Data points distribution:
    n   mean µs  sigma µs       %
    0       560     5.158    0.9%
    1     606.8     1.244    0.2%
    2     644.6     6.555    1.0%
    3     649.7     2.061    0.3%
    4     658.9     3.564    0.5%
    5     669.6     7.099    1.0%
    6     678.4     7.006    1.0%
    7     678.9     2.135    0.3%
    8     692.2     2.143    0.3%
    9     709.2     12.38    1.7%
   10     706.4      0.98    0.1%
   11     724.2     11.15    1.5%
   12     720.9     3.865    0.5%
   13     739.6     8.764    1.1%
   14     743.8     2.023    0.2%
   15     769.1     6.222    0.8%
   16     771.5     8.332    1.0%

Quality and confidence:
param     error
n         0.242

Model:
Time ~=    603.9
    + n    10.71
              µs

Reads = 105 + (0 * n)
Writes = 103 + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_get_storage", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    126.2
    + r    322.6
              µs

Reads = 4 + (100 * r)
Writes = 1 + (0 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     216.9     0.254    0.1%
    1     497.4     2.239    0.4%
    2     794.6     10.61    1.3%
    3      1100        10    0.9%
    4      1402     7.081    0.5%
    5      1723     15.45    0.8%
    6      2028      13.2    0.6%
    7      2350     12.33    0.5%
    8      2637     16.66    0.6%
    9      3027     20.73    0.6%
   10      3317     17.51    0.5%
   11      3651     13.34    0.3%
   12      3970     13.18    0.3%
   13      4286     23.61    0.5%
   14      4602     18.79    0.4%
   15      4959     33.24    0.6%
   16      5275     23.91    0.4%
   17      5617     25.49    0.4%
   18      6032     29.85    0.4%
   19      6363     23.58    0.3%
   20      6706     14.95    0.2%

Quality and confidence:
param     error
r         0.635

Model:
Time ~=    113.1
    + r    324.7
              µs

Reads = 4 + (100 * r)
Writes = 1 + (0 * r)

Pallet: "pallet_contracts", Extrinsic: "seal_get_storage_per_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    576.9
    + n     62.2
              µs

Reads = 104 + (0 * n)
Writes = 1 + (0 * n)

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

Data points distribution:
    n   mean µs  sigma µs       %
    0     499.3     6.129    1.2%
    1     616.5     3.525    0.5%
    2     717.2     5.206    0.7%
    3     770.2     5.788    0.7%
    4     841.4      6.44    0.7%
    5     892.3     2.648    0.2%
    6     961.3     13.18    1.3%
    7      1015     8.106    0.7%
    8      1070     8.421    0.7%
    9      1125     9.963    0.8%
   10      1184      11.2    0.9%
   11      1246     10.47    0.8%
   12      1312     8.224    0.6%
   13      1384      11.8    0.8%
   14      1453     14.26    0.9%
   15      1511     15.47    1.0%
   16      1569     14.35    0.9%

Quality and confidence:
param     error
n         0.354

Model:
Time ~=    562.7
    + n    63.27
              µs

Reads = 104 + (0 * n)
Writes = 1 + (0 * n)

Pallet: "pallet_contracts", Extrinsic: "seal_contains_storage", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

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

Model:
Time ~=    126.6
    + r    294.5
              µs

Reads = 4 + (100 * r)
Writes = 1 + (0 * r)

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

Data points distribution:
    r   mean µs  sigma µs       %
    0     215.5     0.267    0.1%
    1     469.4     1.957    0.4%
    2     734.5     2.742    0.3%
    3      1028     12.76    1.2%
    4      1285     4.957    0.3%
    5      1574      4.01    0.2%
    6      1880     7.533    0.4%
    7      2131     18.27    0.8%
    8      2402     21.14    0.8%
    9      2738     13.77    0.5%
   10      3028     9.927    0.3%
   11      3372     21.65    0.6%
   12      3647     15.84    0.4%
   13      3946     22.59    0.5%
   14      4239     19.21    0.4%
   15      4535     20.07    0.4%
   16      4790     18.35    0.3%
   17      5137     35.08    0.6%
   18      5518     46.71    0.8%
   19      5834     35.92    0.6%
   20      6141      27.4    0.4%

Quality and confidence:
param     error
r         0.655

Model:
Time ~=    112.2
    + r    296.6
              µs

Reads = 4 + (100 * r)
Writes = 1 + (0 * r)

Pallet: "pallet_contracts", Extrinsic: "seal_contains_storage_per_kb", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: Skipped Metadata (r:0 w:0)

Me<truncated>...

ERROR: Unable to push ./frame/contracts/src/weights.rs

@yarikbratashchuk
Copy link
Contributor Author

@joao-paulo-parity, could you help with weights patch, please?

@joao-paulo-parity
Copy link
Contributor

Weights for b32e4ec are at https://gist.github.com/joao-paulo-parity/374c56737868015b7fcd3b3bb7e4bbaa

@yarikbratashchuk
Copy link
Contributor Author

Some crazy numbers here.

@athei
Copy link
Member

athei commented Feb 10, 2022

Some crazy numbers here.

Which benchmark numbers do you mean exactly?

@yarikbratashchuk
Copy link
Contributor Author

yarikbratashchuk commented Feb 10, 2022

Which benchmark numbers do you mean exactly?

Number of reads and writes for contracts OwnerInfoOf.

@athei
Copy link
Member

athei commented Feb 10, 2022

Which benchmark numbers do you mean exactly?

Number of reads and writes for contracts OwnerInfoOf.

The metadata looks strange indeed. But this is only relevant for actual dispatchables. For us it is more of a debugging help.

@shawntabrizi Do you have any idea how this quirky number of 36 is here. I thought read and writes depending on a component are not part of the metadata?

// Storage: System Account (r:1 w:0)
// Storage: Contracts ContractInfoOf (r:1 w:1)
// Storage: Contracts CodeStorage (r:1 w:0)
// Storage: Timestamp Now (r:1 w:0)
// Storage: Contracts OwnerInfoOf (r:36 w:36)
fn seal_set_code_hash(r: u32, ) -> Weight {
	(0 as Weight)
		// Standard Error: 2_158_000
		.saturating_add((932_937_000 as Weight).saturating_mul(r as Weight))
		.saturating_add(T::DbWeight::get().reads((99 as Weight).saturating_mul(r as Weight)))
		.saturating_add(T::DbWeight::get().writes((99 as Weight).saturating_mul(r as Weight)))
}

@athei
Copy link
Member

athei commented Feb 11, 2022

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 665fc06 into paritytech:master Feb 11, 2022
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* poc logic

* set_code_hash impl, tests, benchmark

* Address @xgreenx's comments

* Move func defs closer to set_storage

* Check if code exists

- increment/decrement codehash refcount

* Document error for non-existing code hash

* Revert unrelated change

* Changes due to @athei's review

* Fix error handling

- comment errors: ReturnCodes
- update mock ext implementation
- return Error::CodeNotFound when no code for such hash

* Emit ContractCodeUpdated when setting new code_hash

* Address @athei's comments

* Move related defs to the bottom

* Minor comment update

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Improve docs

* Improve docs

* Update frame/contracts/src/wasm/runtime.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Refactor set_code_hash test

* Minor change to benchmark

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Minor change to benchmark

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Minor comment refactor

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Address @HCastano's comments

* Update seal_set_code_hash comment

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Move set_code_hash after delegate_call

* Move function to the bottom

* Moved and changed banchmark, added verify block

* Bring back previous benchmark

* Remove skip_meta for seal_set_code_hash

* Bring back skip_meta for seal_set_storage_per_new_kb

* Apply weights

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
driemworks added a commit to ideal-lab5/substrate-offchain-ipfs that referenced this pull request May 9, 2022
* Make some UI test expectations crisper (#10791)

* Make some UI test expectations crisper

* Update frame/support/test/tests/construct_runtime_ui/undefined_genesis_config_part.rs

* Update UI test expectations

* Missing newlines

* More whitespace issues

* contracts: `is_contract(address)` and `caller_is_origin()` are added to API (#10789)

* is_contract() and caller_is_origin() added to Ext API

* is_contract() exposed in wasm runtime.rs

* + test for is_contract()

* + seal_is_contract benchmark

* caller_is_origin() exposed to wasm/runtime.rs and covered by a test

* + seal_caller_is_origin benchmark

* Update frame/contracts/src/exec.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Update frame/contracts/src/exec.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Update frame/contracts/src/exec.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Update frame/contracts/src/wasm/runtime.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Update frame/contracts/src/wasm/runtime.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Update frame/contracts/src/wasm/runtime.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Update frame/contracts/src/exec.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* identation fix for benchmark macroses; test cosmetic improvement

* benchmark fix

* + is_contract() wasm test

* + caller_is_origin() wasm test

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* is_contract() to borrow param instead of taking ownership

* phrasing improved

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* fixed wasm tests according to @athei feedback

* dead code warnings suppressed by unstable-interface attributes

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

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>

* maybe_total_supply in pallet-assets (#10799)

* maybe_total_supply in pallet-assets

* Update frame/assets/src/functions.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Referenda and Conviction Voting pallets (#10195)

* Initial draft of new referendum state machine.

* Docs

* Fixes

* Fixes

* Add conviction-voting pallet

* Basic build

* Building

* Some TODOs

* Tests building

* Add missing file

* Basic lifecycle test

* Add couple of tests

* Another test

* More tests

* Fixes

* Fixes

* Formatting

* Fixes

* Tests

* Fixes

* Fixes

* More tests

* Formatting

* First few benchmarks

* First few benchmarks

* Defered queue servicing

* More testing

* Benchmarks

* Fiddly benchmark

* Final nudge benchmarks

* Formatting

* Formatting

* Finished up benchmarks

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

* Events finished

* Missing file

* No GenesisConfig for Referenda

* Formatting

* Docs

* Docs

* Docs

* Per-class conviction voting

* New test & mock utils

* More tests

* Tests

* Tests finished 🎉

* Benchmarking stuff

* Fixes

* Test harness

* Test harness

* Benchmarks for Conviction=Voting

* Benchmarking pipeline complete

* Docs

* Formatting

* Remove unneeded warning

* Fix UI tests

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

* Docs

* Update frame/conviction-voting/src/vote.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* update sp-runtime version

* MEL Fixes for Referenda and Conviction Voting (#10725)

* free maxencodedlen

* more maxencodedlen

* more MEL

* more mel

* disable storage info

* More Referenda Patches (#10760)

* basic fixes

* fix benchmarking

* fix license

* prevent panic in curve math

* fmt

* bump crate versions

* Update mock.rs

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* More efficient WASM instance memory decommit on macos (#10801)

* More efficient WASM instance memory decommit on macos

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Updated error message

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* make inner field of IdentityFields pub (#10773)

* Corrected description of clear_attribute extrinsic (#10729)

* block validators after X sessions, update mock runtime for test

* sp-maybe-compressed-blob: reduce boilerplate code (#10814)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* `seal_delegate_call` api function (support for library contracts)  (#10617)

* seal_call_code implementation

- tests
- benchmark

* Addressing @xgreenx's comments

* Fix test-linux-stable-int

* Rename seal_call_code to seal_delegate_call

* Pass value unchanged into lib contract

* Address @athei's comments

- whitespace .wat issues
- wrong/missing .wat comments
- redundant .wat calls/declarations

- change order of functions (seal_delegate_call right after seal_call)
  in decls, tests, benchmark
- fix comments, move doc comments to enum variants
- remove unnecessary empty lines

- rename runtime cost DelegateCall to DelegateCallBase
- do not set CallFlags::ALLOW_REENTRY for delegate_call

* Do not pass CallFlags::ALLOWS_REENTRY for delegate_call

* Update comment for seal_delegate_call and CallFlags

* Addressing @athei's comments (minor)

* Allow reentry for a new frame after delegate_call (revert)

* Same seal_caller and seal_value_transferred for lib contract

- test
- refactor frame args due to review
- logic for seal_caller (please review)

* Put caller on frame for delegate_call, minor fixes

* Update comment for delegate_call

* Addressing @athei's comments

* Update weights generated by benchmark

* Improve comments

* Address @HCastano's comments

* Update weights, thanks @joao-paulo-parity

* Improve InvalidCallFlags error comment

* Add Storage Info to Various Pallets (#10810)

* atomic swap

* bounties

* bounties fmt

* gilt

* indices

* nicks

* randomness-collective-flip

* recovery

* reuse maxapprovals

* Update tests.rs

* Update frame/randomness-collective-flip/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* use the correct bound

* complete recovery

* use `bounded_vec` macro

* Update tests.rs

* transaction payment

* uniques

* mmr

* example offchain worker

* beefy-mmr

* Update frame/recovery/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use BoundedVec instead of a type-parameterized BoundedString

* cargo fmt

* Update frame/atomic-swap/src/lib.rs

* use config const

* Update lib.rs

* update mel_bound

* fmt

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fixed regression in inline docs (#10819)

* try-runtime-cli: Add to docs (#10822)

* try-runtime-cli: Add to docs of pre/post hooks

* Add note about --ws-max-out-buffer-capacity 1000

* Bump serde from 1.0.132 to 1.0.136 (#10816)

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.132 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.132...v1.0.136)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* uodate tests, ipfs tests failing

* --dev implies --tmp (#10828)

* Add a new host function for reporting fatal errors; make WASM backtraces readable when printing out errors (#10741)

* Add a new host function for reporting fatal errors

* Fix one of the wasmtime executor tests

* Have `#[runtime_interface(wasm_only)]` actually mean WASM-only, and not no_std-only

* Print out errors through `Display` instead of `Debug`

* Switch one more trait to require `Error` for its error instead of only `Debug`

* Align to review comments

* specify ipfs version, update tests

* Add db params for export-state CLI command (#10830)

* update tests, cleanup

* Allow `SetBalance` to handle error when trying to kill acount with reference counter. (#10826)

* bug found

* fix logic

* a little simpler

* add test

* UncheckedExtrinsic: Harden decode and clarify `EXTRINSIC_FORMAT_VERSION` (#10829)

* UncheckedExtrinsic: Harden decode and clarify `EXTRINSIC_FORMAT_VERSION`

* Apply suggestions from code review

* fix typo

* pallet-staking: Add extrinsic `force_apply_min_commission` (#10786)

* pallet-staking: Add extrinsic `force_apply_min_commission`

* Add benchmarks

* cargo run --quiet --profile=production  --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

* Bound iteration by  max_validator_count

* cargo run --quiet --profile=production  --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

* Only apply to 1 validator

* Update doc comments

* Uncomment tests

* cargo run --quiet --profile=production  --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

* Accept signed origins

* cargo run --quiet --profile=production  --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

* Remove contains_key check

* Add test for try_mutate_exists

* Impove try_mutate_exists docs

* Delete redundant try_mutate_exists tests;

* Delete residual from removed test

* cargo run --quiet --profile=production  --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

* Return an error when the stash does not exist

* Update try_mutate_exist doc wording

* Update frame/staking/src/pallet/mod.rs

* Apply suggestions from code review

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Upgradable contracts using `set_code` function (#10690)

* poc logic

* set_code_hash impl, tests, benchmark

* Address @xgreenx's comments

* Move func defs closer to set_storage

* Check if code exists

- increment/decrement codehash refcount

* Document error for non-existing code hash

* Revert unrelated change

* Changes due to @athei's review

* Fix error handling

- comment errors: ReturnCodes
- update mock ext implementation
- return Error::CodeNotFound when no code for such hash

* Emit ContractCodeUpdated when setting new code_hash

* Address @athei's comments

* Move related defs to the bottom

* Minor comment update

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Improve docs

* Improve docs

* Update frame/contracts/src/wasm/runtime.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Refactor set_code_hash test

* Minor change to benchmark

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Minor change to benchmark

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Minor comment refactor

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Address @HCastano's comments

* Update seal_set_code_hash comment

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Move set_code_hash after delegate_call

* Move function to the bottom

* Moved and changed banchmark, added verify block

* Bring back previous benchmark

* Remove skip_meta for seal_set_code_hash

* Bring back skip_meta for seal_set_storage_per_new_kb

* Apply weights

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Separate wasmi and wasmer sandbox implementations into their own modules (#10563)

* Moves wasmi specific `ImportResolver` and `MemoryTransfer` impls to submodule

* Splits context store environmental, moves impl `Externals` to wasmi backend

* Adds wasmer sandbox backend stub module

* Move sandbox impl code to backend specific modules

* Moves wasmi stuff

* Fixes value conversion

* Makes it all compile

* Remove `with_context_store`

* Moves `WasmerBackend` to the impl

* Reformat the source

* Moves wasmer MemoryWrapper

* Reformats the source

* Fixes mutability

* Moves backend impls to a submodule

* Fix visibility

* Reformat the source

* Feature gate wasmer backend module

* Moves wasmi memory allocation to backend module

* Rename WasmerBackend to Backend

* Refactor dispatch result decoding, get rid of Wasmi types in common sandbox code

* Reformat the source

* Remove redundant prefixes in backend functions

* Remove wasmer-sandbox from default features

* Post-review changes

* Add conversion soundness proof

* Remove redundant prefix

* Removes now redundant clone_inner

* Add `Error::SandboxBackend`, refactor invoke result

* Fix comments

* Rename `Error::SandboxBackend` to `Sandbox`

* Simplifies logic in `wasmer_backend::invoke`

* Fixes memory management

* Show Network ID when creating and inspecting (#10838)

Signed-off-by: Antonio Yang <yanganto@gmail.com>

* Reduce overhead of generating network event metrics (#10839)

* Fix reentrancy of FrozenBalance::died hook (#10473)

* assets: execute `died` hook outside of mutate

Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo>

* assets: extend tests for `died` hook

Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo>

* assets: update doc of FrozenBalance::died

Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo>

* assets: review fixes

- fix cases where `died` should not have been called
- use `Option<DeadConsequence>` instead of `DeadConsequence`

Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo>

* assets: update comment in mock.rs

Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo>

* assets: return `Remove` in dead_account

The return value is ignored in the only case that it is produced
by a call, but having it this way makes it more understandable.

Signed-off-by: Oliver Tale-Yazdi <oliver@tasty.limo>

* allow trailing comma (#10841)

* build-script-utils: allow reading the git commit hash from env var (#10845)

* build-script-utils: allow reading the git commit hash from env var

* build-script-utils: make the env var name substrate specific

* Don't create DB leaves when syncing historic blocks (#10844)

* Don't create DB leaves when syncing historic blocks

* Changed leaves check and added test

* fmt

* cleanup, use unsigned tx when appropriate

* add weights

* fix broken link (#10846)

* subkey: Support `--version` cli command (#10853)

* subkey: Support `--version` cli command

* FMT :facepalm:

* Remove `u32_trait` (#10850)

* Remove `u32_trait`

This trait only existed because there wasn't any const generic support at time of creation. However,
we now have support for it :)

* FMT

* wasm-builder: Support latest nightly (#10837)

* wasm-builder: Support latest nightly

With latest nightly, aka rust version 1.60+ namespaced features are added. This changes the handling
of optional dependencies. We currently have features that enable optional dependencies when `std` is
enabled. This was before no problem, but now the wasm-builder detects them as enabled. To support
the transition period until 1.60 is released as stable, this pr adds an heuristic to not enable these
optional crates in the wasm build when they are enabled in the `std` feature. This heuristic fails
when someones enables these optional dependencies from the outside as well as via the `std` feature,
however we hope that no one is doing this at the moment. When namespaced features are enabled, these
dependencies needs to be enabled using `dep:dependency-name` to solve this properly.

https://doc.rust-lang.org/cargo/reference/unstable.html#namespaced-features

* Remove accidentally added features

* update tests, remove unneeded params

* min authorities check before removal

* contracts: Fix `seal_call` weights (#10796)

* Fix call weights

* Fix instantiate benchmark

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

* Remove stale and superflous comments

* `decrement_refcount` should be infallible

* Don't hardcode increment_refcount, decrement_refcount

* Rename CopyIn/CopyOut

* Fix warning in tests

Co-authored-by: Parity Bot <admin@parity.io>

* Enable the `parking_lot` feature for `tokio` (#10855)

* [ci] fix publish-rustdocs (#10858)

* Fix beefy mock ecdsa keys (#10854)

Compressed ECDSA keys requires to have 0x02 or 0x03 as their first byte
in order to allow public key recovery.

Nevertheless the test was working because of the `unwrap_or_default()`
at the end of the conversion routine (i.e. the invalid keys were
converted to an empty vector).

* Mark sync_state_genSyncSpec JSON-RPC as safe (#10832)

* Mark sync_state_genSyncSpec JSON-RPC as safe

* Note that parameter is unused

* Ideally I'd wait for compilation to be finished before pushing, but it's really taking a long time

* Remove deny_unsafe parameter

* Remove unused dependency

* Reduce CPU overhead of gossip (#10859)

* sp-core-hashing: use the `digest::Digest` trait to handle the hashing function uniformly (#10835)

* sp-core-hashing: use sha3 instead of tiny-keccak

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* use blake2 instead of blake2-rfc

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* improve som hashing of sp-core and sp-api-proc-macro

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Some nits

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* cargo fmt

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Use fully qualified sytnax for `retain_mut` (#10865)

* add llvm (#10864)

* refactor election score (#10834)

* refactor election score

* Test for ord

* remove reference

* vec -> slice

* change iter to iter_by_significance

* improve doc

* fix typo

* add explanation about [u128; 3]

* consolidate threshold and epsilon

* random fixes

* rename

* remove Into

* make iter_by_sig private

* remove vec

* Fix tests

* Measure per byte and not kb for certain benchmarks (#10863)

* Tidy Democracy (#10867)

* add test

* Assorted refactorings

* complete test

* saturating math

* final check

* use `default`

Co-authored-by: Gav Wood <gavin@parity.io>

* cleanup storage maps, cleanup unused imports

* sc-executor: Improve logging (#10869)

Improves the logging by switching to `tracing` for a better log output. Besides that, it also adds a
trace for the function being executed.

* fix test issues

* Track allowed requests for state/warp sync (#10843)

* Track allowed requests for state/warp sync

* Added missing allowed_requests resets

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* fmt

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Slots: Ensure that a race betwen finalized and best number is taken care off (#10876)

* Remove old lock file (#10879)

* Further reduce the CPU overhead of networking metrics (#10875)

* Simplify `num_connected_peers`

* Track requested peer counts

* Revert "Track requested peer counts"

This reverts commit 9f1c8704353df6afc17ed7e9f4ab8d8e29466ae4.

* Remove `substrate_sub_libp2p_peerset_num_requested` metric

* Remove two unused functions that I forgot to get rid of in previous commit

* Introduce `BoundedVec::iter_mut` (#10884)

* Introduce iters into BoundedVec

* Fix

* Remove unneeded funcs

* Update frame/support/src/storage/bounded_vec.rs

* Update frame/support/src/storage/bounded_vec.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Slots: Log total proposing duration as milliseconds (#10886)

Parachains have currently a total proposing time of 500ms, so it this
currently always prints `0`. While actually the value is not `0` ;)

* staking: Clarify reward calc docs (#10890)

* tracing: Adds `init_for_tests` (#10893)

This function is useful for tests. It will enable `TRACE` logging and also uses the libtest aware writer.

* make submissions pub (#10899)

* contracts: Allow stack height metering to be disabled (#10877)

* Allow stack height metering to be disabled

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

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

Co-authored-by: Parity Bot <admin@parity.io>

* Rename Uniques Error::Unknown to something more sensible (#10895)

* Rename Uniques Error::Unknown to something more sensible

* Typos

* Typos

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* state-machine: Move all functionality from trie backend to the essence (#10904)

* state-machine: Move all functionality from trie backend to the essence

This is required for some future changes of me and it also makes more sense to have all the
functionality inside the essence. Besides that it changes the child root cache to directly
cache the hash.

* Update primitives/state-machine/src/trie_backend_essence.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* FMT

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* staking: Remove `SessionInterface` supertrait (#10901)

* consensus-slots: cleanup SlotDuration config (#10878)

* consensus-slots: cleanup the SlotDuration config

* fix tests

* address review comments

* add contracts pallet + rpc to runtime

* Replace libsecp256k1 with k256 in FRAME related code (#10883)

* Replace libsecp256k1 with k256 in beefy-mmr

* Port of FRAME `contracts` benchmarking from `libsecp256k1` to `k256`

* Newtype to allow `Pcg32` rng usage with `k256` in contracts benchmarks

* Use `sp-io::crypto` to generate dummy keys in `contracts` bechmarks

* More compact code

* Cargo fmt

* Build `sp-keystore` only for dev profile

* Move public key generation back to the `map`

* Clean obsolete BABE's weight data (#10748)

* Clean obsolete BABE weight data
* Take out test assertion from check closure
* Optimize metadata access using `HeaderMetadata` trait
* Apply suggestions from code review
* Introduce finalize and import pre-commit synchronous actions
* Do not hold locks between internal methods calls
* Remove unused generic bound
* Apply suggestions from code review
* Register BABE's pre-commit actions on `block_import` instead of `start_babe`
* PreCommit actions should be `Fn` instead of `FnMut`
* More robust safenet in case of malformed finality notifications

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Factor DB weights out into their own files (#10908)

* Factor DB weights out into their own files

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix CI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Weights in own mod

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Get rid of unnecessary use of `async-std` in non-test code (#10891)

* No longer generate specs with consensus_engine field (#10346)

* No longer generate specs with consensus_engine field

* #[allow(unused)]

* Upgrading parity-scale-codec to v3 (#10825)

* Upgraded dependencies

* Adapting code to scale v3

* Empty commit to trigger CI

* Triggering CI

* Fixing UI test

* Remove superfluous dev-dep added by #9228

* Cryout for CI

* sc-cli: Fix bugs after switching to clap3 (#10920)

* sc-cli: Fix bugs after switching to clap3

Before switching to clap3 we support cli options like `--reserved-nodes A B` and after you needed to
pass `--reserved-nodes` cli option multiple times `--reserved-nodes A --reserved-nodes B`. This is
fixed by setting `multiple_occurrences(true)` option. This also done for all the other `Vec` cli
options in `sc-cli`. Besides that `--sync` wasn't supporting case insensitive parsing of the value.
This is now also supported. For both regressions a test is added. Besides that the pr removes all
the `rename_all = PascalCase` attributes, because they are not needed. All other `ArgEnum`s were
checked and all are already using `ignore_case(true)`.

* Bring back `PascalCase`, because otherwise it falls back to `kebab-case`...

* Storage benchmarking (#10897)

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP: DB benchmarking

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Simplify code

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove old files

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove old files

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Minimize changes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add license

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove dependencies

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extend template

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Linter

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Linter

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Beauty fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove default

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add feature

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove seed

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* CI wakeup

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Review fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Adding doc

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Adding doc

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Improve template

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Do not expose columns

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix ColumnId

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Nicer template prints

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix json path

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Simplify `bench_write` logic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Invert tx before the second commit

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add transfer assets extrinsic

* add chain ext

* Minor improvements to `bounded_vec` and `defensive`.  (#10873)

* Fix a few things in bounded_vec

* add test for try_extend

* Update frame/support/src/storage/bounded_vec.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* some review comments

* use swap

* remove clone

* use pop instead of truncate

* remove warn

* review comments

* Update frame/support/src/storage/bounded_vec.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* fix rustdoc

* fix links

* undo link

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Replace libsecp256k1 with secp256k1 (#10798)

* Replace libsecp256k1 with secp256k1

* Wipe ecdsa secret key from memory on drop

* Some comments for a known issue

* Safer core crypto primitives `from_slice` constructor

Previous version panics if slice lenght is not the expected one.

* Unit test fix

* Enable use of global secp256k1 context

* Better comments for ecdsa `Pair` drop

* Replace `libsecp256k1` with `seco256k1` in `beefy-mmr`

Used to convert ecdsa public key to ETH address

* Replace `libsecp256k1` with `secp256k1` in FRAME `contracts`benchmarks

* Temporary rollback of `beefy-mmr` to libsecp256k1

Check for detected build issues

* Cargo fmt

* Rollback of FRAME `contracts` benchmarks to `libsecp256k1`

* Rollback for unrelated changes

* Typo fix

* Add comments for deprecated `ecdsa_verify` and `secp256k1_ecdsa_recover`

* Integrate try-runtime into substrate node template (#10909)

* [10892-integrate-try-runtime-into-node-template] - Integrated try-runtime into node template

* [10892-integrate-try-runtime-into-node-template] Added match arms for try-runtime in command.rs

* [10892-integrate-try-runtime-into-node-template] Added match arms for try-runtime in command.rs

* Added feature flag for try-runtime in node-template/node and enabled try-runtime for node-template/runtime

* Added missing type annotations for try-runtime SubCommand in node-template

* Added missing type annotations for try-runtime SubCommand in node-template

* Implemented frame_try_runtime::TryRuntime<Block> for the node-template Runtime

* doc corrections (#10936)

* #10576: generic utility to unsubscribe from broadcast upon drop of the rx-side. (#10708)

* #10576: refactor `sc-utils::notification` and `sc-client-api::notifications`, so that they use common subscribe/unsubscribe routines

* Add some docs. Reorganise `sc-utils::notification`

* `sc-clent-api::notifications` and `sc-utils::notification` — ensure the SubscriptionGuard is dropped before the Rx-channel

* `sc-utils::pubsub::SubscriptionGuard` make it a bit more ergonomic.

Let the `Rx` to be put inside of the `SubscriptionGuard`, so that the latter shall guarantee the order:
- first unsubscribe;
- then drop the `Rx`.

* Being less zealous with splitting the modules into little pieces

* rework pubsub: the concrete usage should only define a good registry type

* sc-client-api::notifications: make it comply with the reworked pubsub

* cargo fmt

* make sc-client-api tests work

* Address the review notes

* cargo fmt

* Describe the behaviour of pubsub registry

* Doc-comments for module `sc-utils::pubsub`

* Fix: it used to send notifications regardless of the filter setup during subscription

* `sc-client-api::StorageNotifications` the API does not have to require mut-self-reference.

As a result `sc-service::Client` does not have to wrap its `storage_notifications` into a Mutex.

* cargo fmt

* Several changes addressing the notes by @bckhr.

- Remove the `impl Default for StorageNotifications<Block>`;
- no need for groupping the `remove_from` and `listen_from` into a separate `helpers` module;
- remove unnecessary import `use registry::SubscribeOp`.

* Add a doc-comment to the `sc-client::notifications::SubscribeOp`

* As per @bkchr note on the unproven assertion: behave gracefully upon receiving a duplicate subscription-ID.

* sc-utils::pubsub: log when a registry yields an ID that does point to an existing sink

* `sc-utils::notifications`: payload materialized lazily

* Update Cargo.lock (after adding `log` as a dependency to the `sc-utils`)

* `sc-client-api::notifications`: introduce a struct (instead of a type def) for the notification message

* Get rid of `sc-utils::pubsub::Channel` trait (instead just use the `sc-utils::mpsc`)

* The SubsID is no more generic: the fact it is a `Copy` is known — no need to pass it by ref

* sc-utils::pubsub internals do not have to be generic over the channel type

* Rename Hub::dispatch into Hub::send

* That method was unnecessary (`SubscriberSink::render_notification`)

* cargo fmt

* No need for a separate UnsubscribeGuard type

* Ditch the type-def of SubsID in the sc-utils::pubsub, instead — just use the crate::id_sequence::SeqID

* Return the <Registry as Dispatch>::Ret when sending an item

* Make the `Hub<M, R>::lock_registry(...)` method more ergonomic

* cargo doc links

* cargo doc links

* Use a simpler name for the type

* cargo doc links

* Derive `Default` rather than implement it

* Derive `Default` rather than implement it

* Remove an unnecessary usage of type_name

* Define a more cautious order between sinks.remove->registry.unsubscribe and registry.subscribe->sinks.insert

* Hub: lock_registry_for_tests->map_registry_for_tests — a safer choice for a public API

* Replace Mutex over the shared Registry with a ReentrableMutex+RefCell

* sc-utils::pubsub: add tests for a panicking registry

* Add the missing copyright headers

* Arc<Vec<_>> -> Arc<[_]>

* Bring back MaxNominations as a metadata constant (#10947)

* chain ext: parse params and call transfer func

* Bump futures from 0.3.16 to 0.3.19 (#10930)

Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.16 to 0.3.19.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.16...0.3.19)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Clean up extra_constant renaming. (#10935)

Co-authored-by: Xiankun Cheng <xiankuncheng@Xiankuns-MacBook-Pro-2.local>

* Bump smallvec from 1.7.0 to 1.8.0 (#10949)

Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* new pallet: whitelist pallet (#10159)

* pallet whitelist

* refactor a bit

* fmt

* address audit

* improve tests

* return Ok + refund

* add test for dispatching failing

* add dispatch_whitelisted_call_with_preimage

* fmt

* better name

* Consume all data on decode

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add error docs

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove phantom data

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use rust 2021

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update crate features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make compile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

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

* Bump Preimage max size

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

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

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Parity Bot <admin@parity.io>

* Release primitive crates (#10937)

* cargo set-version --bump major -p pallet-contracts-primitives

* cargo set-version --bump major -p sp-core

* cargo set-version --bump major -p sp-runtime-interface

* cargo set-version --bump major -p sp-wasm-interface

* cargo set-version --bump major -p sp-runtime

* cargo set-version --bump major -p sp-storage

* cargo set-version --bump major -p sp-rpc

* cargo set-version --bump major -p sp-io

* cargo set-version --bump major -p sp-trie

* cargo set-version -p sp-state-machine  -- 0.12.0

* cargo set-version -p sp-externalities  -- 0.12.0

* cargo set-version -p sp-keystore -- 0.12.0

* cargo set-version --bump major -p sp-keyring

* cargo set-version --bump major -p sp-version

* cargo set-version --bump major -p sp-tracing

* cargo set-version --bump major -p sp-application-crypto

* cargo set-version --bump major -p sp-arithmetic

* cargo unleash version bump-major -p sp-runtime-interface-proc-macro

* Add codec max-encoded-len feature to sp-arithmetic

* cargo unleash version bump-major -p sp-core-hashing-proc-macro

* Update new whitelist pallet to new primitive versions (#10953)

* sp-trie: Switch to thiserror and some other small cleanups (#10954)

* sp-trie: Switch to thiserror and some other small cleanups

* Add some extra method for converting a compact proof to a memory db

* Only maintain at most 1 `UnlockChunk` per era (#10670)

* Only maintain at most 1 `UnlockChunk` per era

* Bound `unlocking`

* Run cargo +nightly-2021-10-29 fmt

* Make benchmarks stuff compile

* Update frame/staking/src/lib.rs

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

* Remove DerefMut; Implement neccesary methods directly

* Doc comments for new BoundedVec methods

* Fix benchmarks

* wip bonded_vec macro

* Correct rust doc

* Apply suggestions from code review

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

* Update staking::Config impls

* Add MaxUnlockingChunks to more places

* Use defensive saturating add

* FMT

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

* staking: Expose `MaxUnlockingChunks` in metadata as a const (#10958)

* Allow trailing commas for `bounded_vec!` (#10959)

* SimpleSlotWorker: Do not implement `SlotWorker` for all types implementing `SimpleSlotWorker` (#10934)

Because Rust currently doesn't support specialization, it prevents users from implementing
`SlotWorker` for their own types. This pr solves this by removing the generic implementation of
`SlotWorker` for `SimpleSlotWorker` and providing some wrapper type for that.

* Bump digest from 0.10.2 to 0.10.3 (#10960)

Bumps [digest](https://github.com/RustCrypto/traits) from 0.10.2 to 0.10.3.
- [Release notes](https://github.com/RustCrypto/traits/releases)
- [Commits](https://github.com/RustCrypto/traits/compare/digest-v0.10.2...digest-v0.10.3)

---
updated-dependencies:
- dependency-name: digest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump scale-info from 2.0.0 to 2.0.1 (#10965)

Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/paritytech/scale-info/releases)
- [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/scale-info/commits)

---
updated-dependencies:
- dependency-name: scale-info
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add pr-custom-review config (#10968)

* Revise how staking configurations are set (#10955)

* Revise how staking configurations are set

fixes #10938

* Fix and add additional tests

* Format

* Formatting

* Add doc

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

* Update frame/staking/src/tests.rs

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

* Format

* Fix build

* Update weights.rs

* cargo run --quiet --profile=production  --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

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>

* Bump libc from 0.2.112 to 0.2.119 (#10967)

Bumps [libc](https://github.com/rust-lang/libc) from 0.2.112 to 0.2.119.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.112...0.2.119)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump parity-db from 0.3.5 to 0.3.8 (#10970)

Bumps [parity-db](https://github.com/paritytech/parity-db) from 0.3.5 to 0.3.8.
- [Release notes](https://github.com/paritytech/parity-db/releases)
- [Commits](https://github.com/paritytech/parity-db/commits/v0.3.8)

---
updated-dependencies:
- dependency-name: parity-db
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [EPM pallet]: remove `number of signed submissions` (#10945)

* [EPM pallet]: remove `number of signed submissions`

Closing #9229

* fix tests

* remove needless assert

* Update frame/election-provider-multi-phase/src/lib.rs

* cargo fmt

Signed-off-by: Niklas <niklasadolfsson1@gmail.com>

* fix grumbles

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

* drop `num_signed_submissions` in WeightInfo too

* fix build

Co-authored-by: Parity Bot <admin@parity.io>

* Refactored block body database scheme (#10779)

* Refactored tx storage database scheme

* Bump parity-db

* fmt

* Fix handling invalid index size + test

* Removed superflous result

* Minor changes

* fmt

* Deprecate "paritydb-experimental" CLI in favour or "paritydb" (#10975)

* Deprecate paritydb-experimental

* Updated comment

* [contracts] Stabilize "seal0" `is_contract` and `caller_is_origin`  (#10971)

* stabilize `seal_is_contract`

* stabilize `seal_caller_is_origin`

* Trie version migration pallet  (#10073)

* starting

* Updated from other branch.

* setting flag

* flag in storage struct

* fix flagging to access and insert.

* added todo to fix

* also missing serialize meta to storage proof

* extract meta.

* Isolate old trie layout.

* failing test that requires storing in meta when old hash scheme is used.

* old hash compatibility

* Db migrate.

* runing tests with both states when interesting.

* fix chain spec test with serde default.

* export state (missing trie function).

* Pending using new branch, lacking genericity on layout resolution.

* extract and set global meta

* Update to branch 4

* fix iterator with root flag (no longer insert node).

* fix trie root hashing of root

* complete basic backend.

* Remove old_hash meta from proof that do not use inner_hashing.

* fix trie test for empty (force layout on empty deltas).

* Root update fix.

* debug on meta

* Use trie key iteration that do not include value in proofs.

* switch default test ext to use inner hash.

* small integration test, and fix tx cache mgmt in ext.
test  failing

* Proof scenario at state-machine level.

* trace for db upgrade

* try different param

* act more like iter_from.

* Bigger batches.

* Update trie dependency.

* drafting codec changes and refact

* before removing unused branch no value alt hashing.
more work todo rename all flag var to alt_hash, and remove extrinsic
replace by storage query at every storage_root call.

* alt hashing only for branch with value.

* fix trie tests

* Hash of value include the encoded size.

* removing fields(broken)

* fix trie_stream to also include value length in inner hash.

* triedbmut only using alt type if inner hashing.

* trie_stream to also only use alt hashing type when actually alt hashing.

* Refactor meta state, logic should work with change of trie treshold.

* Remove NoMeta variant.

* Remove state_hashed trigger specific functions.

* pending switching to using threshold, new storage root api does not
make much sense.

* refactoring to use state from backend (not possible payload changes).

* Applying from previous state

* Remove default from storage, genesis need a special build.

* rem empty space

* Catch problem: when using triedb with default: we should not revert
nodes: otherwhise thing as trie codec cannot decode-encode without
changing state.

* fix compilation

* Right logic to avoid switch on reencode when default layout.

* Clean up some todos

* remove trie meta from root upstream

* update upstream and fix benches.

* split some long lines.

* UPdate trie crate to work with new design.

* Finish update to refactored upstream.

* update to latest triedb changes.

* Clean up.

* fix executor test.

* rust fmt from master.

* rust format.

* rustfmt

* fix

* start host function driven versioning

* update state-machine part

* still need access to state version from runtime

* state hash in mem: wrong

* direction likely correct, but passing call to code exec for genesis
init seem awkward.

* state version serialize in runtime, wrong approach, just initialize it
with no threshold for core api < 4 seems more proper.

* stateversion from runtime version (core api >= 4).

* update trie, fix tests

* unused import

* clean some TODOs

* Require RuntimeVersionOf for executor

* use RuntimeVersionOf to resolve genesis state version.

* update runtime version test

* fix state-machine tests

* TODO

* Use runtime version from storage wasm with fast sync.

* rustfmt

* fmt

* fix test

* revert useless changes.

* clean some unused changes

* fmt

* removing useless trait function.

* remove remaining reference to state_hash

* fix some imports

* Follow chain state version management.

* trie update, fix and constant threshold for trie layouts.

* update deps

* Update to latest trie pr changes.

* fix benches

* Verify proof requires right layout.

* update trie_root

* Update trie deps to  latest

* Update to latest trie versioning

* Removing patch

* update lock

* extrinsic for sc-service-test using layout v0.

* Adding RuntimeVersionOf to CallExecutor works.

* fmt

* error when resolving version and no wasm in storage.

* use existing utils to instantiate runtime code.

* migration pallet

* Patch to delay runtime switch.

* Revert "Patch to delay runtime switch."

This reverts commit d35f273b7d67b1b85a9e72973cab13c5c156c1d3.

* fix test

* fix child migration calls.

* useless closure

* remove remaining state_hash variables.

* Fix and add more tests

* Remove outdated comment

* useless inner hash

* fmt

* remote tests

* finally ksm works

* batches are broken

* clean the benchmarks

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>

* Update frame/state-trie-migration/src/lib.rs

* brand new version

* fix build

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update primitives/storage/src/lib.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* fmt and opt-in feature to apply state change.

* feature gate core version, use new test feature for node and test node

* Use a 'State' api version instead of Core one.

* fix merge of test function

* use blake macro.

* Fix state api (require declaring the api in runtime).

* Opt out feature, fix macro for io to select a given version
instead of latest.

* run test nodes on new state.

* fix

* new test structure

* new testing stuff from emeric

* Add commit_all, still not working

* Fix all tests

* add comment

* we have PoV tracking baby

* document stuff, but proof size is still wrong

* FUCK YEAH

* a big batch of review comments

* add more tests

* tweak test

* update config

* some remote-ext stuff

* delete some of the old stuff

* sync more files with master to minimize the diff

* Fix all tests

* make signed migration a bit more relaxed

* add witness check to signed submissions

* allow custom migration to also go above limit

* Fix these pesky tests

* ==== removal of the unsigned stuff ====

* Make all tests work again

* separate the tests from the logic so it can be reused easier

* fix overall build

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Slightly better termination

* some final tweaks

* Fix tests

* Restrict access to signed migrations

* address most of the review comments

* fix defensive

* New simplified code

* Fix weights

* fmt

* Update frame/state-trie-migration/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* make the tests correctly fail

* Fix build

* Fix build

* try and fix the benchmarks

* fix build

* Fix cargo file

* Fix runtime deposit

* make rustdoc happy

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

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>

* BEEFY and GRANDPA protocol names should use full genesis hash (#10974)

std::fmt::Display shows formats as reduced hash (e.g. 0xb0a8…dafe)

Use hex::encode to format full hash.

Signed-off-by: acatangiu <adrian@parity.io>

* Move weight constants to own mod (#10980)

* Move block+ext weights to own mod

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Unused import

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add block usage logs to system pallet (#10940)

* add block usage logs to system pallet

* add Debug

* use % instead of default Debug impl

* change formatting

* revert

* update runtime storage, update chain extension

* cleanup chain ext

* Fix the undeterministic storage proof recorded for the same execution (#10915)

* Add a test case for the determinism of recorded proof

* Replace HashMap with BTreeMap for the actual proof records

* cargo +nightly fmt --all

* Store the trie nodes in BTreeSet for StorageProof

* Nit

* Revert the BTreeMap changes and sort when converting to storage proof

* Remove PartialEq from StorageProof

* Remove unnecessary change

* Add `compare` method to StorageProof

* FMT

* Dummy change to trigger CI

* Use `BTreeSet` for StorageProof and keep using `Vec` for CompactProof

* Update comment on `iter_nodes`

* Revert `PartialEq` removal

* create iris ledger pallet

* ledger funcs in chain ext

* rename Iris -> IrisAssets, update readmes

* Minor Uniques pallet improvements and XCM v3 preparations (#10896)

* Introduce Helper to Uniques for benchmark stuff

* Fixes

* Formatting

* Featuregate the Helper, include ContainsPair

* Introduce & use EnsureOriginWithArg

* Benchmarking

* Docs

* More ContainsBoth helpers

* Formatting

* Formatting

* Fixes

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* election provider support: Update some test only types (#10983)

* Feedback from @XLC for Referenda Pallet (#10991)

* feedback from @xlc

* english

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make bags-list generic over node value and instantiable (#10997)

* make instantiable

* update

* cargo fmt

* Clean up

* bags-list: Make it generic over node value

* Respond to some feedback

* Apply suggestions from code review

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

* Add back default impl for weight update worst case

* Update to Score in more places'

* Use VoteWeight, not u64 to reduce test diff

* FMT

* FullCodec implies Codec

* formatting

* Fixup bags list remote test

Co-authored-by: doordashcon <jesse.chejieh@gmail.com>
Co-authored-by: Doordashcon <90750465+Doordashcon@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* sc-finality-grandpa: use the #[from] attriute to remove boilerplate code (#11003)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* contracts: Add test to verify unique trie ids (#10914)

* Add test to verify unique trie ids

* Rename trie_seed to nonce

* Rename AccountCounter -> Nonce

* fmt

* sp-core: `full_crypto` doesn't imply `std` (#11006)

* sp-core: `full_crypto` doesn't imply `std`

This pr changes the feature set of `secp256k1` to not use `global-context` when only the
`full_crypto` is enabled. It will be slower when the `std` feature is not enabled as the context
always needs to be recreated, but that is fine.

* Update client/cli/src/arg_enums.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Remove unused `parent_hash` in `OverlayedChanges::into_storage_changes` (#11011)

Ref https://github.com/paritytech/substrate/pull/10922#issuecomment-1064258443

CC @cheme

* iris ledger pallet -> transfer not yet functioning

* sp-api: Don't be dirty (#11015)

Ensure that the sp api macros don't use functions without providing the full path to the function.
This hygiene ensures that we don't actually try to call a method of an imported trait for example.

* unlock and transfer works

* Update clap to the latest version (#11017)

* Update clap to the latest version

Besides that it also removes some `structopt` leftovers from some docs.

* Fix compile errors

* More fixes

* Move scripts used in CI to the new location (#11008)

Move scripts used in CI to the new location - **./scripts/ci/**

* Move github scripts

* Move more files

* Move ci scripts and fix dependencies

* Update docs/node-template-release.md

Co-authored-by: João Paulo Silva de Souza <77391175+joao-paulo-parity@users.noreply.github.com>

* Remove Cargo.lock

* Apply suggestions from code review

Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>

* Make more paths uniform

Co-authored-by: João Paulo Silva de Souza <77391175+joao-paulo-parity@users.noreply.github.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>

* Move `sp-npos-elections-solution-type` to `frame-election-provider-support` (#11016)

* Move `sp-npos-elections-solution-type`
to `frame-election-provider-support`
First stab at it, will need to amend some more stuff

* Fixing tests

* Fixing tests

* Fixing cargo.toml for std configuration

* fmt

* Committing suggested changes
renaming, and re exporting macro.

* Removing unneeded imports

* shell.nix: Update to a newer nightly (#11028)

* update chain ext

* update naming, formatting, start tests

* Update lockfile (#11035)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Additional `benchmark-storage` flags (#11004)

* Fix typos

* Enable overwriting handlebars template

* Optionally name json output or disable json altogether

* Don't write to json by default

* Include block id in handlebars output

* Include warmups for write benchmarks

* PR comments

* Drop unnecessary file extension

* Use more appropriate types

* Use more appropriate error message

* More use of more appropriate types

* Rework write benchmark warmups

* Run same benchmark for both read and write

* SharedData: Update locks to mention possible deadlocks (#11034)

* SharedData: Update locks to mention possible deadlocks

* Update `Cargo.lock`

* Stabilize `seal_delegate_call` (#11037)

* add tests

* re-enumerate chain ext func ids

* Bump names from 0.12.0 to 0.13.0 (#11047)

Bumps [names](https://github.com/fnichol/names) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/fnichol/names/releases)
- [Changelog](https://github.com/fnichol/names/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fnichol/names/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: names
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* State migration rpc (#10981)

* setting flag

* flag in storage struct

* fix flagging to access and insert.

* added todo to fix

* also missing serialize meta to storage proof

* extract meta.

* Isolate old trie layout.

* failing test that requires storing in meta when old hash scheme is used.

* old hash compatibility

* Db migrate.

* runing tests with both states when interesting.

* fix chain spec test with serde default.

* export state (missing trie function).

* Pending using new branch, lacking genericity on layout resolution.

* extract and set global meta

* Update to branch 4

* fix iterator with root flag (no longer insert node).

* fix trie root hashing of root

* complete basic backend.

* Remove old_hash meta from proof that do not use inner_hashing.

* fix trie test for empty (force layout on empty deltas).

* Root update fix.

* debug on meta

* Use trie key iteration that do not include value in proofs.

* switch default test ext to use inner hash.

* small integration test, and fix tx cache mgmt in ext.
test  failing

* Proof scenario at state-machine level.

* trace for db upgrade

* try different param

* act more like iter_from.

* Bigger batches.

* Update trie dependency.

* drafting codec changes and refact

* before removing unused branch no value alt hashing.
more work todo rename all flag var to alt_hash, and remove extrinsic
replace by storage query at every storage_root call.

* alt hashing only for branch with value.

* fix trie tests

* Hash of value include the encoded size.

* removing fields(broken)

* fix trie_stream to also include value length in inner hash.

* triedbmut only using alt type if inner hashing.

* trie_stream to also only use alt hashing type when actually alt hashing.

* Refactor meta state, logic should work with change of trie treshold.

* Remove NoMeta variant.

* Remove state_hashed trigger specific functions.

* pending switching to using threshold, new storage root api does not
make much sense.

* refactoring to use state from backend (not possible payload changes).

* Applying from previous state

* Remove default from storage, genesis need a special build.

* rem empty space

* Catch problem: when using triedb with default: we should not revert
nodes: otherwhise thing as trie codec cannot decode-encode without
changing state.

* fix compilation

* Right …
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* poc logic

* set_code_hash impl, tests, benchmark

* Address @xgreenx's comments

* Move func defs closer to set_storage

* Check if code exists

- increment/decrement codehash refcount

* Document error for non-existing code hash

* Revert unrelated change

* Changes due to @athei's review

* Fix error handling

- comment errors: ReturnCodes
- update mock ext implementation
- return Error::CodeNotFound when no code for such hash

* Emit ContractCodeUpdated when setting new code_hash

* Address @athei's comments

* Move related defs to the bottom

* Minor comment update

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Improve docs

* Improve docs

* Update frame/contracts/src/wasm/runtime.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Refactor set_code_hash test

* Minor change to benchmark

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Minor change to benchmark

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Minor comment refactor

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Address @HCastano's comments

* Update seal_set_code_hash comment

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Move set_code_hash after delegate_call

* Move function to the bottom

* Moved and changed banchmark, added verify block

* Bring back previous benchmark

* Remove skip_meta for seal_set_code_hash

* Bring back skip_meta for seal_set_storage_per_new_kb

* Apply weights

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.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. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Upgradable contracts using set_code function
5 participants