From 4a5707dce9056e8f17629c1be204af2656cf7924 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 5 Jul 2024 12:52:38 +0300 Subject: [PATCH 1/2] Reintroduced diagnostic::on_unimplemented & rustc 1.78 dependency --- framework/base/Cargo.toml | 1 + .../src/types/interaction/tx_data/tx_code_source.rs | 10 ++++++++++ framework/base/src/types/interaction/tx_from.rs | 5 +++++ framework/base/src/types/interaction/tx_gas.rs | 5 +++++ framework/base/src/types/interaction/tx_payment.rs | 5 +++++ .../tx_result_handler_list_item.rs | 5 +++++ framework/base/src/types/interaction/tx_to.rs | 5 +++++ 7 files changed, 36 insertions(+) diff --git a/framework/base/Cargo.toml b/framework/base/Cargo.toml index d8cb7d3306..936efff1be 100644 --- a/framework/base/Cargo.toml +++ b/framework/base/Cargo.toml @@ -2,6 +2,7 @@ name = "multiversx-sc" version = "0.50.6" edition = "2021" +rust-version = "1.78" authors = ["Andrei Marinica ", "MultiversX "] license = "GPL-3.0-only" diff --git a/framework/base/src/types/interaction/tx_data/tx_code_source.rs b/framework/base/src/types/interaction/tx_data/tx_code_source.rs index e7bb0817ea..0d3c180e16 100644 --- a/framework/base/src/types/interaction/tx_data/tx_code_source.rs +++ b/framework/base/src/types/interaction/tx_data/tx_code_source.rs @@ -14,6 +14,11 @@ where { } +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as code (does not implement `TxCodeValue<{Env}>`)", + label = "not a valid smart contract byte code", + note = "there are multiple ways to specify SC byte code, but `{Self}` is not one of them" +)] pub trait TxCodeValue: AnnotatedValue> where Env: TxEnv, @@ -39,6 +44,11 @@ where { } +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as code source value (does not implement `TxFromSourceValue<{Env}>`)", + label = "not an address from where to copy the code", + note = "there are multiple ways to specify a code source address, but `{Self}` is not one of them" +)] pub trait TxFromSourceValue: AnnotatedValue> where Env: TxEnv, diff --git a/framework/base/src/types/interaction/tx_from.rs b/framework/base/src/types/interaction/tx_from.rs index ff5dd73b88..674796e64f 100644 --- a/framework/base/src/types/interaction/tx_from.rs +++ b/framework/base/src/types/interaction/tx_from.rs @@ -13,6 +13,11 @@ where /// Marks the non-empty sender of a transaction. /// /// Enforces the reciipent to be explicitly specified. +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as a sender value (does not implement `TxFromSpecified<{Env}>`)", + label = "sender needs to be explicit", + note = "there are multiple ways to specify the sender value for a transaction, but `{Self}` is not one of them" +)] pub trait TxFromSpecified: TxFrom + AnnotatedValue> where diff --git a/framework/base/src/types/interaction/tx_gas.rs b/framework/base/src/types/interaction/tx_gas.rs index 098eafdd2c..2e03cc1470 100644 --- a/framework/base/src/types/interaction/tx_gas.rs +++ b/framework/base/src/types/interaction/tx_gas.rs @@ -33,6 +33,11 @@ where } } +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as gas value (does not implement `TxGasValue<{Env}>`)", + label = "not a valid value for gas", + note = "there are multiple ways to specify the gas value for a transaction, but `{Self}` is not one of them" +)] pub trait TxGasValue: AnnotatedValue where Env: TxEnv, diff --git a/framework/base/src/types/interaction/tx_payment.rs b/framework/base/src/types/interaction/tx_payment.rs index 5abb38c6ee..c5bcc10637 100644 --- a/framework/base/src/types/interaction/tx_payment.rs +++ b/framework/base/src/types/interaction/tx_payment.rs @@ -24,6 +24,11 @@ use crate::{ use super::{AnnotatedValue, FunctionCall, TxEnv, TxFrom, TxToSpecified}; /// Describes a payment that is part of a transaction. +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as payment (does not implement `TxPayment<{Env}>`)", + label = "not a valid payment type", + note = "there are multiple ways to specify the transaction payment, but `{Self}` is not one of them" +)] pub trait TxPayment where Env: TxEnv, diff --git a/framework/base/src/types/interaction/tx_result_handler_list/tx_result_handler_list_item.rs b/framework/base/src/types/interaction/tx_result_handler_list/tx_result_handler_list_item.rs index 54e1d0cfa3..9ca98bac65 100644 --- a/framework/base/src/types/interaction/tx_result_handler_list/tx_result_handler_list_item.rs +++ b/framework/base/src/types/interaction/tx_result_handler_list/tx_result_handler_list_item.rs @@ -3,6 +3,11 @@ use crate::types::TxEnv; /// Result handler list item. /// /// It acts as a result handler that produces a single result. +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as a decoder result handler (does not implement `RHListItem<{Env}>`)", + label = "not a valid decoder result handler", + note = "there are multiple ways to specify the result handling, but `{Self}` is not one of them" +)] pub trait RHListItem where Env: TxEnv, diff --git a/framework/base/src/types/interaction/tx_to.rs b/framework/base/src/types/interaction/tx_to.rs index 18530bc1ee..41d5d4ce39 100644 --- a/framework/base/src/types/interaction/tx_to.rs +++ b/framework/base/src/types/interaction/tx_to.rs @@ -14,6 +14,11 @@ impl TxTo for () where Env: TxEnv {} /// Marks the non-empty recipient of a transaction. /// /// Enforces the recipient to be explicitly specified. +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as recipient value (does not implement `TxToSpecified<{Env}>`)", + label = "recipient needs to be explicit", + note = "there are multiple ways to specify the recipient value for a transaction, but `{Self}` is not one of them" +)] pub trait TxToSpecified: TxTo + AnnotatedValue> where Env: TxEnv, From cc305f6134d0af17b4e96e6ee5432ad586f7dae5 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 5 Jul 2024 14:09:31 +0300 Subject: [PATCH 2/2] dependency update --- Cargo.lock | 52 +++++++++++++++++++++-------------- data/codec-derive/Cargo.toml | 4 +-- data/codec/Cargo.toml | 2 +- framework/base/Cargo.toml | 2 +- framework/derive/Cargo.toml | 4 +-- framework/meta-lib/Cargo.toml | 4 +-- framework/scenario/Cargo.toml | 2 +- sdk/core/Cargo.toml | 2 +- vm/Cargo.toml | 4 +-- 9 files changed, 43 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 317e3a21fb..197cbe4d1c 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -299,9 +299,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -1546,9 +1546,9 @@ checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1898,7 +1898,7 @@ dependencies = [ name = "multiversx-chain-vm" version = "0.8.4" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "colored", "ed25519-dalek", "hex", @@ -1944,7 +1944,7 @@ dependencies = [ name = "multiversx-sc" version = "0.50.6" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -2210,9 +2210,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", @@ -2273,7 +2273,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -2504,9 +2504,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2722,7 +2722,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -2904,7 +2904,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -3020,7 +3020,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -3290,9 +3290,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -3338,6 +3338,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.61" @@ -3782,12 +3791,12 @@ checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasmparser" -version = "0.208.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd921789c9dcc495f589cb37d200155dee65b4a4beeb853323b5e24e0a5f9c58" +checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" dependencies = [ "ahash", - "bitflags 2.5.0", + "bitflags 2.6.0", "hashbrown", "indexmap", "semver", @@ -3796,11 +3805,12 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.208.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700bdace4821e6c694617938500ae9999946df464bb13219c16570f8b6f202f" +checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" dependencies = [ "anyhow", + "termcolor", "wasmparser", ] diff --git a/data/codec-derive/Cargo.toml b/data/codec-derive/Cargo.toml index 574b7dcb2c..83d95c8c7e 100644 --- a/data/codec-derive/Cargo.toml +++ b/data/codec-derive/Cargo.toml @@ -21,7 +21,7 @@ proc-macro = true default = ["syn/full", "syn/parsing", "syn/extra-traits"] [dependencies] -proc-macro2 = "=1.0.82" +proc-macro2 = "=1.0.86" quote = "=1.0.36" -syn = "=2.0.61" +syn = "=2.0.68" hex = "=0.4.3" diff --git a/data/codec/Cargo.toml b/data/codec/Cargo.toml index 7255a54012..15992eead2 100644 --- a/data/codec/Cargo.toml +++ b/data/codec/Cargo.toml @@ -23,7 +23,7 @@ optional = true [dependencies] arrayvec = { version = "=0.7.4", default-features = false } -num-bigint = { version = "=0.4.5", optional = true } # can only be used in std contexts +num-bigint = { version = "0.4", optional = true } # can only be used in std contexts unwrap-infallible = "0.1.5" [dev-dependencies.multiversx-sc-codec-derive] diff --git a/framework/base/Cargo.toml b/framework/base/Cargo.toml index 936efff1be..c1e56226cd 100644 --- a/framework/base/Cargo.toml +++ b/framework/base/Cargo.toml @@ -25,7 +25,7 @@ esdt-token-payment-legacy-decode = [] [dependencies] hex-literal = "=0.4.1" -bitflags = "=2.5.0" +bitflags = "=2.6.0" num-traits = { version = "=0.2.19", default-features = false } unwrap-infallible = "0.1.5" diff --git a/framework/derive/Cargo.toml b/framework/derive/Cargo.toml index e04ed62c74..3e5cde70ca 100644 --- a/framework/derive/Cargo.toml +++ b/framework/derive/Cargo.toml @@ -14,9 +14,9 @@ keywords = ["multiversx", "blockchain", "contract"] categories = ["cryptography::cryptocurrencies", "development-tools::procedural-macro-helpers"] [dependencies] -proc-macro2 = "=1.0.82" +proc-macro2 = "=1.0.86" quote = "=1.0.36" -syn = "=2.0.61" +syn = "=2.0.68" hex = "=0.4.3" radix_trie = "=0.2.1" diff --git a/framework/meta-lib/Cargo.toml b/framework/meta-lib/Cargo.toml index 6ca749601d..6f8e49fec3 100644 --- a/framework/meta-lib/Cargo.toml +++ b/framework/meta-lib/Cargo.toml @@ -26,8 +26,8 @@ colored = "2.0" lazy_static = "1.4.0" convert_case = "0.6.0" hex = "0.4" -wasmparser = "0.208" -wasmprinter = "0.208" +wasmparser = "0.212" +wasmprinter = "0.212" semver = "1.0.20" [dependencies.multiversx-sc] diff --git a/framework/scenario/Cargo.toml b/framework/scenario/Cargo.toml index da24efe0d2..58bb79a2ac 100644 --- a/framework/scenario/Cargo.toml +++ b/framework/scenario/Cargo.toml @@ -27,7 +27,7 @@ sha2 = "0.10.6" serde = "1.0" serde_json = "1.0" pathdiff = "0.2.1" -itertools = "0.12.0" +itertools = "0.13.0" colored = "2.0" unwrap-infallible = "0.1.5" diff --git a/sdk/core/Cargo.toml b/sdk/core/Cargo.toml index c8bf3c75fb..3e01ff4d98 100644 --- a/sdk/core/Cargo.toml +++ b/sdk/core/Cargo.toml @@ -32,6 +32,6 @@ base64 = "0.22" pbkdf2 = { version = "0.12.2", default-features = false } zeroize = "1.4.2" bech32 = "0.9" -itertools = "0.12.0" +itertools = "0.13.0" pem = "3.0.2" log = "0.4.17" diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 0158bd09fa..933b29a4f9 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -26,9 +26,9 @@ num-traits = "0.2" hex = "0.4" sha2 = "0.10.6" sha3 = "0.10.6" -itertools = "0.12.0" +itertools = "0.13.0" hex-literal = "=0.4.1" -bitflags = "=2.5.0" +bitflags = "=2.6.0" colored = "2.1.0" rand = { version= "0.8.5", optional = true } rand_seeder = { version= "0.2.2", optional = true }