From 91f7c5863f6c8d2fa23374f7f883a51db9f0e236 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 01:21:11 +0000 Subject: [PATCH 1/4] Update rust - all minor and patch updates --- Cargo.lock | 164 +++++++++++++------- node/Cargo.toml | 2 +- pallets/doas/Cargo.toml | 4 +- pallets/process-validation/Cargo.toml | 4 +- pallets/simple-nft/Cargo.toml | 4 +- pallets/symmetric-key/Cargo.toml | 4 +- pallets/traits/Cargo.toml | 2 +- pallets/transaction-payment-free/Cargo.toml | 6 +- runtime/Cargo.toml | 4 +- 9 files changed, 124 insertions(+), 70 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e1f1d7b..4e46a3a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -197,6 +197,46 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-wincon", + "concolor-override", + "concolor-query", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" + +[[package]] +name = "anstyle-parse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-wincon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +dependencies = [ + "anstyle", + "windows-sys 0.45.0", +] + [[package]] name = "anyhow" version = "1.0.69" @@ -475,7 +515,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cexpr", "clang-sys", "lazy_static", @@ -495,12 +535,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5dd14596c0e5b954530d0e6f1fd99b89c03e313aa2086e8da4303701a09e1cf" - [[package]] name = "bitvec" version = "1.0.1" @@ -872,40 +906,45 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.11" +version = "4.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dfd32784433290c51d92c438bb72ea5063797fc3cc9a21a8c4346bebbb2098" +checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" dependencies = [ - "bitflags 2.0.1", + "clap_builder", "clap_derive", - "clap_lex", - "is-terminal", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.9" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.11", ] [[package]] name = "clap_lex" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] name = "codespan-reporting" @@ -928,6 +967,21 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "concolor-override" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" + +[[package]] +name = "concolor-query" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" +dependencies = [ + "windows-sys 0.45.0", +] + [[package]] name = "concurrent-queue" version = "2.1.0" @@ -2135,7 +2189,7 @@ name = "frame-support" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "bitflags 1.3.2", + "bitflags", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", @@ -4226,7 +4280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags 1.3.2", + "bitflags", "byteorder", "libc", "netlink-packet-core", @@ -4279,7 +4333,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", "memoffset 0.6.5", @@ -4291,7 +4345,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", "memoffset 0.7.1", @@ -4455,12 +4509,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" - [[package]] name = "output_vt100" version = "0.1.3" @@ -5602,7 +5650,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -5680,7 +5728,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", "mach", "winapi", @@ -5844,7 +5892,7 @@ version = "0.36.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno", "io-lifetimes", "libc", @@ -6399,7 +6447,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.39#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "futures", "futures-timer", @@ -6881,9 +6929,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +checksum = "0cfdffd972d76b22f3d7f81c8be34b2296afd3a25e0a547bd9abe340a4dbbe97" dependencies = [ "bitvec", "cfg-if", @@ -6895,9 +6943,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +checksum = "61fa974aea2d63dd18a4ec3a49d59af9f34178c73a4f56d2f18205628d00681e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7034,7 +7082,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -7086,29 +7134,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.158" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9" +checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.158" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" +checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn 2.0.4", + "syn 2.0.11", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" dependencies = [ "itoa", "ryu", @@ -7487,7 +7535,7 @@ source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3 dependencies = [ "array-bytes", "base58", - "bitflags 1.3.2", + "bitflags", "blake2", "bounded-collections", "dyn-clonable", @@ -8000,7 +8048,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg_aliases", "libc", "parking_lot 0.11.2", @@ -8179,9 +8227,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.4" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c622ae390c9302e214c31013517c2061ecb2699935882c60a9b37f82f8625ae" +checksum = "21e3787bb71465627110e7d87ed4faaa36c1f61042ee67badb9e2ef173accc40" dependencies = [ "proc-macro2", "quote", @@ -8206,7 +8254,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -8493,7 +8541,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bytes", "futures-core", "futures-util", @@ -8874,6 +8922,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "1.3.0" @@ -9552,7 +9606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" dependencies = [ "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "cc", "ipnet", diff --git a/node/Cargo.toml b/node/Cargo.toml index f741c4e3..17b0b1c6 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -15,7 +15,7 @@ name = 'dscp-node' targets = ['x86_64-unknown-linux-gnu'] [dependencies] -clap = { version = "4.1.11", features = ["derive"] } +clap = { version = "4.2.1", features = ["derive"] } futures = { version = "0.3.27", features = ["thread-pool"]} bs58 = "0.4.0" diff --git a/pallets/doas/Cargo.toml b/pallets/doas/Cargo.toml index ea2a5105..40f7d563 100644 --- a/pallets/doas/Cargo.toml +++ b/pallets/doas/Cargo.toml @@ -12,8 +12,8 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.158", optional = true } -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +serde = { version = "1.0.159", optional = true } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } frame-system = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } diff --git a/pallets/process-validation/Cargo.toml b/pallets/process-validation/Cargo.toml index 36c28377..eed1753f 100644 --- a/pallets/process-validation/Cargo.toml +++ b/pallets/process-validation/Cargo.toml @@ -12,8 +12,8 @@ version = "3.4.1" targets = ['x86_64-unknown-linux-gnu'] [dependencies] -serde = { version = "1.0.158", optional = true } -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +serde = { version = "1.0.159", optional = true } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } dscp-pallet-traits = { default-features = false, path = '../traits' } frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } diff --git a/pallets/simple-nft/Cargo.toml b/pallets/simple-nft/Cargo.toml index 37ad63fa..9e8f4bf2 100644 --- a/pallets/simple-nft/Cargo.toml +++ b/pallets/simple-nft/Cargo.toml @@ -12,7 +12,7 @@ version = "5.0.0" targets = ['x86_64-unknown-linux-gnu'] [dependencies] -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } dscp-pallet-traits = { default-features = false, path = '../traits' } frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } @@ -24,7 +24,7 @@ sp-std = { default-features = false, version = "5.0.0", git = "https://github.co [dev-dependencies] -serde = { version = "1.0.158" } +serde = { version = "1.0.159" } sp-core = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } diff --git a/pallets/symmetric-key/Cargo.toml b/pallets/symmetric-key/Cargo.toml index 7d296a47..07f36942 100644 --- a/pallets/symmetric-key/Cargo.toml +++ b/pallets/symmetric-key/Cargo.toml @@ -11,7 +11,7 @@ version = "2.0.2" targets = ['x86_64-unknown-linux-gnu'] [dependencies] -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } frame-system = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } @@ -21,7 +21,7 @@ sp-io = { default-features = false, version = "7.0.0", git = "https://github.com sp-std = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } [dev-dependencies] -serde = { version = "1.0.158" } +serde = { version = "1.0.159" } frame-support-test = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } pallet-scheduler = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-core = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } diff --git a/pallets/traits/Cargo.toml b/pallets/traits/Cargo.toml index 27de5bcf..bf330b0b 100644 --- a/pallets/traits/Cargo.toml +++ b/pallets/traits/Cargo.toml @@ -8,7 +8,7 @@ repository = 'https://github.com/digicatapult/dscp-node/' description = "Common pallet traits for the dscp-node" [dependencies] -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } sp-std = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } diff --git a/pallets/transaction-payment-free/Cargo.toml b/pallets/transaction-payment-free/Cargo.toml index 1821b622..823f8753 100644 --- a/pallets/transaction-payment-free/Cargo.toml +++ b/pallets/transaction-payment-free/Cargo.toml @@ -15,9 +15,9 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.158", optional = true } +serde = { version = "1.0.159", optional = true } sp-std = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-runtime = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } @@ -27,7 +27,7 @@ sp-core = { default-features = false, version = "7.0.0", git = "https://github.c [dev-dependencies] pallet-balances = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -serde_json = "1.0.94" +serde_json = "1.0.95" [features] default = ["std"] diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 7bef26a7..d9ef5978 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.3.1", default-features = false, features = [ +scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } @@ -65,7 +65,7 @@ pallet-process-validation = { default-features = false, package = 'pallet-proces pallet-symmetric-key = { default-features = false, package = 'pallet-symmetric-key', path = '../pallets/symmetric-key' } pallet-transaction-payment-free = { default-features = false, package = 'pallet-transaction-payment-free', path = '../pallets/transaction-payment-free' } -serde = { version = "1.0.158" } +serde = { version = "1.0.159" } [build-dependencies] substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } From f579f707df453bf9ee485b8e73b225251df57600 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 30 Mar 2023 13:33:17 +0100 Subject: [PATCH 2/4] Improve simple-nft events --- Cargo.lock | 10 ++-- node/Cargo.toml | 2 +- pallets/process-validation/Cargo.toml | 2 +- pallets/process-validation/src/lib.rs | 4 +- .../src/tests/validate_process.rs | 24 ++++---- pallets/simple-nft/Cargo.toml | 2 +- pallets/simple-nft/src/lib.rs | 51 +++++++++++------ pallets/simple-nft/src/mock.rs | 9 ++- pallets/simple-nft/src/tests.rs | 57 ++++++++++++++++++- pallets/traits/Cargo.toml | 2 +- pallets/traits/src/lib.rs | 4 +- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 2 +- 13 files changed, 123 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e1f1d7b..9b3bc3bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1585,7 +1585,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dscp-node" -version = "5.0.2" +version = "5.0.3" dependencies = [ "bs58", "clap", @@ -1629,7 +1629,7 @@ dependencies = [ [[package]] name = "dscp-node-runtime" -version = "5.0.1" +version = "5.0.2" dependencies = [ "frame-benchmarking", "frame-executive", @@ -1677,7 +1677,7 @@ dependencies = [ [[package]] name = "dscp-pallet-traits" -version = "3.2.0" +version = "3.2.1" dependencies = [ "frame-support", "parity-scale-codec", @@ -4669,7 +4669,7 @@ dependencies = [ [[package]] name = "pallet-process-validation" -version = "3.4.1" +version = "3.4.2" dependencies = [ "dscp-pallet-traits", "frame-benchmarking", @@ -4724,7 +4724,7 @@ dependencies = [ [[package]] name = "pallet-simple-nft" -version = "5.0.0" +version = "5.0.1" dependencies = [ "dscp-pallet-traits", "frame-benchmarking", diff --git a/node/Cargo.toml b/node/Cargo.toml index f741c4e3..decb10a7 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -6,7 +6,7 @@ edition = '2021' license = 'Apache-2.0' repository = 'https://github.com/digicatapult/dscp-node/' name = 'dscp-node' -version = '5.0.2' +version = '5.0.3' [[bin]] name = 'dscp-node' diff --git a/pallets/process-validation/Cargo.toml b/pallets/process-validation/Cargo.toml index 36c28377..53d2d359 100644 --- a/pallets/process-validation/Cargo.toml +++ b/pallets/process-validation/Cargo.toml @@ -5,7 +5,7 @@ edition = '2021' license = 'Apache-2.0' repository = 'https://github.com/digicatapult/dscp-node/' name = 'pallet-process-validation' -version = "3.4.1" +version = "3.4.2" [package.metadata.docs.rs] diff --git a/pallets/process-validation/src/lib.rs b/pallets/process-validation/src/lib.rs index 86ce0ef7..8846aedd 100644 --- a/pallets/process-validation/src/lib.rs +++ b/pallets/process-validation/src/lib.rs @@ -395,12 +395,12 @@ impl ProcessValidator, + id: &ProcessFullyQualifiedId, sender: &T::AccountId, inputs: &Vec>, outputs: &Vec> ) -> ValidationResult { - let maybe_process = >::try_get(id.id, id.version); + let maybe_process = >::try_get(id.id.clone(), id.version.clone()); match maybe_process { Ok(process) => { diff --git a/pallets/process-validation/src/tests/validate_process.rs b/pallets/process-validation/src/tests/validate_process.rs index 879fce6a..b1226bb0 100644 --- a/pallets/process-validation/src/tests/validate_process.rs +++ b/pallets/process-validation/src/tests/validate_process.rs @@ -21,7 +21,7 @@ fn it_succeeds_when_process_exists() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -53,7 +53,7 @@ fn it_fails_when_process_id_doesnt_exist() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::B, version: 1u32 }, @@ -85,7 +85,7 @@ fn it_fails_when_process_version_doesnt_exist() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 2u32 }, @@ -117,7 +117,7 @@ fn it_fails_when_process_disabled() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -156,7 +156,7 @@ fn it_succeeds_when_all_restrictions_succeed() { token_roles.insert(Default::default(), 0u64); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -199,7 +199,7 @@ fn it_fails_when_one_restrictions_fails() { token_roles.insert(Default::default(), 1u64); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -244,7 +244,7 @@ fn it_succeeds_with_complex_tree() { token_roles.insert(Default::default(), 1u64); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -289,7 +289,7 @@ fn it_fails_with_complex_tree() { token_roles.insert(Default::default(), 1u64); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -329,7 +329,7 @@ fn it_succeeds_with_handed_expressions_r() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -369,7 +369,7 @@ fn it_succeeds_with_handed_expressions_l() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -409,7 +409,7 @@ fn it_fails_with_handed_expressions_r() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, @@ -449,7 +449,7 @@ fn it_fails_with_handed_expressions_l() { ); let result = ProcessValidation::validate_process( - ProcessFullyQualifiedId { + &ProcessFullyQualifiedId { id: ProcessIdentifier::A, version: 1u32 }, diff --git a/pallets/simple-nft/Cargo.toml b/pallets/simple-nft/Cargo.toml index 37ad63fa..0f9b12db 100644 --- a/pallets/simple-nft/Cargo.toml +++ b/pallets/simple-nft/Cargo.toml @@ -5,7 +5,7 @@ edition = '2021' license = 'Apache-2.0' repository = 'https://github.com/digicatapult/dscp-node/' name = 'pallet-simple-nft' -version = "5.0.0" +version = "5.0.1" [package.metadata.docs.rs] diff --git a/pallets/simple-nft/src/lib.rs b/pallets/simple-nft/src/lib.rs index 8d2fa78f..1e5c6582 100644 --- a/pallets/simple-nft/src/lib.rs +++ b/pallets/simple-nft/src/lib.rs @@ -8,13 +8,13 @@ use frame_support::{ BoundedVec }; pub use pallet::*; -use sp_runtime::traits::{AtLeast32Bit, One}; +use sp_runtime::traits::{AtLeast32Bit, One, Hash}; /// A FRAME pallet for handling non-fungible tokens use sp_std::prelude::*; mod token; - +// mod event; mod output; #[cfg(test)] @@ -162,12 +162,14 @@ pub mod pallet { >; #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// A token was issued. - Minted(T::TokenId, T::AccountId, BoundedVec), - /// A token was burnt. - Burnt(T::TokenId, T::AccountId, BoundedVec) + /// A process was successfully run + ProcessRan { + sender: T::AccountId, + process: ProcessId, + inputs: BoundedVec, + outputs: BoundedVec, + } } #[pallet::error] @@ -244,7 +246,7 @@ pub mod pallet { } ); - let process_is_valid = T::ProcessValidator::validate_process(process, &sender, &io_inputs, &io_outputs); + let process_is_valid = T::ProcessValidator::validate_process(&process, &sender, &io_inputs, &io_outputs); ensure!(process_is_valid.success, Error::::ProcessInvalid); // STORAGE MUTATIONS @@ -280,21 +282,34 @@ pub mod pallet { // Update last token >::put(last); - // EVENTS - - // Emit events - for token_id in children.iter() { - Self::deposit_event(Event::Minted(*token_id, sender.clone(), inputs.clone())); - } - for token_id in inputs.iter() { - Self::deposit_event(Event::Burnt(*token_id, sender.clone(), children.clone())); - } - let actual_weight = T::WeightInfo::run_process(inputs.len() as u32, outputs.len() as u32) + ProcessValidatorWeights::::validate_process(process_is_valid.executed_len) - ProcessValidatorWeights::::validate_process_min(); + // EVENTS + let process_id = &process.id; + let process_version = &process.version; + Self::deposit_event(vec![ + T::Hashing::hash_of(&b"simpleNFT.ProcessRan"), + T::Hashing::hash_of(&(b"simpleNFT.ProcessRan", process_id)), + T::Hashing::hash_of(&(b"simpleNFT.ProcessRan", process_id, process_version)), + ], Event::ProcessRan { + sender, + process, + inputs, + outputs: children, + }); + Ok(Some(actual_weight).into()) } } } + +impl Pallet { + fn deposit_event(topics: Vec, event: Event) { + >::deposit_event_indexed( + &topics, + ::RuntimeEvent::from(event).into(), + ) + } +} diff --git a/pallets/simple-nft/src/mock.rs b/pallets/simple-nft/src/mock.rs index f1ba1efa..3b4f9f43 100644 --- a/pallets/simple-nft/src/mock.rs +++ b/pallets/simple-nft/src/mock.rs @@ -117,13 +117,13 @@ impl ProcessValidator> for MockProcessVa type Weights = (); fn validate_process( - id: TestProcessId, + id: &TestProcessId, _sender: &u64, _inputs: &Vec, _outputs: &Vec ) -> ValidationResult { ValidationResult { - success: id.id == ProcessIdentifier::ShouldSucceed, + success: id.id.clone() == ProcessIdentifier::ShouldSucceed, executed_len: 0u32 } } @@ -151,3 +151,8 @@ impl pallet_simple_nft::Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { system::GenesisConfig::default().build_storage::().unwrap().into() } +pub fn run_to_block(n: u64) { + while System::block_number() < n { + System::set_block_number(System::block_number() + 1); + } +} diff --git a/pallets/simple-nft/src/tests.rs b/pallets/simple-nft/src/tests.rs index f4ae66c2..1b0f9b67 100644 --- a/pallets/simple-nft/src/tests.rs +++ b/pallets/simple-nft/src/tests.rs @@ -1,6 +1,6 @@ // Tests to be written here -use crate::{mock::*, output::Output, token::Token, Error}; +use crate::{mock::*, output::Output, token::Token, Error, Event}; use dscp_pallet_traits::ProcessFullyQualifiedId; use frame_support::{assert_err, assert_ok, bounded_btree_map, bounded_vec}; use sp_core::H256; @@ -668,6 +668,61 @@ fn it_works_for_creating_and_destroy_many_tokens() { }); } +#[test] +fn it_produces_process_ran_events_when_success() { + new_test_ext().execute_with(|| { + run_to_block(1); + + let roles0 = bounded_btree_map!(Default::default() => 1); + let roles1 = bounded_btree_map!(Default::default() => 2); + let metadata0 = bounded_btree_map!(0 => MetadataValue::None); + let metadata1 = bounded_btree_map!(0 => MetadataValue::None); + let metadata2 = bounded_btree_map!(0 => MetadataValue::None); + let metadata3 = bounded_btree_map!(0 => MetadataValue::None); + SimpleNFT::run_process( + RuntimeOrigin::signed(1), + SUCCEED_PROCESS, + bounded_vec![], + bounded_vec![ + Output { + roles: roles0.clone(), + metadata: metadata0.clone() + }, + Output { + roles: roles0.clone(), + metadata: metadata1.clone() + }, + ] + ) + .unwrap(); + // create 2 tokens with 2 parents + assert_ok!(SimpleNFT::run_process( + RuntimeOrigin::signed(1), + SUCCEED_PROCESS, + bounded_vec![1, 2], + bounded_vec![ + Output { + roles: roles0.clone(), + metadata: metadata2.clone() + }, + Output { + roles: roles1.clone(), + metadata: metadata3.clone() + }, + ] + )); + assert_eq!( + System::events().iter().last().unwrap().event, + RuntimeEvent::SimpleNFT(Event::ProcessRan { + sender: 1, + process: SUCCEED_PROCESS, + inputs: bounded_vec![1, 2], + outputs: bounded_vec![3, 4] + }), + ) + }); +} + #[test] fn it_fails_for_destroying_single_invalid_token() { new_test_ext().execute_with(|| { diff --git a/pallets/traits/Cargo.toml b/pallets/traits/Cargo.toml index 27de5bcf..7726e213 100644 --- a/pallets/traits/Cargo.toml +++ b/pallets/traits/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dscp-pallet-traits" -version = "3.2.0" +version = "3.2.1" edition = "2021" authors = ['Digital Catapult '] license = 'Apache-2.0' diff --git a/pallets/traits/src/lib.rs b/pallets/traits/src/lib.rs index 451731c9..628b408f 100644 --- a/pallets/traits/src/lib.rs +++ b/pallets/traits/src/lib.rs @@ -64,7 +64,7 @@ where type Weights: ValidateProcessWeights; fn validate_process( - id: ProcessFullyQualifiedId, + id: &ProcessFullyQualifiedId, sender: &A, inputs: &Vec>, outputs: &Vec> @@ -85,7 +85,7 @@ where type Weights = (); fn validate_process( - _id: ProcessFullyQualifiedId, + _id: &ProcessFullyQualifiedId, _sender: &A, _inputs: &Vec>, _outputs: &Vec> diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 7bef26a7..84e07086 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dscp-node-runtime" -version = "5.0.1" +version = "5.0.2" authors = ["Digital Catapult "] edition = "2021" license = "Apache-2.0" diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 86d3199e..b71c451e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -101,7 +101,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("dscp"), impl_name: create_runtime_str!("dscp"), authoring_version: 1, - spec_version: 501, + spec_version: 502, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 5912cf979886955ae55770eb73e9b1c3477f185e Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 30 Mar 2023 15:42:29 +0100 Subject: [PATCH 3/4] fmt and update weights --- .../process-validation/src/benchmarking.rs | 6 ++-- pallets/simple-nft/src/lib.rs | 34 +++++++++---------- pallets/simple-nft/src/weights.rs | 22 ++++++------ 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/pallets/process-validation/src/benchmarking.rs b/pallets/process-validation/src/benchmarking.rs index f70b89b2..d03a24b4 100644 --- a/pallets/process-validation/src/benchmarking.rs +++ b/pallets/process-validation/src/benchmarking.rs @@ -105,7 +105,7 @@ benchmarks! { metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())]) }; 10]; }: { - let _ = ProcessValidation::::validate_process(process, &account_id, &inputs, &outputs); + let _ = ProcessValidation::::validate_process(&process, &account_id, &inputs, &outputs); } validate_process_min { @@ -124,7 +124,7 @@ benchmarks! { metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())]) }; 10]; }: { - let _ = ProcessValidation::::validate_process(process, &account_id, &inputs, &outputs); + let _ = ProcessValidation::::validate_process(&process, &account_id, &inputs, &outputs); } validate_process_max { @@ -143,7 +143,7 @@ benchmarks! { metadata: BTreeMap::from_iter(vec![(Default::default(), Default::default())]) }; 10]; }: { - let _ = ProcessValidation::::validate_process(process, &account_id, &inputs, &outputs); + let _ = ProcessValidation::::validate_process(&process, &account_id, &inputs, &outputs); } } diff --git a/pallets/simple-nft/src/lib.rs b/pallets/simple-nft/src/lib.rs index 1e5c6582..56c0d8b5 100644 --- a/pallets/simple-nft/src/lib.rs +++ b/pallets/simple-nft/src/lib.rs @@ -8,7 +8,7 @@ use frame_support::{ BoundedVec }; pub use pallet::*; -use sp_runtime::traits::{AtLeast32Bit, One, Hash}; +use sp_runtime::traits::{AtLeast32Bit, Hash, One}; /// A FRAME pallet for handling non-fungible tokens use sp_std::prelude::*; @@ -168,7 +168,7 @@ pub mod pallet { sender: T::AccountId, process: ProcessId, inputs: BoundedVec, - outputs: BoundedVec, + outputs: BoundedVec } } @@ -289,16 +289,19 @@ pub mod pallet { // EVENTS let process_id = &process.id; let process_version = &process.version; - Self::deposit_event(vec![ - T::Hashing::hash_of(&b"simpleNFT.ProcessRan"), - T::Hashing::hash_of(&(b"simpleNFT.ProcessRan", process_id)), - T::Hashing::hash_of(&(b"simpleNFT.ProcessRan", process_id, process_version)), - ], Event::ProcessRan { - sender, - process, - inputs, - outputs: children, - }); + Self::deposit_event( + vec![ + T::Hashing::hash_of(&b"simpleNFT.ProcessRan"), + T::Hashing::hash_of(&(b"simpleNFT.ProcessRan", process_id)), + T::Hashing::hash_of(&(b"simpleNFT.ProcessRan", process_id, process_version)), + ], + Event::ProcessRan { + sender, + process, + inputs, + outputs: children + } + ); Ok(Some(actual_weight).into()) } @@ -307,9 +310,6 @@ pub mod pallet { impl Pallet { fn deposit_event(topics: Vec, event: Event) { - >::deposit_event_indexed( - &topics, - ::RuntimeEvent::from(event).into(), - ) - } + >::deposit_event_indexed(&topics, ::RuntimeEvent::from(event).into()) + } } diff --git a/pallets/simple-nft/src/weights.rs b/pallets/simple-nft/src/weights.rs index fd9bec0e..8b9059bd 100644 --- a/pallets/simple-nft/src/weights.rs +++ b/pallets/simple-nft/src/weights.rs @@ -30,20 +30,20 @@ impl WeightInfo for SubstrateWeight { fn run_process(i: u32, o: u32) -> Weight { // Proof Size summary in bytes: // Measured: `176 + i * (165 ±0)` - // Estimated: `18334 + i * (9436 ±0)` - // Minimum execution time: 77_000 nanoseconds. - Weight::from_ref_time(16_749_333) - .saturating_add(Weight::from_proof_size(18334)) - // Standard Error: 6_416 - .saturating_add(Weight::from_ref_time(9_289_111).saturating_mul(i.into())) - // Standard Error: 6_416 - .saturating_add(Weight::from_ref_time(5_575_555).saturating_mul(o.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Estimated: `25936 + i * (9601 ±0)` + // Minimum execution time: 67_000 nanoseconds. + Weight::from_ref_time(32_372_888) + .saturating_add(Weight::from_proof_size(25936)) + // Standard Error: 7_804 + .saturating_add(Weight::from_ref_time(7_291_111).saturating_mul(i.into())) + // Standard Error: 7_804 + .saturating_add(Weight::from_ref_time(2_888_000).saturating_mul(o.into())) + .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(o.into()))) - .saturating_add(Weight::from_proof_size(9436).saturating_mul(i.into())) + .saturating_add(Weight::from_proof_size(9601).saturating_mul(i.into())) } } From e1573bc6ebf4fd151cb92a71a67706cf5805b3a2 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 30 Mar 2023 16:54:18 +0100 Subject: [PATCH 4/4] remove rogue comment --- pallets/simple-nft/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/simple-nft/src/lib.rs b/pallets/simple-nft/src/lib.rs index 56c0d8b5..e42c037d 100644 --- a/pallets/simple-nft/src/lib.rs +++ b/pallets/simple-nft/src/lib.rs @@ -14,7 +14,7 @@ use sp_runtime::traits::{AtLeast32Bit, Hash, One}; use sp_std::prelude::*; mod token; -// mod event; + mod output; #[cfg(test)]