difftreelog
Merge pull request #183 from UniqueNetwork/feature/CORE-177_evm_contracts_migration
in: master
EVM contract migration
13 files changed
.maintain/frame-weight-template.hbsdiffbeforeafterboth--- /dev/null
+++ b/.maintain/frame-weight-template.hbs
@@ -0,0 +1,95 @@
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
+
+//! Autogenerated weights for {{pallet}}
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}
+//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
+//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}
+
+// Executed Command:
+{{#each args as |arg|~}}
+// {{arg}}
+{{/each}}
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for {{pallet}}.
+pub trait WeightInfo {
+ {{~#each benchmarks as |benchmark|}}
+ fn {{benchmark.name~}}
+ (
+ {{~#each benchmark.components as |c| ~}}
+ {{c.name}}: u32, {{/each~}}
+ ) -> Weight;
+ {{~/each}}
+}
+
+/// Weights for {{pallet}} using the Substrate node and recommended hardware.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+ {{~#each benchmarks as |benchmark|}}
+ {{~#each benchmark.comments as |comment|}}
+ // {{comment}}
+ {{~/each}}
+ fn {{benchmark.name~}}
+ (
+ {{~#each benchmark.components as |c| ~}}
+ {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
+ ) -> Weight {
+ ({{underscore benchmark.base_weight}} as Weight)
+ {{~#each benchmark.component_weight as |cw|}}
+ // Standard Error: {{underscore cw.error}}
+ .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
+ {{~/each}}
+ {{~#if (ne benchmark.base_reads "0")}}
+ .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
+ {{~/if}}
+ {{~#each benchmark.component_reads as |cr|}}
+ .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
+ {{~/each}}
+ {{~#if (ne benchmark.base_writes "0")}}
+ .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
+ {{~/if}}
+ {{~#each benchmark.component_writes as |cw|}}
+ .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
+ {{~/each}}
+ }
+ {{~/each}}
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ {{~#each benchmarks as |benchmark|}}
+ {{~#each benchmark.comments as |comment|}}
+ // {{comment}}
+ {{~/each}}
+ fn {{benchmark.name~}}
+ (
+ {{~#each benchmark.components as |c| ~}}
+ {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
+ ) -> Weight {
+ ({{underscore benchmark.base_weight}} as Weight)
+ {{~#each benchmark.component_weight as |cw|}}
+ // Standard Error: {{underscore cw.error}}
+ .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
+ {{~/each}}
+ {{~#if (ne benchmark.base_reads "0")}}
+ .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
+ {{~/if}}
+ {{~#each benchmark.component_reads as |cr|}}
+ .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
+ {{~/each}}
+ {{~#if (ne benchmark.base_writes "0")}}
+ .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
+ {{~/if}}
+ {{~#each benchmark.component_writes as |cw|}}
+ .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
+ {{~/each}}
+ }
+ {{~/each}}
+}
\ No newline at end of file
Cargo.lockdiffbeforeafterboth703 "once_cell",703 "once_cell",704]704]705706[[package]]707name = "bp-header-chain"708version = "0.1.0"709source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"710dependencies = [711 "finality-grandpa",712 "frame-support",713 "parity-scale-codec",714 "serde",715 "sp-core",716 "sp-finality-grandpa",717 "sp-runtime",718 "sp-std",719]720721[[package]]722name = "bp-messages"723version = "0.1.0"724source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"725dependencies = [726 "bitvec 0.20.4",727 "bp-runtime",728 "frame-support",729 "frame-system",730 "impl-trait-for-tuples",731 "parity-scale-codec",732 "serde",733 "sp-std",734]735736[[package]]737name = "bp-polkadot-core"738version = "0.1.0"739source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"740dependencies = [741 "bp-messages",742 "bp-runtime",743 "frame-support",744 "frame-system",745 "parity-scale-codec",746 "sp-api",747 "sp-core",748 "sp-runtime",749 "sp-std",750 "sp-version",751]752753[[package]]754name = "bp-rococo"755version = "0.1.0"756source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"757dependencies = [758 "bp-messages",759 "bp-polkadot-core",760 "bp-runtime",761 "frame-support",762 "parity-scale-codec",763 "smallvec 1.6.1",764 "sp-api",765 "sp-runtime",766 "sp-std",767 "sp-version",768]769770[[package]]771name = "bp-runtime"772version = "0.1.0"773source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"774dependencies = [775 "frame-support",776 "hash-db",777 "num-traits",778 "parity-scale-codec",779 "sp-core",780 "sp-io",781 "sp-runtime",782 "sp-state-machine",783 "sp-std",784 "sp-trie",785]786787[[package]]788name = "bp-test-utils"789version = "0.1.0"790source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"791dependencies = [792 "bp-header-chain",793 "ed25519-dalek",794 "finality-grandpa",795 "parity-scale-codec",796 "sp-application-crypto",797 "sp-finality-grandpa",798 "sp-runtime",799 "sp-std",800]801802[[package]]803name = "bp-wococo"804version = "0.1.0"805source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"806dependencies = [807 "bp-messages",808 "bp-polkadot-core",809 "bp-rococo",810 "bp-runtime",811 "parity-scale-codec",812 "sp-api",813 "sp-runtime",814 "sp-std",815]705816706[[package]]817[[package]]707name = "bs58"818name = "bs58"3778 "winapi-build",3889 "winapi-build",3779]3890]38913892[[package]]3893name = "kusama-runtime"3894version = "0.9.8"3895source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"3896dependencies = [3897 "beefy-primitives",3898 "bitvec 0.20.4",3899 "frame-benchmarking",3900 "frame-election-provider-support",3901 "frame-executive",3902 "frame-support",3903 "frame-system",3904 "frame-system-benchmarking",3905 "frame-system-rpc-runtime-api",3906 "frame-try-runtime",3907 "hex-literal",3908 "log",3909 "max-encoded-len",3910 "pallet-authority-discovery",3911 "pallet-authorship",3912 "pallet-babe",3913 "pallet-balances",3914 "pallet-bounties",3915 "pallet-collective",3916 "pallet-democracy",3917 "pallet-election-provider-multi-phase",3918 "pallet-elections-phragmen",3919 "pallet-gilt",3920 "pallet-grandpa",3921 "pallet-identity",3922 "pallet-im-online",3923 "pallet-indices",3924 "pallet-membership",3925 "pallet-mmr-primitives",3926 "pallet-multisig",3927 "pallet-nicks",3928 "pallet-offences",3929 "pallet-offences-benchmarking",3930 "pallet-proxy",3931 "pallet-recovery",3932 "pallet-scheduler 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",3933 "pallet-session",3934 "pallet-session-benchmarking",3935 "pallet-society",3936 "pallet-staking",3937 "pallet-staking-reward-fn",3938 "pallet-timestamp",3939 "pallet-tips",3940 "pallet-transaction-payment",3941 "pallet-transaction-payment-rpc-runtime-api",3942 "pallet-treasury",3943 "pallet-utility",3944 "pallet-vesting",3945 "pallet-xcm",3946 "parity-scale-codec",3947 "polkadot-primitives",3948 "polkadot-runtime-common",3949 "polkadot-runtime-parachains",3950 "rustc-hex",3951 "serde",3952 "serde_derive",3953 "smallvec 1.6.1",3954 "sp-api",3955 "sp-arithmetic",3956 "sp-authority-discovery",3957 "sp-block-builder",3958 "sp-consensus-babe",3959 "sp-core",3960 "sp-inherents",3961 "sp-io",3962 "sp-npos-elections",3963 "sp-offchain",3964 "sp-runtime",3965 "sp-session",3966 "sp-staking",3967 "sp-std",3968 "sp-transaction-pool",3969 "sp-version",3970 "static_assertions",3971 "substrate-wasm-builder 4.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",3972 "xcm",3973 "xcm-builder",3974 "xcm-executor",3975]378039763781[[package]]3977[[package]]3782name = "kv-log-macro"3978name = "kv-log-macro"5019 "pallet-evm",5215 "pallet-evm",5020 "pallet-evm-coder-substrate",5216 "pallet-evm-coder-substrate",5021 "pallet-evm-contract-helpers",5217 "pallet-evm-contract-helpers",5218 "pallet-evm-migration",5022 "pallet-evm-transaction-payment",5219 "pallet-evm-transaction-payment",5023 "pallet-inflation",5220 "pallet-inflation",5024 "pallet-nft",5221 "pallet-nft",5321version = "3.0.0"5518version = "3.0.0"5322source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5519source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5323dependencies = [5520dependencies = [5521 "frame-benchmarking",5324 "frame-support",5522 "frame-support",5325 "frame-system",5523 "frame-system",5326 "pallet-treasury",5524 "pallet-treasury",5329 "sp-std",5527 "sp-std",5330]5528]55295530[[package]]5531name = "pallet-bridge-grandpa"5532version = "0.1.0"5533source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"5534dependencies = [5535 "bp-header-chain",5536 "bp-runtime",5537 "bp-test-utils",5538 "finality-grandpa",5539 "frame-support",5540 "frame-system",5541 "log",5542 "num-traits",5543 "parity-scale-codec",5544 "serde",5545 "sp-finality-grandpa",5546 "sp-runtime",5547 "sp-std",5548 "sp-trie",5549]533155505332[[package]]5551[[package]]5333name = "pallet-collective"5552name = "pallet-collective"5334version = "3.0.0"5553version = "3.0.0"5335source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5554source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5336dependencies = [5555dependencies = [5556 "frame-benchmarking",5337 "frame-support",5557 "frame-support",5338 "frame-system",5558 "frame-system",5339 "log",5559 "log",5423version = "3.0.0"5643version = "3.0.0"5424source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5644source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5425dependencies = [5645dependencies = [5646 "frame-benchmarking",5426 "frame-election-provider-support",5647 "frame-election-provider-support",5427 "frame-support",5648 "frame-support",5428 "frame-system",5649 "frame-system",5429 "log",5650 "log",5430 "parity-scale-codec",5651 "parity-scale-codec",5652 "rand 0.7.3",5431 "sp-arithmetic",5653 "sp-arithmetic",5432 "sp-core",5654 "sp-core",5433 "sp-io",5655 "sp-io",5442version = "4.0.0"5664version = "4.0.0"5443source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5665source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5444dependencies = [5666dependencies = [5667 "frame-benchmarking",5445 "frame-support",5668 "frame-support",5446 "frame-system",5669 "frame-system",5447 "log",5670 "log",5541 "up-sponsorship",5764 "up-sponsorship",5542]5765]57665767[[package]]5768name = "pallet-evm-migration"5769version = "0.1.0"5770dependencies = [5771 "fp-evm",5772 "frame-benchmarking",5773 "frame-support",5774 "frame-system",5775 "pallet-evm",5776 "parity-scale-codec",5777 "sp-core",5778 "sp-io",5779 "sp-runtime",5780 "sp-std",5781]554357825544[[package]]5783[[package]]5545name = "pallet-evm-transaction-payment"5784name = "pallet-evm-transaction-payment"5558 "up-sponsorship",5797 "up-sponsorship",5559]5798]57995800[[package]]5801name = "pallet-gilt"5802version = "3.0.0"5803source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5804dependencies = [5805 "frame-benchmarking",5806 "frame-support",5807 "frame-system",5808 "parity-scale-codec",5809 "sp-arithmetic",5810 "sp-runtime",5811 "sp-std",5812]556058135561[[package]]5814[[package]]5562name = "pallet-grandpa"5815name = "pallet-grandpa"5600version = "3.0.0"5853version = "3.0.0"5601source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5854source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5602dependencies = [5855dependencies = [5856 "frame-benchmarking",5603 "frame-support",5857 "frame-support",5604 "frame-system",5858 "frame-system",5605 "log",5859 "log",5618version = "3.0.0"5872version = "3.0.0"5619source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5873source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5620dependencies = [5874dependencies = [5875 "frame-benchmarking",5621 "frame-support",5876 "frame-support",5622 "frame-system",5877 "frame-system",5623 "parity-scale-codec",5878 "parity-scale-codec",5717version = "3.0.0"5972version = "3.0.0"5718source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5973source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5719dependencies = [5974dependencies = [5975 "frame-benchmarking",5720 "frame-support",5976 "frame-support",5721 "frame-system",5977 "frame-system",5722 "parity-scale-codec",5978 "parity-scale-codec",5821 "sp-std",6077 "sp-std",5822]6078]60796080[[package]]6081name = "pallet-offences-benchmarking"6082version = "3.0.0"6083source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6084dependencies = [6085 "frame-benchmarking",6086 "frame-election-provider-support",6087 "frame-support",6088 "frame-system",6089 "pallet-babe",6090 "pallet-balances",6091 "pallet-grandpa",6092 "pallet-im-online",6093 "pallet-offences",6094 "pallet-session",6095 "pallet-staking",6096 "parity-scale-codec",6097 "sp-runtime",6098 "sp-staking",6099 "sp-std",6100]582361015824[[package]]6102[[package]]5825name = "pallet-proxy"6103name = "pallet-proxy"5826version = "3.0.0"6104version = "3.0.0"5827source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6105source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5828dependencies = [6106dependencies = [6107 "frame-benchmarking",5829 "frame-support",6108 "frame-support",5830 "frame-system",6109 "frame-system",5831 "max-encoded-len",6110 "max-encoded-len",5849 "sp-std",6128 "sp-std",5850]6129]61306131[[package]]6132name = "pallet-recovery"6133version = "3.0.0"6134source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6135dependencies = [6136 "enumflags2",6137 "frame-support",6138 "frame-system",6139 "parity-scale-codec",6140 "sp-io",6141 "sp-runtime",6142 "sp-std",6143]585161445852[[package]]6145[[package]]5853name = "pallet-scheduler"6146name = "pallet-scheduler"5902 "sp-trie",6195 "sp-trie",5903]6196]61976198[[package]]6199name = "pallet-session-benchmarking"6200version = "3.0.0"6201source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6202dependencies = [6203 "frame-benchmarking",6204 "frame-support",6205 "frame-system",6206 "pallet-session",6207 "pallet-staking",6208 "rand 0.7.3",6209 "sp-runtime",6210 "sp-session",6211 "sp-std",6212]62136214[[package]]6215name = "pallet-society"6216version = "3.0.0"6217source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6218dependencies = [6219 "frame-support",6220 "frame-system",6221 "parity-scale-codec",6222 "rand_chacha 0.2.2",6223 "sp-runtime",6224 "sp-std",6225]590462265905[[package]]6227[[package]]5906name = "pallet-staking"6228name = "pallet-staking"5907version = "3.0.0"6229version = "3.0.0"5908source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6230source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5909dependencies = [6231dependencies = [6232 "frame-benchmarking",5910 "frame-election-provider-support",6233 "frame-election-provider-support",5911 "frame-support",6234 "frame-support",5912 "frame-system",6235 "frame-system",5915 "pallet-session",6238 "pallet-session",5916 "parity-scale-codec",6239 "parity-scale-codec",5917 "paste",6240 "paste",6241 "rand_chacha 0.2.2",5918 "serde",6242 "serde",5919 "sp-application-crypto",6243 "sp-application-crypto",5920 "sp-io",6244 "sp-io",5935 "syn",6259 "syn",5936]6260]62616262[[package]]6263name = "pallet-staking-reward-fn"6264version = "3.0.0"6265source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6266dependencies = [6267 "log",6268 "sp-arithmetic",6269]593762705938[[package]]6271[[package]]5939name = "pallet-sudo"6272name = "pallet-sudo"5971version = "3.0.0"6304version = "3.0.0"5972source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6305source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"5973dependencies = [6306dependencies = [6307 "frame-benchmarking",5974 "frame-support",6308 "frame-support",5975 "frame-system",6309 "frame-system",5976 "pallet-treasury",6310 "pallet-treasury",6029version = "3.0.0"6363version = "3.0.0"6030source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6364source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6031dependencies = [6365dependencies = [6366 "frame-benchmarking",6032 "frame-support",6367 "frame-support",6033 "frame-system",6368 "frame-system",6034 "impl-trait-for-tuples",6369 "impl-trait-for-tuples",6044version = "3.0.0"6379version = "3.0.0"6045source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6380source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6046dependencies = [6381dependencies = [6382 "frame-benchmarking",6047 "frame-support",6383 "frame-support",6048 "frame-system",6384 "frame-system",6049 "parity-scale-codec",6385 "parity-scale-codec",6059source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6395source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8#74101dc21cfffb4c2d014fcc28edc166d5ca1b16"6060dependencies = [6396dependencies = [6061 "enumflags2",6397 "enumflags2",6398 "frame-benchmarking",6062 "frame-support",6399 "frame-support",6063 "frame-system",6400 "frame-system",6064 "parity-scale-codec",6401 "parity-scale-codec",6074 "frame-support",6411 "frame-support",6075 "frame-system",6412 "frame-system",6076 "parity-scale-codec",6413 "parity-scale-codec",6414 "serde",6077 "sp-runtime",6415 "sp-runtime",6078 "sp-std",6416 "sp-std",6079 "xcm",6417 "xcm",7149dependencies = [7487dependencies = [7150 "beefy-primitives",7488 "beefy-primitives",7151 "bitvec 0.20.4",7489 "bitvec 0.20.4",7490 "frame-benchmarking",7152 "frame-election-provider-support",7491 "frame-election-provider-support",7153 "frame-executive",7492 "frame-executive",7154 "frame-support",7493 "frame-support",7155 "frame-system",7494 "frame-system",7495 "frame-system-benchmarking",7156 "frame-system-rpc-runtime-api",7496 "frame-system-rpc-runtime-api",7157 "frame-try-runtime",7497 "frame-try-runtime",7498 "hex-literal",7158 "log",7499 "log",7159 "max-encoded-len",7500 "max-encoded-len",7160 "pallet-authority-discovery",7501 "pallet-authority-discovery",7175 "pallet-multisig",7516 "pallet-multisig",7176 "pallet-nicks",7517 "pallet-nicks",7177 "pallet-offences",7518 "pallet-offences",7519 "pallet-offences-benchmarking",7178 "pallet-proxy",7520 "pallet-proxy",7179 "pallet-scheduler 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",7521 "pallet-scheduler 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",7180 "pallet-session",7522 "pallet-session",7523 "pallet-session-benchmarking",7181 "pallet-staking",7524 "pallet-staking",7182 "pallet-staking-reward-curve",7525 "pallet-staking-reward-curve",7183 "pallet-timestamp",7526 "pallet-timestamp",7220dependencies = [7563dependencies = [7221 "beefy-primitives",7564 "beefy-primitives",7222 "bitvec 0.20.4",7565 "bitvec 0.20.4",7566 "frame-benchmarking",7223 "frame-support",7567 "frame-support",7224 "frame-system",7568 "frame-system",7225 "impl-trait-for-tuples",7569 "impl-trait-for-tuples",7226 "libsecp256k1 0.3.5",7570 "libsecp256k1 0.3.5",7227 "log",7571 "log",7228 "pallet-authorship",7572 "pallet-authorship",7573 "pallet-babe",7229 "pallet-balances",7574 "pallet-balances",7230 "pallet-beefy",7575 "pallet-beefy",7231 "pallet-election-provider-multi-phase",7576 "pallet-election-provider-multi-phase",7263dependencies = [7608dependencies = [7264 "bitvec 0.20.4",7609 "bitvec 0.20.4",7265 "derive_more",7610 "derive_more",7611 "frame-benchmarking",7266 "frame-support",7612 "frame-support",7267 "frame-system",7613 "frame-system",7614 "libsecp256k1 0.3.5",7268 "log",7615 "log",7269 "pallet-authority-discovery",7616 "pallet-authority-discovery",7270 "pallet-authorship",7617 "pallet-authorship",7304 "frame-system-rpc-runtime-api",7651 "frame-system-rpc-runtime-api",7305 "futures 0.3.16",7652 "futures 0.3.16",7306 "hex-literal",7653 "hex-literal",7654 "kusama-runtime",7307 "kvdb",7655 "kvdb",7308 "kvdb-rocksdb",7656 "kvdb-rocksdb",7309 "pallet-babe",7657 "pallet-babe",7339 "polkadot-runtime",7687 "polkadot-runtime",7340 "polkadot-runtime-parachains",7688 "polkadot-runtime-parachains",7341 "polkadot-statement-distribution",7689 "polkadot-statement-distribution",7690 "rococo-runtime",7342 "sc-authority-discovery",7691 "sc-authority-discovery",7343 "sc-basic-authorship",7692 "sc-basic-authorship",7344 "sc-block-builder",7693 "sc-block-builder",7380 "substrate-prometheus-endpoint",7729 "substrate-prometheus-endpoint",7381 "thiserror",7730 "thiserror",7382 "tracing",7731 "tracing",7732 "westend-runtime",7383]7733]738477347385[[package]]7735[[package]]8143 "librocksdb-sys",8493 "librocksdb-sys",8144]8494]84958496[[package]]8497name = "rococo-runtime"8498version = "0.9.8"8499source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"8500dependencies = [8501 "beefy-primitives",8502 "bp-rococo",8503 "bp-wococo",8504 "frame-executive",8505 "frame-support",8506 "frame-system",8507 "frame-system-rpc-runtime-api",8508 "hex-literal",8509 "log",8510 "max-encoded-len",8511 "pallet-authority-discovery",8512 "pallet-authorship",8513 "pallet-babe",8514 "pallet-balances",8515 "pallet-beefy",8516 "pallet-bridge-grandpa",8517 "pallet-collective",8518 "pallet-grandpa",8519 "pallet-im-online",8520 "pallet-indices",8521 "pallet-membership",8522 "pallet-mmr",8523 "pallet-mmr-primitives",8524 "pallet-offences",8525 "pallet-proxy",8526 "pallet-session",8527 "pallet-staking",8528 "pallet-staking-reward-curve",8529 "pallet-sudo",8530 "pallet-timestamp",8531 "pallet-transaction-payment",8532 "pallet-transaction-payment-rpc-runtime-api",8533 "pallet-utility",8534 "pallet-xcm",8535 "parity-scale-codec",8536 "polkadot-parachain",8537 "polkadot-primitives",8538 "polkadot-runtime-common",8539 "polkadot-runtime-parachains",8540 "serde",8541 "serde_derive",8542 "smallvec 1.6.1",8543 "sp-api",8544 "sp-authority-discovery",8545 "sp-block-builder",8546 "sp-consensus-babe",8547 "sp-core",8548 "sp-inherents",8549 "sp-io",8550 "sp-offchain",8551 "sp-runtime",8552 "sp-session",8553 "sp-staking",8554 "sp-std",8555 "sp-transaction-pool",8556 "sp-version",8557 "substrate-wasm-builder 4.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",8558 "xcm",8559 "xcm-builder",8560 "xcm-executor",8561]814585628146[[package]]8563[[package]]8147name = "rpassword"8564name = "rpassword"12043 "cc",12460 "cc",12044]12461]1246212463[[package]]12464name = "westend-runtime"12465version = "0.9.8"12466source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.8#3a10ee63c0b5703a1c802db3438ab7e01344a8ce"12467dependencies = [12468 "beefy-primitives",12469 "bitvec 0.20.4",12470 "frame-benchmarking",12471 "frame-election-provider-support",12472 "frame-executive",12473 "frame-support",12474 "frame-system",12475 "frame-system-benchmarking",12476 "frame-system-rpc-runtime-api",12477 "frame-try-runtime",12478 "hex-literal",12479 "log",12480 "max-encoded-len",12481 "pallet-authority-discovery",12482 "pallet-authorship",12483 "pallet-babe",12484 "pallet-balances",12485 "pallet-collective",12486 "pallet-democracy",12487 "pallet-election-provider-multi-phase",12488 "pallet-elections-phragmen",12489 "pallet-grandpa",12490 "pallet-identity",12491 "pallet-im-online",12492 "pallet-indices",12493 "pallet-membership",12494 "pallet-mmr-primitives",12495 "pallet-multisig",12496 "pallet-nicks",12497 "pallet-offences",12498 "pallet-offences-benchmarking",12499 "pallet-proxy",12500 "pallet-recovery",12501 "pallet-scheduler 3.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",12502 "pallet-session",12503 "pallet-session-benchmarking",12504 "pallet-society",12505 "pallet-staking",12506 "pallet-staking-reward-curve",12507 "pallet-sudo",12508 "pallet-timestamp",12509 "pallet-transaction-payment",12510 "pallet-transaction-payment-rpc-runtime-api",12511 "pallet-treasury",12512 "pallet-utility",12513 "pallet-vesting",12514 "pallet-xcm",12515 "parity-scale-codec",12516 "polkadot-parachain",12517 "polkadot-primitives",12518 "polkadot-runtime-common",12519 "polkadot-runtime-parachains",12520 "rustc-hex",12521 "serde",12522 "serde_derive",12523 "smallvec 1.6.1",12524 "sp-api",12525 "sp-authority-discovery",12526 "sp-block-builder",12527 "sp-consensus-babe",12528 "sp-core",12529 "sp-inherents",12530 "sp-io",12531 "sp-npos-elections",12532 "sp-offchain",12533 "sp-runtime",12534 "sp-session",12535 "sp-staking",12536 "sp-std",12537 "sp-transaction-pool",12538 "sp-version",12539 "static_assertions",12540 "substrate-wasm-builder 4.0.0 (git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.8)",12541 "xcm",12542 "xcm-builder",12543 "xcm-executor",12544]120451254512046[[package]]12546[[package]]12047name = "which"12547name = "which"Makefilediffbeforeafterboth--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+.PHONY: _bench
+_bench:
+ cargo run --release --features runtime-benchmarks -- \
+ benchmark --pallet pallet-$(PALLET) \
+ --wasm-execution compiled --extrinsic '*' \
+ --template .maintain/frame-weight-template.hbs --steps=50 --repeat=20 \
+ --output=./pallets/$(PALLET)/src/weights.rs
+
+.PHONY: bench-evm-migration
+bench-evm-migration:
+ make _bench PALLET=evm-migration
+
+.PHONY: bench
+bench: bench-evm-migration
node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -317,4 +317,7 @@
[features]
default = []
-runtime-benchmarks = ['nft-runtime/runtime-benchmarks']
+runtime-benchmarks = [
+ 'nft-runtime/runtime-benchmarks',
+ 'polkadot-service/runtime-benchmarks',
+]
pallets/evm-migration/Cargo.tomldiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-migration/Cargo.toml
@@ -0,0 +1,36 @@
+[package]
+name = "pallet-evm-migration"
+version = "0.1.0"
+edition = "2018"
+
+[dependencies]
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+pallet-evm = { default-features = false, version = "5.0.0-dev", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }
+fp-evm = { default-features = false, version = "2.0.0", git = "https://github.com/uniquenetwork/frontier.git", branch = "injected-transactions-parachain" }
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '2.0.0'
+
+[features]
+default = ["std", "runtime-benchmarks"]
+std = [
+ "frame-support/std",
+ "frame-system/std",
+ "frame-benchmarking/std",
+ "sp-runtime/std",
+ "sp-std/std",
+ "sp-io/std",
+ "sp-core/std",
+ "pallet-evm/std",
+ "fp-evm/std",
+]
+runtime-benchmarks = ["frame-benchmarking"]
pallets/evm-migration/src/benchmarking.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-migration/src/benchmarking.rs
@@ -0,0 +1,30 @@
+use super::{Call, Config, Pallet};
+use frame_benchmarking::benchmarks;
+use frame_system::RawOrigin;
+use sp_core::{H160, H256};
+use sp_std::vec::Vec;
+
+benchmarks! {
+ begin {
+ }: _(RawOrigin::Root, H160::default())
+
+ set_data {
+ let b in 0..80;
+ let address = H160::from_low_u64_be(b as u64);
+ let mut data = Vec::new();
+ for i in 0..b {
+ data.push((
+ H256::from_low_u64_be(i as u64),
+ H256::from_low_u64_be(i as u64),
+ ));
+ }
+ <Pallet<T>>::begin(RawOrigin::Root.into(), address)?;
+ }: _(RawOrigin::Root, address, data)
+
+ finish {
+ let b in 0..80;
+ let address = H160::from_low_u64_be(b as u64);
+ let data: Vec<u8> = (0..b as u8).collect();
+ <Pallet<T>>::begin(RawOrigin::Root.into(), address)?;
+ }: _(RawOrigin::Root, address, data)
+}
pallets/evm-migration/src/lib.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-migration/src/lib.rs
@@ -0,0 +1,111 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub use pallet::*;
+#[cfg(feature = "runtime-benchmarks")]
+pub mod benchmarking;
+pub mod weights;
+
+#[frame_support::pallet]
+pub mod pallet {
+ use frame_support::{pallet_prelude::*, transactional};
+ use frame_system::pallet_prelude::*;
+ use sp_core::{H160, H256};
+ use sp_std::vec::Vec;
+ use super::weights::WeightInfo;
+
+ #[pallet::config]
+ pub trait Config: frame_system::Config + pallet_evm::Config {
+ type WeightInfo: WeightInfo;
+ }
+
+ type SelfWeightOf<T> = <T as Config>::WeightInfo;
+
+ #[pallet::pallet]
+ #[pallet::generate_store(pub(super) trait Store)]
+ pub struct Pallet<T>(_);
+
+ #[pallet::error]
+ pub enum Error<T> {
+ AccountNotEmpty,
+ AccountIsNotMigrating,
+ }
+
+ #[pallet::storage]
+ pub(super) type MigrationPending<T: Config> =
+ StorageMap<Hasher = Twox64Concat, Key = H160, Value = bool, QueryKind = ValueQuery>;
+
+ #[pallet::call]
+ impl<T: Config> Pallet<T> {
+ #[pallet::weight(<SelfWeightOf<T>>::begin())]
+ pub fn begin(origin: OriginFor<T>, address: H160) -> DispatchResult {
+ ensure_root(origin)?;
+ ensure!(
+ <pallet_evm::Pallet<T>>::is_account_empty(&address)
+ && !<MigrationPending<T>>::get(&address),
+ <Error<T>>::AccountNotEmpty,
+ );
+
+ <MigrationPending<T>>::insert(address, true);
+ Ok(())
+ }
+
+ #[pallet::weight(<SelfWeightOf<T>>::set_data(data.len() as u32))]
+ pub fn set_data(
+ origin: OriginFor<T>,
+ address: H160,
+ data: Vec<(H256, H256)>,
+ ) -> DispatchResult {
+ use frame_support::StorageDoubleMap;
+ ensure_root(origin)?;
+ ensure!(
+ <MigrationPending<T>>::get(&address),
+ <Error<T>>::AccountIsNotMigrating,
+ );
+
+ for (k, v) in data {
+ pallet_evm::AccountStorages::insert(&address, k, v);
+ }
+ Ok(())
+ }
+
+ #[pallet::weight(<SelfWeightOf<T>>::finish(code.len() as u32))]
+ #[transactional]
+ pub fn finish(origin: OriginFor<T>, address: H160, code: Vec<u8>) -> DispatchResult {
+ use frame_support::StorageMap;
+ ensure_root(origin)?;
+ ensure!(
+ <MigrationPending<T>>::get(&address),
+ <Error<T>>::AccountIsNotMigrating,
+ );
+
+ pallet_evm::AccountCodes::insert(&address, code);
+ <MigrationPending<T>>::remove(address);
+ Ok(())
+ }
+ }
+
+ pub struct OnMethodCall<T>(PhantomData<T>);
+ impl<T: Config> pallet_evm::OnMethodCall<T> for OnMethodCall<T> {
+ fn is_reserved(contract: &H160) -> bool {
+ <MigrationPending<T>>::get(&contract)
+ }
+
+ fn is_used(_contract: &H160) -> bool {
+ false
+ }
+
+ fn call(
+ _source: &H160,
+ _arget: &H160,
+ _gas_left: u64,
+ _input: &[u8],
+ _value: sp_core::U256,
+ ) -> Option<pallet_evm::PrecompileOutput> {
+ None
+ }
+
+ fn get_code(_contract: &H160) -> Option<Vec<u8>> {
+ None
+ }
+ }
+}
pallets/evm-migration/src/weights.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-migration/src/weights.rs
@@ -0,0 +1,80 @@
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
+
+//! Autogenerated weights for pallet_evm_migration
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
+//! DATE: 2021-08-12, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
+
+// Executed Command:
+// target/release/nft
+// benchmark
+// --pallet
+// pallet-evm-migration
+// --wasm-execution
+// compiled
+// --extrinsic
+// *
+// --template
+// .maintain/frame-weight-template.hbs
+// --steps=50
+// --repeat=20
+// --output=./pallets/evm-migration/src/weights.rs
+
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for pallet_evm_migration.
+pub trait WeightInfo {
+ fn begin() -> Weight;
+ fn set_data(b: u32, ) -> Weight;
+ fn finish(b: u32, ) -> Weight;
+}
+
+/// Weights for pallet_evm_migration using the Substrate node and recommended hardware.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+ fn begin() -> Weight {
+ (6_210_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(3 as Weight))
+ .saturating_add(T::DbWeight::get().writes(1 as Weight))
+ }
+ fn set_data(b: u32, ) -> Weight {
+ (2_926_000 as Weight)
+ // Standard Error: 4_000
+ .saturating_add((649_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+ }
+ fn finish(_b: u32, ) -> Weight {
+ (4_309_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(1 as Weight))
+ .saturating_add(T::DbWeight::get().writes(2 as Weight))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ fn begin() -> Weight {
+ (6_210_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(1 as Weight))
+ }
+ fn set_data(b: u32, ) -> Weight {
+ (2_926_000 as Weight)
+ // Standard Error: 4_000
+ .saturating_add((649_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+ }
+ fn finish(_b: u32, ) -> Weight {
+ (4_309_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(2 as Weight))
+ }
+}
\ No newline at end of file
pallets/nft-transaction-payment/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nft-transaction-payment/src/benchmarking.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#![cfg(feature = "runtime-benchmarks")]
-
-use super::*;
-
-use sp_std::prelude::*;
-use frame_system::RawOrigin;
-use frame_benchmarking::{benchmarks};
-use frame_support::traits::OnInitialize;
-
-benchmarks! {
-
- // on_initialize {
- // let block1: T::BlockNumber = T::BlockNumber::from(1u32);
- // let block2: T::BlockNumber = T::BlockNumber::from(2u32);
- // Inflation::<T>::on_initialize(block1); // Create Treasury account
- // }: { Inflation::<T>::on_initialize(block2); } // Benchmark deposit_into_existing path
-
-}
pallets/nft-transaction-payment/src/lib.rsdiffbeforeafterboth--- a/pallets/nft-transaction-payment/src/lib.rs
+++ b/pallets/nft-transaction-payment/src/lib.rs
@@ -11,9 +11,6 @@
#[cfg(feature = "std")]
pub use serde::*;
-#[cfg(feature = "runtime-benchmarks")]
-mod benchmarking;
-
use frame_support::{decl_module, decl_storage};
use sp_std::prelude::*;
use up_sponsorship::SponsorshipHandler;
runtime/Cargo.tomldiffbeforeafterboth--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -23,11 +23,14 @@
'frame-support/runtime-benchmarks',
'frame-system-benchmarking',
'frame-system/runtime-benchmarks',
+ 'pallet-evm-migration/runtime-benchmarks',
'pallet-balances/runtime-benchmarks',
'pallet-timestamp/runtime-benchmarks',
'pallet-nft/runtime-benchmarks',
'pallet-inflation/runtime-benchmarks',
+ 'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
+ 'xcm-builder/runtime-benchmarks',
]
std = [
'codec/std',
@@ -56,6 +59,7 @@
'pallet-treasury/std',
'pallet-vesting/std',
'pallet-evm/std',
+ 'pallet-evm-migration/std',
'pallet-evm-contract-helpers/std',
'pallet-evm-transaction-payment/std',
'pallet-evm-coder-substrate/std',
@@ -392,6 +396,7 @@
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
pallet-nft-transaction-payment = { path = '../pallets/nft-transaction-payment', default-features = false, version = '3.0.0' }
pallet-nft-charge-transaction = { path = '../pallets/nft-charge-transaction', default-features = false, version = '3.0.0' }
+pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }
pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }
pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }
pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }
runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -252,6 +252,7 @@
type Currency = Balances;
type Event = Event;
type OnMethodCall = (
+ pallet_evm_migration::OnMethodCall<Self>,
pallet_nft::NftErcSupport<Self>,
pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
);
@@ -263,6 +264,10 @@
type FindAuthor = EthereumFindAuthor<Aura>;
}
+impl pallet_evm_migration::Config for Runtime {
+ type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;
+}
+
pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
fn find_author<'a, I>(digests: I) -> Option<H160>
@@ -819,6 +824,7 @@
EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,
EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
+ EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
}
);
@@ -1180,6 +1186,7 @@
let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);
+ add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
add_benchmark!(params, batches, pallet_nft, Nft);
add_benchmark!(params, batches, pallet_inflation, Inflation);
tests/src/eth/migration.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/eth/migration.test.ts
@@ -0,0 +1,82 @@
+import { expect } from 'chai';
+import privateKey from '../substrate/privateKey';
+import { submitTransactionAsync } from '../substrate/substrate-api';
+import { createEthAccountWithBalance, GAS_ARGS, itWeb3 } from './util/helpers';
+
+describe('EVM Migrations', () => {
+ itWeb3('Deploy contract saved state', async ({ web3, api }) => {
+ /*
+ contract StatefulContract {
+ uint counter;
+ mapping (uint => uint) kv;
+
+ function inc() public {
+ counter = counter + 1;
+ }
+ function counterValue() public view returns (uint) {
+ return counter;
+ }
+
+ function set(uint key, uint value) public {
+ kv[key] = value;
+ }
+
+ function get(uint key) public view returns (uint) {
+ return kv[key];
+ }
+ }
+ */
+ const ADDRESS = '0x4956bf52ef9ed8789f21bc600e915e0d961079f6';
+ const CODE = '0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80631ab06ee514610051578063371303c01461006d5780637bfdec3b146100775780639507d39a14610095575b600080fd5b61006b60048036038101906100669190610160565b6100c5565b005b6100756100e1565b005b61007f6100f8565b60405161008c91906101af565b60405180910390f35b6100af60048036038101906100aa9190610133565b610101565b6040516100bc91906101af565b60405180910390f35b8060016000848152602001908152602001600020819055505050565b60016000546100f091906101ca565b600081905550565b60008054905090565b600060016000838152602001908152602001600020549050919050565b60008135905061012d8161025e565b92915050565b60006020828403121561014957610148610259565b5b60006101578482850161011e565b91505092915050565b6000806040838503121561017757610176610259565b5b60006101858582860161011e565b92505060206101968582860161011e565b9150509250929050565b6101a981610220565b82525050565b60006020820190506101c460008301846101a0565b92915050565b60006101d582610220565b91506101e083610220565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156102155761021461022a565b5b828201905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b61026781610220565b811461027257600080fd5b5056fea26469706673582212206a02d2fb5c244105ab884961479c1aee3b4c1011e4b5530ab483eb22344a865664736f6c63430008060033';
+ const DATA = [
+ // counter = 10
+ ['0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000000000000000000000000000000000000000000a'],
+ // kv = {1: 1, 2: 2, 3: 3, 4: 4},
+ ['0xcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f', '0x0000000000000000000000000000000000000000000000000000000000000001'],
+ ['0xd9d16d34ffb15ba3a3d852f0d403e2ce1d691fb54de27ac87cd2f993f3ec330f', '0x0000000000000000000000000000000000000000000000000000000000000002'],
+ ['0x7dfe757ecd65cbd7922a9c0161e935dd7fdbcc0e999689c7d31633896b1fc60b', '0x0000000000000000000000000000000000000000000000000000000000000003'],
+ ['0xedc95719e9a3b28dd8e80877cb5880a9be7de1a13fc8b05e7999683b6b567643', '0x0000000000000000000000000000000000000000000000000000000000000004'],
+ ];
+
+ const alice = privateKey('//Alice');
+ const caller = await createEthAccountWithBalance(api, web3);
+
+ await submitTransactionAsync(alice, api.tx.sudo.sudo(api.tx.evmMigration.begin(ADDRESS)));
+ await submitTransactionAsync(alice, api.tx.sudo.sudo(api.tx.evmMigration.setData(ADDRESS, DATA)));
+ await submitTransactionAsync(alice, api.tx.sudo.sudo(api.tx.evmMigration.finish(ADDRESS, CODE)));
+
+ const contract = new web3.eth.Contract([
+ {
+ inputs: [],
+ name: 'counterValue',
+ outputs: [{
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [{
+ internalType: 'uint256',
+ name: 'key',
+ type: 'uint256',
+ }],
+ name: 'get',
+ outputs: [{
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ ], ADDRESS, { from: caller, ...GAS_ARGS });
+
+ expect(await contract.methods.counterValue().call()).to.be.equal('10');
+ for (let i = 1; i <= 4; i++) {
+ expect(await contract.methods.get(i).call()).to.be.equal(i.toString());
+ }
+ });
+});
\ No newline at end of file