From be45ed3ca8599bb1aec316cfb61512ed76013082 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 7 Jun 2022 10:31:43 +0200 Subject: [PATCH 01/17] set fee currency on new account (and remove on account deletion) --- Cargo.lock | 98 ++++++++++--------- Cargo.toml | 22 ++++- pallets/duster/src/mock.rs | 2 + pallets/exchange/benchmarking/src/mock.rs | 2 + pallets/exchange/src/mock.rs | 2 + pallets/lbp/src/mock.rs | 2 + .../liquidity-mining/benchmarking/src/mock.rs | 2 + pallets/liquidity-mining/src/mock.rs | 2 + pallets/offchain-duster/src/mock.rs | 2 + pallets/xyk/src/mock.rs | 2 + runtime/basilisk/src/lib.rs | 4 +- 11 files changed, 87 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61059dab7d2..9b2b020c328 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -518,7 +518,7 @@ dependencies = [ "getrandom 0.2.6", "hash-db", "hex-literal", - "hydradx-traits", + "hydradx-traits 0.6.0", "memory-db 0.27.0", "orml-benchmarking", "orml-currencies", @@ -1293,7 +1293,7 @@ version = "1.7.2" dependencies = [ "frame-support", "frame-system", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-currencies", "orml-tokens", "orml-traits", @@ -3228,6 +3228,18 @@ dependencies = [ "sp-std", ] +[[package]] +name = "hydradx-traits" +version = "0.6.0" +source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-std", +] + [[package]] name = "hyper" version = "0.14.18" @@ -5177,7 +5189,7 @@ dependencies = [ [[package]] name = "orml-benchmarking" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-benchmarking", "frame-support", @@ -5197,12 +5209,12 @@ dependencies = [ [[package]] name = "orml-currencies" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "frame-system", "orml-traits", - "orml-utilities 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38)", + "orml-utilities", "parity-scale-codec", "scale-info", "serde", @@ -5214,7 +5226,7 @@ dependencies = [ [[package]] name = "orml-tokens" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "frame-system", @@ -5229,12 +5241,12 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "impl-trait-for-tuples", "num-traits", - "orml-utilities 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38)", + "orml-utilities", "parity-scale-codec", "scale-info", "serde", @@ -5247,7 +5259,7 @@ dependencies = [ [[package]] name = "orml-unknown-tokens" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "frame-system", @@ -5262,20 +5274,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=63b32194e7b9aff6a6350d2d4434525de4eec7c1#63b32194e7b9aff6a6350d2d4434525de4eec7c1" -dependencies = [ - "frame-support", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "orml-utilities" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "parity-scale-codec", @@ -5289,7 +5288,7 @@ dependencies = [ [[package]] name = "orml-vesting" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "frame-system", @@ -5304,7 +5303,7 @@ dependencies = [ [[package]] name = "orml-xcm" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "frame-system", @@ -5318,7 +5317,7 @@ dependencies = [ [[package]] name = "orml-xcm-support" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "frame-support", "orml-traits", @@ -5332,7 +5331,7 @@ dependencies = [ [[package]] name = "orml-xtokens" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38#aac79b3b31953381669a2ffa9b3e9bfe48e87f38" +source = "git+https://github.com/apopiak/open-runtime-module-library?branch=apopiak/on-new-account-9-17#caf2f032eef837a4e8fcca2c45e6a45b0d32c7fd" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -5372,7 +5371,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hydradx-traits", + "hydradx-traits 0.5.1", "orml-traits", "parity-scale-codec", "primitive-types 0.8.0", @@ -5736,7 +5735,7 @@ dependencies = [ "frame-support", "frame-system", "hydra-dx-math 4.1.1", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-tokens", "orml-traits", "pallet-asset-registry", @@ -5761,7 +5760,7 @@ dependencies = [ "frame-support", "frame-system", "frame-system-benchmarking", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-tokens", "orml-traits", "pallet-asset-registry", @@ -5878,7 +5877,7 @@ dependencies = [ "frame-system", "frame-system-benchmarking", "hydra-dx-math 4.1.1", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-tokens", "orml-traits", "parity-scale-codec", @@ -5929,7 +5928,7 @@ dependencies = [ "frame-support", "frame-system", "hydra-dx-math 4.2.0", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-currencies", "orml-tokens", "orml-traits", @@ -5955,7 +5954,7 @@ dependencies = [ "frame-support", "frame-system", "frame-system-benchmarking", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-currencies", "orml-tokens", "orml-traits", @@ -5983,7 +5982,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "orml-utilities 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library?rev=63b32194e7b9aff6a6350d2d4434525de4eec7c1)", + "orml-utilities", "pallet-balances", "pallet-nft", "pallet-uniques", @@ -6087,7 +6086,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "orml-utilities 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38)", + "orml-utilities", "pallet-balances", "pallet-uniques", "parity-scale-codec", @@ -6172,13 +6171,13 @@ dependencies = [ [[package]] name = "pallet-price-oracle" -version = "0.2.2" -source = "git+https://github.com/galacticcouncil//warehouse?rev=e428fd81f84781c4508df72f095e7bed6bb58ea1#e428fd81f84781c4508df72f095e7bed6bb58ea1" +version = "0.3.0" +source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hydradx-traits", + "hydradx-traits 0.6.0", "parity-scale-codec", "scale-info", "serde", @@ -6217,8 +6216,8 @@ dependencies = [ [[package]] name = "pallet-relaychain-info" -version = "0.2.1" -source = "git+https://github.com/galacticcouncil//warehouse?rev=e428fd81f84781c4508df72f095e7bed6bb58ea1#e428fd81f84781c4508df72f095e7bed6bb58ea1" +version = "0.3.0" +source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -6393,12 +6392,12 @@ dependencies = [ [[package]] name = "pallet-transaction-multi-payment" -version = "7.0.2" -source = "git+https://github.com/galacticcouncil//warehouse?rev=e428fd81f84781c4508df72f095e7bed6bb58ea1#e428fd81f84781c4508df72f095e7bed6bb58ea1" +version = "7.1.0" +source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" dependencies = [ "frame-support", "frame-system", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-traits", "pallet-transaction-payment", "parity-scale-codec", @@ -6561,10 +6560,10 @@ dependencies = [ "frame-system", "frame-system-benchmarking", "hydra-dx-math 4.1.1", - "hydradx-traits", + "hydradx-traits 0.6.0", "orml-tokens", "orml-traits", - "orml-utilities 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library?rev=aac79b3b31953381669a2ffa9b3e9bfe48e87f38)", + "orml-utilities", "pallet-asset-registry", "parity-scale-codec", "primitive-types 0.8.0", @@ -8772,7 +8771,7 @@ dependencies = [ "hash-db", "hex-literal", "hydra-dx-math 4.1.1", - "hydradx-traits", + "hydradx-traits 0.6.0", "kusama-runtime", "memory-db 0.27.0", "orml-currencies", @@ -11304,7 +11303,7 @@ dependencies = [ "getrandom 0.2.6", "hash-db", "hex-literal", - "hydradx-traits", + "hydradx-traits 0.6.0", "memory-db 0.27.0", "orml-currencies", "orml-tokens", @@ -12745,3 +12744,8 @@ dependencies = [ "cc", "libc", ] + +[[patch.unused]] +name = "pallet-asset-registry" +version = "1.3.0" +source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" diff --git a/Cargo.toml b/Cargo.toml index 0b9258e192c..32a905409fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -198,8 +198,20 @@ cumulus-relay-chain-interface = { git = "https://github.com/paritytech//cumulus" cumulus-relay-chain-local = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } [patch."https://github.com/galacticcouncil/warehouse"] -pallet-price-oracle = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1"} -pallet-relaychain-info = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1"} -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1"} -pallet-asset-registry= { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1"} -hydradx-traits = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1"} +pallet-price-oracle = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} +pallet-relaychain-info = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} +pallet-asset-registry= { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} +hydradx-traits = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} + +[patch."https://github.com/open-web3-stack/open-runtime-module-library"] +orml-currencies = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-tokens = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-traits = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-vesting = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-benchmarking = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17", optional = true } +orml-xtokens = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-xcm-support = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-unknown-tokens = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-xcm = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } +orml-utilities = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } diff --git a/pallets/duster/src/mock.rs b/pallets/duster/src/mock.rs index bb248eb3b06..faab3e01e6b 100644 --- a/pallets/duster/src/mock.rs +++ b/pallets/duster/src/mock.rs @@ -142,6 +142,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = (); type DustRemovalWhitelist = Nothing; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } impl orml_currencies::Config for Test { diff --git a/pallets/exchange/benchmarking/src/mock.rs b/pallets/exchange/benchmarking/src/mock.rs index 1bdbcf41c9d..deb7b7602d3 100644 --- a/pallets/exchange/benchmarking/src/mock.rs +++ b/pallets/exchange/benchmarking/src/mock.rs @@ -117,6 +117,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = (); type DustRemovalWhitelist = Everything; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/exchange/src/mock.rs b/pallets/exchange/src/mock.rs index 0ed5e35ccce..a5b13981c93 100644 --- a/pallets/exchange/src/mock.rs +++ b/pallets/exchange/src/mock.rs @@ -134,6 +134,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = (); type DustRemovalWhitelist = Nothing; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/lbp/src/mock.rs b/pallets/lbp/src/mock.rs index df26930ecfb..b9b991f6c56 100644 --- a/pallets/lbp/src/mock.rs +++ b/pallets/lbp/src/mock.rs @@ -134,6 +134,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = MaxLocks; type DustRemovalWhitelist = Nothing; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/liquidity-mining/benchmarking/src/mock.rs b/pallets/liquidity-mining/benchmarking/src/mock.rs index c36b969fcda..77f4dc43555 100644 --- a/pallets/liquidity-mining/benchmarking/src/mock.rs +++ b/pallets/liquidity-mining/benchmarking/src/mock.rs @@ -220,6 +220,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = MaxLocks; type DustRemovalWhitelist = Nothing; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct ExtBuilder { diff --git a/pallets/liquidity-mining/src/mock.rs b/pallets/liquidity-mining/src/mock.rs index 7a14f8da4aa..f35a6c59084 100644 --- a/pallets/liquidity-mining/src/mock.rs +++ b/pallets/liquidity-mining/src/mock.rs @@ -346,6 +346,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = MaxLocks; type DustRemovalWhitelist = Nothing; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct ExtBuilder { diff --git a/pallets/offchain-duster/src/mock.rs b/pallets/offchain-duster/src/mock.rs index ff90b5fa584..78552b6dfc3 100644 --- a/pallets/offchain-duster/src/mock.rs +++ b/pallets/offchain-duster/src/mock.rs @@ -159,6 +159,8 @@ impl orml_tokens::Config for Test { type ExistentialDeposits = ExistentialDeposits; type OnDust = (); type MaxLocks = (); + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct ExtBuilder { diff --git a/pallets/xyk/src/mock.rs b/pallets/xyk/src/mock.rs index 6059c9ee77c..b4bae99c7ad 100644 --- a/pallets/xyk/src/mock.rs +++ b/pallets/xyk/src/mock.rs @@ -138,6 +138,8 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = (); type DustRemovalWhitelist = Nothing; + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 1d71053c851..631016326b9 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -76,7 +76,7 @@ use orml_currencies::BasicCurrencyAdapter; use common_runtime::locked_balance::MultiCurrencyLockedBalance; pub use common_runtime::*; -use pallet_transaction_multi_payment::MultiCurrencyAdapter; +use pallet_transaction_multi_payment::{AddTxAssetOnAccount, MultiCurrencyAdapter, RemoveTxAssetOnKilled}; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -411,6 +411,8 @@ impl orml_tokens::Config for Runtime { type OnDust = Duster; type MaxLocks = MaxLocks; type DustRemovalWhitelist = pallet_duster::DusterWhitelist; + type OnNewTokenAccount = AddTxAssetOnAccount; + type OnKilledTokenAccount = RemoveTxAssetOnKilled; } impl orml_currencies::Config for Runtime { From fd374dfd47ebbbed0e807cc2f2aa961838da759b Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 7 Jun 2022 11:51:54 +0200 Subject: [PATCH 02/17] fix compile issues (warehouse deps, testing runtime etc.) --- Cargo.lock | 47 ++++++------------- integration-tests/Cargo.toml | 2 +- integration-tests/src/non_native_fee.rs | 20 ++++---- pallets/duster/src/mock.rs | 2 +- pallets/exchange/Cargo.toml | 2 +- pallets/exchange/benchmarking/Cargo.toml | 2 +- pallets/exchange/benchmarking/src/mock.rs | 2 +- pallets/exchange/src/mock.rs | 2 +- pallets/lbp/src/mock.rs | 2 +- .../liquidity-mining/benchmarking/Cargo.toml | 2 +- .../liquidity-mining/benchmarking/src/mock.rs | 2 +- pallets/liquidity-mining/src/mock.rs | 2 +- pallets/offchain-duster/Cargo.toml | 2 +- pallets/xyk/Cargo.toml | 2 +- pallets/xyk/src/mock.rs | 2 +- pallets/xyk/src/tests.rs | 14 +++++- runtime/basilisk/Cargo.toml | 2 +- runtime/common/Cargo.toml | 2 +- runtime/testing-basilisk/Cargo.toml | 2 +- runtime/testing-basilisk/src/lib.rs | 4 +- 20 files changed, 58 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e3c16bfa64..c0c8df684e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -508,7 +508,7 @@ dependencies = [ "getrandom 0.2.6", "hash-db", "hex-literal", - "hydradx-traits 0.6.0", + "hydradx-traits", "memory-db 0.27.0", "orml-benchmarking", "orml-currencies", @@ -1283,7 +1283,7 @@ version = "1.7.2" dependencies = [ "frame-support", "frame-system", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-currencies", "orml-tokens", "orml-traits", @@ -3204,18 +3204,6 @@ dependencies = [ "sp-arithmetic", ] -[[package]] -name = "hydradx-traits" -version = "0.5.1" -source = "git+https://github.com/galacticcouncil//warehouse?rev=e428fd81f84781c4508df72f095e7bed6bb58ea1#e428fd81f84781c4508df72f095e7bed6bb58ea1" -dependencies = [ - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-std", -] - [[package]] name = "hydradx-traits" version = "0.6.0" @@ -5353,13 +5341,13 @@ dependencies = [ [[package]] name = "pallet-asset-registry" -version = "1.2.0" -source = "git+https://github.com/galacticcouncil//warehouse?rev=e428fd81f84781c4508df72f095e7bed6bb58ea1#e428fd81f84781c4508df72f095e7bed6bb58ea1" +version = "1.3.0" +source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hydradx-traits 0.5.1", + "hydradx-traits", "orml-traits", "parity-scale-codec", "primitive-types 0.8.0", @@ -5723,7 +5711,7 @@ dependencies = [ "frame-support", "frame-system", "hydra-dx-math 4.1.1", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-tokens", "orml-traits", "pallet-asset-registry", @@ -5748,7 +5736,7 @@ dependencies = [ "frame-support", "frame-system", "frame-system-benchmarking", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-tokens", "orml-traits", "pallet-asset-registry", @@ -5865,7 +5853,7 @@ dependencies = [ "frame-system", "frame-system-benchmarking", "hydra-dx-math 4.1.1", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-tokens", "orml-traits", "parity-scale-codec", @@ -5916,7 +5904,7 @@ dependencies = [ "frame-support", "frame-system", "hydra-dx-math 4.2.0", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-currencies", "orml-tokens", "orml-traits", @@ -5942,7 +5930,7 @@ dependencies = [ "frame-support", "frame-system", "frame-system-benchmarking", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-currencies", "orml-tokens", "orml-traits", @@ -6165,7 +6153,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hydradx-traits 0.6.0", + "hydradx-traits", "parity-scale-codec", "scale-info", "serde", @@ -6385,7 +6373,7 @@ source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-t dependencies = [ "frame-support", "frame-system", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-traits", "pallet-transaction-payment", "parity-scale-codec", @@ -6548,7 +6536,7 @@ dependencies = [ "frame-system", "frame-system-benchmarking", "hydra-dx-math 4.1.1", - "hydradx-traits 0.6.0", + "hydradx-traits", "orml-tokens", "orml-traits", "orml-utilities", @@ -8753,7 +8741,7 @@ dependencies = [ "hash-db", "hex-literal", "hydra-dx-math 4.1.1", - "hydradx-traits 0.6.0", + "hydradx-traits", "kusama-runtime", "memory-db 0.27.0", "orml-currencies", @@ -11285,7 +11273,7 @@ dependencies = [ "getrandom 0.2.6", "hash-db", "hex-literal", - "hydradx-traits 0.6.0", + "hydradx-traits", "memory-db 0.27.0", "orml-currencies", "orml-tokens", @@ -12732,8 +12720,3 @@ dependencies = [ "cc", "libc", ] - -[[patch.unused]] -name = "pallet-asset-registry" -version = "1.3.0" -source = "git+https://github.com/galacticcouncil//warehouse?branch=apopiak/set-tx-fee-asset-on-new-account#f366704e38c16388ca7a4bdd5ccd1cc173a0d231" diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 93e2a95ec98..2c9bc6b927e 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -77,7 +77,7 @@ xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "relea polkadot-xcm = { package = "xcm", git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false } # HydraDX dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } # Substrate dependencies diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 87e1dca77ec..abbd6ab7589 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -111,15 +111,19 @@ fn non_native_fee_payment_works() { assert_eq!(dave_balance, bob_balance + expected_diff); expect_basilisk_events(vec![ - pallet_transaction_multi_payment::Event::FeeWithdrawn( - DAVE.into(), - 1, - 462_676_500_000, - 265_222_898_276, - FALLBACK.into(), - ) + pallet_transaction_multi_payment::Event::FeeWithdrawn { + account_id: DAVE.into(), + asset_id: 1, + native_fee_amount: 462_676_500_000, + non_native_fee_amount: 265_222_898_276, + destination_account_id: FALLBACK.into(), + } + .into(), + pallet_transaction_multi_payment::Event::CurrencySet { + account_id: DAVE.into(), + asset_id: 1, + } .into(), - pallet_transaction_multi_payment::Event::CurrencySet(DAVE.into(), 1).into(), ]); basilisk_run_to_block(11); diff --git a/pallets/duster/src/mock.rs b/pallets/duster/src/mock.rs index faab3e01e6b..e5dc0a4f70c 100644 --- a/pallets/duster/src/mock.rs +++ b/pallets/duster/src/mock.rs @@ -143,7 +143,7 @@ impl orml_tokens::Config for Test { type MaxLocks = (); type DustRemovalWhitelist = Nothing; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } impl orml_currencies::Config for Test { diff --git a/pallets/exchange/Cargo.toml b/pallets/exchange/Cargo.toml index 85f0d499c89..c9ced15638f 100644 --- a/pallets/exchange/Cargo.toml +++ b/pallets/exchange/Cargo.toml @@ -29,7 +29,7 @@ orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-li orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "aac79b3b31953381669a2ffa9b3e9bfe48e87f38", default-features = false } # HydraDX dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } hydra-dx-math = { default-features = false, version = "4.1.1" } diff --git a/pallets/exchange/benchmarking/Cargo.toml b/pallets/exchange/benchmarking/Cargo.toml index 61fb02289bc..1ac9c12612e 100644 --- a/pallets/exchange/benchmarking/Cargo.toml +++ b/pallets/exchange/benchmarking/Cargo.toml @@ -29,7 +29,7 @@ orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-li orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "aac79b3b31953381669a2ffa9b3e9bfe48e87f38", default-features = false } # HydraDX dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } # Substrate dependencies diff --git a/pallets/exchange/benchmarking/src/mock.rs b/pallets/exchange/benchmarking/src/mock.rs index deb7b7602d3..099c7465205 100644 --- a/pallets/exchange/benchmarking/src/mock.rs +++ b/pallets/exchange/benchmarking/src/mock.rs @@ -118,7 +118,7 @@ impl orml_tokens::Config for Test { type MaxLocks = (); type DustRemovalWhitelist = Everything; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/exchange/src/mock.rs b/pallets/exchange/src/mock.rs index a5b13981c93..a7ea8626c8d 100644 --- a/pallets/exchange/src/mock.rs +++ b/pallets/exchange/src/mock.rs @@ -135,7 +135,7 @@ impl orml_tokens::Config for Test { type MaxLocks = (); type DustRemovalWhitelist = Nothing; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/lbp/src/mock.rs b/pallets/lbp/src/mock.rs index b9b991f6c56..daeb0e34435 100644 --- a/pallets/lbp/src/mock.rs +++ b/pallets/lbp/src/mock.rs @@ -135,7 +135,7 @@ impl orml_tokens::Config for Test { type MaxLocks = MaxLocks; type DustRemovalWhitelist = Nothing; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/liquidity-mining/benchmarking/Cargo.toml b/pallets/liquidity-mining/benchmarking/Cargo.toml index ec8adb3cfa9..c067fb68bfd 100644 --- a/pallets/liquidity-mining/benchmarking/Cargo.toml +++ b/pallets/liquidity-mining/benchmarking/Cargo.toml @@ -24,7 +24,7 @@ pallet-liquidity-mining = { path = "../../liquidity-mining", default-features = orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "aac79b3b31953381669a2ffa9b3e9bfe48e87f38", default-features = false } # HydraDX dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev="e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } primitives = { path = "../../../primitives", default-features = false } diff --git a/pallets/liquidity-mining/benchmarking/src/mock.rs b/pallets/liquidity-mining/benchmarking/src/mock.rs index 77f4dc43555..4aafca2f1e1 100644 --- a/pallets/liquidity-mining/benchmarking/src/mock.rs +++ b/pallets/liquidity-mining/benchmarking/src/mock.rs @@ -221,7 +221,7 @@ impl orml_tokens::Config for Test { type MaxLocks = MaxLocks; type DustRemovalWhitelist = Nothing; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct ExtBuilder { diff --git a/pallets/liquidity-mining/src/mock.rs b/pallets/liquidity-mining/src/mock.rs index f35a6c59084..3045577afa1 100644 --- a/pallets/liquidity-mining/src/mock.rs +++ b/pallets/liquidity-mining/src/mock.rs @@ -347,7 +347,7 @@ impl orml_tokens::Config for Test { type MaxLocks = MaxLocks; type DustRemovalWhitelist = Nothing; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct ExtBuilder { diff --git a/pallets/offchain-duster/Cargo.toml b/pallets/offchain-duster/Cargo.toml index b3344933a69..0ecf76ccf1f 100644 --- a/pallets/offchain-duster/Cargo.toml +++ b/pallets/offchain-duster/Cargo.toml @@ -26,7 +26,7 @@ primitives = { path = "../../primitives", default-features = false } pallet-duster = { path = "../duster", default-features = false } # Warehouse dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } # ORML dependencies orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "aac79b3b31953381669a2ffa9b3e9bfe48e87f38", default-features = false } diff --git a/pallets/xyk/Cargo.toml b/pallets/xyk/Cargo.toml index 063a13ab723..36128d10310 100644 --- a/pallets/xyk/Cargo.toml +++ b/pallets/xyk/Cargo.toml @@ -44,7 +44,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v [dev-dependencies] sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" } [features] diff --git a/pallets/xyk/src/mock.rs b/pallets/xyk/src/mock.rs index b4bae99c7ad..1dabcf449c7 100644 --- a/pallets/xyk/src/mock.rs +++ b/pallets/xyk/src/mock.rs @@ -139,7 +139,7 @@ impl orml_tokens::Config for Test { type MaxLocks = (); type DustRemovalWhitelist = Nothing; type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct AssetPairAccountIdTest(); diff --git a/pallets/xyk/src/tests.rs b/pallets/xyk/src/tests.rs index eb6849fc049..7895a895661 100644 --- a/pallets/xyk/src/tests.rs +++ b/pallets/xyk/src/tests.rs @@ -963,7 +963,12 @@ fn discount_sell_fees_should_work() { expect_events(vec![ Event::PoolCreated(user_1, asset_a, HDX, 10_000, share_token_native, native_pair_account).into(), - pallet_asset_registry::Event::Registered(1, bounded_name, AssetType::PoolShare(asset_a, asset_b)).into(), + pallet_asset_registry::Event::Registered { + asset_id: 1, + asset_name: bounded_name, + asset_type: AssetType::PoolShare(asset_a, asset_b), + } + .into(), frame_system::Event::NewAccount { account: pair_account }.into(), orml_tokens::Event::Endowed { currency_id: asset_a, @@ -1230,7 +1235,12 @@ fn single_buy_with_discount_should_work() { expect_events(vec![ Event::PoolCreated(user_1, asset_a, asset_b, 640_000_000_000, share_token, pair_account).into(), - pallet_asset_registry::Event::Registered(1, bounded_name, AssetType::PoolShare(asset_a, HDX)).into(), + pallet_asset_registry::Event::Registered { + asset_id: 1, + asset_name: bounded_name, + asset_type: AssetType::PoolShare(asset_a, HDX), + } + .into(), frame_system::Event::NewAccount { account: native_pair_account, } diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index f6face0c926..ad71755de8f 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -52,7 +52,7 @@ hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = " pallet-price-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false} pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } # collator support pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17", default-features = false } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index b0419a79388..fbe5825a460 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -30,7 +30,7 @@ pallet-marketplace = { path = '../../pallets/marketplace', default-features = fa hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } pallet-price-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } # Substrate dependencies sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false } diff --git a/runtime/testing-basilisk/Cargo.toml b/runtime/testing-basilisk/Cargo.toml index 82b18e7f370..aaae6c25d36 100644 --- a/runtime/testing-basilisk/Cargo.toml +++ b/runtime/testing-basilisk/Cargo.toml @@ -52,7 +52,7 @@ hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = " pallet-price-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil//warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "e428fd81f84781c4508df72f095e7bed6bb58ea1", default-features = false } # collator support pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.17", default-features = false } diff --git a/runtime/testing-basilisk/src/lib.rs b/runtime/testing-basilisk/src/lib.rs index 65009594674..ada24459e30 100644 --- a/runtime/testing-basilisk/src/lib.rs +++ b/runtime/testing-basilisk/src/lib.rs @@ -73,7 +73,7 @@ use pallet_xyk_rpc_runtime_api as xyk_rpc; use orml_currencies::BasicCurrencyAdapter; pub use common_runtime::*; -use pallet_transaction_multi_payment::MultiCurrencyAdapter; +use pallet_transaction_multi_payment::{AddTxAssetOnAccount, MultiCurrencyAdapter, RemoveTxAssetOnKilled}; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -365,6 +365,8 @@ impl orml_tokens::Config for Runtime { type OnDust = Duster; type MaxLocks = MaxLocks; type DustRemovalWhitelist = pallet_duster::DusterWhitelist; + type OnNewTokenAccount = AddTxAssetOnAccount; + type OnKilledTokenAccount = RemoveTxAssetOnKilled; } impl orml_currencies::Config for Runtime { From ef137ebd82308eba57939c23177c619bf5656328 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 7 Jun 2022 12:44:03 +0200 Subject: [PATCH 03/17] add integration test for automatic fee currency --- integration-tests/src/non_native_fee.rs | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index abbd6ab7589..322e9f5fd3e 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -144,3 +144,38 @@ fn non_native_fee_payment_works() { ); }); } + +#[test] +fn fee_currency_on_account_lifecycle() { + TestNet::reset(); + + const HITCHHIKER: [u8; 32] = [42u8; 32]; + + Basilisk::execute_with(|| { + let currency_1 = 1; + let acc_id = AccountId::from(HITCHHIKER); + + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&acc_id), None); + + // ------------ set on create ------------ + assert_ok!(basilisk_runtime::Currencies::transfer( + basilisk_runtime::Origin::signed(BOB.into()), + HITCHHIKER.into(), + currency_1, + 50_000_000_000_000, + )); + + assert_eq!(basilisk_runtime::Tokens::free_balance(1, &acc_id), 50_000_000_000_000); + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&acc_id), Some(currency_1)); + + // ------------ remove on delete ------------ + assert_ok!(basilisk_runtime::Tokens::transfer_all( + basilisk_runtime::Origin::signed(HITCHHIKER.into()), + BOB.into(), + currency_1, + false, + )); + + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&acc_id), None); + }); +} From b2e30717cb5ac85d2132302cf5c0b4cc87ea39a0 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 7 Jun 2022 12:54:51 +0200 Subject: [PATCH 04/17] add integration test for automatic fee currency on xcm transfer --- integration-tests/src/cross_chain_transfer.rs | 56 +++++++++++++++++++ integration-tests/src/non_native_fee.rs | 14 ++--- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 0d211494e6e..223a5477bc9 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -133,6 +133,7 @@ fn transfer_from_hydra() { ); }); } + #[test] fn transfer_insufficient_amount_should_fail() { TestNet::reset(); @@ -182,3 +183,58 @@ fn transfer_insufficient_amount_should_fail() { ); }); } + +#[test] +fn fee_currency_set_on_xcm_transfer() { + TestNet::reset(); + + const HITCHHIKER: [u8; 32] = [42u8; 32]; + + let transfer_amount = 100 * BSX; + + Basilisk::execute_with(|| { + assert_ok!(basilisk_runtime::AssetRegistry::set_location( + basilisk_runtime::Origin::root(), + 1, + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(3000), GeneralIndex(0)))) + )); + + // fee currency is not set before XCM transfer + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None); + }); + + Hydra::execute_with(|| { + assert_ok!(basilisk_runtime::XTokens::transfer( + basilisk_runtime::Origin::signed(ALICE.into()), + 0, + transfer_amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(2000), + Junction::AccountId32 { + id: HITCHHIKER, + network: NetworkId::Any, + } + ) + ) + .into() + ), + 399_600_000_000 + )); + assert_eq!( + basilisk_runtime::Balances::free_balance(&AccountId::from(ALICE)), + 200 * BSX - transfer_amount + ); + }); + + Basilisk::execute_with(|| { + assert_eq!( + basilisk_runtime::Tokens::free_balance(1, &AccountId::from(HITCHHIKER)), + transfer_amount + ); + // fee currency is set after XCM transfer + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), Some(1)); + }); +} diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 322e9f5fd3e..08edc3b864c 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -152,30 +152,28 @@ fn fee_currency_on_account_lifecycle() { const HITCHHIKER: [u8; 32] = [42u8; 32]; Basilisk::execute_with(|| { - let currency_1 = 1; - let acc_id = AccountId::from(HITCHHIKER); - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&acc_id), None); + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None); // ------------ set on create ------------ assert_ok!(basilisk_runtime::Currencies::transfer( basilisk_runtime::Origin::signed(BOB.into()), HITCHHIKER.into(), - currency_1, + 1, 50_000_000_000_000, )); - assert_eq!(basilisk_runtime::Tokens::free_balance(1, &acc_id), 50_000_000_000_000); - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&acc_id), Some(currency_1)); + assert_eq!(basilisk_runtime::Tokens::free_balance(1, &AccountId::from(HITCHHIKER)), 50_000_000_000_000); + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), Some(1)); // ------------ remove on delete ------------ assert_ok!(basilisk_runtime::Tokens::transfer_all( basilisk_runtime::Origin::signed(HITCHHIKER.into()), BOB.into(), - currency_1, + 1, false, )); - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&acc_id), None); + assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None); }); } From 1c104df8ba09e6527d1a6d1b781a08e3c8f4d2c0 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 7 Jun 2022 12:56:38 +0200 Subject: [PATCH 05/17] formatting --- integration-tests/src/cross_chain_transfer.rs | 10 +++++++-- integration-tests/src/non_native_fee.rs | 21 ++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 223a5477bc9..596212e7753 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -200,7 +200,10 @@ fn fee_currency_set_on_xcm_transfer() { )); // fee currency is not set before XCM transfer - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None); + assert_eq!( + basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + None + ); }); Hydra::execute_with(|| { @@ -235,6 +238,9 @@ fn fee_currency_set_on_xcm_transfer() { transfer_amount ); // fee currency is set after XCM transfer - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), Some(1)); + assert_eq!( + basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + Some(1) + ); }); } diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 08edc3b864c..6d8d14890b7 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -152,8 +152,10 @@ fn fee_currency_on_account_lifecycle() { const HITCHHIKER: [u8; 32] = [42u8; 32]; Basilisk::execute_with(|| { - - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None); + assert_eq!( + basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + None + ); // ------------ set on create ------------ assert_ok!(basilisk_runtime::Currencies::transfer( @@ -163,8 +165,14 @@ fn fee_currency_on_account_lifecycle() { 50_000_000_000_000, )); - assert_eq!(basilisk_runtime::Tokens::free_balance(1, &AccountId::from(HITCHHIKER)), 50_000_000_000_000); - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), Some(1)); + assert_eq!( + basilisk_runtime::Tokens::free_balance(1, &AccountId::from(HITCHHIKER)), + 50_000_000_000_000 + ); + assert_eq!( + basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + Some(1) + ); // ------------ remove on delete ------------ assert_ok!(basilisk_runtime::Tokens::transfer_all( @@ -174,6 +182,9 @@ fn fee_currency_on_account_lifecycle() { false, )); - assert_eq!(basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None); + assert_eq!( + basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + None + ); }); } From f844b7e6e19871a3e5eaa51de55283314af9e97a Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 10 Jun 2022 17:17:26 +0200 Subject: [PATCH 06/17] add use for basilisk_runtime types --- integration-tests/src/non_native_fee.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 6d8d14890b7..6b1a3a70830 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -152,38 +152,40 @@ fn fee_currency_on_account_lifecycle() { const HITCHHIKER: [u8; 32] = [42u8; 32]; Basilisk::execute_with(|| { + use basilisk_runtime::{Currencies, MultiTransactionPayment, Origin, Tokens}; + assert_eq!( - basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None ); // ------------ set on create ------------ - assert_ok!(basilisk_runtime::Currencies::transfer( - basilisk_runtime::Origin::signed(BOB.into()), + assert_ok!(Currencies::transfer( + Origin::signed(BOB.into()), HITCHHIKER.into(), 1, 50_000_000_000_000, )); assert_eq!( - basilisk_runtime::Tokens::free_balance(1, &AccountId::from(HITCHHIKER)), + Tokens::free_balance(1, &AccountId::from(HITCHHIKER)), 50_000_000_000_000 ); assert_eq!( - basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), Some(1) ); // ------------ remove on delete ------------ - assert_ok!(basilisk_runtime::Tokens::transfer_all( - basilisk_runtime::Origin::signed(HITCHHIKER.into()), + assert_ok!(Tokens::transfer_all( + Origin::signed(HITCHHIKER.into()), BOB.into(), 1, false, )); assert_eq!( - basilisk_runtime::MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), + MultiTransactionPayment::get_currency(&AccountId::from(HITCHHIKER)), None ); }); From fd2f2cb2eb985fa93ff0d91a38d8566345cb2a17 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 10 Jun 2022 17:18:34 +0200 Subject: [PATCH 07/17] bump spec_version --- runtime/basilisk/src/lib.rs | 2 +- runtime/testing-basilisk/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 113dc917710..4fdc3708b61 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 47, + spec_version: 48, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/testing-basilisk/src/lib.rs b/runtime/testing-basilisk/src/lib.rs index ada24459e30..56fed39c57d 100644 --- a/runtime/testing-basilisk/src/lib.rs +++ b/runtime/testing-basilisk/src/lib.rs @@ -113,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testing-basilisk"), impl_name: create_runtime_str!("testing-basilisk"), authoring_version: 1, - spec_version: 47, + spec_version: 48, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 22498c6e7f0080d45ab8f62ae25f04f9d60fdf61 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 10 Jun 2022 17:26:20 +0200 Subject: [PATCH 08/17] fix whitespace --- pallets/offchain-duster/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/offchain-duster/src/mock.rs b/pallets/offchain-duster/src/mock.rs index 78552b6dfc3..789de7c9563 100644 --- a/pallets/offchain-duster/src/mock.rs +++ b/pallets/offchain-duster/src/mock.rs @@ -160,7 +160,7 @@ impl orml_tokens::Config for Test { type OnDust = (); type MaxLocks = (); type OnNewTokenAccount = (); - type OnKilledTokenAccount = (); + type OnKilledTokenAccount = (); } pub struct ExtBuilder { From a0ae4253713217b0a56f70f67c485a5e1bc4ffa1 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Sat, 11 Jun 2022 08:52:59 +0200 Subject: [PATCH 09/17] update orml-tokens weights --- runtime/common/src/weights/tokens.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/runtime/common/src/weights/tokens.rs b/runtime/common/src/weights/tokens.rs index e1c021dc594..0dcbabe296a 100644 --- a/runtime/common/src/weights/tokens.rs +++ b/runtime/common/src/weights/tokens.rs @@ -18,8 +18,8 @@ //! Autogenerated weights for orml_tokens //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-02-03, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 +//! DATE: 2022-06-11, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: // target/release/basilisk @@ -50,28 +50,28 @@ pub struct BasiliskWeight(PhantomData); impl WeightInfo for BasiliskWeight { fn transfer() -> Weight { - (66_923_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (66_005_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn transfer_all() -> Weight { - (72_657_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (69_573_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn transfer_keep_alive() -> Weight { - (55_058_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) + (54_203_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn force_transfer() -> Weight { - (59_423_000 as Weight) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) + (56_560_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn set_balance() -> Weight { - (46_355_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) + (46_361_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } } From 21b7c2b8ebef9490b48c5c53815eeb30cc2cbcae Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 13 Jun 2022 12:41:41 +0200 Subject: [PATCH 10/17] bump spec_version --- runtime/basilisk/src/lib.rs | 2 +- runtime/testing-basilisk/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 7d3b9452c82..e1eb374f2c1 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 48, + spec_version: 49, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/testing-basilisk/src/lib.rs b/runtime/testing-basilisk/src/lib.rs index 1246639fb01..65464d7e686 100644 --- a/runtime/testing-basilisk/src/lib.rs +++ b/runtime/testing-basilisk/src/lib.rs @@ -113,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testing-basilisk"), impl_name: create_runtime_str!("testing-basilisk"), authoring_version: 1, - spec_version: 48, + spec_version: 49, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From caf3389497f579acd4ee74164cac22883889dea9 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 14 Jun 2022 10:44:26 +0200 Subject: [PATCH 11/17] point warehouse pallets to specific revision --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 32a905409fa..42268b0f706 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -198,11 +198,11 @@ cumulus-relay-chain-interface = { git = "https://github.com/paritytech//cumulus" cumulus-relay-chain-local = { git = "https://github.com/paritytech//cumulus", rev = "76479e7fef3af7c8828a44647847b01afd5fefe5" } [patch."https://github.com/galacticcouncil/warehouse"] -pallet-price-oracle = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} -pallet-relaychain-info = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} -pallet-asset-registry= { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} -hydradx-traits = { git = "https://github.com/galacticcouncil//warehouse", branch = "apopiak/set-tx-fee-asset-on-new-account"} +pallet-price-oracle = { git = "https://github.com/galacticcouncil//warehouse", rev = "9d1a6dc7cf6af6f9f7c76ca9438e3d671097fe90" } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil//warehouse", rev = "9d1a6dc7cf6af6f9f7c76ca9438e3d671097fe90" } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil//warehouse", rev = "9d1a6dc7cf6af6f9f7c76ca9438e3d671097fe90" } +pallet-asset-registry= { git = "https://github.com/galacticcouncil//warehouse", rev = "9d1a6dc7cf6af6f9f7c76ca9438e3d671097fe90" } +hydradx-traits = { git = "https://github.com/galacticcouncil//warehouse", rev = "9d1a6dc7cf6af6f9f7c76ca9438e3d671097fe90" } [patch."https://github.com/open-web3-stack/open-runtime-module-library"] orml-currencies = { git = "https://github.com/apopiak/open-runtime-module-library", branch = "apopiak/on-new-account-9-17" } From 6d83043c58da133ae8825b3e26f362d516209b58 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 14 Jun 2022 10:48:37 +0200 Subject: [PATCH 12/17] bump spec_version --- runtime/basilisk/src/lib.rs | 2 +- runtime/testing-basilisk/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index e1eb374f2c1..88e05dd717a 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 49, + spec_version: 51, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/testing-basilisk/src/lib.rs b/runtime/testing-basilisk/src/lib.rs index 65464d7e686..13745b4f769 100644 --- a/runtime/testing-basilisk/src/lib.rs +++ b/runtime/testing-basilisk/src/lib.rs @@ -113,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testing-basilisk"), impl_name: create_runtime_str!("testing-basilisk"), authoring_version: 1, - spec_version: 49, + spec_version: 51, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 161886c85a9becbfefa23ba20d7b22a1d2655c48 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 14 Jun 2022 15:58:59 +0200 Subject: [PATCH 13/17] integrate new multi tx payment pallet (fee receiver etc.) --- integration-tests/src/kusama_test_net.rs | 4 +--- integration-tests/src/non_native_fee.rs | 4 +++- node/src/chain_spec.rs | 11 ----------- node/src/testing_chain_spec.rs | 7 ------- runtime/basilisk/src/benchmarking/multi_payment.rs | 2 -- runtime/basilisk/src/lib.rs | 5 +++++ runtime/testing-basilisk/src/lib.rs | 5 +++++ 7 files changed, 14 insertions(+), 24 deletions(-) diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index c65282ed851..159cbdbec6e 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -7,7 +7,6 @@ pub const ALICE: [u8; 32] = [4u8; 32]; pub const BOB: [u8; 32] = [5u8; 32]; pub const CHARLIE: [u8; 32] = [6u8; 32]; pub const DAVE: [u8; 32] = [7u8; 32]; -pub const FALLBACK: [u8; 32] = [99u8; 32]; pub const BSX: Balance = 1_000_000_000_000; @@ -194,7 +193,7 @@ pub fn basilisk_ext() -> sp_io::TestExternalities { >::assimilate_storage( ¶chain_info::GenesisConfig { - parachain_id: 2000.into(), + parachain_id: 2000u32.into(), }, &mut t, ) @@ -220,7 +219,6 @@ pub fn basilisk_ext() -> sp_io::TestExternalities { pallet_transaction_multi_payment::GenesisConfig:: { currencies: vec![(1, Price::from(1))], - fallback_account: Some(FALLBACK.into()), account_currencies: vec![], } .assimilate_storage(&mut t) diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 6b1a3a70830..eb1cc66634f 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -34,6 +34,8 @@ pub fn basilisk_run_to_block(to: BlockNumber) { #[test] fn non_native_fee_payment_works() { + use pallet_transaction_multi_payment::TransactionMultiPaymentDataProvider; + TestNet::reset(); Basilisk::execute_with(|| { @@ -116,7 +118,7 @@ fn non_native_fee_payment_works() { asset_id: 1, native_fee_amount: 462_676_500_000, non_native_fee_amount: 265_222_898_276, - destination_account_id: FALLBACK.into(), + destination_account_id: basilisk_runtime::MultiTransactionPayment::get_fee_receiver(), } .into(), pallet_transaction_multi_payment::Event::CurrencySet { diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 7d8217f27e3..a0d2698a5d1 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -150,7 +150,6 @@ pub fn kusama_staging_parachain_config() -> Result { true, PARA_ID.into(), //technical committee - hex!["6d6f646c70792f74727372790000000000000000000000000000000000000000"].into(), // TREASURY - Fallback for multi tx payment ) }, // Bootnodes @@ -227,7 +226,6 @@ pub fn testnet_parachain_config() -> Result { vec![hex!["30035c21ba9eda780130f2029a80c3e962f56588bc04c36be95a225cb536fb55"].into()], //technical committee vec![hex!["30035c21ba9eda780130f2029a80c3e962f56588bc04c36be95a225cb536fb55"].into()], - hex!["30035c21ba9eda780130f2029a80c3e962f56588bc04c36be95a225cb536fb55"].into(), // SAME AS ROOT vec![], vec![(b"KSM".to_vec(), 1_000u128), (b"KUSD".to_vec(), 1_000u128)], vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], @@ -314,7 +312,6 @@ pub fn parachain_development_config() -> Result { get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Eve"), ], - get_account_id_from_seed::("Alice"), // SAME AS ROOT get_vesting_config_for_test(), vec![(b"KSM".to_vec(), 1_000u128), (b"KUSD".to_vec(), 1_000u128)], vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], @@ -381,7 +378,6 @@ pub fn rococo_parachain_config() -> Result { //technical committee vec![hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into()], // same as sudo vec![], - hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into(), // same as sudo vec![], vec![], vec![], @@ -459,7 +455,6 @@ pub fn karura_testnet_parachain_config() -> Result { //technical committee vec![hex!["0897746a8df7df1969bf5fdb4f048221109830994c8afa001e9454c525211404"].into()], // same as sudo vec![], - hex!["0897746a8df7df1969bf5fdb4f048221109830994c8afa001e9454c525211404"].into(), // same as sudo vec![], vec![], vec![], @@ -545,7 +540,6 @@ pub fn benchmarks_development_config() -> Result { get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Eve"), ], - get_account_id_from_seed::("Alice"), // SAME AS ROOT get_vesting_config_for_test(), vec![], vec![], @@ -624,7 +618,6 @@ pub fn local_parachain_config() -> Result { get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Eve"), ], - get_account_id_from_seed::("Alice"), // SAME AS ROOT get_vesting_config_for_test(), vec![(b"KSM".to_vec(), 1_000u128), (b"KUSD".to_vec(), 1_000u128)], vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], @@ -657,7 +650,6 @@ fn parachain_genesis( _endowed_accounts: Vec, _enable_println: bool, parachain_id: ParaId, - tx_fee_payment_account: AccountId, ) -> GenesisConfig { GenesisConfig { system: SystemConfig { @@ -712,7 +704,6 @@ fn parachain_genesis( }, multi_transaction_payment: MultiTransactionPaymentConfig { currencies: vec![], - fallback_account: Some(tx_fee_payment_account), account_currencies: vec![], }, tokens: TokensConfig { balances: vec![] }, @@ -762,7 +753,6 @@ fn testnet_parachain_genesis( parachain_id: ParaId, council_members: Vec, tech_committee_members: Vec, - tx_fee_payment_account: AccountId, vesting_list: Vec<(AccountId, BlockNumber, BlockNumber, u32, Balance)>, registered_assets: Vec<(Vec, Balance)>, // (Asset name, Existential deposit) accepted_assets: Vec<(AssetId, Price)>, // (Asset id, Fallback price) - asset which fee can be paid with @@ -814,7 +804,6 @@ fn testnet_parachain_genesis( }, multi_transaction_payment: MultiTransactionPaymentConfig { currencies: accepted_assets, - fallback_account: Some(tx_fee_payment_account), account_currencies: vec![], }, tokens: TokensConfig { diff --git a/node/src/testing_chain_spec.rs b/node/src/testing_chain_spec.rs index f285610becb..61f7eaf0e95 100644 --- a/node/src/testing_chain_spec.rs +++ b/node/src/testing_chain_spec.rs @@ -129,7 +129,6 @@ pub fn parachain_development_config() -> Result { get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Eve"), ], - get_account_id_from_seed::("Alice"), // SAME AS ROOT get_vesting_config_for_test(), vec![(b"KSM".to_vec(), 1_000u128), (b"KUSD".to_vec(), 1_000u128)], vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], @@ -208,7 +207,6 @@ pub fn local_parachain_config() -> Result { get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Eve"), ], - get_account_id_from_seed::("Alice"), // SAME AS ROOT get_vesting_config_for_test(), vec![(b"KSM".to_vec(), 1_000u128), (b"KUSD".to_vec(), 1_000u128)], vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], @@ -272,9 +270,7 @@ pub fn k8s_testnet_parachain_config() -> Result { PARA_ID.into(), //technical committee vec![hex!["a62f1daf8e490a1c0514c7d9f3a700999100f2aeb1d67a2ca68b241d3d6b3547"].into()], - // TREASURY - Fallback for multi tx payment vec![], - hex!["a62f1daf8e490a1c0514c7d9f3a700999100f2aeb1d67a2ca68b241d3d6b3547"].into(), get_vesting_config_for_test(), vec![(b"KSM".to_vec(), 1_000u128), (b"KUSD".to_vec(), 1_000u128)], vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))], @@ -339,7 +335,6 @@ pub fn moonbase_parachain_config() -> Result { //technical committee vec![hex!["9eaea650948488ccc720491b8e40be7436359dc4213a6487ba758ed496f9e53f"].into()], // same as sudo vec![], - hex!["9eaea650948488ccc720491b8e40be7436359dc4213a6487ba758ed496f9e53f"].into(), // same as sudo vec![], vec![], vec![], @@ -386,7 +381,6 @@ fn testnet_parachain_genesis( parachain_id: ParaId, council_members: Vec, tech_committee_members: Vec, - tx_fee_payment_account: AccountId, vesting_list: Vec<(AccountId, BlockNumber, BlockNumber, u32, Balance)>, registered_assets: Vec<(Vec, Balance)>, // (Asset name, Existential deposit) accepted_assets: Vec<(AssetId, Price)>, // (Asset id, Fallback price) - asset which fee can be paid with @@ -438,7 +432,6 @@ fn testnet_parachain_genesis( }, multi_transaction_payment: MultiTransactionPaymentConfig { currencies: accepted_assets, - fallback_account: Some(tx_fee_payment_account), account_currencies: vec![], }, tokens: TokensConfig { diff --git a/runtime/basilisk/src/benchmarking/multi_payment.rs b/runtime/basilisk/src/benchmarking/multi_payment.rs index a67da5fb686..6baeab6140c 100644 --- a/runtime/basilisk/src/benchmarking/multi_payment.rs +++ b/runtime/basilisk/src/benchmarking/multi_payment.rs @@ -62,8 +62,6 @@ runtime_benchmarks! { set_currency { let maker: AccountId = account("maker", 0, SEED); let caller: AccountId = account("caller", 0, SEED); - let fallback_account: AccountId = account("fallback_account", 1, SEED); - pallet_transaction_multi_payment::FallbackAccount::::put(fallback_account); let asset_id = register_asset(b"TST".to_vec(), 100u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index bea1a493c13..ea86bcaa6bf 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -341,6 +341,10 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } +parameter_types! { + pub TreasuryAccount: AccountId = Treasury::account_id(); +} + impl pallet_transaction_multi_payment::Config for Runtime { type Event = Event; type AcceptedCurrencyOrigin = EnsureSuperMajorityTechCommitteeOrRoot; @@ -350,6 +354,7 @@ impl pallet_transaction_multi_payment::Config for Runtime { type WithdrawFeeForSetCurrency = MultiPaymentCurrencySetFee; type WeightToFee = WeightToFee; type NativeAssetId = NativeAssetId; + type FeeReceiver = TreasuryAccount; } impl pallet_sudo::Config for Runtime { diff --git a/runtime/testing-basilisk/src/lib.rs b/runtime/testing-basilisk/src/lib.rs index 30a1bda3331..d5dd0a4fdec 100644 --- a/runtime/testing-basilisk/src/lib.rs +++ b/runtime/testing-basilisk/src/lib.rs @@ -295,6 +295,10 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } +parameter_types! { + pub TreasuryAccount: AccountId = Treasury::account_id(); +} + impl pallet_transaction_multi_payment::Config for Runtime { type Event = Event; type AcceptedCurrencyOrigin = EnsureSuperMajorityTechCommitteeOrRoot; @@ -304,6 +308,7 @@ impl pallet_transaction_multi_payment::Config for Runtime { type WithdrawFeeForSetCurrency = MultiPaymentCurrencySetFee; type WeightToFee = WeightToFee; type NativeAssetId = (); + type FeeReceiver = TreasuryAccount; } impl pallet_sudo::Config for Runtime { From dd12d7851673cf00301d53062a77935a426594a5 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 14 Jun 2022 16:27:05 +0200 Subject: [PATCH 14/17] bump spec_version --- runtime/basilisk/src/lib.rs | 2 +- runtime/testing-basilisk/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index ea86bcaa6bf..524143abab5 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 51, + spec_version: 52, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/testing-basilisk/src/lib.rs b/runtime/testing-basilisk/src/lib.rs index d5dd0a4fdec..1770de9e28f 100644 --- a/runtime/testing-basilisk/src/lib.rs +++ b/runtime/testing-basilisk/src/lib.rs @@ -113,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testing-basilisk"), impl_name: create_runtime_str!("testing-basilisk"), authoring_version: 1, - spec_version: 51, + spec_version: 52, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 981e3f4026e4bd6dc6ce6b097f2fc2ed4c0898af Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 16 Jun 2022 10:58:28 +0200 Subject: [PATCH 15/17] bump pallet versions due to orml-token update --- Cargo.lock | 14 +++++++------- integration-tests/Cargo.toml | 2 +- pallets/duster/Cargo.toml | 2 +- pallets/exchange/Cargo.toml | 2 +- pallets/exchange/benchmarking/Cargo.toml | 2 +- pallets/lbp/Cargo.toml | 2 +- pallets/liquidity-mining/Cargo.toml | 2 +- pallets/offchain-duster/Cargo.toml | 2 +- pallets/xyk/Cargo.toml | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc7e6cfb2ec..af2cc5c2ea6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5612,7 +5612,7 @@ dependencies = [ [[package]] name = "pallet-duster" -version = "2.3.0" +version = "2.3.1" dependencies = [ "frame-benchmarking", "frame-support", @@ -5677,7 +5677,7 @@ dependencies = [ [[package]] name = "pallet-exchange" -version = "5.3.2" +version = "5.3.3" dependencies = [ "frame-support", "frame-system", @@ -5701,7 +5701,7 @@ dependencies = [ [[package]] name = "pallet-exchange-benchmarking" -version = "3.3.12" +version = "3.3.13" dependencies = [ "frame-benchmarking", "frame-support", @@ -5817,7 +5817,7 @@ dependencies = [ [[package]] name = "pallet-lbp" -version = "4.4.2" +version = "4.4.3" dependencies = [ "frame-benchmarking", "frame-support", @@ -5870,7 +5870,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining" -version = "1.2.3" +version = "1.2.4" dependencies = [ "frame-support", "frame-system", @@ -6500,7 +6500,7 @@ dependencies = [ [[package]] name = "pallet-xyk" -version = "3.6.2" +version = "3.6.3" dependencies = [ "frame-benchmarking", "frame-support", @@ -8690,7 +8690,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "0.3.0" +version = "0.3.1" dependencies = [ "basilisk-runtime", "cumulus-pallet-aura-ext", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index c37371b8376..15e0a17c154 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "0.3.0" +version = "0.3.1" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/duster/Cargo.toml b/pallets/duster/Cargo.toml index d1e26cc3c27..e69ec014262 100644 --- a/pallets/duster/Cargo.toml +++ b/pallets/duster/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-duster" -version = "2.3.0" +version = "2.3.1" description = "Account duster" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/exchange/Cargo.toml b/pallets/exchange/Cargo.toml index 746cff70bee..0d37ee34322 100644 --- a/pallets/exchange/Cargo.toml +++ b/pallets/exchange/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-exchange" -version = "5.3.2" +version = "5.3.3" description = "Exchange Module" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/exchange/benchmarking/Cargo.toml b/pallets/exchange/benchmarking/Cargo.toml index c54889bb683..5f39a3dfb10 100644 --- a/pallets/exchange/benchmarking/Cargo.toml +++ b/pallets/exchange/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-exchange-benchmarking" -version = "3.3.12" +version = "3.3.13" description = "Exchange Benchmarking Module" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/lbp/Cargo.toml b/pallets/lbp/Cargo.toml index fcf0d9c9cc3..60b1c2d1d77 100644 --- a/pallets/lbp/Cargo.toml +++ b/pallets/lbp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-lbp" -version = "4.4.2" +version = "4.4.3" description = "HydraDX Liquidity Bootstrapping Pool Pallet" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/liquidity-mining/Cargo.toml b/pallets/liquidity-mining/Cargo.toml index b93588cd146..3bda31d050b 100644 --- a/pallets/liquidity-mining/Cargo.toml +++ b/pallets/liquidity-mining/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-liquidity-mining" -version = "1.2.3" +version = "1.2.4" description = "Liquidity mining" authors = ["GalacticCouncil"] edition = "2018" diff --git a/pallets/offchain-duster/Cargo.toml b/pallets/offchain-duster/Cargo.toml index da11c137430..8c1c5c3f115 100644 --- a/pallets/offchain-duster/Cargo.toml +++ b/pallets/offchain-duster/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-offchain-duster" -version = "2.0.5" +version = "2.0.6" description = "Account duster offchain worker" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/xyk/Cargo.toml b/pallets/xyk/Cargo.toml index 66903e45143..4fbba9ca841 100644 --- a/pallets/xyk/Cargo.toml +++ b/pallets/xyk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-xyk' -version = '3.6.2' +version = '3.6.3' description = 'XYK automated market maker' authors = ['GalacticCouncil'] edition = '2021' From 052ed50213cb89ffa715d1670ed2b1565dc935a5 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 16 Jun 2022 11:49:57 +0200 Subject: [PATCH 16/17] bump versions - again --- pallets/liquidity-mining/benchmarking/Cargo.toml | 2 +- runtime/common/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/liquidity-mining/benchmarking/Cargo.toml b/pallets/liquidity-mining/benchmarking/Cargo.toml index 1fd02f0e64b..65d4d813eac 100644 --- a/pallets/liquidity-mining/benchmarking/Cargo.toml +++ b/pallets/liquidity-mining/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-liquidity-mining-benchmarking" -version = "1.0.3" +version = "1.0.4" description = "Liquidity Mining Benchmarking Module" authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 4501472b2e3..d35e64e1c84 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "common-runtime" -version = "1.9.2" +version = "1.9.3" authors = ["GalacticCouncil"] edition = "2021" homepage = "https://github.com/galacticcouncil/Basilisk-node" From 0ebdb1ba8b60f2a2385d25793eae3b3fb8f69da4 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 16 Jun 2022 12:21:41 +0200 Subject: [PATCH 17/17] update lock file --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af2cc5c2ea6..127a77ec632 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "common-runtime" -version = "1.9.2" +version = "1.9.3" dependencies = [ "frame-support", "frame-system", @@ -5895,7 +5895,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining-benchmarking" -version = "1.0.3" +version = "1.0.4" dependencies = [ "frame-benchmarking", "frame-support",