diff --git a/Cargo.lock b/Cargo.lock index ec08ab301..7645adfaf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -219,6 +219,7 @@ dependencies = [ "module-vault-registry-rpc-runtime-api", "nomination", "oracle", + "orml-asset-registry", "orml-currencies", "orml-tokens", "orml-traits", @@ -1142,9 +1143,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.17" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0827b011f6f8ab38590295339817b0d26f344aa4932c3ced71b45b0c54b4a9" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ "clap_builder", "clap_derive", @@ -1153,9 +1154,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.17" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9441b403be87be858db6a23edb493e7f694761acdc3343d5a0fcaafd304cbc9e" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ "anstream", "anstyle", @@ -2039,7 +2040,7 @@ dependencies = [ [[package]] name = "currency" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "frame-system", @@ -2576,9 +2577,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -2821,7 +2822,7 @@ dependencies = [ [[package]] name = "fee" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "currency", "frame-benchmarking", @@ -3003,6 +3004,7 @@ dependencies = [ "module-vault-registry-rpc-runtime-api", "nomination", "oracle", + "orml-asset-registry", "orml-currencies", "orml-currencies-allowance-extension", "orml-tokens", @@ -4116,7 +4118,7 @@ dependencies = [ [[package]] name = "issue" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "base64 0.13.1", "currency", @@ -5030,9 +5032,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "24e6ab01971eb092ffe6a7d42f49f9ff42662f17604681e2843ad65077ba47dc" dependencies = [ "cc", "pkg-config", @@ -5393,7 +5395,7 @@ dependencies = [ [[package]] name = "module-issue-rpc" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "jsonrpsee", "module-issue-rpc-runtime-api", @@ -5406,7 +5408,7 @@ dependencies = [ [[package]] name = "module-issue-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "parity-scale-codec", @@ -5417,7 +5419,7 @@ dependencies = [ [[package]] name = "module-oracle-rpc" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "jsonrpsee", "module-oracle-rpc-runtime-api", @@ -5430,7 +5432,7 @@ dependencies = [ [[package]] name = "module-oracle-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "parity-scale-codec", @@ -5442,7 +5444,7 @@ dependencies = [ [[package]] name = "module-redeem-rpc" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "jsonrpsee", "module-redeem-rpc-runtime-api", @@ -5455,7 +5457,7 @@ dependencies = [ [[package]] name = "module-redeem-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "parity-scale-codec", @@ -5466,7 +5468,7 @@ dependencies = [ [[package]] name = "module-replace-rpc" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "jsonrpsee", "module-replace-rpc-runtime-api", @@ -5479,7 +5481,7 @@ dependencies = [ [[package]] name = "module-replace-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "parity-scale-codec", @@ -5490,7 +5492,7 @@ dependencies = [ [[package]] name = "module-vault-registry-rpc" version = "0.3.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "jsonrpsee", "module-oracle-rpc-runtime-api", @@ -5504,7 +5506,7 @@ dependencies = [ [[package]] name = "module-vault-registry-rpc-runtime-api" version = "0.3.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "module-oracle-rpc-runtime-api", @@ -5779,7 +5781,7 @@ dependencies = [ [[package]] name = "nomination" version = "0.5.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "currency", "fee", @@ -5950,7 +5952,7 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "oracle" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "currency", "dia-oracle", @@ -6014,6 +6016,25 @@ dependencies = [ "num-traits", ] +[[package]] +name = "orml-asset-registry" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library.git?branch=polkadot-v0.9.40#19afb58a300faac6ceb0e6e4e341859282897c53" +dependencies = [ + "frame-support", + "frame-system", + "orml-traits", + "pallet-xcm", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-std", + "xcm", + "xcm-builder", + "xcm-executor", +] + [[package]] name = "orml-currencies" version = "0.4.1-dev" @@ -7619,6 +7640,7 @@ dependencies = [ "frame-try-runtime", "hex-literal", "log", + "orml-asset-registry", "orml-currencies", "orml-tokens", "orml-traits", @@ -9255,9 +9277,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" +checksum = "f31999cfc7927c4e212e60fd50934ab40e8e8bfd2d493d6095d2d306bc0764d9" dependencies = [ "bytes", "rand 0.8.5", @@ -9273,9 +9295,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -9422,7 +9444,7 @@ dependencies = [ [[package]] name = "redeem" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "currency", "fee", @@ -9583,7 +9605,7 @@ dependencies = [ [[package]] name = "replace" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "currency", "fee", @@ -9625,7 +9647,7 @@ dependencies = [ [[package]] name = "reward" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-benchmarking", "frame-support", @@ -9843,12 +9865,19 @@ name = "runtime-common" version = "0.1.0" dependencies = [ "dia-oracle", + "frame-benchmarking", + "frame-support", + "frame-system", + "orml-asset-registry", + "orml-traits", "parity-scale-codec", "scale-info", "sp-consensus-aura", "sp-core", "sp-runtime", + "sp-std", "spacewalk-primitives", + "xcm", "zenlink-protocol", ] @@ -11360,7 +11389,7 @@ dependencies = [ [[package]] name = "security" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-support", "frame-system", @@ -11431,18 +11460,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.174" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.174" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", @@ -12402,7 +12431,7 @@ dependencies = [ [[package]] name = "spacewalk-primitives" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "base58", "bstringify", @@ -12463,7 +12492,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "staking" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "frame-benchmarking", "frame-support", @@ -12608,7 +12637,7 @@ dependencies = [ [[package]] name = "stellar-relay" version = "1.0.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "base64 0.13.1", "currency", @@ -13587,7 +13616,7 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vault-registry" version = "1.2.0" -source = "git+https://github.com/pendulum-chain/spacewalk?rev=0e3ead7a89570099b724b8c71b1fb13e1646bdcc#0e3ead7a89570099b724b8c71b1fb13e1646bdcc" +source = "git+https://github.com/pendulum-chain/spacewalk?rev=eae146c3795debfdab7215fa82ff1ffc4c2cae48#eae146c3795debfdab7215fa82ff1ffc4c2cae48" dependencies = [ "currency", "fee", @@ -14718,9 +14747,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +checksum = "25b5872fa2e10bd067ae946f927e726d7d603eaeb6e02fa6a350e0722d2b8c11" dependencies = [ "memchr", ] diff --git a/README.md b/README.md index 25864d71e..49a0b791c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ A successful build will create a binary under `./target/release/pendulum-node`. ### How to Generate Chain Spec -There are 4 different [runtime](runtime)s currently in the repo; **amplitude** for the Amplitude parachain, **foucoco** for the Foucoco testnet (running on Rococo), **pendulum** for the Pendulum parachain and **development** for the local development. Any of these runtimes are used depending on the config. The config is created by generating the chain spec: +There are 4 different [runtime](runtime)s currently in the repo; **amplitude** for the Amplitude parachain, **foucoco** +for the Foucoco testnet (running on Rococo), **pendulum** for the Pendulum parachain and **development** for the local +development. Any of these runtimes are used depending on the config. The config is created by generating the chain spec: ``` ./target/release/pendulum-node build-spec --disable-default-bootnode > local-parachain-plain.json @@ -105,9 +107,11 @@ An example for Amplitude will look like this: --execution=wasm --sync fast --pruning archive ``` -You can find the kusama.json [here](https://github.com/paritytech/polkadot/blob/master/node/service/chain-specs/kusama.json). +You can find the +kusama.json [here](https://github.com/paritytech/polkadot/blob/master/node/service/chain-specs/kusama.json). -For local testing, you can replace `--name` with predefined keys like `--alice` or `--bob`. You also need to specify the `--bootnode`. Here's an example: +For local testing, you can replace `--name` with predefined keys like `--alice` or `--bob`. You also need to specify +the `--bootnode`. Here's an example: ``` ./target/release/pendulum-node \ @@ -129,6 +133,62 @@ For local testing, you can replace `--name` with predefined keys like `--alice` ``` where `ALICE_NODE_ID` is the peer id of Alice. -You can find the rococo-custom-2-raw.json [here](https://github.com/substrate-developer-hub/substrate-docs/blob/314e9cd3bd0ca9426bbfd381b79c3ef4d06b49c2/static/assets/tutorials/cumulus/chain-specs/rococo-custom-2-raw.json). +You can find the +rococo-custom-2-raw.json [here](https://github.com/substrate-developer-hub/substrate-docs/blob/314e9cd3bd0ca9426bbfd381b79c3ef4d06b49c2/static/assets/tutorials/cumulus/chain-specs/rococo-custom-2-raw.json). -There are prerequisites in running the collator with a local relay chain. Refer to [how to run Pendulum locally](https://pendulum.gitbook.io/pendulum-docs/build/build-environment/local-pendulum-chain-setup). +There are prerequisites in running the collator with a local relay chain. Refer +to [how to run Pendulum locally](https://pendulum.gitbook.io/pendulum-docs/build/build-environment/local-pendulum-chain-setup). + +## How to benchmark runtime pallets + +Build the node with the `production` profile and the `runtime-benchmarks` feature enabled. + +```shell +cargo build --profile=production --features runtime-benchmarks --package pendulum-node +``` + +Run the benchmarks of a registered pallet. +The pallet has to be added to the list of defined benchmarks that you can find in the `benches` module of each +runtimes `lib.rs` file. + +#### Pendulum + +```shell +./target/production/pendulum-node benchmark pallet \ + --chain pendulum \ + --execution=wasm \ + --wasm-execution=compiled \ + --pallet "*" \ + --extrinsic "*" \ + --steps 50 \ + --repeat 20 \ + --output runtime/pendulum/src/weights/ +``` + +#### Amplitude + +```shell +./target/production/pendulum-node benchmark pallet \ + --chain amplitude \ + --execution=wasm \ + --wasm-execution=compiled \ + --pallet "*" \ + --extrinsic "*" \ + --steps 50 \ + --repeat 20 \ + --output runtime/amplitude/src/weights/ +``` + +#### Foucoco + +```shell +./target/production/pendulum-node benchmark pallet \ + --chain foucoco \ + --execution=wasm \ + --wasm-execution=compiled \ + --pallet "*" \ + --extrinsic "*" \ + --steps 50 \ + --repeat 20 \ + --output runtime/foucoco/src/weights/ +``` diff --git a/node/Cargo.toml b/node/Cargo.toml index 3e72d887a..2b35554f9 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -15,13 +15,13 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } serde = { version = "1.0.145", features = ["derive"] } jsonrpsee = { version = "0.16.2", features = ["server"] } -module-issue-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} +module-issue-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} -spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} +spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} # Local amplitude-runtime = {path = "../runtime/amplitude"} diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 4bc53ae1b..56076d542 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -521,6 +521,7 @@ fn amplitude_genesis( ); amplitude_runtime::GenesisConfig { + asset_registry: Default::default(), system: amplitude_runtime::SystemConfig { code: amplitude_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") @@ -708,6 +709,7 @@ fn foucoco_genesis( ); foucoco_runtime::GenesisConfig { + asset_registry: Default::default(), system: foucoco_runtime::SystemConfig { code: foucoco_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") @@ -933,6 +935,7 @@ fn pendulum_genesis( .collect(); pendulum_runtime::GenesisConfig { + asset_registry: Default::default(), system: pendulum_runtime::SystemConfig { code: pendulum_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") diff --git a/runtime/amplitude/Cargo.toml b/runtime/amplitude/Cargo.toml index f40feb08c..d3660ec5f 100644 --- a/runtime/amplitude/Cargo.toml +++ b/runtime/amplitude/Cargo.toml @@ -26,24 +26,24 @@ smallvec = "1.9.0" runtime-common = { path = "../common", default-features = false } # Custom libraries for Spacewalk -currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } -module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc" } +currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } +module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.40" } @@ -88,6 +88,7 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } # Open Runtime Module Library +orml-asset-registry = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } @@ -150,6 +151,7 @@ std = [ "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", + "orml-asset-registry/std", "orml-currencies/std", "orml-traits/std", "orml-tokens/std", @@ -243,7 +245,9 @@ runtime-benchmarks = [ "xcm-builder/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "pallet-collective/runtime-benchmarks" + "pallet-collective/runtime-benchmarks", + + "runtime-common/runtime-benchmarks" ] try-runtime = [ diff --git a/runtime/amplitude/src/lib.rs b/runtime/amplitude/src/lib.rs index 36c5ee734..7a1e0b74b 100644 --- a/runtime/amplitude/src/lib.rs +++ b/runtime/amplitude/src/lib.rs @@ -58,8 +58,8 @@ use frame_system::{ pub use sp_runtime::{MultiAddress, Perbill, Permill, Perquintill}; use runtime_common::{ - opaque, AccountId, Amount, AuraId, Balance, BlockNumber, Hash, Index, ReserveIdentifier, - Signature, EXISTENTIAL_DEPOSIT, MILLIUNIT, NANOUNIT, UNIT, + asset_registry, opaque, AccountId, Amount, AuraId, Balance, BlockNumber, Hash, Index, + ReserveIdentifier, Signature, EXISTENTIAL_DEPOSIT, MILLIUNIT, NANOUNIT, UNIT, }; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; @@ -355,7 +355,8 @@ impl Contains for BaseFilter { RuntimeCall::Security(_) | RuntimeCall::StellarRelay(_) | RuntimeCall::VaultRegistry(_) | - RuntimeCall::VaultRewards(_) => true, + RuntimeCall::VaultRewards(_) | + RuntimeCall::AssetRegistry(_) => true, // All pallets are allowed, but exhaustive match is defensive // in the case of adding new pallets. } @@ -819,6 +820,16 @@ impl orml_currencies::Config for Runtime { type WeightInfo = (); } +impl orml_asset_registry::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CustomMetadata = asset_registry::CustomMetadata; + type AssetId = CurrencyId; + type AuthorityOrigin = asset_registry::AssetAuthority; + type AssetProcessor = asset_registry::CustomAssetProcessor; + type Balance = Balance; + type WeightInfo = weights::orml_asset_registry::WeightInfo; +} + parameter_types! { pub const MinBlocksPerRound: BlockNumber = HOURS; pub const DefaultBlocksPerRound: BlockNumber = 2 * HOURS; @@ -1251,6 +1262,9 @@ construct_runtime!( VaultRewards: reward::{Pallet, Call, Storage, Event} = 70, VaultStaking: staking::{Pallet, Storage, Event} = 71, + // Asset Metadata + AssetRegistry: orml_asset_registry::{Pallet, Storage, Call, Event, Config} = 91, + VestingManager: vesting_manager::{Pallet, Call, Event} = 100 } ); @@ -1277,6 +1291,9 @@ mod benches { [replace, Replace] [stellar_relay, StellarRelay] [vault_registry, VaultRegistry] + + // Other + [orml_asset_registry, runtime_common::benchmarking::orml_asset_registry::Pallet::] [pallet_xcm, PolkadotXcm] ); } @@ -1518,6 +1535,7 @@ impl_runtime_apis! { impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} + impl runtime_common::benchmarking::orml_asset_registry::Config for Runtime {} use cumulus_pallet_session_benchmarking::Pallet as SessionBench; impl cumulus_pallet_session_benchmarking::Config for Runtime {} diff --git a/runtime/amplitude/src/weights/mod.rs b/runtime/amplitude/src/weights/mod.rs index aae2a4feb..b05024844 100644 --- a/runtime/amplitude/src/weights/mod.rs +++ b/runtime/amplitude/src/weights/mod.rs @@ -19,6 +19,7 @@ pub mod block_weights; pub mod extrinsic_weights; +pub mod orml_asset_registry; pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; diff --git a/runtime/amplitude/src/weights/orml_asset_registry.rs b/runtime/amplitude/src/weights/orml_asset_registry.rs new file mode 100644 index 000000000..200ff9c48 --- /dev/null +++ b/runtime/amplitude/src/weights/orml_asset_registry.rs @@ -0,0 +1,75 @@ + +//! Autogenerated weights for `orml_asset_registry` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Marcels-MBP`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("amplitude"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/pendulum-node +// benchmark +// pallet +// --chain +// amplitude +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// orml-asset-registry +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --output +// runtime/amplitude/src/weights/orml_asset_registry.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `orml_asset_registry`. +pub struct WeightInfo(PhantomData); +impl orml_asset_registry::WeightInfo for WeightInfo { + /// Storage: AssetRegistry Metadata (r:1 w:1) + /// Proof Skipped: AssetRegistry Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: AssetRegistry LocationToAssetId (r:1 w:1) + /// Proof Skipped: AssetRegistry LocationToAssetId (max_values: None, max_size: None, mode: Measured) + fn register_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `104` + // Estimated: `7138` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) + .saturating_add(Weight::from_parts(0, 7138)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: AssetRegistry Metadata (r:1 w:1) + /// Proof Skipped: AssetRegistry Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: AssetRegistry LocationToAssetId (r:1 w:2) + /// Proof Skipped: AssetRegistry LocationToAssetId (max_values: None, max_size: None, mode: Measured) + fn update_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `745` + // Estimated: `8420` + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) + .saturating_add(Weight::from_parts(0, 8420)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + fn set_asset_location() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(0, 0) + .saturating_add(Weight::from_parts(0, 0)) + } +} diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 7d35f7bd1..f4a849783 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -11,33 +11,52 @@ edition = "2021" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -# Substrate -parity-scale-codec = {version = "3.1.5", default-features = false, features = ["derive"]} -scale-info = {version = "2.1.1", default-features = false, features = ["derive"]} +parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive"] } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40", default-features = false, optional = true } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } -spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40" } + +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch = "polkadot-v0.9.40" } +orml-asset-registry = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch = "polkadot-v0.9.40" } + dia-oracle = { git = "https://github.com/pendulum-chain/oracle-pallet", default-features = false, branch = "polkadot-v0.9.40" } zenlink-protocol = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", default-features = false, branch = "polkadot-v0.9.40-protocol" } +spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" } + [features] default = [ - "std", + "std", ] std = [ - "sp-consensus-aura/std", - "sp-runtime/std", - "sp-core/std", - "spacewalk-primitives/std", - "parity-scale-codec/std", - "scale-info/std", - "dia-oracle/std", + "parity-scale-codec/std", + "scale-info/std", + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "sp-consensus-aura/std", + "sp-core/std", + "xcm/std", + "orml-traits/std", + "dia-oracle/std", "zenlink-protocol/std", + "spacewalk-primitives/std", ] runtime-benchmarks = [ - "sp-runtime/runtime-benchmarks", + "frame-benchmarking", + "sp-runtime/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", ] diff --git a/runtime/common/src/asset_registry.rs b/runtime/common/src/asset_registry.rs new file mode 100644 index 000000000..e61bbe924 --- /dev/null +++ b/runtime/common/src/asset_registry.rs @@ -0,0 +1,36 @@ +use crate::*; +use frame_support::traits::AsEnsureOriginWithArg; +use frame_system::EnsureRoot; +use orml_traits::asset_registry::{AssetMetadata, AssetProcessor}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; +use sp_runtime::DispatchError; +use spacewalk_primitives::CurrencyId; + +pub use spacewalk_primitives::CustomMetadata; + +#[derive( + Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen, +)] +pub struct CustomAssetProcessor; + +impl AssetProcessor> for CustomAssetProcessor { + fn pre_register( + id: Option, + metadata: AssetMetadata, + ) -> Result<(CurrencyId, AssetMetadata), DispatchError> { + match id { + Some(id) => Ok((id, metadata)), + None => Err(DispatchError::Other("asset-registry: AssetId is required")), + } + } + + fn post_register( + _id: CurrencyId, + _asset_metadata: AssetMetadata, + ) -> Result<(), DispatchError> { + Ok(()) + } +} + +pub type AssetAuthority = AsEnsureOriginWithArg>; diff --git a/runtime/common/src/benchmarking/mod.rs b/runtime/common/src/benchmarking/mod.rs new file mode 100644 index 000000000..31673820e --- /dev/null +++ b/runtime/common/src/benchmarking/mod.rs @@ -0,0 +1 @@ +pub mod orml_asset_registry; diff --git a/runtime/common/src/benchmarking/orml_asset_registry.rs b/runtime/common/src/benchmarking/orml_asset_registry.rs new file mode 100644 index 000000000..0fabd64ed --- /dev/null +++ b/runtime/common/src/benchmarking/orml_asset_registry.rs @@ -0,0 +1,86 @@ +use frame_benchmarking::v2::benchmarks; +use frame_support::assert_ok; +use frame_system::RawOrigin; +use orml_asset_registry::AssetMetadata; +use sp_std::{vec, vec::Vec}; +use spacewalk_primitives::{CurrencyId, CustomMetadata}; +use xcm::{ + latest::MultiLocation, + opaque::lts::{Junction::*, Junctions::*}, +}; + +pub struct Pallet(orml_asset_registry::Pallet); +pub trait Config: + orml_asset_registry::Config +{ +} + +#[benchmarks] +pub mod benchmarks { + use super::{Config, Pallet, *}; + use orml_asset_registry::Call; + + fn longest_vec() -> Vec { + // there is no fixed upperbound, but all actions are root-only so an assumed upperbound of 128 will do + vec![b'a', 128] + } + + fn longest_multilocation() -> MultiLocation { + let key = GeneralKey { length: 32, data: [0; 32] }; + MultiLocation::new(1, X8(key, key, key, key, key, key, key, key)) + } + + fn get_asset_metadata() -> AssetMetadata { + AssetMetadata { + decimals: 12, + name: longest_vec(), + symbol: longest_vec(), + existential_deposit: 0, + location: Some(longest_multilocation().into()), + additional: CustomMetadata, + } + } + + #[benchmark] + fn register_asset() { + let metadata = get_asset_metadata(); + + #[extrinsic_call] + register_asset(RawOrigin::Root, metadata, Some(CurrencyId::Native)); + } + + #[benchmark] + fn update_asset() { + let metadata = get_asset_metadata(); + + assert_ok!(orml_asset_registry::Pallet::::register_asset( + RawOrigin::Root.into(), + metadata, + Some(CurrencyId::Native), + )); + + // update values, and make sure to change the actual values in case there is some optimization + // somewhere in the codepath + let key = GeneralKey { length: 32, data: [1; 32] }; + let location = MultiLocation::new(1, X8(key, key, key, key, key, key, key, key)); + #[extrinsic_call] + update_asset( + RawOrigin::Root, + CurrencyId::Native, + Some(123), + Some(vec![b'b', 128]), + Some(vec![b'b', 128]), + Some(1234), + Some(Some(location.into())), + Some(CustomMetadata), + ); + } + + #[benchmark] + fn set_asset_location() { + #[block] + { + // todo: remove this benchmark when this unused item is removed from the weight type upstream + } + } +} diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 33c92567f..32687e145 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -5,10 +5,14 @@ use sp_runtime::{ DispatchError, MultiSignature, }; +pub mod asset_registry; pub mod chain_ext; pub mod stellar; pub mod zenlink; +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = MultiSignature; diff --git a/runtime/foucoco/Cargo.toml b/runtime/foucoco/Cargo.toml index 7983a3e5c..c65be1fa5 100644 --- a/runtime/foucoco/Cargo.toml +++ b/runtime/foucoco/Cargo.toml @@ -26,25 +26,25 @@ smallvec = "1.9.0" runtime-common = { path = "../common", default-features = false } # custom libraries from spacewalk -currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} +currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} -module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} -module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} +module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} +module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.40" } @@ -90,6 +90,7 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" } # Open Runtime Module Library +orml-asset-registry = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch = "polkadot-v0.9.40" } orml-currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } @@ -155,6 +156,7 @@ std = [ "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", + "orml-asset-registry/std", "orml-currencies/std", "orml-traits/std", "orml-tokens/std", @@ -254,7 +256,8 @@ runtime-benchmarks = [ "stellar-relay/runtime-benchmarks", "vault-registry/runtime-benchmarks", - "orml-currencies-allowance-extension/runtime-benchmarks", + "runtime-common/runtime-benchmarks", + "orml-currencies-allowance-extension/runtime-benchmarks" ] try-runtime = [ diff --git a/runtime/foucoco/src/lib.rs b/runtime/foucoco/src/lib.rs index fa3c8b355..742aba37c 100644 --- a/runtime/foucoco/src/lib.rs +++ b/runtime/foucoco/src/lib.rs @@ -59,8 +59,8 @@ use frame_system::{ pub use sp_runtime::{MultiAddress, Perbill, Permill, Perquintill}; use runtime_common::{ - chain_ext, opaque, AccountId, Amount, AuraId, Balance, BlockNumber, Hash, Index, PoolId, - ReserveIdentifier, Signature, EXISTENTIAL_DEPOSIT, MILLIUNIT, NANOUNIT, UNIT, + asset_registry, chain_ext, opaque, AccountId, Amount, AuraId, Balance, BlockNumber, Hash, + Index, PoolId, ReserveIdentifier, Signature, EXISTENTIAL_DEPOSIT, MILLIUNIT, NANOUNIT, UNIT, }; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; @@ -367,7 +367,8 @@ impl Contains for BaseFilter { RuntimeCall::VaultRegistry(_) | RuntimeCall::VaultRewards(_) | RuntimeCall::Farming(_) | - RuntimeCall::TokenAllowance(_) => true, + RuntimeCall::TokenAllowance(_) | + RuntimeCall::AssetRegistry(_) => true, // All pallets are allowed, but exhaustive match is defensive // in the case of adding new pallets. } @@ -825,6 +826,16 @@ impl orml_currencies::Config for Runtime { type WeightInfo = (); } +impl orml_asset_registry::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CustomMetadata = asset_registry::CustomMetadata; + type AssetId = CurrencyId; + type AuthorityOrigin = asset_registry::AssetAuthority; + type AssetProcessor = asset_registry::CustomAssetProcessor; + type Balance = Balance; + type WeightInfo = weights::orml_asset_registry::WeightInfo; +} + parameter_types! { pub const MinBlocksPerRound: BlockNumber = HOURS; pub const DefaultBlocksPerRound: BlockNumber = 2 * HOURS; @@ -1569,6 +1580,9 @@ construct_runtime!( TokenAllowance: orml_currencies_allowance_extension::{Pallet, Storage, Call, Event} = 80, Farming: farming::{Pallet, Call, Storage, Event} = 90, + + // Asset Metadata + AssetRegistry: orml_asset_registry::{Pallet, Storage, Call, Event, Config} = 91, } ); @@ -1594,6 +1608,9 @@ mod benches { [replace, Replace] [stellar_relay, StellarRelay] [vault_registry, VaultRegistry] + + // Other + [orml_asset_registry, runtime_common::benchmarking::orml_asset_registry::Pallet::] [pallet_xcm, PolkadotXcm] [orml_currencies_allowance_extension, TokenAllowance] @@ -1842,13 +1859,13 @@ impl_runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; - + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} + impl runtime_common::benchmarking::orml_asset_registry::Config for Runtime {} use cumulus_pallet_session_benchmarking::Pallet as SessionBench; impl cumulus_pallet_session_benchmarking::Config for Runtime {} diff --git a/runtime/foucoco/src/weights/mod.rs b/runtime/foucoco/src/weights/mod.rs index aae2a4feb..b05024844 100644 --- a/runtime/foucoco/src/weights/mod.rs +++ b/runtime/foucoco/src/weights/mod.rs @@ -19,6 +19,7 @@ pub mod block_weights; pub mod extrinsic_weights; +pub mod orml_asset_registry; pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; diff --git a/runtime/foucoco/src/weights/orml_asset_registry.rs b/runtime/foucoco/src/weights/orml_asset_registry.rs new file mode 100644 index 000000000..d29e2db73 --- /dev/null +++ b/runtime/foucoco/src/weights/orml_asset_registry.rs @@ -0,0 +1,75 @@ + +//! Autogenerated weights for `orml_asset_registry` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Marcels-MBP`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("foucoco"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/pendulum-node +// benchmark +// pallet +// --chain +// foucoco +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// orml-asset-registry +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --output +// runtime/foucoco/src/weights/orml_asset_registry.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `orml_asset_registry`. +pub struct WeightInfo(PhantomData); +impl orml_asset_registry::WeightInfo for WeightInfo { + /// Storage: AssetRegistry Metadata (r:1 w:1) + /// Proof Skipped: AssetRegistry Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: AssetRegistry LocationToAssetId (r:1 w:1) + /// Proof Skipped: AssetRegistry LocationToAssetId (max_values: None, max_size: None, mode: Measured) + fn register_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `104` + // Estimated: `7138` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) + .saturating_add(Weight::from_parts(0, 7138)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: AssetRegistry Metadata (r:1 w:1) + /// Proof Skipped: AssetRegistry Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: AssetRegistry LocationToAssetId (r:1 w:2) + /// Proof Skipped: AssetRegistry LocationToAssetId (max_values: None, max_size: None, mode: Measured) + fn update_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `745` + // Estimated: `8420` + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) + .saturating_add(Weight::from_parts(0, 8420)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + fn set_asset_location() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(0, 0) + .saturating_add(Weight::from_parts(0, 0)) + } +} diff --git a/runtime/pendulum/Cargo.toml b/runtime/pendulum/Cargo.toml index d3644d202..69cdc6ca1 100644 --- a/runtime/pendulum/Cargo.toml +++ b/runtime/pendulum/Cargo.toml @@ -26,7 +26,7 @@ smallvec = "1.9.0" runtime-common = {path = "../common", default-features = false} # Spacewalk libraries -spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "0e3ead7a89570099b724b8c71b1fb13e1646bdcc"} +spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"} # Substrate frame-benchmarking = {git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.40"} @@ -71,6 +71,7 @@ sp-transaction-pool = {git = "https://github.com/paritytech/substrate", default- sp-version = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40"} # Open Runtime Module Library +orml-asset-registry = {git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-traits = {git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } orml-tokens = {git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.40" } @@ -134,6 +135,7 @@ std = [ "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", + "orml-asset-registry/std", "orml-currencies/std", "orml-traits/std", "orml-tokens/std", @@ -198,7 +200,9 @@ runtime-benchmarks = [ "xcm-builder/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "pallet-collective/runtime-benchmarks" + "pallet-collective/runtime-benchmarks", + + "runtime-common/runtime-benchmarks" ] try-runtime = [ diff --git a/runtime/pendulum/src/lib.rs b/runtime/pendulum/src/lib.rs index 130379414..6e9ade8f9 100644 --- a/runtime/pendulum/src/lib.rs +++ b/runtime/pendulum/src/lib.rs @@ -55,8 +55,8 @@ use frame_system::{ pub use sp_runtime::{traits::AccountIdConversion, MultiAddress, Perbill, Permill, Perquintill}; use runtime_common::{ - opaque, AccountId, Amount, AuraId, Balance, BlockNumber, Hash, Index, ReserveIdentifier, - Signature, EXISTENTIAL_DEPOSIT, MILLIUNIT, NANOUNIT, UNIT, + asset_registry, opaque, AccountId, Amount, AuraId, Balance, BlockNumber, Hash, Index, + ReserveIdentifier, Signature, EXISTENTIAL_DEPOSIT, MILLIUNIT, NANOUNIT, UNIT, }; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; @@ -268,7 +268,8 @@ impl Contains for BaseFilter { RuntimeCall::Contracts(_) | RuntimeCall::ZenlinkProtocol(_) | RuntimeCall::DiaOracleModule(_) | - RuntimeCall::VestingManager(_) => true, + RuntimeCall::VestingManager(_) | + RuntimeCall::AssetRegistry(_) => true, // All pallets are allowed, but exhaustive match is defensive // in the case of adding new pallets. } @@ -727,6 +728,16 @@ impl orml_currencies::Config for Runtime { type WeightInfo = (); } +impl orml_asset_registry::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CustomMetadata = asset_registry::CustomMetadata; + type AssetId = CurrencyId; + type AuthorityOrigin = asset_registry::AssetAuthority; + type AssetProcessor = asset_registry::CustomAssetProcessor; + type Balance = Balance; + type WeightInfo = weights::orml_asset_registry::WeightInfo; +} + parameter_types! { pub const MinBlocksPerRound: BlockNumber = HOURS; pub const DefaultBlocksPerRound: BlockNumber = 2 * HOURS; @@ -1000,6 +1011,9 @@ construct_runtime!( ZenlinkProtocol: zenlink_protocol::{Pallet, Call, Storage, Event} = 59, + // Asset Metadata + AssetRegistry: orml_asset_registry::{Pallet, Storage, Call, Event, Config} = 91, + VestingManager: vesting_manager::{Pallet, Call, Event} = 100 } ); @@ -1018,6 +1032,8 @@ mod benches { [pallet_timestamp, Timestamp] [cumulus_pallet_xcmp_queue, XcmpQueue] + // Other + [orml_asset_registry, runtime_common::benchmarking::orml_asset_registry::Pallet::] [pallet_xcm, PolkadotXcm] ); } @@ -1259,6 +1275,7 @@ impl_runtime_apis! { impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} + impl runtime_common::benchmarking::orml_asset_registry::Config for Runtime {} use cumulus_pallet_session_benchmarking::Pallet as SessionBench; impl cumulus_pallet_session_benchmarking::Config for Runtime {} diff --git a/runtime/pendulum/src/weights/mod.rs b/runtime/pendulum/src/weights/mod.rs index aae2a4feb..b05024844 100644 --- a/runtime/pendulum/src/weights/mod.rs +++ b/runtime/pendulum/src/weights/mod.rs @@ -19,6 +19,7 @@ pub mod block_weights; pub mod extrinsic_weights; +pub mod orml_asset_registry; pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; diff --git a/runtime/pendulum/src/weights/orml_asset_registry.rs b/runtime/pendulum/src/weights/orml_asset_registry.rs new file mode 100644 index 000000000..aabdf34d8 --- /dev/null +++ b/runtime/pendulum/src/weights/orml_asset_registry.rs @@ -0,0 +1,75 @@ + +//! Autogenerated weights for `orml_asset_registry` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Marcels-MBP`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pendulum"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/pendulum-node +// benchmark +// pallet +// --chain +// pendulum +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --output +// runtime/pendulum/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `orml_asset_registry`. +pub struct WeightInfo(PhantomData); +impl orml_asset_registry::WeightInfo for WeightInfo { + /// Storage: AssetRegistry Metadata (r:1 w:1) + /// Proof Skipped: AssetRegistry Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: AssetRegistry LocationToAssetId (r:1 w:1) + /// Proof Skipped: AssetRegistry LocationToAssetId (max_values: None, max_size: None, mode: Measured) + fn register_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `66` + // Estimated: `7062` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) + .saturating_add(Weight::from_parts(0, 7062)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: AssetRegistry Metadata (r:1 w:1) + /// Proof Skipped: AssetRegistry Metadata (max_values: None, max_size: None, mode: Measured) + /// Storage: AssetRegistry LocationToAssetId (r:1 w:2) + /// Proof Skipped: AssetRegistry LocationToAssetId (max_values: None, max_size: None, mode: Measured) + fn update_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `707` + // Estimated: `8344` + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) + .saturating_add(Weight::from_parts(0, 8344)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + fn set_asset_location() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 0_000 picoseconds. + Weight::from_parts(0, 0) + .saturating_add(Weight::from_parts(0, 0)) + } +}