From 4020ff64cfcad3dcc7f4f090cc9bc7699a78cc9c Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Thu, 20 Oct 2022 18:32:11 +0000 Subject: [PATCH 1/3] build: upgrade to polkadot-v0.9.30 Signed-off-by: Yaroslav Bolyukin --- Cargo.dev.toml | 130 +++++------ asset-registry/Cargo.toml | 38 ++-- asset-registry/src/lib.rs | 4 +- asset-registry/src/mock/para.rs | 58 ++--- asset-registry/src/mock/relay.rs | 34 +-- asset-registry/src/tests.rs | 70 +++--- auction/Cargo.toml | 12 +- auction/src/lib.rs | 2 +- auction/src/mock.rs | 8 +- auction/src/tests.rs | 12 +- authority/Cargo.toml | 16 +- authority/src/lib.rs | 37 ++-- authority/src/mock.rs | 40 ++-- authority/src/tests.rs | 288 +++++++++++++++---------- bencher/Cargo.toml | 24 +-- bencher/test/Cargo.toml | 12 +- bencher/test/src/benches.rs | 2 +- bencher/test/src/mock.rs | 6 +- bencher/test/src/tests.rs | 2 +- benchmarking/Cargo.toml | 18 +- benchmarking/src/lib.rs | 10 +- benchmarking/src/tests.rs | 8 +- currencies/Cargo.toml | 14 +- currencies/src/mock.rs | 10 +- currencies/src/tests.rs | 14 +- gradually-update/Cargo.toml | 12 +- gradually-update/src/lib.rs | 4 +- gradually-update/src/mock.rs | 8 +- gradually-update/src/tests.rs | 143 ++++++++---- nft/Cargo.toml | 12 +- nft/src/mock.rs | 6 +- oracle/Cargo.toml | 14 +- oracle/rpc/Cargo.toml | 6 +- oracle/rpc/runtime-api/Cargo.toml | 4 +- oracle/src/lib.rs | 5 +- oracle/src/mock.rs | 8 +- oracle/src/tests.rs | 66 +++--- payments/Cargo.toml | 12 +- payments/src/lib.rs | 4 +- payments/src/mock.rs | 12 +- payments/src/tests.rs | 111 +++++----- rewards/Cargo.toml | 14 +- rewards/src/mock.rs | 6 +- tokens/Cargo.toml | 16 +- tokens/rpc/Cargo.toml | 12 +- tokens/rpc/runtime-api/Cargo.toml | 6 +- tokens/src/lib.rs | 7 +- tokens/src/mock.rs | 12 +- tokens/src/tests.rs | 30 +-- tokens/src/tests_events.rs | 52 ++--- tokens/src/tests_multicurrency.rs | 44 ++-- traits/Cargo.toml | 10 +- unknown-tokens/Cargo.toml | 14 +- unknown-tokens/src/lib.rs | 2 +- unknown-tokens/src/mock.rs | 8 +- unknown-tokens/src/tests.rs | 10 +- utilities/Cargo.toml | 10 +- utilities/src/lib.rs | 2 +- vesting/Cargo.toml | 14 +- vesting/src/lib.rs | 4 +- vesting/src/mock.rs | 18 +- vesting/src/tests.rs | 126 +++++++---- weight-meter/Cargo.toml | 14 +- weight-meter/src/mock.rs | 8 +- weight-meter/src/tests.rs | 16 +- xcm-support/Cargo.toml | 10 +- xcm/Cargo.toml | 12 +- xcm/src/lib.rs | 4 +- xtokens/Cargo.toml | 40 ++-- xtokens/src/lib.rs | 12 +- xtokens/src/mock/para.rs | 52 ++--- xtokens/src/mock/para_relative_view.rs | 52 ++--- xtokens/src/mock/para_teleport.rs | 52 ++--- xtokens/src/mock/relay.rs | 34 +-- xtokens/src/tests.rs | 18 +- 75 files changed, 1110 insertions(+), 927 deletions(-) diff --git a/Cargo.dev.toml b/Cargo.dev.toml index ae0b53161..5428a6949 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -32,72 +32,72 @@ resolver = "2" split-debuginfo = "unpacked" [patch.'https://github.com/paritytech/substrate'] -frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -frame-support = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -frame-system = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-babe = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-session = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -pallet-transaction-payment = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sc-executor = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sc-utils = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-api = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-consensus-slots = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-core = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-io = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-session = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-staking = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-std = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-storage = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-trie = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-version = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-tracing = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech//substrate", rev = "7c4ac358c29c9748c6e8ed4e05910504cd01a3b9" } +frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +frame-support = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +frame-system = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-babe = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-session = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +pallet-transaction-payment = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sc-executor = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sc-utils = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-api = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-consensus-slots = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-core = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-io = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-session = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-staking = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-std = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-storage = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-trie = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-version = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-tracing = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech//substrate", rev = "a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" } [patch.'https://github.com/paritytech/cumulus'] -cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "2fa95572487cfcf8dbe6941bf93545c39d47f784" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "2fa95572487cfcf8dbe6941bf93545c39d47f784" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "2fa95572487cfcf8dbe6941bf93545c39d47f784" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "2fa95572487cfcf8dbe6941bf93545c39d47f784" } -parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "2fa95572487cfcf8dbe6941bf93545c39d47f784" } +cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "5fc9081ff72bfe2bc2f013fc7f83208a86e6826a" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "5fc9081ff72bfe2bc2f013fc7f83208a86e6826a" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "5fc9081ff72bfe2bc2f013fc7f83208a86e6826a" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "5fc9081ff72bfe2bc2f013fc7f83208a86e6826a" } +parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "5fc9081ff72bfe2bc2f013fc7f83208a86e6826a" } [patch.'https://github.com/paritytech/polkadot'] -pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -xcm = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } -xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "94078b44fb6c9767bf60ffcaaa3be40681be5a76" } +pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +xcm = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } +xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "064536093f5ff70d867f4bbce8d4c41a406d317a" } diff --git a/asset-registry/Cargo.toml b/asset-registry/Cargo.toml index 0d069e18c..27eaa1031 100644 --- a/asset-registry/Cargo.toml +++ b/asset-registry/Cargo.toml @@ -13,37 +13,37 @@ serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } # substrate -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } # polkadot -pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } # orml orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] # substrate -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # polkadot -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } -xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # orml orml-tokens = { path = "../tokens" } diff --git a/asset-registry/src/lib.rs b/asset-registry/src/lib.rs index f3a8342ab..4086f19b6 100644 --- a/asset-registry/src/lib.rs +++ b/asset-registry/src/lib.rs @@ -34,7 +34,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Additional non-standard metadata to store for each asset type CustomMetadata: Parameter + Member + TypeInfo; @@ -43,7 +43,7 @@ pub mod module { type AssetId: Parameter + Member + Default + TypeInfo + MaybeSerializeDeserialize; /// Checks that an origin has the authority to register/update an asset - type AuthorityOrigin: EnsureOriginWithArg>; + type AuthorityOrigin: EnsureOriginWithArg>; /// A filter ran upon metadata registration that assigns an is and /// potentially modifies the supplied metadata. diff --git a/asset-registry/src/mock/para.rs b/asset-registry/src/mock/para.rs index 5769d9b7e..51ec51eb8 100644 --- a/asset-registry/src/mock/para.rs +++ b/asset-registry/src/mock/para.rs @@ -37,8 +37,8 @@ use xcm_executor::{Config, XcmExecutor}; pub type AccountId = AccountId32; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -46,7 +46,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -66,7 +66,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = System; @@ -86,7 +86,7 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -116,10 +116,10 @@ ord_parameter_types! { } pub struct AssetAuthority; -impl EnsureOriginWithArg> for AssetAuthority { +impl EnsureOriginWithArg> for AssetAuthority { type Success = (); - fn try_origin(origin: Origin, asset_id: &Option) -> Result { + fn try_origin(origin: RuntimeOrigin, asset_id: &Option) -> Result { match asset_id { // We mock an edge case where the asset_id 2 requires a special origin check. Some(2) => EnsureSignedBy::::try_origin(origin.clone()) @@ -138,7 +138,7 @@ impl EnsureOriginWithArg> for AssetAuthority { } impl orml_asset_registry::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type AssetId = u32; type AuthorityOrigin = AssetAuthority; @@ -157,7 +157,7 @@ impl parachain_info::Config for Runtime {} parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayNetwork: NetworkId = NetworkId::Kusama; - pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } @@ -168,11 +168,11 @@ pub type LocationToAccountId = ( ); pub type XcmOriginToCallOrigin = ( - SovereignSignedViaLocation, - RelayChainAsNative, - SiblingParachainAsNative, - SignedAccountId32AsNative, - XcmPassthrough, + SovereignSignedViaLocation, + RelayChainAsNative, + SiblingParachainAsNative, + SignedAccountId32AsNative, + XcmPassthrough, ); pub type LocalAssetTransactor = MultiCurrencyAdapter< @@ -221,7 +221,7 @@ impl FixedConversionRateProvider for MyFixedConversionRateProvider { pub struct XcmConfig; impl Config for XcmConfig { - type Call = Call; + type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; @@ -229,7 +229,7 @@ impl Config for XcmConfig { type IsTeleporter = (); type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type Trader = AssetRegistryWeightTrader; type ResponseHandler = (); type AssetTrap = PolkadotXcm; @@ -248,7 +248,7 @@ impl GetChannelInfo for ChannelInfo { } impl cumulus_pallet_xcmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ChannelInfo = ChannelInfo; type VersionWrapper = (); @@ -259,31 +259,31 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { } impl cumulus_pallet_dmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ExecuteOverweightOrigin = EnsureRoot; } impl cumulus_pallet_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { - type Event = Event; - type SendXcmOrigin = EnsureXcmOrigin; + type RuntimeEvent = RuntimeEvent; + type SendXcmOrigin = EnsureXcmOrigin; type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; + type ExecuteXcmOrigin = EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type LocationInverter = LocationInverter; - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } @@ -327,7 +327,7 @@ parameter_type_with_key! { } impl orml_xtokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; @@ -336,7 +336,7 @@ impl orml_xtokens::Config for Runtime { type MultiLocationsFilter = ParentOrParachains; type MinXcmFee = ParachainMinFee; type XcmExecutor = XcmExecutor; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type BaseXcmWeight = ConstU64<100_000_000>; type LocationInverter = LocationInverter; type MaxAssetsForTransfer = MaxAssetsForTransfer; @@ -344,7 +344,7 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } diff --git a/asset-registry/src/mock/relay.rs b/asset-registry/src/mock/relay.rs index 5f7f18bac..f6ec6f367 100644 --- a/asset-registry/src/mock/relay.rs +++ b/asset-registry/src/mock/relay.rs @@ -20,8 +20,8 @@ pub type AccountId = AccountId32; pub type Balance = u128; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -29,7 +29,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -49,7 +49,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = System; @@ -79,9 +79,9 @@ pub type LocalAssetTransactor = XcmCurrencyAdapter, SovereignAccountOf, AccountId, ()>; type LocalOriginConverter = ( - SovereignSignedViaLocation, - ChildParachainAsNative, - SignedAccountId32AsNative, + SovereignSignedViaLocation, + ChildParachainAsNative, + SignedAccountId32AsNative, ); pub type XcmRouter = super::RelayChainXcmRouter; @@ -89,7 +89,7 @@ pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom pub struct XcmConfig; impl Config for XcmConfig { - type Call = Call; + type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = LocalOriginConverter; @@ -97,7 +97,7 @@ impl Config for XcmConfig { type IsTeleporter = (); type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type Trader = UsingComponents, KsmLocation, AccountId, Balances, ()>; type ResponseHandler = (); type AssetTrap = (); @@ -105,28 +105,28 @@ impl Config for XcmConfig { type SubscriptionService = XcmPallet; } -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { - type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type RuntimeEvent = RuntimeEvent; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally... - type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; + type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type LocationInverter = LocationInverter; - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } impl ump::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type UmpSink = ump::XcmSink, Runtime>; type FirstMessageFactorPercent = ConstU64<100>; type ExecuteOverweightOrigin = EnsureRoot; diff --git a/asset-registry/src/tests.rs b/asset-registry/src/tests.rs index c564501c0..a56999888 100644 --- a/asset-registry/src/tests.rs +++ b/asset-registry/src/tests.rs @@ -2,9 +2,9 @@ use super::*; use crate as orml_asset_registry; -use crate::tests::para::{AdminAssetTwo, AssetRegistry, CustomMetadata, Origin, Tokens, TreasuryAccount}; +use crate::tests::para::{AdminAssetTwo, AssetRegistry, CustomMetadata, RuntimeOrigin, Tokens, TreasuryAccount}; use frame_support::{assert_noop, assert_ok}; -use mock::{para::Call, *}; +use mock::{para::RuntimeCall, *}; use orml_traits::MultiCurrency; use polkadot_parachain::primitives::Sibling; @@ -92,12 +92,12 @@ fn send_self_parachain_asset_to_sibling() { let mut metadata = dummy_metadata(); ParaB::execute_with(|| { - AssetRegistry::register_asset(Origin::root(), metadata.clone(), None).unwrap(); + AssetRegistry::register_asset(RuntimeOrigin::root(), metadata.clone(), None).unwrap(); }); ParaA::execute_with(|| { metadata.location = Some(MultiLocation::new(0, X1(GeneralKey(vec![0].try_into().unwrap()))).into()); - AssetRegistry::register_asset(Origin::root(), metadata, None).unwrap(); + AssetRegistry::register_asset(RuntimeOrigin::root(), metadata, None).unwrap(); assert_ok!(ParaTokens::deposit(CurrencyId::RegisteredAsset(1), &ALICE, 1_000)); @@ -146,7 +146,7 @@ fn send_sibling_asset_to_non_reserve_sibling() { ParaA::execute_with(|| { AssetRegistry::register_asset( - Origin::root(), + RuntimeOrigin::root(), AssetMetadata { location: Some(MultiLocation::new(1, X2(Parachain(2), GeneralKey(vec![0].try_into().unwrap()))).into()), ..dummy_metadata() @@ -159,7 +159,7 @@ fn send_sibling_asset_to_non_reserve_sibling() { ParaB::execute_with(|| { AssetRegistry::register_asset( - Origin::root(), + RuntimeOrigin::root(), AssetMetadata { location: Some(MultiLocation::new(0, X1(GeneralKey(vec![0].try_into().unwrap()))).into()), ..dummy_metadata() @@ -176,7 +176,7 @@ fn send_sibling_asset_to_non_reserve_sibling() { ParaC::execute_with(|| { AssetRegistry::register_asset( - Origin::root(), + RuntimeOrigin::root(), AssetMetadata { location: Some(MultiLocation::new(1, X2(Parachain(2), GeneralKey(vec![0].try_into().unwrap()))).into()), ..dummy_metadata() @@ -240,8 +240,8 @@ fn test_sequential_id_normal_behavior() { location: Some(MultiLocation::new(1, X2(Parachain(1), GeneralKey(vec![1].try_into().unwrap()))).into()), ..dummy_metadata() }; - AssetRegistry::register_asset(Origin::root(), metadata1.clone(), None).unwrap(); - AssetRegistry::register_asset(Origin::root(), metadata2.clone(), None).unwrap(); + AssetRegistry::register_asset(RuntimeOrigin::root(), metadata1.clone(), None).unwrap(); + AssetRegistry::register_asset(RuntimeOrigin::root(), metadata2.clone(), None).unwrap(); assert_eq!(AssetRegistry::metadata(1).unwrap(), metadata1); assert_eq!(AssetRegistry::metadata(2).unwrap(), metadata2); @@ -253,9 +253,13 @@ fn test_sequential_id_with_invalid_id_returns_error() { TestNet::reset(); ParaA::execute_with(|| { - assert_ok!(AssetRegistry::register_asset(Origin::root(), dummy_metadata(), Some(1))); + assert_ok!(AssetRegistry::register_asset( + RuntimeOrigin::root(), + dummy_metadata(), + Some(1) + )); assert_noop!( - AssetRegistry::register_asset(Origin::root(), dummy_metadata(), Some(1)), + AssetRegistry::register_asset(RuntimeOrigin::root(), dummy_metadata(), Some(1)), Error::::InvalidAssetId ); }); @@ -269,7 +273,7 @@ fn test_fixed_rate_asset_trader() { let metadata = dummy_metadata(); ParaB::execute_with(|| { - AssetRegistry::register_asset(Origin::root(), metadata.clone(), None).unwrap(); + AssetRegistry::register_asset(RuntimeOrigin::root(), metadata.clone(), None).unwrap(); }); ParaA::execute_with(|| { @@ -277,7 +281,7 @@ fn test_fixed_rate_asset_trader() { location: Some(MultiLocation::new(0, X1(GeneralKey(vec![0].try_into().unwrap()))).into()), ..metadata.clone() }; - AssetRegistry::register_asset(Origin::root(), para_a_metadata, None).unwrap(); + AssetRegistry::register_asset(RuntimeOrigin::root(), para_a_metadata, None).unwrap(); assert_ok!(ParaTokens::deposit(CurrencyId::RegisteredAsset(1), &ALICE, 1_000)); @@ -317,7 +321,7 @@ fn test_fixed_rate_asset_trader() { // now double the fee rate AssetRegistry::update_asset( - Origin::root(), + RuntimeOrigin::root(), 1, None, None, @@ -376,13 +380,17 @@ fn test_register_duplicate_location_returns_error() { ParaA::execute_with(|| { let metadata = dummy_metadata(); - assert_ok!(AssetRegistry::register_asset(Origin::root(), metadata.clone(), None)); - let register_asset = Call::AssetRegistry(crate::Call::::register_asset { + assert_ok!(AssetRegistry::register_asset( + RuntimeOrigin::root(), + metadata.clone(), + None + )); + let register_asset = RuntimeCall::AssetRegistry(crate::Call::::register_asset { metadata: metadata.clone(), asset_id: None, }); assert_noop!( - register_asset.dispatch(Origin::root()), + register_asset.dispatch(RuntimeOrigin::root()), Error::::ConflictingLocation ); }); @@ -393,7 +401,11 @@ fn test_register_duplicate_asset_id_returns_error() { TestNet::reset(); ParaA::execute_with(|| { - assert_ok!(AssetRegistry::register_asset(Origin::root(), dummy_metadata(), Some(1))); + assert_ok!(AssetRegistry::register_asset( + RuntimeOrigin::root(), + dummy_metadata(), + Some(1) + )); assert_noop!( AssetRegistry::do_register_asset_without_asset_processor(dummy_metadata(), 1), Error::::ConflictingAssetId @@ -408,7 +420,7 @@ fn test_update_metadata_works() { ParaA::execute_with(|| { let old_metadata = dummy_metadata(); assert_ok!(AssetRegistry::register_asset( - Origin::root(), + RuntimeOrigin::root(), old_metadata.clone(), None )); @@ -424,7 +436,7 @@ fn test_update_metadata_works() { }, }; assert_ok!(AssetRegistry::update_asset( - Origin::root(), + RuntimeOrigin::root(), 1, Some(new_metadata.decimals), Some(new_metadata.name.clone()), @@ -452,13 +464,13 @@ fn test_update_metadata_fails_with_unknown_asset() { ParaA::execute_with(|| { let old_metadata = dummy_metadata(); assert_ok!(AssetRegistry::register_asset( - Origin::root(), + RuntimeOrigin::root(), old_metadata.clone(), None )); assert_noop!( - AssetRegistry::update_asset(Origin::root(), 4, None, None, None, None, None, None,), + AssetRegistry::update_asset(RuntimeOrigin::root(), 4, None, None, None, None, None, None,), Error::::AssetNotFound ); }); @@ -473,10 +485,10 @@ fn test_existential_deposits() { existential_deposit: 100, ..dummy_metadata() }; - assert_ok!(AssetRegistry::register_asset(Origin::root(), metadata, None)); + assert_ok!(AssetRegistry::register_asset(RuntimeOrigin::root(), metadata, None)); assert_ok!(Tokens::set_balance( - Origin::root(), + RuntimeOrigin::root(), ALICE, CurrencyId::RegisteredAsset(1), 1_000, @@ -506,7 +518,11 @@ fn test_asset_authority() { let metadata = dummy_metadata(); // Assert that root can register an asset with id 1 - assert_ok!(AssetRegistry::register_asset(Origin::root(), metadata.clone(), Some(1))); + assert_ok!(AssetRegistry::register_asset( + RuntimeOrigin::root(), + metadata.clone(), + Some(1) + )); // Assert that only Account42 can register asset with id 42 let metadata = AssetMetadata { @@ -516,12 +532,12 @@ fn test_asset_authority() { // It fails when signed with root... assert_noop!( - AssetRegistry::register_asset(Origin::root(), metadata.clone(), Some(2)), + AssetRegistry::register_asset(RuntimeOrigin::root(), metadata.clone(), Some(2)), BadOrigin ); // It works when signed with the right account assert_ok!(AssetRegistry::register_asset( - Origin::signed(AdminAssetTwo::get()), + RuntimeOrigin::signed(AdminAssetTwo::get()), metadata, Some(2) )); diff --git a/auction/Cargo.toml b/auction/Cargo.toml index 5600f4e36..8ff6100ce 100644 --- a/auction/Cargo.toml +++ b/auction/Cargo.toml @@ -12,16 +12,16 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/auction/src/lib.rs b/auction/src/lib.rs index 278edd146..c35db9cbc 100644 --- a/auction/src/lib.rs +++ b/auction/src/lib.rs @@ -35,7 +35,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The balance type for bidding. type Balance: Parameter diff --git a/auction/src/mock.rs b/auction/src/mock.rs index d115118f7..081db9198 100644 --- a/auction/src/mock.rs +++ b/auction/src/mock.rs @@ -19,16 +19,16 @@ pub type BlockNumber = u64; pub type AuctionId = u64; impl frame_system::Config for Runtime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -71,7 +71,7 @@ impl AuctionHandler for Handler { } impl Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type AuctionId = AuctionId; type Handler = Handler; diff --git a/auction/src/tests.rs b/auction/src/tests.rs index 89edffcaf..ed79b6362 100644 --- a/auction/src/tests.rs +++ b/auction/src/tests.rs @@ -4,7 +4,7 @@ use super::*; use frame_support::{assert_noop, assert_ok}; -use mock::{Event, *}; +use mock::*; #[test] fn new_auction_should_work() { @@ -67,8 +67,8 @@ fn bid_should_work() { end: Some(5) }) ); - assert_ok!(AuctionModule::bid(Origin::signed(ALICE), 0, 20)); - System::assert_last_event(Event::AuctionModule(crate::Event::Bid { + assert_ok!(AuctionModule::bid(RuntimeOrigin::signed(ALICE), 0, 20)); + System::assert_last_event(RuntimeEvent::AuctionModule(crate::Event::Bid { auction_id: 0, bidder: ALICE, amount: 20, @@ -90,15 +90,15 @@ fn bid_should_fail() { assert_ok!(AuctionModule::new_auction(10, Some(100)), 0); assert_ok!(AuctionModule::new_auction(0, Some(100)), 1); assert_noop!( - AuctionModule::bid(Origin::signed(ALICE), 0, 20), + AuctionModule::bid(RuntimeOrigin::signed(ALICE), 0, 20), Error::::AuctionNotStarted ); assert_noop!( - AuctionModule::bid(Origin::signed(BOB), 1, 20), + AuctionModule::bid(RuntimeOrigin::signed(BOB), 1, 20), Error::::BidNotAccepted, ); assert_noop!( - AuctionModule::bid(Origin::signed(ALICE), 1, 0), + AuctionModule::bid(RuntimeOrigin::signed(ALICE), 1, 0), Error::::InvalidBidPrice, ); }); diff --git a/authority/Cargo.toml b/authority/Cargo.toml index 8613da1f9..6d8b44268 100644 --- a/authority/Cargo.toml +++ b/authority/Cargo.toml @@ -12,16 +12,16 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/authority/src/lib.rs b/authority/src/lib.rs index a314d5d54..c895fd4ec 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -22,12 +22,12 @@ use codec::MaxEncodedLen; use frame_support::{ dispatch::PostDispatchInfo, + dispatch::{DispatchClass, GetDispatchInfo, Pays}, pallet_prelude::*, traits::{ schedule::{DispatchTime, Named as ScheduleNamed, Priority}, EitherOfDiverse, EnsureOrigin, Get, IsType, OriginTrait, }, - weights::{DispatchClass, GetDispatchInfo, Pays}, }; use frame_system::{pallet_prelude::*, EnsureRoot, EnsureSigned}; use scale_info::TypeInfo; @@ -127,35 +127,35 @@ pub mod module { /// Origin for the authority module. #[pallet::origin] pub type Origin = DelayedOrigin<::BlockNumber, ::PalletsOrigin>; - pub(crate) type CallOf = ::Call; + pub(crate) type CallOf = ::RuntimeCall; #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The outer origin type. - type Origin: From::PalletsOrigin>> - + IsType<::Origin> + type RuntimeOrigin: From::PalletsOrigin>> + + IsType<::RuntimeOrigin> + OriginTrait; /// The caller origin, overarching type of all pallets origins. - type PalletsOrigin: Parameter + Into<::Origin>; + type PalletsOrigin: Parameter + Into<::RuntimeOrigin>; /// The aggregated call type. - type Call: Parameter - + Dispatchable::Origin, PostInfo = PostDispatchInfo> + type RuntimeCall: Parameter + + Dispatchable::RuntimeOrigin, PostInfo = PostDispatchInfo> + GetDispatchInfo; /// The Scheduler. - type Scheduler: ScheduleNamed::Call, Self::PalletsOrigin>; + type Scheduler: ScheduleNamed::RuntimeCall, Self::PalletsOrigin>; /// The type represent origin that can be dispatched by other origins. - type AsOriginId: Parameter + AsOriginId<::Origin, Self::PalletsOrigin>; + type AsOriginId: Parameter + AsOriginId<::RuntimeOrigin, Self::PalletsOrigin>; /// Additional permission config. type AuthorityConfig: AuthorityConfig< - ::Origin, + ::RuntimeOrigin, Self::PalletsOrigin, Self::BlockNumber, >; @@ -277,14 +277,15 @@ pub mod module { DispatchTime::After(x) => x, }; let schedule_origin = if with_delayed_origin { - let origin: ::Origin = From::from(origin); - let origin: ::Origin = From::from(DelayedOrigin:: { - delay, - origin: Box::new(origin.caller().clone()), - }); + let origin: ::RuntimeOrigin = From::from(origin); + let origin: ::RuntimeOrigin = + From::from(DelayedOrigin:: { + delay, + origin: Box::new(origin.caller().clone()), + }); origin } else { - ::Origin::from(origin) + ::RuntimeOrigin::from(origin) }; let pallets_origin = schedule_origin.caller().clone(); @@ -428,7 +429,7 @@ pub mod module { ensure!(who == caller, Error::::TriggerCallNotPermitted); } ensure!( - call_weight_bound >= call.get_dispatch_info().weight, + call_weight_bound.all_gte(call.get_dispatch_info().weight), Error::::WrongCallWeightBound ); let result = call.dispatch(OriginFor::::root()); diff --git a/authority/src/mock.rs b/authority/src/mock.rs index c34890c26..760e3ba05 100644 --- a/authority/src/mock.rs +++ b/authority/src/mock.rs @@ -28,16 +28,16 @@ parameter_types! { } impl frame_system::Config for Runtime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -60,10 +60,10 @@ parameter_types! { pub const NoPreimagePostponement: Option = Some(10); } impl pallet_scheduler::Config for Runtime { - type Event = Event; - type Origin = Origin; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type PalletsOrigin = OriginCaller; - type Call = Call; + type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = (); @@ -82,8 +82,8 @@ pub enum MockAsOriginId { pub struct AuthorityConfigImpl; -impl AuthorityConfig for AuthorityConfigImpl { - fn check_schedule_dispatch(origin: Origin, _priority: Priority) -> DispatchResult { +impl AuthorityConfig for AuthorityConfigImpl { + fn check_schedule_dispatch(origin: RuntimeOrigin, _priority: Priority) -> DispatchResult { let origin: Result, _> = origin.into(); match origin { Ok(frame_system::RawOrigin::Root) @@ -93,14 +93,14 @@ impl AuthorityConfig for AuthorityConfigImpl } } fn check_fast_track_schedule( - origin: Origin, + origin: RuntimeOrigin, _initial_origin: &OriginCaller, _new_delay: BlockNumber, ) -> DispatchResult { ensure_root(origin)?; Ok(()) } - fn check_delay_schedule(origin: Origin, initial_origin: &OriginCaller) -> DispatchResult { + fn check_delay_schedule(origin: RuntimeOrigin, initial_origin: &OriginCaller) -> DispatchResult { ensure_root(origin.clone()).or_else(|_| { if origin.caller() == initial_origin { Ok(()) @@ -109,7 +109,7 @@ impl AuthorityConfig for AuthorityConfigImpl } }) } - fn check_cancel_schedule(origin: Origin, initial_origin: &OriginCaller) -> DispatchResult { + fn check_cancel_schedule(origin: RuntimeOrigin, initial_origin: &OriginCaller) -> DispatchResult { ensure_root(origin.clone()).or_else(|_| { if origin.caller() == initial_origin { Ok(()) @@ -120,18 +120,18 @@ impl AuthorityConfig for AuthorityConfigImpl } } -impl AsOriginId for MockAsOriginId { +impl AsOriginId for MockAsOriginId { fn into_origin(self) -> OriginCaller { match self { - MockAsOriginId::Root => Origin::root().caller().clone(), - MockAsOriginId::Account1 => Origin::signed(1).caller().clone(), - MockAsOriginId::Account2 => Origin::signed(2).caller().clone(), + MockAsOriginId::Root => RuntimeOrigin::root().caller().clone(), + MockAsOriginId::Account1 => RuntimeOrigin::signed(1).caller().clone(), + MockAsOriginId::Account2 => RuntimeOrigin::signed(2).caller().clone(), } } - fn check_dispatch_from(&self, origin: Origin) -> DispatchResult { + fn check_dispatch_from(&self, origin: RuntimeOrigin) -> DispatchResult { ensure_root(origin.clone()).or_else(|_| { if let OriginCaller::Authority(ref sign) = origin.caller() { - if sign.origin == Box::new(Origin::root().caller().clone()) { + if sign.origin == Box::new(RuntimeOrigin::root().caller().clone()) { return Ok(()); } else { return Err(BadOrigin.into()); @@ -153,11 +153,11 @@ impl AsOriginId for MockAsOriginId { } impl Config for Runtime { - type Event = Event; - type Origin = Origin; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type PalletsOrigin = OriginCaller; type Scheduler = Scheduler; - type Call = Call; + type RuntimeCall = RuntimeCall; type AsOriginId = MockAsOriginId; type AuthorityConfig = AuthorityConfigImpl; type WeightInfo = (); diff --git a/authority/src/tests.rs b/authority/src/tests.rs index 3d64f889e..1cb2cb36c 100644 --- a/authority/src/tests.rs +++ b/authority/src/tests.rs @@ -10,42 +10,42 @@ use frame_support::{ }; use frame_system::RawOrigin; use mock::{ - authority, run_to_block, Authority, BlockNumber, Call, ExtBuilder, MockAsOriginId, Origin, OriginCaller, Runtime, - System, + authority, run_to_block, Authority, BlockNumber, ExtBuilder, MockAsOriginId, OriginCaller, Runtime, RuntimeCall, + RuntimeOrigin, System, }; use sp_runtime::{traits::BadOrigin, Perbill}; #[test] fn dispatch_as_work() { ExtBuilder::default().build().execute_with(|| { - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let ensure_signed_call = Call::System(frame_system::Call::remark { remark: vec![] }); + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let ensure_signed_call = RuntimeCall::System(frame_system::Call::remark { remark: vec![] }); assert_ok!(Authority::dispatch_as( - Origin::root(), + RuntimeOrigin::root(), MockAsOriginId::Root, Box::new(ensure_root_call) )); assert_ok!(Authority::dispatch_as( - Origin::root(), + RuntimeOrigin::root(), MockAsOriginId::Account1, Box::new(ensure_signed_call.clone()) )); assert_noop!( Authority::dispatch_as( - Origin::signed(1), + RuntimeOrigin::signed(1), MockAsOriginId::Root, Box::new(ensure_signed_call.clone()) ), BadOrigin, ); assert_ok!(Authority::dispatch_as( - Origin::signed(1), + RuntimeOrigin::signed(1), MockAsOriginId::Account1, Box::new(ensure_signed_call.clone()) )); assert_noop!( Authority::dispatch_as( - Origin::signed(1), + RuntimeOrigin::signed(1), MockAsOriginId::Account2, Box::new(ensure_signed_call) ), @@ -57,25 +57,31 @@ fn dispatch_as_work() { #[test] fn schedule_dispatch_at_work() { ExtBuilder::default().build().execute_with(|| { - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); run_to_block(1); assert_noop!( - Authority::schedule_dispatch(Origin::root(), DispatchTime::At(1), 0, true, Box::new(call.clone())), + Authority::schedule_dispatch( + RuntimeOrigin::root(), + DispatchTime::At(1), + 0, + true, + Box::new(call.clone()) + ), Error::::FailedToSchedule ); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, true, Box::new(call.clone()) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -84,56 +90,66 @@ fn schedule_dispatch_at_work() { })); run_to_block(2); - System::assert_last_event(mock::Event::Scheduler(pallet_scheduler::Event::::Dispatched { - task: (2, 0), - id: Some([1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].to_vec()), - result: Ok(()), - })); + System::assert_last_event(mock::RuntimeEvent::Scheduler( + pallet_scheduler::Event::::Dispatched { + task: (2, 0), + id: Some([1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].to_vec()), + result: Ok(()), + }, + )); // with_delayed_origin = false assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(3), 0, false, Box::new(call) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::system(RawOrigin::Root), index: 1, })); run_to_block(3); - System::assert_last_event(mock::Event::Scheduler(pallet_scheduler::Event::::Dispatched { - task: (3, 0), - id: Some([0, 0, 1, 0, 0, 0].to_vec()), - result: Ok(()), - })); + System::assert_last_event(mock::RuntimeEvent::Scheduler( + pallet_scheduler::Event::::Dispatched { + task: (3, 0), + id: Some([0, 0, 1, 0, 0, 0].to_vec()), + result: Ok(()), + }, + )); }); } #[test] fn schedule_dispatch_after_work() { ExtBuilder::default().build().execute_with(|| { - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); run_to_block(1); assert_noop!( - Authority::schedule_dispatch(Origin::root(), DispatchTime::At(0), 0, true, Box::new(call.clone())), + Authority::schedule_dispatch( + RuntimeOrigin::root(), + DispatchTime::At(0), + 0, + true, + Box::new(call.clone()) + ), ArithmeticError::Overflow ); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::After(0), 0, true, Box::new(call.clone()) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::Authority(DelayedOrigin { delay: 0, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -142,31 +158,35 @@ fn schedule_dispatch_after_work() { })); run_to_block(2); - System::assert_last_event(mock::Event::Scheduler(pallet_scheduler::Event::::Dispatched { - task: (2, 0), - id: Some([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].to_vec()), - result: Ok(()), - })); + System::assert_last_event(mock::RuntimeEvent::Scheduler( + pallet_scheduler::Event::::Dispatched { + task: (2, 0), + id: Some([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].to_vec()), + result: Ok(()), + }, + )); // with_delayed_origin = false assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::After(0), 0, false, Box::new(call) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::system(RawOrigin::Root), index: 1, })); run_to_block(3); - System::assert_last_event(mock::Event::Scheduler(pallet_scheduler::Event::::Dispatched { - task: (3, 0), - id: Some([0, 0, 1, 0, 0, 0].to_vec()), - result: Ok(()), - })); + System::assert_last_event(mock::RuntimeEvent::Scheduler( + pallet_scheduler::Event::::Dispatched { + task: (3, 0), + id: Some([0, 0, 1, 0, 0, 0].to_vec()), + result: Ok(()), + }, + )); }); } @@ -174,20 +194,20 @@ fn schedule_dispatch_after_work() { fn fast_track_scheduled_dispatch_work() { ExtBuilder::default().build().execute_with(|| { System::set_block_number(1); - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); run_to_block(1); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, true, Box::new(call.clone()) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -196,8 +216,8 @@ fn fast_track_scheduled_dispatch_work() { })); let schedule_origin = { - let origin: ::Origin = Origin::root(); - let origin: ::Origin = + let origin: ::RuntimeOrigin = RuntimeOrigin::root(); + let origin: ::RuntimeOrigin = From::from(DelayedOrigin::::PalletsOrigin> { delay: 1, origin: Box::new(origin.caller().clone()), @@ -207,12 +227,12 @@ fn fast_track_scheduled_dispatch_work() { let pallets_origin = schedule_origin.caller().clone(); assert_ok!(Authority::fast_track_scheduled_dispatch( - Origin::root(), + RuntimeOrigin::root(), Box::new(pallets_origin), 0, DispatchTime::At(4), )); - System::assert_last_event(mock::Event::Authority(Event::FastTracked { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::FastTracked { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -222,24 +242,24 @@ fn fast_track_scheduled_dispatch_work() { })); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, false, Box::new(call) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::system(RawOrigin::Root), index: 1, })); assert_ok!(Authority::fast_track_scheduled_dispatch( - Origin::root(), + RuntimeOrigin::root(), Box::new(frame_system::RawOrigin::Root.into()), 1, DispatchTime::At(4), )); - System::assert_last_event(mock::Event::Authority(Event::FastTracked { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::FastTracked { origin: OriginCaller::system(RawOrigin::Root), index: 1, when: 4, @@ -251,20 +271,20 @@ fn fast_track_scheduled_dispatch_work() { fn delay_scheduled_dispatch_work() { ExtBuilder::default().build().execute_with(|| { System::set_block_number(1); - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); run_to_block(1); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, true, Box::new(call.clone()) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -273,8 +293,8 @@ fn delay_scheduled_dispatch_work() { })); let schedule_origin = { - let origin: ::Origin = Origin::root(); - let origin: ::Origin = + let origin: ::RuntimeOrigin = RuntimeOrigin::root(); + let origin: ::RuntimeOrigin = From::from(DelayedOrigin::::PalletsOrigin> { delay: 1, origin: Box::new(origin.caller().clone()), @@ -284,12 +304,12 @@ fn delay_scheduled_dispatch_work() { let pallets_origin = schedule_origin.caller().clone(); assert_ok!(Authority::delay_scheduled_dispatch( - Origin::root(), + RuntimeOrigin::root(), Box::new(pallets_origin), 0, 4, )); - System::assert_last_event(mock::Event::Authority(Event::Delayed { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Delayed { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -299,24 +319,24 @@ fn delay_scheduled_dispatch_work() { })); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, false, Box::new(call) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::system(RawOrigin::Root), index: 1, })); assert_ok!(Authority::delay_scheduled_dispatch( - Origin::root(), + RuntimeOrigin::root(), Box::new(frame_system::RawOrigin::Root.into()), 1, 4, )); - System::assert_last_event(mock::Event::Authority(Event::Delayed { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Delayed { origin: OriginCaller::system(RawOrigin::Root), index: 1, when: 5, @@ -327,20 +347,20 @@ fn delay_scheduled_dispatch_work() { #[test] fn cancel_scheduled_dispatch_work() { ExtBuilder::default().build().execute_with(|| { - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); run_to_block(1); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, true, Box::new(call.clone()) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -349,8 +369,8 @@ fn cancel_scheduled_dispatch_work() { })); let schedule_origin = { - let origin: ::Origin = Origin::root(); - let origin: ::Origin = + let origin: ::RuntimeOrigin = RuntimeOrigin::root(); + let origin: ::RuntimeOrigin = From::from(DelayedOrigin::::PalletsOrigin> { delay: 1, origin: Box::new(origin.caller().clone()), @@ -360,11 +380,11 @@ fn cancel_scheduled_dispatch_work() { let pallets_origin = schedule_origin.caller().clone(); assert_ok!(Authority::cancel_scheduled_dispatch( - Origin::root(), + RuntimeOrigin::root(), Box::new(pallets_origin), 0 )); - System::assert_last_event(mock::Event::Authority(Event::Cancelled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Cancelled { origin: OriginCaller::Authority(DelayedOrigin { delay: 1, origin: Box::new(OriginCaller::system(RawOrigin::Root)), @@ -373,23 +393,23 @@ fn cancel_scheduled_dispatch_work() { })); assert_ok!(Authority::schedule_dispatch( - Origin::root(), + RuntimeOrigin::root(), DispatchTime::At(2), 0, false, Box::new(call) )); - System::assert_last_event(mock::Event::Authority(Event::Scheduled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Scheduled { origin: OriginCaller::system(RawOrigin::Root), index: 1, })); assert_ok!(Authority::cancel_scheduled_dispatch( - Origin::root(), + RuntimeOrigin::root(), Box::new(frame_system::RawOrigin::Root.into()), 1 )); - System::assert_last_event(mock::Event::Authority(Event::Cancelled { + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Cancelled { origin: OriginCaller::system(RawOrigin::Root), index: 1, })); @@ -410,26 +430,36 @@ fn call_size_limit() { fn authorize_call_works() { ExtBuilder::default().build().execute_with(|| { run_to_block(1); - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); let hash = ::Hashing::hash_of(&call); // works without account - assert_ok!(Authority::authorize_call(Origin::root(), Box::new(call.clone()), None)); + assert_ok!(Authority::authorize_call( + RuntimeOrigin::root(), + Box::new(call.clone()), + None + )); assert_eq!(Authority::saved_calls(&hash), Some((call.clone(), None))); - System::assert_last_event(mock::Event::Authority(Event::AuthorizedCall { hash, caller: None })); + System::assert_last_event(mock::RuntimeEvent::Authority(Event::AuthorizedCall { + hash, + caller: None, + })); // works with account assert_ok!(Authority::authorize_call( - Origin::root(), + RuntimeOrigin::root(), Box::new(call.clone()), Some(1) )); assert_eq!(Authority::saved_calls(&hash), Some((call.clone(), Some(1)))); - System::assert_last_event(mock::Event::Authority(Event::AuthorizedCall { hash, caller: Some(1) })); + System::assert_last_event(mock::RuntimeEvent::Authority(Event::AuthorizedCall { + hash, + caller: Some(1), + })); }); } @@ -437,8 +467,8 @@ fn authorize_call_works() { fn trigger_call_works() { ExtBuilder::default().build().execute_with(|| { run_to_block(1); - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); @@ -448,42 +478,64 @@ fn trigger_call_works() { // call not authorized yet assert_noop!( - Authority::trigger_call(Origin::signed(1), hash, call_weight_bound), + Authority::trigger_call(RuntimeOrigin::signed(1), hash, call_weight_bound), Error::::CallNotAuthorized ); - assert_ok!(Authority::authorize_call(Origin::root(), Box::new(call.clone()), None)); + assert_ok!(Authority::authorize_call( + RuntimeOrigin::root(), + Box::new(call.clone()), + None + )); // wrong call weight bound assert_noop!( - Authority::trigger_call(Origin::signed(1), hash, call_weight_bound - Weight::from_ref_time(1)), + Authority::trigger_call( + RuntimeOrigin::signed(1), + hash, + call_weight_bound - Weight::from_ref_time(1) + ), Error::::WrongCallWeightBound ); // works without caller - assert_ok!(Authority::trigger_call(Origin::signed(1), hash, call_weight_bound)); + assert_ok!(Authority::trigger_call( + RuntimeOrigin::signed(1), + hash, + call_weight_bound + )); assert_eq!(Authority::saved_calls(&hash), None); - System::assert_has_event(mock::Event::Authority(Event::TriggeredCallBy { hash, caller: 1 })); - System::assert_last_event(mock::Event::Authority(Event::Dispatched { result: Ok(()) })); + System::assert_has_event(mock::RuntimeEvent::Authority(Event::TriggeredCallBy { + hash, + caller: 1, + })); + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Dispatched { result: Ok(()) })); // works with caller 1 assert_ok!(Authority::authorize_call( - Origin::root(), + RuntimeOrigin::root(), Box::new(call.clone()), Some(1) )); // caller 2 is not permitted to trigger the call assert_noop!( - Authority::trigger_call(Origin::signed(2), hash, call_weight_bound), + Authority::trigger_call(RuntimeOrigin::signed(2), hash, call_weight_bound), Error::::TriggerCallNotPermitted ); assert_eq!(Authority::saved_calls(&hash), Some((call.clone(), Some(1)))); // caller 1 triggering the call - assert_ok!(Authority::trigger_call(Origin::signed(1), hash, call_weight_bound)); + assert_ok!(Authority::trigger_call( + RuntimeOrigin::signed(1), + hash, + call_weight_bound + )); assert_eq!(Authority::saved_calls(&hash), None); - System::assert_has_event(mock::Event::Authority(Event::TriggeredCallBy { hash, caller: 1 })); - System::assert_last_event(mock::Event::Authority(Event::Dispatched { result: Ok(()) })); + System::assert_has_event(mock::RuntimeEvent::Authority(Event::TriggeredCallBy { + hash, + caller: 1, + })); + System::assert_last_event(mock::RuntimeEvent::Authority(Event::Dispatched { result: Ok(()) })); }); } @@ -491,46 +543,50 @@ fn trigger_call_works() { fn remove_authorized_call_works() { ExtBuilder::default().build().execute_with(|| { run_to_block(1); - let ensure_root_call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); - let call = Call::Authority(authority::Call::dispatch_as { + let ensure_root_call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::Authority(authority::Call::dispatch_as { as_origin: MockAsOriginId::Root, call: Box::new(ensure_root_call), }); let hash = ::Hashing::hash_of(&call); assert_noop!( - Authority::remove_authorized_call(Origin::root(), hash), + Authority::remove_authorized_call(RuntimeOrigin::root(), hash), Error::::CallNotAuthorized ); - assert_ok!(Authority::authorize_call(Origin::root(), Box::new(call.clone()), None)); + assert_ok!(Authority::authorize_call( + RuntimeOrigin::root(), + Box::new(call.clone()), + None + )); assert_noop!( - Authority::remove_authorized_call(Origin::signed(1), hash), + Authority::remove_authorized_call(RuntimeOrigin::signed(1), hash), Error::::CallNotAuthorized ); assert_eq!(Authority::saved_calls(&hash), Some((call.clone(), None))); - assert_ok!(Authority::remove_authorized_call(Origin::root(), hash)); + assert_ok!(Authority::remove_authorized_call(RuntimeOrigin::root(), hash)); assert_eq!(Authority::saved_calls(&hash), None); assert_ok!(Authority::authorize_call( - Origin::root(), + RuntimeOrigin::root(), Box::new(call.clone()), Some(1) )); - assert_ok!(Authority::remove_authorized_call(Origin::root(), hash)); + assert_ok!(Authority::remove_authorized_call(RuntimeOrigin::root(), hash)); assert_eq!(Authority::saved_calls(&hash), None); assert_ok!(Authority::authorize_call( - Origin::root(), + RuntimeOrigin::root(), Box::new(call.clone()), Some(1) )); assert_noop!( - Authority::remove_authorized_call(Origin::signed(2), hash), + Authority::remove_authorized_call(RuntimeOrigin::signed(2), hash), Error::::CallNotAuthorized ); assert_eq!(Authority::saved_calls(&hash), Some((call.clone(), Some(1)))); - assert_ok!(Authority::remove_authorized_call(Origin::signed(1), hash)); + assert_ok!(Authority::remove_authorized_call(RuntimeOrigin::signed(1), hash)); assert_eq!(Authority::saved_calls(&hash), None); }); } @@ -538,19 +594,23 @@ fn remove_authorized_call_works() { #[test] fn trigger_call_should_be_free_and_operational() { ExtBuilder::default().build().execute_with(|| { - let call = Call::System(frame_system::Call::fill_block { ratio: Perbill::one() }); + let call = RuntimeCall::System(frame_system::Call::fill_block { ratio: Perbill::one() }); let hash = ::Hashing::hash_of(&call); let call_weight_bound = call.get_dispatch_info().weight; - let trigger_call = Call::Authority(authority::Call::trigger_call { + let trigger_call = RuntimeCall::Authority(authority::Call::trigger_call { hash, call_weight_bound, }); - assert_ok!(Authority::authorize_call(Origin::root(), Box::new(call), Some(1))); + assert_ok!(Authority::authorize_call( + RuntimeOrigin::root(), + Box::new(call), + Some(1) + )); // bad caller pays fee assert_eq!( - trigger_call.clone().dispatch(Origin::signed(2)), + trigger_call.clone().dispatch(RuntimeOrigin::signed(2)), Err(DispatchErrorWithPostInfo { post_info: PostDispatchInfo { actual_weight: None, @@ -562,7 +622,7 @@ fn trigger_call_should_be_free_and_operational() { // successfull call doesn't pay fee assert_eq!( - trigger_call.clone().dispatch(Origin::signed(1)), + trigger_call.clone().dispatch(RuntimeOrigin::signed(1)), Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No diff --git a/bencher/Cargo.toml b/bencher/Cargo.toml index a1b190413..72e569b12 100644 --- a/bencher/Cargo.toml +++ b/bencher/Cargo.toml @@ -26,18 +26,18 @@ hash-db = { version = "0.15.2", default-features = false, optional = true } bencher-procedural = { path = "bencher-procedural", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-state-machine = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.29" } -sc-executor = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["wasmtime"], optional = true , branch = "polkadot-v0.9.29" } -sc-executor-common = { git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.29" } -sc-client-db = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["rocksdb"], optional = true , branch = "polkadot-v0.9.29" } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.29" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-externalities = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-storage = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-state-machine = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } +sc-executor = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["wasmtime"], optional = true , branch = "polkadot-v0.9.30" } +sc-executor-common = { git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.30" } +sc-client-db = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["rocksdb"], optional = true , branch = "polkadot-v0.9.30" } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-externalities = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-storage = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/bencher/test/Cargo.toml b/bencher/test/Cargo.toml index f67c2fc60..5b4459a63 100644 --- a/bencher/test/Cargo.toml +++ b/bencher/test/Cargo.toml @@ -15,16 +15,16 @@ required-features = ["bench"] serde = { version = "1.0.136", optional = true } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-bencher = { path = "..", default-features = false } orml-weight-meter = { path = "../../weight-meter", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/bencher/test/src/benches.rs b/bencher/test/src/benches.rs index 9a72d9fa5..dbd98cc7e 100644 --- a/bencher/test/src/benches.rs +++ b/bencher/test/src/benches.rs @@ -6,7 +6,7 @@ use frame_support::assert_ok; use orml_bencher::{benches, Bencher}; fn set_value(b: &mut Bencher) { - let result = b.bench(|| Test::set_value(Origin::signed(1), 1)); + let result = b.bench(|| Test::set_value(RuntimeOrigin::signed(1), 1)); assert_ok!(result); assert_eq!(Test::value(), Some(1 + 1)); } diff --git a/bencher/test/src/mock.rs b/bencher/test/src/mock.rs index 375044a1a..54d84fcd2 100644 --- a/bencher/test/src/mock.rs +++ b/bencher/test/src/mock.rs @@ -36,16 +36,16 @@ impl frame_system::Config for Runtime { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = u64; type Hash = H256; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = (); type Version = (); type PalletInfo = PalletInfo; diff --git a/bencher/test/src/tests.rs b/bencher/test/src/tests.rs index 03dfec30b..b3d9441f4 100644 --- a/bencher/test/src/tests.rs +++ b/bencher/test/src/tests.rs @@ -9,7 +9,7 @@ fn set_value() { let weight = ModuleWeights::::set_value() + ModuleWeights::::set_foo(); ExtBuilder::default().build().execute_with(|| { assert_eq!( - Test::set_value(Origin::signed(1), 1), + Test::set_value(RuntimeOrigin::signed(1), 1), Ok(PostDispatchInfo { actual_weight: Some(weight), ..Default::default() diff --git a/benchmarking/Cargo.toml b/benchmarking/Cargo.toml index 392930608..a28745289 100644 --- a/benchmarking/Cargo.toml +++ b/benchmarking/Cargo.toml @@ -14,19 +14,19 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-storage = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-storage = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [dev-dependencies] hex-literal = "0.3.4" -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = [ "std" ] diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index 98770f65a..4a4d8ec98 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -99,14 +99,14 @@ macro_rules! whitelist_account { /// foo { /// let caller = account::(b"caller", 0, benchmarks_seed); /// let l in 1 .. MAX_LENGTH => initialize_l(l); -/// }: _(Origin::Signed(caller), vec![0u8; l]) +/// }: _(RuntimeOrigin::signed(caller), vec![0u8; l]) /// /// // second dispatchable: bar; this is a root dispatchable and accepts a `u8` vector of size /// // `l`. /// // In this case, we explicitly name the call using `bar` instead of `_`. /// bar { /// let l in 1 .. MAX_LENGTH => initialize_l(l); -/// }: bar(Origin::Root, vec![0u8; l]) +/// }: bar(RuntimeOrigin::root, vec![0u8; l]) /// /// // third dispatchable: baz; this is a user dispatchable. It isn't dependent on length like the /// // other two but has its own complexity `c` that needs setting up. It uses `caller` (in the @@ -115,13 +115,13 @@ macro_rules! whitelist_account { /// baz1 { /// let caller = account::(b"caller", 0, benchmarks_seed); /// let c = 0 .. 10 => setup_c(&caller, c); -/// }: baz(Origin::Signed(caller)) +/// }: baz(RuntimeOrigin::signed(caller)) /// /// // this is a second benchmark of the baz dispatchable with a different setup. /// baz2 { /// let caller = account::(b"caller", 0, benchmarks_seed); /// let c = 0 .. 10 => setup_c_in_some_other_way(&caller, c); -/// }: baz(Origin::Signed(caller)) +/// }: baz(RuntimeOrigin::signed(caller)) /// /// // this is benchmarking some code that is not a dispatchable. /// populate_a_set { @@ -450,7 +450,7 @@ macro_rules! to_origin { $origin.into() }; ($origin:expr, $origin_type:ty) => { - <<$runtime as frame_system::Config>::Origin as From<$origin_type>>::from($origin) + <<$runtime as frame_system::Config>::RuntimeOrigin as From<$origin_type>>::from($origin) }; } diff --git a/benchmarking/src/tests.rs b/benchmarking/src/tests.rs index 1f05926e2..15c827918 100644 --- a/benchmarking/src/tests.rs +++ b/benchmarking/src/tests.rs @@ -52,16 +52,16 @@ pub mod test { type AccountId = u128; impl frame_system::Config for Test { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = u64; type Hash = H256; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = (); type DbWeight = (); type BlockWeights = (); @@ -81,7 +81,7 @@ impl frame_system::Config for Test { impl Config for Test {} pub type Block = sp_runtime::generic::Block; -pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; construct_runtime!( pub enum Test where diff --git a/currencies/Cargo.toml b/currencies/Cargo.toml index 48c78ad9f..c2c696a0c 100644 --- a/currencies/Cargo.toml +++ b/currencies/Cargo.toml @@ -12,18 +12,18 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } orml_tokens = { package = "orml-tokens", path = "../tokens", version = "0.4.1-dev" } diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index 978b4c6d9..64a398a7a 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -22,8 +22,8 @@ pub type ReserveIdentifier = [u8; 8]; pub type AccountId = AccountId32; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -31,7 +31,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -54,7 +54,7 @@ type Balance = u64; impl pallet_balances::Config for Runtime { type Balance = Balance; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ConstU64<2>; type AccountStore = frame_system::Pallet; type MaxLocks = (); @@ -74,7 +74,7 @@ parameter_types! { } impl orml_tokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = i64; type CurrencyId = CurrencyId; diff --git a/currencies/src/tests.rs b/currencies/src/tests.rs index 6c0b0f6fa..091b599ce 100644 --- a/currencies/src/tests.rs +++ b/currencies/src/tests.rs @@ -4,7 +4,7 @@ use super::*; use frame_support::{assert_noop, assert_ok}; -use mock::{Event, *}; +use mock::*; use sp_runtime::traits::BadOrigin; #[test] @@ -334,14 +334,14 @@ fn update_balance_call_should_work() { .build() .execute_with(|| { assert_ok!(Currencies::update_balance( - Origin::root(), + RuntimeOrigin::root(), ALICE, NATIVE_CURRENCY_ID, -10 )); assert_eq!(NativeCurrency::free_balance(&ALICE), 90); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 100); - assert_ok!(Currencies::update_balance(Origin::root(), ALICE, X_TOKEN_ID, 10)); + assert_ok!(Currencies::update_balance(RuntimeOrigin::root(), ALICE, X_TOKEN_ID, 10)); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 110); }); } @@ -367,7 +367,7 @@ fn call_event_should_work() { assert_ok!(Currencies::transfer(Some(ALICE).into(), BOB, X_TOKEN_ID, 50)); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 50); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &BOB), 150); - System::assert_last_event(Event::Tokens(orml_tokens::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(orml_tokens::Event::Transfer { currency_id: X_TOKEN_ID, from: ALICE, to: BOB, @@ -379,7 +379,7 @@ fn call_event_should_work() { )); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 40); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &BOB), 160); - System::assert_last_event(Event::Tokens(orml_tokens::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(orml_tokens::Event::Transfer { currency_id: X_TOKEN_ID, from: ALICE, to: BOB, @@ -390,7 +390,7 @@ fn call_event_should_work() { X_TOKEN_ID, &ALICE, 100 )); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 140); - System::assert_last_event(Event::Tokens(orml_tokens::Event::Deposited { + System::assert_last_event(RuntimeEvent::Tokens(orml_tokens::Event::Deposited { currency_id: X_TOKEN_ID, who: ALICE, amount: 100, @@ -400,7 +400,7 @@ fn call_event_should_work() { X_TOKEN_ID, &ALICE, 20 )); assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 120); - System::assert_last_event(Event::Tokens(orml_tokens::Event::Withdrawn { + System::assert_last_event(RuntimeEvent::Tokens(orml_tokens::Event::Withdrawn { currency_id: X_TOKEN_ID, who: ALICE, amount: 20, diff --git a/gradually-update/Cargo.toml b/gradually-update/Cargo.toml index 3d0c54430..e36ff5d38 100644 --- a/gradually-update/Cargo.toml +++ b/gradually-update/Cargo.toml @@ -12,12 +12,12 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/gradually-update/src/lib.rs b/gradually-update/src/lib.rs index 14a5d08f0..b7d186add 100644 --- a/gradually-update/src/lib.rs +++ b/gradually-update/src/lib.rs @@ -66,14 +66,14 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The frequency of updating values between blocks #[pallet::constant] type UpdateFrequency: Get; /// The origin that can schedule an update - type DispatchOrigin: EnsureOrigin; + type DispatchOrigin: EnsureOrigin; /// Weight information for extrinsics in this module. type WeightInfo: WeightInfo; diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs index fc86b9809..444336f20 100644 --- a/gradually-update/src/mock.rs +++ b/gradually-update/src/mock.rs @@ -16,16 +16,16 @@ pub type AccountId = u128; pub type BlockNumber = u64; impl frame_system::Config for Runtime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -43,7 +43,7 @@ impl frame_system::Config for Runtime { } impl Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type UpdateFrequency = ConstU64<10>; type DispatchOrigin = frame_system::EnsureRoot; type WeightInfo = (); diff --git a/gradually-update/src/tests.rs b/gradually-update/src/tests.rs index 5e07adbc8..6cef7bf6f 100644 --- a/gradually-update/src/tests.rs +++ b/gradually-update/src/tests.rs @@ -5,7 +5,7 @@ use super::*; use codec::Encode; use frame_support::{assert_noop, assert_ok}; -use mock::{Event, *}; +use mock::*; use sp_runtime::{FixedPointNumber, FixedU128, Permill}; fn storage_set(key: &Vec, value: &Vec) { @@ -29,12 +29,17 @@ fn gradually_update_should_work() { target_value: vec![9].try_into().unwrap(), per_block: vec![1].try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::GraduallyUpdateAdded { - key: update.key, - per_block: update.per_block, - target_value: update.target_value, - })); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule( + crate::Event::GraduallyUpdateAdded { + key: update.key, + per_block: update.per_block, + target_value: update.target_value, + }, + )); }); } @@ -47,7 +52,7 @@ fn gradually_update_should_fail() { per_block: 1u64.encode().try_into().unwrap(), }; assert_noop!( - GraduallyUpdateModule::gradually_update(Origin::root(), update), + GraduallyUpdateModule::gradually_update(RuntimeOrigin::root(), update), Error::::InvalidPerBlockOrTargetValue ); @@ -56,7 +61,10 @@ fn gradually_update_should_fail() { target_value: 90u32.encode().try_into().unwrap(), per_block: 1u32.encode().try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); GraduallyUpdateModule::on_finalize(20); @@ -66,12 +74,12 @@ fn gradually_update_should_fail() { per_block: 1u64.encode().try_into().unwrap(), }; assert_noop!( - GraduallyUpdateModule::gradually_update(Origin::root(), new_update), + GraduallyUpdateModule::gradually_update(RuntimeOrigin::root(), new_update), Error::::InvalidTargetValue ); assert_noop!( - GraduallyUpdateModule::gradually_update(Origin::root(), update), + GraduallyUpdateModule::gradually_update(RuntimeOrigin::root(), update), Error::::GraduallyUpdateHasExisted ); }); @@ -87,20 +95,25 @@ fn cancel_gradually_update_should_work() { target_value: vec![9].try_into().unwrap(), per_block: vec![1].try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::GraduallyUpdateAdded { - key: update.key.clone(), - per_block: update.per_block, - target_value: update.target_value, - })); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule( + crate::Event::GraduallyUpdateAdded { + key: update.key.clone(), + per_block: update.per_block, + target_value: update.target_value, + }, + )); assert_ok!(GraduallyUpdateModule::cancel_gradually_update( - Origin::root(), + RuntimeOrigin::root(), update.key.clone() )); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::GraduallyUpdateCancelled { - key: update.key, - })); + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule( + crate::Event::GraduallyUpdateCancelled { key: update.key }, + )); }); } @@ -113,14 +126,17 @@ fn cancel_gradually_update_should_fail() { per_block: 1u32.encode().try_into().unwrap(), }; assert_noop!( - GraduallyUpdateModule::cancel_gradually_update(Origin::root(), update.key.clone()), + GraduallyUpdateModule::cancel_gradually_update(RuntimeOrigin::root(), update.key.clone()), Error::::GraduallyUpdateNotFound ); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_ok!(GraduallyUpdateModule::cancel_gradually_update( - Origin::root(), + RuntimeOrigin::root(), update.key )); }); @@ -136,13 +152,16 @@ fn add_on_finalize_should_work() { target_value: vec![30].try_into().unwrap(), per_block: vec![1].try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_eq!(storage_get(&update.key), Vec::::new()); GraduallyUpdateModule::on_finalize(10); assert_eq!(storage_get(&update.key), vec![10]); println!("Length {}", System::events().len()); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::Updated { + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule(crate::Event::Updated { block_number: 10, key: update.key.clone(), target_value: vec![10].try_into().unwrap(), @@ -155,7 +174,7 @@ fn add_on_finalize_should_work() { GraduallyUpdateModule::on_finalize(20); assert_eq!(storage_get(&update.key), vec![20]); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::Updated { + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule(crate::Event::Updated { block_number: 20, key: update.key.clone(), target_value: vec![20].try_into().unwrap(), @@ -164,7 +183,7 @@ fn add_on_finalize_should_work() { GraduallyUpdateModule::on_finalize(40); assert_eq!(storage_get(&update.key), vec![30]); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::Updated { + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule(crate::Event::Updated { block_number: 40, key: update.key, target_value: vec![30].try_into().unwrap(), @@ -184,12 +203,15 @@ fn sub_on_finalize_should_work() { }; storage_set(&update.key, &vec![30]); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_eq!(storage_get(&update.key), vec![30]); GraduallyUpdateModule::on_finalize(10); assert_eq!(storage_get(&update.key), vec![20]); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::Updated { + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule(crate::Event::Updated { block_number: 10, key: update.key.clone(), target_value: vec![20].try_into().unwrap(), @@ -202,7 +224,7 @@ fn sub_on_finalize_should_work() { GraduallyUpdateModule::on_finalize(20); assert_eq!(storage_get(&update.key), vec![10]); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::Updated { + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule(crate::Event::Updated { block_number: 20, key: update.key.clone(), target_value: vec![10].try_into().unwrap(), @@ -211,7 +233,7 @@ fn sub_on_finalize_should_work() { GraduallyUpdateModule::on_finalize(40); assert_eq!(storage_get(&update.key), vec![5]); - System::assert_last_event(Event::GraduallyUpdateModule(crate::Event::Updated { + System::assert_last_event(RuntimeEvent::GraduallyUpdateModule(crate::Event::Updated { block_number: 40, key: update.key, target_value: vec![5].try_into().unwrap(), @@ -227,7 +249,10 @@ fn u32_should_work() { target_value: 30u32.encode().try_into().unwrap(), per_block: 1u32.encode().try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_eq!(storage_get(&update.key), Vec::::new()); GraduallyUpdateModule::on_finalize(10); assert_eq!(storage_get(&update.key), vec![10, 0, 0, 0]); @@ -248,7 +273,10 @@ fn u128_should_work() { target_value: 30u128.encode().try_into().unwrap(), per_block: 1u128.encode().try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_eq!(storage_get(&update.key), Vec::::new()); GraduallyUpdateModule::on_finalize(10); assert_eq!( @@ -281,7 +309,10 @@ fn permill_should_work() { target_value: Permill::from_percent(30).encode().try_into().unwrap(), per_block: Permill::from_percent(1).encode().try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_eq!(storage_get(&update.key), Vec::::new()); GraduallyUpdateModule::on_finalize(10); assert_eq!(storage_get(&update.key), vec![160, 134, 1, 0]); @@ -302,7 +333,10 @@ fn fixedu128_should_work() { target_value: FixedU128::saturating_from_rational(30, 1).encode().try_into().unwrap(), per_block: FixedU128::saturating_from_rational(1, 1).encode().try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); assert_eq!(storage_get(&update.key), Vec::::new()); GraduallyUpdateModule::on_finalize(10); assert_eq!( @@ -347,9 +381,18 @@ fn finish_multiple_on_finalize_should_work() { target_value: vec![100].try_into().unwrap(), per_block: vec![3].try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update2.clone())); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update3.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update2.clone() + )); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update3.clone() + )); GraduallyUpdateModule::on_finalize(10); assert_eq!(storage_get(&update.key), vec![10]); @@ -403,18 +446,30 @@ fn exceeding_max_gradually_updates_should_fail() { target_value: vec![120].try_into().unwrap(), per_block: vec![4].try_into().unwrap(), }; - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone())); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update2.clone())); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update3.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update.clone() + )); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update2.clone() + )); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update3.clone() + )); assert_noop!( - GraduallyUpdateModule::gradually_update(Origin::root(), update4.clone()), + GraduallyUpdateModule::gradually_update(RuntimeOrigin::root(), update4.clone()), Error::::MaxGraduallyUpdateExceeded ); GraduallyUpdateModule::on_finalize(10); GraduallyUpdateModule::on_finalize(20); GraduallyUpdateModule::on_finalize(30); - assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update4.clone())); + assert_ok!(GraduallyUpdateModule::gradually_update( + RuntimeOrigin::root(), + update4.clone() + )); GraduallyUpdateModule::on_finalize(40); GraduallyUpdateModule::on_finalize(50); GraduallyUpdateModule::on_finalize(60); diff --git a/nft/Cargo.toml b/nft/Cargo.toml index 97c4aeebc..96cccd5db 100644 --- a/nft/Cargo.toml +++ b/nft/Cargo.toml @@ -12,14 +12,14 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/nft/src/mock.rs b/nft/src/mock.rs index 6ab0e83f6..3c25f9677 100644 --- a/nft/src/mock.rs +++ b/nft/src/mock.rs @@ -17,16 +17,16 @@ pub type AccountId = u128; pub type BlockNumber = u64; impl frame_system::Config for Runtime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); diff --git a/oracle/Cargo.toml b/oracle/Cargo.toml index a9d912101..255bd1992 100644 --- a/oracle/Cargo.toml +++ b/oracle/Cargo.toml @@ -12,18 +12,18 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/oracle/rpc/Cargo.toml b/oracle/rpc/Cargo.toml index 538241617..44a7f74cf 100644 --- a/oracle/rpc/Cargo.toml +++ b/oracle/rpc/Cargo.toml @@ -12,8 +12,8 @@ jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } tracing = { version = "0.1.29" } tracing-core = { version = "0.1.28" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } orml-oracle-rpc-runtime-api = { path = "runtime-api", version = "0.4.1-dev" } diff --git a/oracle/rpc/runtime-api/Cargo.toml b/oracle/rpc/runtime-api/Cargo.toml index 8f68b233b..2e1ae565f 100644 --- a/oracle/rpc/runtime-api/Cargo.toml +++ b/oracle/rpc/runtime-api/Cargo.toml @@ -8,8 +8,8 @@ description = "Runtime API module for orml-oracle-rpc." [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs index fced2ea67..a44ba200d 100644 --- a/oracle/src/lib.rs +++ b/oracle/src/lib.rs @@ -25,10 +25,11 @@ use codec::{Decode, Encode, MaxEncodedLen}; use serde::{Deserialize, Serialize}; use frame_support::{ + dispatch::Pays, ensure, pallet_prelude::*, traits::{ChangeMembers, Get, SortedMembers, Time}, - weights::{Pays, Weight}, + weights::Weight, Parameter, }; use frame_system::{ensure_root, ensure_signed, pallet_prelude::*}; @@ -64,7 +65,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Hook on new data received type OnNewData: OnNewData; diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs index 279855402..6d989fb09 100644 --- a/oracle/src/mock.rs +++ b/oracle/src/mock.rs @@ -23,8 +23,8 @@ type Key = u32; type Value = u32; impl frame_system::Config for Test { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -32,7 +32,7 @@ impl frame_system::Config for Test { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -82,7 +82,7 @@ impl SortedMembers for Members { } impl Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnNewData = (); type CombineData = DefaultCombineData, ConstU32<600>>; type Time = Timestamp; diff --git a/oracle/src/tests.rs b/oracle/src/tests.rs index 492087ecb..737ba34c3 100644 --- a/oracle/src/tests.rs +++ b/oracle/src/tests.rs @@ -2,7 +2,7 @@ use super::*; use frame_support::{assert_noop, assert_ok}; -use mock::{Event, *}; +use mock::*; #[test] fn should_feed_values_from_member() { @@ -11,17 +11,20 @@ fn should_feed_values_from_member() { let account_id: AccountId = 1; assert_noop!( - ModuleOracle::feed_values(Origin::signed(5), vec![(50, 1000), (51, 900), (52, 800)]), + ModuleOracle::feed_values(RuntimeOrigin::signed(5), vec![(50, 1000), (51, 900), (52, 800)]), Error::::NoPermission, ); assert_eq!( - ModuleOracle::feed_values(Origin::signed(account_id), vec![(50, 1000), (51, 900), (52, 800)]) - .unwrap() - .pays_fee, + ModuleOracle::feed_values( + RuntimeOrigin::signed(account_id), + vec![(50, 1000), (51, 900), (52, 800)] + ) + .unwrap() + .pays_fee, Pays::No ); - System::assert_last_event(Event::ModuleOracle(crate::Event::NewFeedData { + System::assert_last_event(RuntimeEvent::ModuleOracle(crate::Event::NewFeedData { sender: 1, values: vec![(50, 1000), (51, 900), (52, 800)], })); @@ -58,7 +61,7 @@ fn should_feed_values_from_root() { let root_feeder: AccountId = RootOperatorAccountId::get(); assert_ok!(ModuleOracle::feed_values( - Origin::root(), + RuntimeOrigin::root(), vec![(50, 1000), (51, 900), (52, 800)] )); @@ -94,7 +97,10 @@ fn should_not_feed_values_from_root_directly() { let root_feeder: AccountId = RootOperatorAccountId::get(); assert_noop!( - ModuleOracle::feed_values(Origin::signed(root_feeder), vec![(50, 1000), (51, 900), (52, 800)]), + ModuleOracle::feed_values( + RuntimeOrigin::signed(root_feeder), + vec![(50, 1000), (51, 900), (52, 800)] + ), Error::::NoPermission, ); }); @@ -108,8 +114,8 @@ fn should_read_raw_values() { let raw_values = ModuleOracle::read_raw_values(&key); assert_eq!(raw_values, vec![]); - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(key, 1000)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(key, 1200)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(key, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(key, 1200)])); let raw_values = ModuleOracle::read_raw_values(&key); assert_eq!( @@ -133,9 +139,9 @@ fn should_combined_data() { new_test_ext().execute_with(|| { let key: u32 = 50; - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(key, 1300)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(key, 1000)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(3), vec![(key, 1200)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(key, 1300)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(key, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(3), vec![(key, 1200)])); let expected = Some(TimestampedValue { value: 1200, @@ -160,15 +166,15 @@ fn should_return_none_for_non_exist_key() { #[test] fn multiple_calls_should_fail() { new_test_ext().execute_with(|| { - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(50, 1300)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(50, 1300)])); assert_noop!( - ModuleOracle::feed_values(Origin::signed(1), vec![(50, 1300)]), + ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(50, 1300)]), Error::::AlreadyFeeded, ); ModuleOracle::on_finalize(1); - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(50, 1300)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(50, 1300)])); }); } @@ -181,9 +187,9 @@ fn get_all_values_should_work() { assert_eq!(ModuleOracle::get_all_values(), vec![]); // feed eur & jpy - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(eur, 1300)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(eur, 1000)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(3), vec![(jpy, 9000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(eur, 1300)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(eur, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(3), vec![(jpy, 9000)])); // not enough eur & jpy prices assert_eq!(ModuleOracle::get(&eur), None); @@ -194,8 +200,8 @@ fn get_all_values_should_work() { ModuleOracle::on_finalize(1); // feed eur & jpy - assert_ok!(ModuleOracle::feed_values(Origin::signed(3), vec![(eur, 1200)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(jpy, 8000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(3), vec![(eur, 1200)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(jpy, 8000)])); // enough eur prices let eur_price = Some(TimestampedValue { @@ -210,7 +216,7 @@ fn get_all_values_should_work() { assert_eq!(ModuleOracle::get_all_values(), vec![(eur, eur_price)]); // feed jpy - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(jpy, 7000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(jpy, 7000)])); // enough jpy prices let jpy_price = Some(TimestampedValue { @@ -229,19 +235,19 @@ fn change_member_should_work() { OracleMembers::set(vec![2, 3, 4]); >::change_members_sorted(&[4], &[1], &[2, 3, 4]); assert_noop!( - ModuleOracle::feed_values(Origin::signed(1), vec![(50, 1000)]), + ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(50, 1000)]), Error::::NoPermission, ); - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(50, 1000)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(4), vec![(50, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(50, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(4), vec![(50, 1000)])); }); } #[test] fn should_clear_data_for_removed_members() { new_test_ext().execute_with(|| { - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(50, 1000)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(50, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(50, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(50, 1000)])); ModuleOracle::change_members_sorted(&[4], &[1], &[2, 3, 4]); @@ -252,14 +258,14 @@ fn should_clear_data_for_removed_members() { #[test] fn values_are_updated_on_feed() { new_test_ext().execute_with(|| { - assert_ok!(ModuleOracle::feed_values(Origin::signed(1), vec![(50, 900)])); - assert_ok!(ModuleOracle::feed_values(Origin::signed(2), vec![(50, 1000)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(1), vec![(50, 900)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(2), vec![(50, 1000)])); assert_eq!(ModuleOracle::values(50), None); // Upon the third price feed, the value is updated immediately after `combine` // can produce valid result. - assert_ok!(ModuleOracle::feed_values(Origin::signed(3), vec![(50, 1100)])); + assert_ok!(ModuleOracle::feed_values(RuntimeOrigin::signed(3), vec![(50, 1100)])); assert_eq!( ModuleOracle::values(50), Some(TimestampedValue { diff --git a/payments/Cargo.toml b/payments/Cargo.toml index 265c76428..9cb36750e 100644 --- a/payments/Cargo.toml +++ b/payments/Cargo.toml @@ -14,18 +14,18 @@ parity-scale-codec = { version = "3.1.5", default-features = false, features = [ log = { version = "0.4.17", default-features = false } 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.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-traits = {path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] serde = { version = "1.0.136" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-tokens = { path = "../tokens", version = "0.4.1-dev", default-features = false } diff --git a/payments/src/lib.rs b/payments/src/lib.rs index 0a4158fc5..f70a4d055 100644 --- a/payments/src/lib.rs +++ b/payments/src/lib.rs @@ -102,7 +102,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's /// definition of an event. - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// the type of assets this pallet can hold in payment type Asset: MultiReservableCurrency; /// Dispute resolution account @@ -239,7 +239,7 @@ pub mod pallet { // order by oldest task to process task_list.sort_by(|(_, t), (_, x)| x.when.cmp(&t.when)); - while !task_list.is_empty() && remaining_weight >= cancel_weight { + while !task_list.is_empty() && remaining_weight.all_gte(cancel_weight) { if let Some((account_pair, _)) = task_list.pop() { remaining_weight = remaining_weight.saturating_sub(cancel_weight); // remove the task form the tasks storage diff --git a/payments/src/mock.rs b/payments/src/mock.rs index 0da207991..ac32214ba 100644 --- a/payments/src/mock.rs +++ b/payments/src/mock.rs @@ -1,9 +1,9 @@ use crate as payment; use crate::PaymentDetail; use frame_support::{ + dispatch::DispatchClass, parameter_types, traits::{ConstU32, Contains, Everything, GenesisBuild, Hooks, OnFinalize}, - weights::DispatchClass, }; use frame_system as system; use orml_traits::parameter_type_with_key; @@ -53,8 +53,8 @@ impl system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -62,7 +62,7 @@ impl system::Config for Test { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); type PalletInfo = PalletInfo; @@ -96,7 +96,7 @@ impl orml_tokens::Config for Test { type Amount = i64; type Balance = Balance; type CurrencyId = u32; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposits = ExistentialDeposits; type OnDust = (); type OnSlash = (); @@ -141,7 +141,7 @@ parameter_types! { } impl payment::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Asset = Tokens; type DisputeResolver = MockDisputeResolver; type IncentivePercentage = IncentivePercentage; diff --git a/payments/src/tests.rs b/payments/src/tests.rs index 19bc67cb3..ddcc3fa79 100644 --- a/payments/src/tests.rs +++ b/payments/src/tests.rs @@ -9,7 +9,7 @@ use sp_runtime::{Percent, TransactionOutcome}; type Error = crate::Error; -fn last_event() -> Event { +fn last_event() -> RuntimeEvent { System::events().pop().expect("Event expected").event } @@ -29,7 +29,7 @@ fn test_pay_works() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -75,7 +75,7 @@ fn test_pay_works() { // the payment should not be overwritten assert_noop!( Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -107,7 +107,7 @@ fn test_cancel_works() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -133,7 +133,10 @@ fn test_cancel_works() { assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0); // cancel should succeed when caller is the recipent - assert_ok!(Payment::cancel(Origin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR)); + assert_ok!(Payment::cancel( + RuntimeOrigin::signed(PAYMENT_RECIPENT), + PAYMENT_CREATOR + )); assert_eq!( last_event(), crate::Event::::PaymentCancelled { @@ -163,7 +166,7 @@ fn test_release_works() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -188,7 +191,10 @@ fn test_release_works() { assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0); // should succeed for valid payment - assert_ok!(Payment::release(Origin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT)); + assert_ok!(Payment::release( + RuntimeOrigin::signed(PAYMENT_CREATOR), + PAYMENT_RECIPENT + )); assert_eq!( last_event(), crate::Event::::PaymentReleased { @@ -209,7 +215,7 @@ fn test_release_works() { // should be able to create another payment since previous is released assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -232,7 +238,7 @@ fn test_resolve_payment_works() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -242,7 +248,7 @@ fn test_resolve_payment_works() { // should fail for non whitelisted caller assert_noop!( Payment::resolve_payment( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_CREATOR, PAYMENT_RECIPENT, Percent::from_percent(100) @@ -252,7 +258,7 @@ fn test_resolve_payment_works() { // should be able to release a payment assert_ok!(Payment::resolve_payment( - Origin::signed(RESOLVER_ACCOUNT), + RuntimeOrigin::signed(RESOLVER_ACCOUNT), PAYMENT_CREATOR, PAYMENT_RECIPENT, Percent::from_percent(100) @@ -278,7 +284,7 @@ fn test_resolve_payment_works() { assert_eq!(PaymentStore::::get(PAYMENT_CREATOR, PAYMENT_RECIPENT), None); assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -287,7 +293,7 @@ fn test_resolve_payment_works() { // should be able to cancel a payment assert_ok!(Payment::resolve_payment( - Origin::signed(RESOLVER_ACCOUNT), + RuntimeOrigin::signed(RESOLVER_ACCOUNT), PAYMENT_CREATOR, PAYMENT_RECIPENT, Percent::from_percent(0) @@ -324,7 +330,7 @@ fn test_charging_fee_payment_works() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT_FEE_CHARGED, CURRENCY_ID, payment_amount, @@ -350,7 +356,7 @@ fn test_charging_fee_payment_works() { // should succeed for valid payment assert_ok!(Payment::release( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT_FEE_CHARGED )); // the payment amount should be transferred @@ -383,7 +389,7 @@ fn test_charging_fee_payment_works_when_canceled() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT_FEE_CHARGED, CURRENCY_ID, payment_amount, @@ -409,7 +415,7 @@ fn test_charging_fee_payment_works_when_canceled() { // should succeed for valid payment assert_ok!(Payment::cancel( - Origin::signed(PAYMENT_RECIPENT_FEE_CHARGED), + RuntimeOrigin::signed(PAYMENT_RECIPENT_FEE_CHARGED), PAYMENT_CREATOR )); // the payment amount should be transferred @@ -432,7 +438,7 @@ fn test_pay_with_remark_works() { // should be able to create a payment with available balance assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -467,7 +473,7 @@ fn test_pay_with_remark_works() { // the payment should not be overwritten assert_noop!( Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -496,7 +502,7 @@ fn test_do_not_overwrite_logic_works() { let expected_incentive_amount = payment_amount / INCENTIVE_PERCENTAGE as u128; assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -505,7 +511,7 @@ fn test_do_not_overwrite_logic_works() { assert_noop!( Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -531,7 +537,7 @@ fn test_do_not_overwrite_logic_works() { // the payment should not be overwritten assert_noop!( Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -550,7 +556,7 @@ fn test_request_refund() { let expected_cancel_block = CANCEL_BLOCK_BUFFER + 1; assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -558,14 +564,14 @@ fn test_request_refund() { )); assert_ok!(Payment::request_refund( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT )); // do not overwrite payment assert_noop!( Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -608,7 +614,7 @@ fn test_dispute_refund() { let expected_cancel_block = CANCEL_BLOCK_BUFFER + 1; assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -617,12 +623,12 @@ fn test_dispute_refund() { // cannot dispute if refund is not requested assert_noop!( - Payment::dispute_refund(Origin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR), + Payment::dispute_refund(RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR), Error::InvalidAction ); // creator requests a refund assert_ok!(Payment::request_refund( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT )); // ensure the request is added to the refund queue @@ -637,7 +643,7 @@ fn test_dispute_refund() { // recipient disputes the refund request assert_ok!(Payment::dispute_refund( - Origin::signed(PAYMENT_RECIPENT), + RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR )); @@ -675,14 +681,14 @@ fn test_request_payment() { let expected_incentive_amount = 0; assert_ok!(Payment::request_payment( - Origin::signed(PAYMENT_RECIPENT), + RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR, CURRENCY_ID, payment_amount, )); assert_noop!( - Payment::request_refund(Origin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT), + Payment::request_refund(RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT), crate::Error::::InvalidAction ); @@ -715,7 +721,7 @@ fn test_requested_payment_cannot_be_released() { let payment_amount = 20; assert_ok!(Payment::request_payment( - Origin::signed(PAYMENT_RECIPENT), + RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR, CURRENCY_ID, payment_amount, @@ -723,7 +729,7 @@ fn test_requested_payment_cannot_be_released() { // requested payment cannot be released assert_noop!( - Payment::release(Origin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT), + Payment::release(RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT), Error::InvalidAction ); }); @@ -735,13 +741,16 @@ fn test_requested_payment_can_be_cancelled_by_requestor() { let payment_amount = 20; assert_ok!(Payment::request_payment( - Origin::signed(PAYMENT_RECIPENT), + RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR, CURRENCY_ID, payment_amount, )); - assert_ok!(Payment::cancel(Origin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR)); + assert_ok!(Payment::cancel( + RuntimeOrigin::signed(PAYMENT_RECIPENT), + PAYMENT_CREATOR + )); // the request should be removed from storage assert_eq!(PaymentStore::::get(PAYMENT_CREATOR, PAYMENT_RECIPENT), None); @@ -756,7 +765,7 @@ fn test_accept_and_pay() { let expected_incentive_amount = 0; assert_ok!(Payment::request_payment( - Origin::signed(PAYMENT_RECIPENT), + RuntimeOrigin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR, CURRENCY_ID, payment_amount, @@ -775,7 +784,7 @@ fn test_accept_and_pay() { ); assert_ok!(Payment::accept_and_pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, )); @@ -804,7 +813,7 @@ fn test_accept_and_pay() { fn test_accept_and_pay_should_fail_for_non_payment_requested() { new_test_ext().execute_with(|| { assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, 20, @@ -812,7 +821,7 @@ fn test_accept_and_pay_should_fail_for_non_payment_requested() { )); assert_noop!( - Payment::accept_and_pay(Origin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT,), + Payment::accept_and_pay(RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT,), Error::InvalidAction ); }); @@ -827,7 +836,7 @@ fn test_accept_and_pay_should_charge_fee_correctly() { let expected_fee_amount = payment_amount / MARKETPLACE_FEE_PERCENTAGE as u128; assert_ok!(Payment::request_payment( - Origin::signed(PAYMENT_RECIPENT_FEE_CHARGED), + RuntimeOrigin::signed(PAYMENT_RECIPENT_FEE_CHARGED), PAYMENT_CREATOR, CURRENCY_ID, payment_amount, @@ -846,7 +855,7 @@ fn test_accept_and_pay_should_charge_fee_correctly() { ); assert_ok!(Payment::accept_and_pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT_FEE_CHARGED, )); @@ -1058,7 +1067,7 @@ fn test_settle_payment_works_for_cancel() { // should be able to create a payment with available balance within a // transaction assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -1101,7 +1110,7 @@ fn test_settle_payment_works_for_release() { // should be able to create a payment with available balance within a // transaction assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -1145,7 +1154,7 @@ fn test_settle_payment_works_for_70_30() { // should be able to create a payment with available balance within a // transaction assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT_FEE_CHARGED, CURRENCY_ID, payment_amount, @@ -1200,7 +1209,7 @@ fn test_settle_payment_works_for_50_50() { // should be able to create a payment with available balance within a // transaction assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT_FEE_CHARGED, CURRENCY_ID, payment_amount, @@ -1251,7 +1260,7 @@ fn test_automatic_refund_works() { const CANCEL_BLOCK: u64 = CANCEL_PERIOD + 1; assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, payment_amount, @@ -1259,7 +1268,7 @@ fn test_automatic_refund_works() { )); assert_ok!(Payment::request_refund( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT )); @@ -1335,7 +1344,7 @@ fn test_automatic_refund_works_for_multiple_payments() { const CANCEL_PERIOD: u64 = 600; assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT, CURRENCY_ID, 20, @@ -1343,7 +1352,7 @@ fn test_automatic_refund_works_for_multiple_payments() { )); assert_ok!(Payment::pay( - Origin::signed(PAYMENT_CREATOR_TWO), + RuntimeOrigin::signed(PAYMENT_CREATOR_TWO), PAYMENT_RECIPENT_TWO, CURRENCY_ID, 20, @@ -1351,12 +1360,12 @@ fn test_automatic_refund_works_for_multiple_payments() { )); assert_ok!(Payment::request_refund( - Origin::signed(PAYMENT_CREATOR), + RuntimeOrigin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT )); run_n_blocks(1); assert_ok!(Payment::request_refund( - Origin::signed(PAYMENT_CREATOR_TWO), + RuntimeOrigin::signed(PAYMENT_CREATOR_TWO), PAYMENT_RECIPENT_TWO )); diff --git a/rewards/Cargo.toml b/rewards/Cargo.toml index cbdc866a3..5ce213661 100644 --- a/rewards/Cargo.toml +++ b/rewards/Cargo.toml @@ -12,17 +12,17 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/rewards/src/mock.rs b/rewards/src/mock.rs index 8a88ed4cd..e6e92c5d9 100644 --- a/rewards/src/mock.rs +++ b/rewards/src/mock.rs @@ -30,16 +30,16 @@ pub const NATIVE_COIN: CurrencyId = 0; pub const STABLE_COIN: CurrencyId = 1; impl frame_system::Config for Runtime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index b0260f5cf..71cc09f6c 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -12,18 +12,18 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/tokens/rpc/Cargo.toml b/tokens/rpc/Cargo.toml index 3431997be..348026496 100644 --- a/tokens/rpc/Cargo.toml +++ b/tokens/rpc/Cargo.toml @@ -12,11 +12,11 @@ jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } tracing = { version = "0.1.29" } tracing-core = { version = "0.1.28" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } orml-tokens-rpc-runtime-api = { version = "0.4.1-dev", path = "./runtime-api" } diff --git a/tokens/rpc/runtime-api/Cargo.toml b/tokens/rpc/runtime-api/Cargo.toml index be03b4c10..e9ee82f1c 100644 --- a/tokens/rpc/runtime-api/Cargo.toml +++ b/tokens/rpc/runtime-api/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } orml-tokens = { default-features = false, path = "../../../tokens" } [features] diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index 9919ed981..ed4e78419 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -60,7 +60,7 @@ use sp_runtime::{ AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, Saturating, StaticLookup, Zero, }, - ArithmeticError, DispatchError, DispatchResult, RuntimeDebug, + ArithmeticError, DispatchError, DispatchResult, FixedPointOperand, RuntimeDebug, }; use sp_std::{cmp, convert::Infallible, marker, prelude::*, vec::Vec}; @@ -179,7 +179,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The balance type type Balance: Parameter @@ -188,7 +188,8 @@ pub mod module { + Default + Copy + MaybeSerializeDeserialize - + MaxEncodedLen; + + MaxEncodedLen + + FixedPointOperand; /// The amount type, should be signed version of `Balance` type Amount: Signed diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index cb836e317..0a4346a27 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -42,8 +42,8 @@ pub const RID_2: ReserveIdentifier = [2u8; 8]; use crate as tokens; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -51,7 +51,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -119,7 +119,7 @@ impl pallet_treasury::Config for Runtime { type Currency = MockCurrencyAdapter; type ApproveOrigin = frame_system::EnsureRoot; type RejectOrigin = frame_system::EnsureRoot; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnSlash = (); type ProposalBond = ProposalBond; type ProposalBondMinimum = ProposalBondMinimum; @@ -187,7 +187,7 @@ parameter_types! { impl pallet_elections_phragmen::Config for Runtime { type PalletId = ElectionsPhragmenPalletId; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = MockCurrencyAdapter; type CurrencyToVote = SaturatingCurrencyToVote; type ChangeMembers = TestChangeMembers; @@ -322,7 +322,7 @@ parameter_types! { } impl Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = i64; type CurrencyId = CurrencyId; diff --git a/tokens/src/tests.rs b/tokens/src/tests.rs index eaec40446..12feb02ea 100644 --- a/tokens/src/tests.rs +++ b/tokens/src/tests.rs @@ -5,7 +5,7 @@ use super::*; use frame_support::{assert_noop, assert_ok}; use frame_system::RawOrigin; -use mock::{Event, *}; +use mock::*; use sp_runtime::{traits::BadOrigin, TokenError}; // ************************************************* @@ -36,7 +36,7 @@ fn transfer_should_work() { .build() .execute_with(|| { assert_ok!(Tokens::transfer(Some(ALICE).into(), BOB, DOT, 50)); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: BOB, @@ -83,7 +83,7 @@ fn transfer_keep_alive_should_work() { ); assert_ok!(Tokens::transfer_keep_alive(Some(ALICE).into(), BOB, DOT, 98)); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: BOB, @@ -102,7 +102,7 @@ fn transfer_all_keep_alive_should_work() { .execute_with(|| { assert_eq!(Tokens::free_balance(DOT, &ALICE), 100); assert_ok!(Tokens::transfer_all(Some(ALICE).into(), CHARLIE, DOT, true)); - System::assert_has_event(Event::Tokens(crate::Event::Transfer { + System::assert_has_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: CHARLIE, @@ -114,7 +114,7 @@ fn transfer_all_keep_alive_should_work() { assert_eq!(Tokens::accounts(&BOB, DOT).frozen, 50); assert_eq!(Tokens::free_balance(DOT, &BOB), 100); assert_ok!(Tokens::transfer_all(Some(BOB).into(), CHARLIE, DOT, true)); - System::assert_has_event(Event::Tokens(crate::Event::Transfer { + System::assert_has_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: BOB, to: CHARLIE, @@ -133,7 +133,7 @@ fn transfer_all_allow_death_should_work() { assert_eq!(Tokens::free_balance(DOT, &ALICE), 100); assert_ok!(Tokens::transfer_all(Some(ALICE).into(), CHARLIE, DOT, false)); assert_eq!(TrackCreatedAccounts::accounts(), vec![(CHARLIE, DOT)]); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: CHARLIE, @@ -147,7 +147,7 @@ fn transfer_all_allow_death_should_work() { assert_eq!(Tokens::accounts(&BOB, DOT).frozen, 50); assert_eq!(Tokens::free_balance(DOT, &BOB), 100); assert_ok!(Tokens::transfer_all(Some(BOB).into(), CHARLIE, DOT, false)); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: BOB, to: CHARLIE, @@ -172,7 +172,7 @@ fn force_transfer_should_work() { // imply AllowDeath assert_ok!(Tokens::force_transfer(RawOrigin::Root.into(), ALICE, BOB, DOT, 100)); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: BOB, @@ -218,7 +218,7 @@ fn set_balance_should_work() { assert_eq!(Tokens::total_issuance(DOT), 200); assert_ok!(Tokens::set_balance(RawOrigin::Root.into(), ALICE, DOT, 200, 100)); - System::assert_has_event(Event::Tokens(crate::Event::BalanceSet { + System::assert_has_event(RuntimeEvent::Tokens(crate::Event::BalanceSet { currency_id: DOT, who: ALICE, free: 200, @@ -234,7 +234,7 @@ fn set_balance_should_work() { assert_eq!(Tokens::reserved_balance(DOT, &BOB), 0); assert_ok!(Tokens::set_balance(RawOrigin::Root.into(), BOB, DOT, 0, 0)); - System::assert_has_event(Event::Tokens(crate::Event::BalanceSet { + System::assert_has_event(RuntimeEvent::Tokens(crate::Event::BalanceSet { currency_id: DOT, who: BOB, free: 0, @@ -251,7 +251,7 @@ fn set_balance_should_work() { // below ED, assert_ok!(Tokens::set_balance(RawOrigin::Root.into(), CHARLIE, DOT, 1, 0)); - System::assert_has_event(Event::Tokens(crate::Event::BalanceSet { + System::assert_has_event(RuntimeEvent::Tokens(crate::Event::BalanceSet { currency_id: DOT, who: CHARLIE, free: 0, @@ -1000,7 +1000,7 @@ fn endowed_account_work() { assert_eq!(System::providers(&ALICE), 0); assert!(!Accounts::::contains_key(ALICE, DOT)); Tokens::set_free_balance(DOT, &ALICE, 100); - System::assert_last_event(Event::Tokens(crate::Event::Endowed { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Endowed { currency_id: DOT, who: ALICE, amount: 100, @@ -1084,7 +1084,7 @@ fn dust_removal_work() { assert_eq!(Tokens::free_balance(DOT, &ALICE), 100); assert_eq!(Tokens::free_balance(DOT, &DustReceiver::get()), 0); Tokens::set_free_balance(DOT, &ALICE, 1); - System::assert_last_event(Event::Tokens(crate::Event::DustLost { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::DustLost { currency_id: DOT, who: ALICE, amount: 1, @@ -1103,7 +1103,7 @@ fn dust_removal_work() { assert!(Accounts::::contains_key(DAVE, DOT)); assert_eq!(System::providers(&DAVE), 1); assert_eq!(Tokens::free_balance(DOT, &DAVE), 1); - System::assert_last_event(Event::Tokens(crate::Event::Endowed { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Endowed { currency_id: DOT, who: DAVE, amount: 1, @@ -1122,7 +1122,7 @@ fn account_survive_due_to_dust_transfer_failure() { assert!(!Accounts::::contains_key(ALICE, DOT)); Tokens::set_reserved_balance(DOT, &ALICE, 1); - System::assert_last_event(Event::Tokens(crate::Event::DustLost { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::DustLost { currency_id: DOT, who: ALICE, amount: 1, diff --git a/tokens/src/tests_events.rs b/tokens/src/tests_events.rs index a03c3c0bf..e966a2acd 100644 --- a/tokens/src/tests_events.rs +++ b/tokens/src/tests_events.rs @@ -4,7 +4,7 @@ use super::*; use frame_support::assert_ok; -use mock::{Event, *}; +use mock::*; #[test] fn pallet_multicurrency_deposit_events() { @@ -13,7 +13,7 @@ fn pallet_multicurrency_deposit_events() { .build() .execute_with(|| { assert_ok!(>::transfer(DOT, &ALICE, &BOB, 10)); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: BOB, @@ -21,14 +21,14 @@ fn pallet_multicurrency_deposit_events() { })); assert_ok!(>::deposit(DOT, &ALICE, 10)); - System::assert_last_event(Event::Tokens(crate::Event::Deposited { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Deposited { currency_id: DOT, who: ALICE, amount: 10, })); assert_ok!(>::withdraw(DOT, &ALICE, 10)); - System::assert_last_event(Event::Tokens(crate::Event::Withdrawn { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Withdrawn { currency_id: DOT, who: ALICE, amount: 10, @@ -36,7 +36,7 @@ fn pallet_multicurrency_deposit_events() { assert_ok!(>::reserve(DOT, &ALICE, 50)); assert_eq!(>::slash(DOT, &ALICE, 60), 0); - System::assert_last_event(Event::Tokens(crate::Event::Slashed { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Slashed { currency_id: DOT, who: ALICE, free_amount: 40, @@ -54,7 +54,7 @@ fn pallet_multicurrency_extended_deposit_events() { assert_ok!(>::update_balance( DOT, &ALICE, 500 )); - System::assert_last_event(Event::Tokens(crate::Event::Deposited { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Deposited { currency_id: DOT, who: ALICE, amount: 500, @@ -62,7 +62,7 @@ fn pallet_multicurrency_extended_deposit_events() { assert_ok!(>::update_balance( DOT, &ALICE, -500 )); - System::assert_last_event(Event::Tokens(crate::Event::Withdrawn { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Withdrawn { currency_id: DOT, who: ALICE, amount: 500, @@ -79,7 +79,7 @@ fn pallet_multi_lockable_currency_deposit_events() { assert_ok!(>::set_lock( [0u8; 8], DOT, &ALICE, 10 )); - System::assert_last_event(Event::Tokens(crate::Event::LockSet { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::LockSet { lock_id: [0u8; 8], currency_id: DOT, who: ALICE, @@ -89,7 +89,7 @@ fn pallet_multi_lockable_currency_deposit_events() { assert_ok!(>::remove_lock( [0u8; 8], DOT, &ALICE )); - System::assert_last_event(Event::Tokens(crate::Event::LockRemoved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::LockRemoved { lock_id: [0u8; 8], currency_id: DOT, who: ALICE, @@ -106,7 +106,7 @@ fn pallet_multi_reservable_currency_deposit_events() { assert_ok!(>::reserve( DOT, &ALICE, 500 )); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 500, @@ -116,7 +116,7 @@ fn pallet_multi_reservable_currency_deposit_events() { >::slash_reserved(DOT, &ALICE, 300), 0 ); - System::assert_last_event(Event::Tokens(crate::Event::Slashed { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Slashed { currency_id: DOT, who: ALICE, free_amount: 0, @@ -127,7 +127,7 @@ fn pallet_multi_reservable_currency_deposit_events() { >::unreserve(DOT, &ALICE, 100), 0 ); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 100, @@ -140,7 +140,7 @@ fn pallet_multi_reservable_currency_deposit_events() { 100, BalanceStatus::Free )); - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: ALICE, to: BOB, @@ -157,13 +157,13 @@ fn pallet_fungibles_mutate_deposit_events() { .build() .execute_with(|| { assert_ok!(>::mint_into(DOT, &ALICE, 500)); - System::assert_last_event(Event::Tokens(crate::Event::Deposited { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Deposited { currency_id: DOT, who: ALICE, amount: 500, })); assert_ok!(>::burn_from(DOT, &ALICE, 500)); - System::assert_last_event(Event::Tokens(crate::Event::Withdrawn { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Withdrawn { currency_id: DOT, who: ALICE, amount: 500, @@ -180,7 +180,7 @@ fn pallet_fungibles_transfer_deposit_events() { assert_ok!(>::transfer( DOT, &ALICE, &BOB, 50, true )); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: BOB, @@ -199,7 +199,7 @@ fn pallet_fungibles_unbalanced_deposit_events() { assert_ok!(>::set_balance( DOT, &ALICE, 500 )); - System::assert_last_event(Event::Tokens(crate::Event::BalanceSet { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::BalanceSet { currency_id: DOT, who: ALICE, free: 500, @@ -207,7 +207,7 @@ fn pallet_fungibles_unbalanced_deposit_events() { })); >::set_total_issuance(DOT, 1000); - System::assert_last_event(Event::Tokens(crate::Event::TotalIssuanceSet { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::TotalIssuanceSet { currency_id: DOT, amount: 1000, })); @@ -221,7 +221,7 @@ fn pallet_fungibles_mutate_hold_deposit_events() { .build() .execute_with(|| { assert_ok!(>::hold(DOT, &ALICE, 50)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 50, @@ -230,7 +230,7 @@ fn pallet_fungibles_mutate_hold_deposit_events() { assert_ok!(>::transfer_held( DOT, &ALICE, &BOB, 50, true, true )); - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: ALICE, to: BOB, @@ -242,7 +242,7 @@ fn pallet_fungibles_mutate_hold_deposit_events() { >::release(DOT, &BOB, 50, true), Ok(50) ); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: BOB, amount: 50, @@ -258,13 +258,13 @@ fn currency_adapter_pallet_currency_deposit_events() { .execute_with(|| { // Use std::mem::forget to get rid the returned imbalance. std::mem::forget(>::burn(500)); - System::assert_last_event(Event::Tokens(crate::Event::TotalIssuanceSet { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::TotalIssuanceSet { currency_id: DOT, amount: 0, })); std::mem::forget(>::issue(200)); - System::assert_last_event(Event::Tokens(crate::Event::TotalIssuanceSet { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::TotalIssuanceSet { currency_id: DOT, amount: 200, })); @@ -275,7 +275,7 @@ fn currency_adapter_pallet_currency_deposit_events() { 50, ExistenceRequirement::AllowDeath )); - System::assert_last_event(Event::Tokens(crate::Event::Transfer { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Transfer { currency_id: DOT, from: ALICE, to: BOB, @@ -284,7 +284,7 @@ fn currency_adapter_pallet_currency_deposit_events() { assert_ok!(>::reserve(DOT, &BOB, 50)); std::mem::forget(>::slash(&BOB, 110)); - System::assert_last_event(Event::Tokens(crate::Event::Slashed { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Slashed { currency_id: DOT, who: BOB, free_amount: 100, @@ -292,7 +292,7 @@ fn currency_adapter_pallet_currency_deposit_events() { })); std::mem::forget(>::make_free_balance_be(&BOB, 200)); - System::assert_last_event(Event::Tokens(crate::Event::BalanceSet { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::BalanceSet { currency_id: DOT, who: BOB, free: 200, diff --git a/tokens/src/tests_multicurrency.rs b/tokens/src/tests_multicurrency.rs index 1fc067c84..0db833786 100644 --- a/tokens/src/tests_multicurrency.rs +++ b/tokens/src/tests_multicurrency.rs @@ -4,7 +4,7 @@ use super::*; use frame_support::{assert_noop, assert_ok}; -use mock::{Event, *}; +use mock::*; #[test] fn multicurrency_deposit_work() { @@ -196,7 +196,7 @@ fn multi_reservable_currency_reserve_work() { assert_eq!(Tokens::reserved_balance(DOT, &ALICE), 0); assert_eq!(Tokens::total_balance(DOT, &ALICE), 100); assert_ok!(Tokens::reserve(DOT, &ALICE, 50)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 50, @@ -212,7 +212,7 @@ fn multi_reservable_currency_reserve_work() { // ensure will not trigger Endowed event assert!(System::events().iter().all(|record| !matches!( record.event, - Event::Tokens(crate::Event::Endowed { + RuntimeEvent::Tokens(crate::Event::Endowed { currency_id: DOT, who: ALICE, amount: _ @@ -231,13 +231,13 @@ fn multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::reserved_balance(DOT, &ALICE), 0); assert_eq!(Tokens::unreserve(DOT, &ALICE, 0), 0); assert_eq!(Tokens::unreserve(DOT, &ALICE, 50), 50); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 0, })); assert_ok!(Tokens::reserve(DOT, &ALICE, 30)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 30, @@ -245,7 +245,7 @@ fn multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::free_balance(DOT, &ALICE), 70); assert_eq!(Tokens::reserved_balance(DOT, &ALICE), 30); assert_eq!(Tokens::unreserve(DOT, &ALICE, 15), 0); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 15, @@ -253,7 +253,7 @@ fn multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::free_balance(DOT, &ALICE), 85); assert_eq!(Tokens::reserved_balance(DOT, &ALICE), 15); assert_eq!(Tokens::unreserve(DOT, &ALICE, 30), 15); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 15, @@ -263,7 +263,7 @@ fn multi_reservable_currency_unreserve_work() { // ensure will not trigger Endowed event assert!(System::events().iter().all(|record| !matches!( record.event, - Event::Tokens(crate::Event::Endowed { + RuntimeEvent::Tokens(crate::Event::Endowed { currency_id: DOT, who: ALICE, amount: _ @@ -289,7 +289,7 @@ fn multi_reservable_currency_repatriate_reserved_work() { Ok(50) ); // Repatriating from and to the same account, fund is `unreserved`. - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 0, @@ -315,7 +315,7 @@ fn multi_reservable_currency_repatriate_reserved_work() { Tokens::repatriate_reserved(DOT, &BOB, &ALICE, 30, BalanceStatus::Reserved), Ok(0) ); - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: BOB, to: ALICE, @@ -334,7 +334,7 @@ fn multi_reservable_currency_repatriate_reserved_work() { ); // Actual amount repatriated is 20. - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: BOB, to: ALICE, @@ -448,7 +448,7 @@ fn named_multi_reservable_currency_reserve_work() { assert_eq!(Tokens::reserved_balance_named(&RID_1, DOT, &ALICE), 0); assert_eq!(Tokens::total_balance(DOT, &ALICE), 100); assert_ok!(Tokens::reserve_named(&RID_1, DOT, &ALICE, 50)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 50, @@ -459,7 +459,7 @@ fn named_multi_reservable_currency_reserve_work() { assert_eq!(Tokens::total_balance(DOT, &ALICE), 100); assert_ok!(Tokens::reserve_named(&RID_2, DOT, &ALICE, 50)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 50, @@ -474,7 +474,7 @@ fn named_multi_reservable_currency_reserve_work() { // ensure will not trigger Endowed event assert!(System::events().iter().all(|record| !matches!( record.event, - Event::Tokens(crate::Event::Endowed { + RuntimeEvent::Tokens(crate::Event::Endowed { currency_id: DOT, who: ALICE, amount: _ @@ -494,7 +494,7 @@ fn named_multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::unreserve_named(&RID_1, DOT, &ALICE, 0), 0); assert_ok!(Tokens::reserve_named(&RID_1, DOT, &ALICE, 30)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 30, @@ -504,7 +504,7 @@ fn named_multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::reserved_balance_named(&RID_1, DOT, &ALICE), 30); assert_ok!(Tokens::reserve_named(&RID_2, DOT, &ALICE, 30)); - System::assert_last_event(Event::Tokens(crate::Event::Reserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Reserved { currency_id: DOT, who: ALICE, amount: 30, @@ -515,7 +515,7 @@ fn named_multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::reserved_balance_named(&RID_2, DOT, &ALICE), 30); assert_eq!(Tokens::unreserve_named(&RID_1, DOT, &ALICE, 30), 0); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 30, @@ -526,7 +526,7 @@ fn named_multi_reservable_currency_unreserve_work() { assert_eq!(Tokens::reserved_balance_named(&RID_2, DOT, &ALICE), 30); assert_eq!(Tokens::unreserve_named(&RID_2, DOT, &ALICE, 30), 0); - System::assert_last_event(Event::Tokens(crate::Event::Unreserved { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::Unreserved { currency_id: DOT, who: ALICE, amount: 30, @@ -538,7 +538,7 @@ fn named_multi_reservable_currency_unreserve_work() { // ensure will not trigger Endowed event assert!(System::events().iter().all(|record| !matches!( record.event, - Event::Tokens(crate::Event::Endowed { + RuntimeEvent::Tokens(crate::Event::Endowed { currency_id: DOT, who: ALICE, amount: _ @@ -584,7 +584,7 @@ fn named_multi_reservable_currency_repatriate_reserved_work() { Tokens::repatriate_reserved_named(&RID_1, DOT, &BOB, &ALICE, 30, BalanceStatus::Reserved), Ok(0) ); - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: BOB, to: ALICE, @@ -605,7 +605,7 @@ fn named_multi_reservable_currency_repatriate_reserved_work() { ); // Actual amount repatriated is 20. - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: BOB, to: ALICE, @@ -722,7 +722,7 @@ fn named_multi_reservable_repatriate_all_reserved_named_works() { assert_eq!(Tokens::free_balance(DOT, &BOB), 100); assert_eq!(Tokens::reserved_balance_named(&RID_1, DOT, &BOB), 50); - System::assert_last_event(Event::Tokens(crate::Event::ReserveRepatriated { + System::assert_last_event(RuntimeEvent::Tokens(crate::Event::ReserveRepatriated { currency_id: DOT, from: ALICE, to: BOB, diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 7a898947d..4659413b4 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -14,12 +14,12 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = num-traits = { version = "0.2.14", default-features = false } impl-trait-for-tuples = "0.2.2" -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } diff --git a/unknown-tokens/Cargo.toml b/unknown-tokens/Cargo.toml index 61c824d2b..a4c4f75f2 100644 --- a/unknown-tokens/Cargo.toml +++ b/unknown-tokens/Cargo.toml @@ -12,18 +12,18 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } orml-xcm-support = { path = "../xcm-support", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/unknown-tokens/src/lib.rs b/unknown-tokens/src/lib.rs index 1ef06ed41..be7fee5d2 100644 --- a/unknown-tokens/src/lib.rs +++ b/unknown-tokens/src/lib.rs @@ -18,7 +18,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From + IsType<::Event>; + type RuntimeEvent: From + IsType<::RuntimeEvent>; } #[pallet::event] diff --git a/unknown-tokens/src/mock.rs b/unknown-tokens/src/mock.rs index 4ca58bed1..3f2172108 100644 --- a/unknown-tokens/src/mock.rs +++ b/unknown-tokens/src/mock.rs @@ -15,8 +15,8 @@ use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; pub type AccountId = AccountId32; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -24,7 +24,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -42,7 +42,7 @@ impl frame_system::Config for Runtime { } impl Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; } type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; diff --git a/unknown-tokens/src/tests.rs b/unknown-tokens/src/tests.rs index 5a8fefc75..236d7f1fe 100644 --- a/unknown-tokens/src/tests.rs +++ b/unknown-tokens/src/tests.rs @@ -3,7 +3,7 @@ #![cfg(test)] use super::*; -use mock::{Event, *}; +use mock::*; use frame_support::{assert_err, assert_ok}; @@ -31,7 +31,7 @@ fn deposit_concrete_fungible_asset_works() { UnknownTokens::concrete_fungible_balances(&MOCK_RECIPIENT, &MOCK_CONCRETE_FUNGIBLE_ID), 3 ); - System::assert_last_event(Event::UnknownTokens(crate::Event::Deposited { + System::assert_last_event(RuntimeEvent::UnknownTokens(crate::Event::Deposited { asset, who: MOCK_RECIPIENT, })); @@ -54,7 +54,7 @@ fn deposit_abstract_fungible_asset() { UnknownTokens::abstract_fungible_balances(&MOCK_RECIPIENT, &mock_abstract_fungible_id()), 3 ); - System::assert_last_event(Event::UnknownTokens(crate::Event::Deposited { + System::assert_last_event(RuntimeEvent::UnknownTokens(crate::Event::Deposited { asset, who: MOCK_RECIPIENT, })); @@ -99,7 +99,7 @@ fn withdraw_concrete_fungible_asset_works() { UnknownTokens::concrete_fungible_balances(&MOCK_RECIPIENT, &MOCK_CONCRETE_FUNGIBLE_ID), 0 ); - System::assert_last_event(Event::UnknownTokens(crate::Event::Withdrawn { + System::assert_last_event(RuntimeEvent::UnknownTokens(crate::Event::Withdrawn { asset: asset.clone(), who: MOCK_RECIPIENT, })); @@ -123,7 +123,7 @@ fn withdraw_abstract_fungible_asset_works() { UnknownTokens::abstract_fungible_balances(&MOCK_RECIPIENT, &mock_abstract_fungible_id()), 0 ); - System::assert_last_event(Event::UnknownTokens(crate::Event::Withdrawn { + System::assert_last_event(RuntimeEvent::UnknownTokens(crate::Event::Withdrawn { asset: asset.clone(), who: MOCK_RECIPIENT, })); diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index bc755928f..bd916aebd 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -12,15 +12,15 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [dev-dependencies] serde_json = "1.0.64" -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/utilities/src/lib.rs b/utilities/src/lib.rs index 2e7fa9595..a75ea1534 100644 --- a/utilities/src/lib.rs +++ b/utilities/src/lib.rs @@ -56,7 +56,7 @@ mod tests { pub trait Config: frame_system::Config {} decl_module! { - pub struct Module for enum Call where origin: T::Origin {} + pub struct Module for enum Call where origin: T::RuntimeOrigin {} } decl_storage! { diff --git a/vesting/Cargo.toml b/vesting/Cargo.toml index b295f50a8..2b40e7b05 100644 --- a/vesting/Cargo.toml +++ b/vesting/Cargo.toml @@ -12,15 +12,15 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/vesting/src/lib.rs b/vesting/src/lib.rs index 092aae7bd..d742327dc 100644 --- a/vesting/src/lib.rs +++ b/vesting/src/lib.rs @@ -123,7 +123,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; type Currency: LockableCurrency; @@ -132,7 +132,7 @@ pub mod module { type MinVestedTransfer: Get>; /// Required origin for vested transfer. - type VestedTransferOrigin: EnsureOrigin; + type VestedTransferOrigin: EnsureOrigin; /// Weight information for extrinsics in this module. type WeightInfo: WeightInfo; diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index dae1b5f91..fc7331c5d 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -15,8 +15,8 @@ use crate as vesting; pub type AccountId = u128; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -24,7 +24,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -46,7 +46,7 @@ type Balance = u64; impl pallet_balances::Config for Runtime { type Balance = Balance; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ConstU64<1>; type AccountStore = frame_system::Pallet; type MaxLocks = (); @@ -56,14 +56,14 @@ impl pallet_balances::Config for Runtime { } pub struct EnsureAliceOrBob; -impl EnsureOrigin for EnsureAliceOrBob { +impl EnsureOrigin for EnsureAliceOrBob { type Success = AccountId; - fn try_origin(o: Origin) -> Result { - Into::, Origin>>::into(o).and_then(|o| match o { + fn try_origin(o: RuntimeOrigin) -> Result { + Into::, RuntimeOrigin>>::into(o).and_then(|o| match o { RawOrigin::Signed(ALICE) => Ok(ALICE), RawOrigin::Signed(BOB) => Ok(BOB), - r => Err(Origin::from(r)), + r => Err(RuntimeOrigin::from(r)), }) } @@ -88,7 +88,7 @@ impl BlockNumberProvider for MockBlockNumberProvider { } impl Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = PalletBalances; type MinVestedTransfer = ConstU64<5>; type VestedTransferOrigin = EnsureAliceOrBob; diff --git a/vesting/src/tests.rs b/vesting/src/tests.rs index 51706440d..97371ffac 100644 --- a/vesting/src/tests.rs +++ b/vesting/src/tests.rs @@ -4,7 +4,7 @@ use super::*; use frame_support::{assert_noop, assert_ok, error::BadOrigin}; -use mock::{Call, Event, *}; +use mock::*; use pallet_balances::{BalanceLock, Reasons}; use sp_runtime::traits::Dispatchable; @@ -39,7 +39,7 @@ fn vesting_from_chain_spec_works() { MockBlockNumberProvider::set(13); - assert_ok!(Vesting::claim(Origin::signed(CHARLIE))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(CHARLIE))); assert_ok!(PalletBalances::ensure_can_withdraw( &CHARLIE, @@ -51,7 +51,7 @@ fn vesting_from_chain_spec_works() { MockBlockNumberProvider::set(14); - assert_ok!(Vesting::claim(Origin::signed(CHARLIE))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(CHARLIE))); assert_ok!(PalletBalances::ensure_can_withdraw( &CHARLIE, @@ -73,9 +73,13 @@ fn vested_transfer_works() { period_count: 1u32, per_period: 100u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); assert_eq!(Vesting::vesting_schedules(&BOB), vec![schedule.clone()]); - System::assert_last_event(Event::Vesting(crate::Event::VestingScheduleAdded { + System::assert_last_event(RuntimeEvent::Vesting(crate::Event::VestingScheduleAdded { from: ALICE, to: BOB, vesting_schedule: schedule, @@ -92,7 +96,7 @@ fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); MockBlockNumberProvider::set(12); @@ -102,7 +106,11 @@ fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { period_count: 1u32, per_period: 7u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, another_schedule)); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + another_schedule + )); assert_eq!( PalletBalances::locks(&BOB).get(0), @@ -124,7 +132,7 @@ fn cannot_use_fund_if_not_claimed() { period_count: 1u32, per_period: 50u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); assert!(PalletBalances::ensure_can_withdraw(&BOB, 1, WithdrawReasons::TRANSFER, 49).is_err()); }); } @@ -139,7 +147,7 @@ fn vested_transfer_fails_if_zero_period_or_count() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule), Error::::ZeroVestingPeriod ); @@ -150,7 +158,7 @@ fn vested_transfer_fails_if_zero_period_or_count() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule), Error::::ZeroVestingPeriodCount ); }); @@ -166,7 +174,7 @@ fn vested_transfer_fails_if_transfer_err() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(BOB), ALICE, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(BOB), ALICE, schedule), pallet_balances::Error::::InsufficientBalance, ); }); @@ -182,7 +190,7 @@ fn vested_transfer_fails_if_overflow() { per_period: u64::MAX, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule), ArithmeticError::Overflow, ); @@ -193,7 +201,7 @@ fn vested_transfer_fails_if_overflow() { per_period: 1u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, another_schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, another_schedule), ArithmeticError::Overflow, ); }); @@ -209,7 +217,7 @@ fn vested_transfer_fails_if_bad_origin() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(CHARLIE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(CHARLIE), BOB, schedule), BadOrigin ); }); @@ -224,23 +232,23 @@ fn claim_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); MockBlockNumberProvider::set(11); // remain locked if not claimed - assert!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10).is_err()); + assert!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10).is_err()); // unlocked after claiming - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(VestingSchedules::::contains_key(BOB)); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10)); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10)); // more are still locked - assert!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 1).is_err()); + assert!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 1).is_err()); MockBlockNumberProvider::set(21); // claim more - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(!VestingSchedules::::contains_key(BOB)); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10)); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10)); // all used up assert_eq!(PalletBalances::free_balance(BOB), 0); @@ -258,9 +266,9 @@ fn claim_for_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); - assert_ok!(Vesting::claim_for(Origin::signed(ALICE), BOB)); + assert_ok!(Vesting::claim_for(RuntimeOrigin::signed(ALICE), BOB)); assert_eq!( PalletBalances::locks(&BOB).get(0), @@ -274,7 +282,7 @@ fn claim_for_works() { MockBlockNumberProvider::set(21); - assert_ok!(Vesting::claim_for(Origin::signed(ALICE), BOB)); + assert_ok!(Vesting::claim_for(RuntimeOrigin::signed(ALICE), BOB)); // no locks anymore assert_eq!(PalletBalances::locks(&BOB), vec![]); @@ -291,7 +299,7 @@ fn update_vesting_schedules_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); let updated_schedule = VestingSchedule { start: 0u64, @@ -300,18 +308,18 @@ fn update_vesting_schedules_works() { per_period: 10u64, }; assert_ok!(Vesting::update_vesting_schedules( - Origin::root(), + RuntimeOrigin::root(), BOB, vec![updated_schedule] )); MockBlockNumberProvider::set(11); - assert_ok!(Vesting::claim(Origin::signed(BOB))); - assert!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 1).is_err()); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); + assert!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 1).is_err()); MockBlockNumberProvider::set(21); - assert_ok!(Vesting::claim(Origin::signed(BOB))); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10)); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10)); // empty vesting schedules cleanup the storage and unlock the fund assert!(VestingSchedules::::contains_key(BOB)); @@ -323,7 +331,7 @@ fn update_vesting_schedules_works() { reasons: Reasons::All, }) ); - assert_ok!(Vesting::update_vesting_schedules(Origin::root(), BOB, vec![])); + assert_ok!(Vesting::update_vesting_schedules(RuntimeOrigin::root(), BOB, vec![])); assert!(!VestingSchedules::::contains_key(BOB)); assert_eq!(PalletBalances::locks(&BOB), vec![]); }); @@ -332,7 +340,7 @@ fn update_vesting_schedules_works() { #[test] fn update_vesting_schedules_fails_if_unexpected_existing_locks() { ExtBuilder::build().execute_with(|| { - assert_ok!(PalletBalances::transfer(Origin::signed(ALICE), BOB, 1)); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(ALICE), BOB, 1)); PalletBalances::set_lock(*b"prelocks", &BOB, 0u64, WithdrawReasons::all()); }); } @@ -347,7 +355,7 @@ fn vested_transfer_check_for_min() { per_period: 3u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(BOB), ALICE, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(BOB), ALICE, schedule), Error::::AmountLow ); }); @@ -362,7 +370,11 @@ fn multiple_vesting_schedule_claim_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); let schedule2 = VestingSchedule { start: 0u64, @@ -370,19 +382,23 @@ fn multiple_vesting_schedule_claim_works() { period_count: 3u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule2.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule2.clone() + )); assert_eq!(Vesting::vesting_schedules(&BOB), vec![schedule, schedule2.clone()]); MockBlockNumberProvider::set(21); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert_eq!(Vesting::vesting_schedules(&BOB), vec![schedule2]); MockBlockNumberProvider::set(31); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(!VestingSchedules::::contains_key(&BOB)); @@ -399,22 +415,30 @@ fn exceeding_maximum_schedules_should_fail() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); - let create = Call::Vesting(crate::Call::::vested_transfer { + let create = RuntimeCall::Vesting(crate::Call::::vested_transfer { dest: BOB, schedule: schedule.clone(), }); assert_noop!( - create.dispatch(Origin::signed(ALICE)), + create.dispatch(RuntimeOrigin::signed(ALICE)), Error::::MaxVestingSchedulesExceeded ); let schedules = vec![schedule.clone(), schedule.clone(), schedule]; assert_noop!( - Vesting::update_vesting_schedules(Origin::root(), BOB, schedules), + Vesting::update_vesting_schedules(RuntimeOrigin::root(), BOB, schedules), Error::::MaxVestingSchedulesExceeded ); }); @@ -440,24 +464,32 @@ fn cliff_vesting_works() { }; assert_eq!(PalletBalances::free_balance(BOB), 0); - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, cliff_schedule)); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + cliff_schedule + )); assert_eq!(PalletBalances::free_balance(BOB), VESTING_AMOUNT); assert_eq!(PalletBalances::locks(&BOB), vec![balance_lock.clone()]); for i in 1..VESTING_PERIOD { MockBlockNumberProvider::set(i); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert_eq!(PalletBalances::free_balance(BOB), VESTING_AMOUNT); assert_eq!(PalletBalances::locks(&BOB), vec![balance_lock.clone()]); assert_noop!( - PalletBalances::transfer(Origin::signed(BOB), CHARLIE, VESTING_AMOUNT), + PalletBalances::transfer(RuntimeOrigin::signed(BOB), CHARLIE, VESTING_AMOUNT), pallet_balances::Error::::LiquidityRestrictions, ); } MockBlockNumberProvider::set(VESTING_PERIOD); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(PalletBalances::locks(&BOB).is_empty()); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), CHARLIE, VESTING_AMOUNT)); + assert_ok!(PalletBalances::transfer( + RuntimeOrigin::signed(BOB), + CHARLIE, + VESTING_AMOUNT + )); }); } diff --git a/weight-meter/Cargo.toml b/weight-meter/Cargo.toml index 51e4d589b..0b9c67954 100644 --- a/weight-meter/Cargo.toml +++ b/weight-meter/Cargo.toml @@ -10,19 +10,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } weight-meter-procedural = { path = "weight-meter-procedural", default-features = false } [dev-dependencies] serde = { version = "1.0.136" } codec = { package = "parity-scale-codec", version = "3.0.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] diff --git a/weight-meter/src/mock.rs b/weight-meter/src/mock.rs index b7ad79eeb..dee781d26 100644 --- a/weight-meter/src/mock.rs +++ b/weight-meter/src/mock.rs @@ -140,16 +140,16 @@ type Block = frame_system::mocking::MockBlock; type Balance = u128; impl frame_system::Config for Runtime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -168,7 +168,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = frame_system::Pallet; diff --git a/weight-meter/src/tests.rs b/weight-meter/src/tests.rs index 2bc294c04..97d08a16f 100644 --- a/weight-meter/src/tests.rs +++ b/weight-meter/src/tests.rs @@ -1,16 +1,16 @@ use crate::mock::*; -use frame_support::weights::{PostDispatchInfo, Weight}; +use frame_support::{dispatch::PostDispatchInfo, weights::Weight}; #[test] fn used_weight_works() { new_test_ext().execute_with(|| { - let result: PostDispatchInfo = TestModule::expect_100(Origin::signed(100)).unwrap(); + let result: PostDispatchInfo = TestModule::expect_100(RuntimeOrigin::signed(100)).unwrap(); // Check used weight is correct assert_eq!(Some(Weight::from_ref_time(100)), result.actual_weight); // Check that the method ran correctly assert_eq!(Some(100), TestModule::something()); - let result: PostDispatchInfo = TestModule::expect_500(Origin::signed(100)).unwrap(); + let result: PostDispatchInfo = TestModule::expect_500(RuntimeOrigin::signed(100)).unwrap(); assert_eq!(Some(Weight::from_ref_time(500)), result.actual_weight); assert_eq!(Some(600), TestModule::something()); }); @@ -19,13 +19,13 @@ fn used_weight_works() { #[test] fn used_weight_branch_works() { new_test_ext().execute_with(|| { - let result: PostDispatchInfo = TestModule::expect_100_or_200(Origin::signed(100), false).unwrap(); + let result: PostDispatchInfo = TestModule::expect_100_or_200(RuntimeOrigin::signed(100), false).unwrap(); // Check used weight is correct assert_eq!(Some(Weight::from_ref_time(100)), result.actual_weight); // Check that the method ran correctly assert_eq!(Some(100), TestModule::something()); - let result: PostDispatchInfo = TestModule::expect_100_or_200(Origin::signed(100), true).unwrap(); + let result: PostDispatchInfo = TestModule::expect_100_or_200(RuntimeOrigin::signed(100), true).unwrap(); // Check used weight is correct assert_eq!(Some(Weight::from_ref_time(200)), result.actual_weight); // Check that the method ran correctly @@ -36,7 +36,7 @@ fn used_weight_branch_works() { #[test] fn used_weight_nested_calls_works() { new_test_ext().execute_with(|| { - let result: PostDispatchInfo = TestModule::nested_inner_methods(Origin::signed(100)).unwrap(); + let result: PostDispatchInfo = TestModule::nested_inner_methods(RuntimeOrigin::signed(100)).unwrap(); // Check used weight is correct assert_eq!(Some(Weight::from_ref_time(300)), result.actual_weight); }); @@ -45,7 +45,7 @@ fn used_weight_nested_calls_works() { #[test] fn exceed_max_weight_works() { new_test_ext().execute_with(|| { - let result: PostDispatchInfo = TestModule::expect_max_weight(Origin::signed(100)).unwrap(); + let result: PostDispatchInfo = TestModule::expect_max_weight(RuntimeOrigin::signed(100)).unwrap(); // Check used weight is correct assert_eq!(Some(Weight::MAX), result.actual_weight); }); @@ -54,7 +54,7 @@ fn exceed_max_weight_works() { #[test] fn nested_module_calls_works() { new_test_ext().execute_with(|| { - let result = TestModule::nested_extrinsic(Origin::signed(0)).unwrap(); + let result = TestModule::nested_extrinsic(RuntimeOrigin::signed(0)).unwrap(); assert_eq!(result.actual_weight, Some(Weight::from_ref_time(700))); }); } diff --git a/xcm-support/Cargo.toml b/xcm-support/Cargo.toml index db178fcbb..2e1878fde 100644 --- a/xcm-support/Cargo.toml +++ b/xcm-support/Cargo.toml @@ -10,12 +10,12 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } diff --git a/xcm/Cargo.toml b/xcm/Cargo.toml index 51d7586d6..b40c1f232 100644 --- a/xcm/Cargo.toml +++ b/xcm/Cargo.toml @@ -11,15 +11,15 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } [dev-dependencies] -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } [features] default = ["std"] diff --git a/xcm/src/lib.rs b/xcm/src/lib.rs index 441874772..61607a5b4 100644 --- a/xcm/src/lib.rs +++ b/xcm/src/lib.rs @@ -16,12 +16,12 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config + pallet_xcm::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The required origin for sending XCM as parachain sovereign. /// /// Typically root or the majority of collective. - type SovereignOrigin: EnsureOrigin<::Origin>; + type SovereignOrigin: EnsureOrigin<::RuntimeOrigin>; } #[pallet::pallet] diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index 371e364d5..4b3db69db 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -13,19 +13,19 @@ serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } # substrate -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false , branch = "polkadot-v0.9.29" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false , branch = "polkadot-v0.9.30" } # polkadot -pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" } # orml orml-xcm-support = { path = "../xcm-support", default-features = false } @@ -33,21 +33,21 @@ orml-traits = { path = "../traits", default-features = false} [dev-dependencies] # substrate -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # polkadot -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } -xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # orml orml-tokens = { path = "../tokens" } diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 022417df5..027ad6215 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -66,7 +66,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The balance type. type Balance: Parameter @@ -94,13 +94,13 @@ pub mod module { type MinXcmFee: GetByKey>; /// XCM executor. - type XcmExecutor: ExecuteXcm; + type XcmExecutor: ExecuteXcm; /// MultiLocation filter type MultiLocationsFilter: Contains; /// Means of measuring the weight consumed by an XCM message locally. - type Weigher: WeightBounds; + type Weigher: WeightBounds; /// Base XCM weight. /// @@ -657,7 +657,7 @@ pub mod module { dest: MultiLocation, recipient: MultiLocation, dest_weight: Weight, - ) -> Result, DispatchError> { + ) -> Result, DispatchError> { Ok(Xcm(vec![TransferReserveAsset { assets: assets.clone(), dest: dest.clone(), @@ -674,7 +674,7 @@ pub mod module { reserve: MultiLocation, recipient: MultiLocation, dest_weight: Weight, - ) -> Result, DispatchError> { + ) -> Result, DispatchError> { Ok(Xcm(vec![ WithdrawAsset(assets.clone()), InitiateReserveWithdraw { @@ -696,7 +696,7 @@ pub mod module { recipient: MultiLocation, dest_weight: Weight, use_teleport: bool, - ) -> Result, DispatchError> { + ) -> Result, DispatchError> { let mut reanchored_dest = dest.clone(); if reserve == MultiLocation::parent() { match dest { diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index 6ea94703a..830ad48f4 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -32,8 +32,8 @@ use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset} pub type AccountId = AccountId32; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -41,7 +41,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -61,7 +61,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = System; @@ -77,7 +77,7 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -105,7 +105,7 @@ impl parachain_info::Config for Runtime {} parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayNetwork: NetworkId = NetworkId::Kusama; - pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } @@ -116,11 +116,11 @@ pub type LocationToAccountId = ( ); pub type XcmOriginToCallOrigin = ( - SovereignSignedViaLocation, - RelayChainAsNative, - SiblingParachainAsNative, - SignedAccountId32AsNative, - XcmPassthrough, + SovereignSignedViaLocation, + RelayChainAsNative, + SiblingParachainAsNative, + SignedAccountId32AsNative, + XcmPassthrough, ); pub type LocalAssetTransactor = MultiCurrencyAdapter< @@ -139,7 +139,7 @@ pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom pub struct XcmConfig; impl Config for XcmConfig { - type Call = Call; + type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; @@ -147,7 +147,7 @@ impl Config for XcmConfig { type IsTeleporter = NativeAsset; type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type Trader = AllTokensAreCreatedEqualToWeight; type ResponseHandler = (); type AssetTrap = PolkadotXcm; @@ -166,7 +166,7 @@ impl GetChannelInfo for ChannelInfo { } impl cumulus_pallet_xcmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ChannelInfo = ChannelInfo; type VersionWrapper = (); @@ -177,31 +177,31 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { } impl cumulus_pallet_dmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ExecuteOverweightOrigin = EnsureRoot; } impl cumulus_pallet_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { - type Event = Event; - type SendXcmOrigin = EnsureXcmOrigin; + type RuntimeEvent = RuntimeEvent; + type SendXcmOrigin = EnsureXcmOrigin; type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; + type ExecuteXcmOrigin = EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type LocationInverter = LocationInverter; - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } @@ -245,7 +245,7 @@ parameter_type_with_key! { } impl orml_xtokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; @@ -254,7 +254,7 @@ impl orml_xtokens::Config for Runtime { type MultiLocationsFilter = ParentOrParachains; type MinXcmFee = ParachainMinFee; type XcmExecutor = XcmExecutor; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type BaseXcmWeight = ConstU64<100_000_000>; type LocationInverter = LocationInverter; type MaxAssetsForTransfer = MaxAssetsForTransfer; @@ -262,7 +262,7 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } diff --git a/xtokens/src/mock/para_relative_view.rs b/xtokens/src/mock/para_relative_view.rs index f269e24c6..064cdb0db 100644 --- a/xtokens/src/mock/para_relative_view.rs +++ b/xtokens/src/mock/para_relative_view.rs @@ -35,8 +35,8 @@ use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset} pub type AccountId = AccountId32; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -44,7 +44,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -64,7 +64,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = System; @@ -80,7 +80,7 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -108,7 +108,7 @@ impl parachain_info::Config for Runtime {} parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayNetwork: NetworkId = NetworkId::Kusama; - pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } @@ -119,11 +119,11 @@ pub type LocationToAccountId = ( ); pub type XcmOriginToCallOrigin = ( - SovereignSignedViaLocation, - RelayChainAsNative, - SiblingParachainAsNative, - SignedAccountId32AsNative, - XcmPassthrough, + SovereignSignedViaLocation, + RelayChainAsNative, + SiblingParachainAsNative, + SignedAccountId32AsNative, + XcmPassthrough, ); pub type LocalAssetTransactor = MultiCurrencyAdapter< @@ -142,7 +142,7 @@ pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom pub struct XcmConfig; impl Config for XcmConfig { - type Call = Call; + type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; @@ -150,7 +150,7 @@ impl Config for XcmConfig { type IsTeleporter = (); type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type Trader = AllTokensAreCreatedEqualToWeight; type ResponseHandler = (); type AssetTrap = PolkadotXcm; @@ -169,7 +169,7 @@ impl GetChannelInfo for ChannelInfo { } impl cumulus_pallet_xcmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ChannelInfo = ChannelInfo; type VersionWrapper = (); @@ -180,31 +180,31 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { } impl cumulus_pallet_dmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ExecuteOverweightOrigin = EnsureRoot; } impl cumulus_pallet_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { - type Event = Event; - type SendXcmOrigin = EnsureXcmOrigin; + type RuntimeEvent = RuntimeEvent; + type SendXcmOrigin = EnsureXcmOrigin; type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; + type ExecuteXcmOrigin = EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type LocationInverter = LocationInverter; - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } @@ -317,7 +317,7 @@ parameter_type_with_key! { } impl orml_xtokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = RelativeCurrencyIdConvert; @@ -326,7 +326,7 @@ impl orml_xtokens::Config for Runtime { type MultiLocationsFilter = ParentOrParachains; type MinXcmFee = ParachainMinFee; type XcmExecutor = XcmExecutor; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type BaseXcmWeight = ConstU64<100_000_000>; type LocationInverter = LocationInverter; type MaxAssetsForTransfer = MaxAssetsForTransfer; @@ -334,7 +334,7 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } diff --git a/xtokens/src/mock/para_teleport.rs b/xtokens/src/mock/para_teleport.rs index 9f66dd238..a9660e07f 100644 --- a/xtokens/src/mock/para_teleport.rs +++ b/xtokens/src/mock/para_teleport.rs @@ -33,8 +33,8 @@ use orml_xcm_support::{DisabledParachainFee, IsNativeConcrete, MultiNativeAsset} pub type AccountId = AccountId32; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -42,7 +42,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -62,7 +62,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = System; @@ -78,7 +78,7 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -106,7 +106,7 @@ impl parachain_info::Config for Runtime {} parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayNetwork: NetworkId = NetworkId::Kusama; - pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } @@ -117,11 +117,11 @@ pub type LocationToAccountId = ( ); pub type XcmOriginToCallOrigin = ( - SovereignSignedViaLocation, - RelayChainAsNative, - SiblingParachainAsNative, - SignedAccountId32AsNative, - XcmPassthrough, + SovereignSignedViaLocation, + RelayChainAsNative, + SiblingParachainAsNative, + SignedAccountId32AsNative, + XcmPassthrough, ); pub type LocalAssetTransactor = MultiTeleportCurrencyAdapter< @@ -140,7 +140,7 @@ pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom pub struct XcmConfig; impl Config for XcmConfig { - type Call = Call; + type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToCallOrigin; @@ -148,7 +148,7 @@ impl Config for XcmConfig { type IsTeleporter = NativeAsset; type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type Trader = AllTokensAreCreatedEqualToWeight; type ResponseHandler = (); type AssetTrap = PolkadotXcm; @@ -167,7 +167,7 @@ impl GetChannelInfo for ChannelInfo { } impl cumulus_pallet_xcmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ChannelInfo = ChannelInfo; type VersionWrapper = (); @@ -178,31 +178,31 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { } impl cumulus_pallet_dmp_queue::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ExecuteOverweightOrigin = EnsureRoot; } impl cumulus_pallet_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { - type Event = Event; - type SendXcmOrigin = EnsureXcmOrigin; + type RuntimeEvent = RuntimeEvent; + type SendXcmOrigin = EnsureXcmOrigin; type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; + type ExecuteXcmOrigin = EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type LocationInverter = LocationInverter; - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } @@ -236,7 +236,7 @@ match_types! { } impl orml_xtokens::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; @@ -245,7 +245,7 @@ impl orml_xtokens::Config for Runtime { type MultiLocationsFilter = ParentOrParachains; type MinXcmFee = DisabledParachainFee; type XcmExecutor = XcmExecutor; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type BaseXcmWeight = ConstU64<100_000_000>; type LocationInverter = LocationInverter; type MaxAssetsForTransfer = MaxAssetsForTransfer; @@ -253,7 +253,7 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } diff --git a/xtokens/src/mock/relay.rs b/xtokens/src/mock/relay.rs index 02df04f52..e0b1e9965 100644 --- a/xtokens/src/mock/relay.rs +++ b/xtokens/src/mock/relay.rs @@ -21,8 +21,8 @@ pub type AccountId = AccountId32; pub type Balance = u128; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -30,7 +30,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type BlockWeights = (); type BlockLength = (); @@ -50,7 +50,7 @@ impl frame_system::Config for Runtime { impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type Balance = Balance; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ConstU128<1>; type AccountStore = System; @@ -80,9 +80,9 @@ pub type LocalAssetTransactor = XcmCurrencyAdapter, SovereignAccountOf, AccountId, ()>; type LocalOriginConverter = ( - SovereignSignedViaLocation, - ChildParachainAsNative, - SignedAccountId32AsNative, + SovereignSignedViaLocation, + ChildParachainAsNative, + SignedAccountId32AsNative, ); pub type XcmRouter = super::RelayChainXcmRouter; @@ -98,7 +98,7 @@ pub type TrustedTeleporters = xcm_builder::Case; pub struct XcmConfig; impl Config for XcmConfig { - type Call = Call; + type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = LocalAssetTransactor; type OriginConverter = LocalOriginConverter; @@ -106,7 +106,7 @@ impl Config for XcmConfig { type IsTeleporter = TrustedTeleporters; type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type Trader = UsingComponents, KsmLocation, AccountId, Balances, ()>; type ResponseHandler = (); type AssetTrap = (); @@ -114,28 +114,28 @@ impl Config for XcmConfig { type SubscriptionService = XcmPallet; } -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId32; impl pallet_xcm::Config for Runtime { - type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type RuntimeEvent = RuntimeEvent; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally... - type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; + type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds, Call, ConstU32<100>>; + type Weigher = FixedWeightBounds, RuntimeCall, ConstU32<100>>; type LocationInverter = LocationInverter; - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } impl ump::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type UmpSink = ump::XcmSink, Runtime>; type FirstMessageFactorPercent = ConstU64<100>; type ExecuteOverweightOrigin = EnsureRoot; diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 4ce08e2a1..d1f368ef5 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -1023,11 +1023,12 @@ fn send_as_sovereign() { ParaA::execute_with(|| { use xcm::latest::OriginKind::SovereignAccount; - let call = - relay::Call::System(frame_system::Call::::remark_with_event { remark: vec![1, 1, 1] }); + let call = relay::RuntimeCall::System(frame_system::Call::::remark_with_event { + remark: vec![1, 1, 1], + }); let assets: MultiAsset = (Here, 1_000_000_000_000).into(); assert_ok!(para::OrmlXcm::send_as_sovereign( - para::Origin::root(), + para::RuntimeOrigin::root(), Box::new(Parent.into()), Box::new(VersionedXcm::from(Xcm(vec![ WithdrawAsset(assets.clone().into()), @@ -1048,7 +1049,7 @@ fn send_as_sovereign() { assert!(relay::System::events().iter().any(|r| { matches!( r.event, - relay::Event::System(frame_system::Event::::Remarked { sender: _, hash: _ }) + relay::RuntimeEvent::System(frame_system::Event::::Remarked { sender: _, hash: _ }) ) })); }) @@ -1065,12 +1066,13 @@ fn send_as_sovereign_fails_if_bad_origin() { ParaA::execute_with(|| { use xcm::latest::OriginKind::SovereignAccount; - let call = - relay::Call::System(frame_system::Call::::remark_with_event { remark: vec![1, 1, 1] }); + let call = relay::RuntimeCall::System(frame_system::Call::::remark_with_event { + remark: vec![1, 1, 1], + }); let assets: MultiAsset = (Here, 1_000_000_000_000).into(); assert_err!( para::OrmlXcm::send_as_sovereign( - para::Origin::signed(ALICE), + para::RuntimeOrigin::signed(ALICE), Box::new(Parent.into()), Box::new(VersionedXcm::from(Xcm(vec![ WithdrawAsset(assets.clone().into()), @@ -1178,7 +1180,7 @@ fn send_with_insufficient_fee_traps_assets() { assert!(para::System::events().iter().any(|r| { matches!( r.event, - para::Event::PolkadotXcm(pallet_xcm::Event::::AssetsTrapped(_, _, _)) + para::RuntimeEvent::PolkadotXcm(pallet_xcm::Event::::AssetsTrapped(_, _, _)) ) })); }) From 6199c96de8e35de6c91a1d64f42eab335a9d2128 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Mon, 31 Oct 2022 11:56:08 +1300 Subject: [PATCH 2/3] fix --- asset-registry/src/mock/para.rs | 2 +- vesting/src/mock.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/asset-registry/src/mock/para.rs b/asset-registry/src/mock/para.rs index 51ec51eb8..585f29280 100644 --- a/asset-registry/src/mock/para.rs +++ b/asset-registry/src/mock/para.rs @@ -132,7 +132,7 @@ impl EnsureOriginWithArg> for AssetAuthority { } #[cfg(feature = "runtime-benchmarks")] - fn successful_origin(_asset_id: &Option) -> Origin { + fn successful_origin(_asset_id: &Option) -> RuntimeOrigin { unimplemented!() } } diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index fc7331c5d..e7d476429 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -68,7 +68,7 @@ impl EnsureOrigin for EnsureAliceOrBob { } #[cfg(feature = "runtime-benchmarks")] - fn successful_origin() -> Origin { + fn successful_origin() -> RuntimeOrigin { let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) .expect("infinite length input; no invalid inputs for type; qed"); Origin::from(RawOrigin::Signed(zero_account_id)) From ae13a54dbc1a654df0e2d5e9dc18582b62716365 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Mon, 31 Oct 2022 12:22:49 +1300 Subject: [PATCH 3/3] fix --- vesting/src/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index e7d476429..75024a63f 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -71,7 +71,7 @@ impl EnsureOrigin for EnsureAliceOrBob { fn successful_origin() -> RuntimeOrigin { let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) .expect("infinite length input; no invalid inputs for type; qed"); - Origin::from(RawOrigin::Signed(zero_account_id)) + RuntimeOrigin::from(RawOrigin::Signed(zero_account_id)) } }