From 2072b7ad60104c6958e5777a0db3b5d23acac1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Thu, 7 Nov 2024 14:10:05 +0100 Subject: [PATCH 1/2] feat: Update MultiTest to 2.2.0 Uncomment auto deserialization of payload in tests. Add test case for deserialization of custom data type. --- Cargo.lock | 94 ++++++++++++-------- Cargo.toml | 12 +-- examples/Cargo.lock | 158 +++++++++++++++++++-------------- examples/Cargo.toml | 2 +- sylvia-derive/Cargo.toml | 8 +- sylvia/tests/reply_data.rs | 61 ++++++++++--- sylvia/tests/reply_dispatch.rs | 25 ++---- 7 files changed, 216 insertions(+), 144 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0cd58e7..6bb77612 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "ark-bls12-381" @@ -251,7 +251,7 @@ dependencies = [ "rand_core", "rayon", "sha2", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -262,31 +262,31 @@ checksum = "1b5658b1dc64e10b56ae7a449f678f96932a96f6cfad1769d608d1d1d656480a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] name = "cosmwasm-schema" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc0d4d85e83438ab9a0fea9348446f7268bc016aacfebce37e998559f151294" +checksum = "f86b4d949b6041519c58993a73f4bbfba8083ba14f7001eae704865a09065845" dependencies = [ "cosmwasm-schema-derive", "schemars", "serde", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] name = "cosmwasm-schema-derive" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edf5c8adac41bb7751c050d7c4c18675be19ee128714454454575e894424eeef" +checksum = "c8ef1b5835a65fcca3ab8b9a02b4f4dacc78e233a5c2f20b270efb9db0666d12" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -309,7 +309,7 @@ dependencies = [ "serde-json-wasm", "sha2", "static_assertions", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -392,27 +392,27 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] name = "cw-multi-test" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0ae276e7a06ad1b7e7da78a3d68aba80634cde30ee7fe8259a94e653603fef8" +checksum = "1149fe104344cc4f4ca0fc784b7411042fd1626813fe85fd412b05252a0ae9d8" dependencies = [ "anyhow", "bech32", + "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "cw-utils", - "derivative", "itertools 0.13.0", "prost", "schemars", "serde", "sha2", - "thiserror", + "thiserror 2.0.0", ] [[package]] @@ -436,7 +436,7 @@ dependencies = [ "cosmwasm-std", "schemars", "serde", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -477,7 +477,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", "unicode-xid", ] @@ -845,9 +845,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -872,7 +872,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -979,7 +979,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -1003,9 +1003,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] @@ -1030,13 +1030,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -1047,7 +1047,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -1122,7 +1122,7 @@ dependencies = [ "serde-cw-value", "serde-json-wasm", "sylvia-derive", - "thiserror", + "thiserror 2.0.0", "trybuild", ] @@ -1144,8 +1144,8 @@ dependencies = [ "serde", "sylvia", "sylvia-runtime-macros", - "syn 2.0.77", - "thiserror", + "syn 2.0.87", + "thiserror 2.0.0", ] [[package]] @@ -1172,9 +1172,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1196,7 +1196,16 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.64", +] + +[[package]] +name = "thiserror" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15291287e9bff1bc6f9ff3409ed9af665bec7a5fc8ac079ea96be07bca0e2668" +dependencies = [ + "thiserror-impl 2.0.0", ] [[package]] @@ -1207,7 +1216,18 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22efd00f33f93fa62848a7cab956c3d38c8d43095efda1decfc2b3a5dc0b8972" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] @@ -1418,7 +1438,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] [[package]] @@ -1438,5 +1458,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.87", ] diff --git a/Cargo.toml b/Cargo.toml index c7f2ff5d..e28adf9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,15 @@ version = "1.2.1" [workspace.dependencies] sylvia-derive = { version = "1.2.1", path = "sylvia-derive" } -anyhow = "1.0.86" -cosmwasm-schema = "2.1.1" -cosmwasm-std = "2.1.1" -cw-multi-test = "2.1.1" +anyhow = "1.0.93" +cosmwasm-schema = "2.1.4" +cosmwasm-std = "2.1.4" +cw-multi-test = "2.2.0" cw-storage-plus = "2.0.0" schemars = "0.8.21" cw-utils = "2.0.0" -serde = { version = "1.0.204", default-features = false, features = ["derive"] } -thiserror = "1.0.63" +serde = { version = "1.0.214", default-features = false, features = ["derive"] } +thiserror = "2.0.0" [workspace.metadata.docs.rs] all-features = true diff --git a/examples/Cargo.lock b/examples/Cargo.lock index d9a82503..0bd75153 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -22,9 +22,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "ark-bls12-381" @@ -233,15 +233,15 @@ dependencies = [ [[package]] name = "cosmwasm-core" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d905990ef3afb5753bb709dc7de88e9e370aa32bcc2f31731d4b533b63e82490" +checksum = "5f6ceb8624260d0d3a67c4e1a1d43fc7e9406720afbcb124521501dd138f90aa" [[package]] name = "cosmwasm-crypto" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b2a7bd9c1dd9a377a4dc0f4ad97d24b03c33798cd5a6d7ceb8869b41c5d2f2d" +checksum = "4125381e5fd7fefe9f614640049648088015eca2b60d861465329a5d87dfa538" dependencies = [ "ark-bls12-381", "ark-ec", @@ -257,49 +257,49 @@ dependencies = [ "rand_core", "rayon", "sha2", - "thiserror", + "thiserror 1.0.63", ] [[package]] name = "cosmwasm-derive" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029910b409398fdf81955d7301b906caf81f2c42b013ea074fbd89720229c424" +checksum = "1b5658b1dc64e10b56ae7a449f678f96932a96f6cfad1769d608d1d1d656480a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] name = "cosmwasm-schema" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc0d4d85e83438ab9a0fea9348446f7268bc016aacfebce37e998559f151294" +checksum = "f86b4d949b6041519c58993a73f4bbfba8083ba14f7001eae704865a09065845" dependencies = [ "cosmwasm-schema-derive", "schemars", "serde", "serde_json", - "thiserror", + "thiserror 1.0.63", ] [[package]] name = "cosmwasm-schema-derive" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edf5c8adac41bb7751c050d7c4c18675be19ee128714454454575e894424eeef" +checksum = "c8ef1b5835a65fcca3ab8b9a02b4f4dacc78e233a5c2f20b270efb9db0666d12" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] name = "cosmwasm-std" -version = "2.1.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51dec99a2e478715c0a4277f0dbeadbb8466500eb7dec873d0924edd086e77f1" +checksum = "70eb7ab0c1e99dd6207496963ba2a457c4128ac9ad9c72a83f8d9808542b849b" dependencies = [ "base64", "bech32", @@ -315,7 +315,7 @@ dependencies = [ "serde-json-wasm", "sha2", "static_assertions", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -398,7 +398,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -419,22 +419,22 @@ dependencies = [ [[package]] name = "cw-multi-test" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0ae276e7a06ad1b7e7da78a3d68aba80634cde30ee7fe8259a94e653603fef8" +checksum = "1149fe104344cc4f4ca0fc784b7411042fd1626813fe85fd412b05252a0ae9d8" dependencies = [ "anyhow", "bech32", + "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "cw-utils", - "derivative", "itertools 0.13.0", "prost", "schemars", "serde", "sha2", - "thiserror", + "thiserror 2.0.0", ] [[package]] @@ -458,7 +458,7 @@ dependencies = [ "cosmwasm-std", "schemars", "serde", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -478,7 +478,7 @@ dependencies = [ "cw1-whitelist", "cw2", "sylvia", - "thiserror", + "thiserror 2.0.0", "whitelist", ] @@ -491,7 +491,7 @@ dependencies = [ "cw1", "cw2", "sylvia", - "thiserror", + "thiserror 2.0.0", "whitelist", ] @@ -507,7 +507,7 @@ dependencies = [ "schemars", "semver", "serde", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -531,7 +531,7 @@ dependencies = [ "cw20-minting", "semver", "sylvia", - "thiserror", + "thiserror 2.0.0", ] [[package]] @@ -593,7 +593,7 @@ checksum = "2bba3e9872d7c58ce7ef0fcf1844fcc3e23ef2a58377b50df35dd98e42a5726e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", "unicode-xid", ] @@ -759,7 +759,7 @@ dependencies = [ "cw1", "generic", "sylvia", - "thiserror", + "thiserror 2.0.0", ] [[package]] @@ -803,6 +803,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + [[package]] name = "hex" version = "0.4.3" @@ -820,12 +826,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.15.1", ] [[package]] @@ -975,9 +981,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] @@ -1008,18 +1014,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" dependencies = [ "bytes", "prost-derive", @@ -1027,22 +1033,22 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1142,7 +1148,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1166,9 +1172,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] @@ -1193,13 +1199,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1210,7 +1216,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1284,7 +1290,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1300,9 +1306,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1315,7 +1321,16 @@ version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.63", +] + +[[package]] +name = "thiserror" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15291287e9bff1bc6f9ff3409ed9af665bec7a5fc8ac079ea96be07bca0e2668" +dependencies = [ + "thiserror-impl 2.0.0", ] [[package]] @@ -1326,20 +1341,31 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22efd00f33f93fa62848a7cab956c3d38c8d43095efda1decfc2b3a5dc0b8972" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", @@ -1406,9 +1432,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -1440,7 +1466,7 @@ checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1451,7 +1477,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1471,5 +1497,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index cd94bc3c..8a8ef011 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -32,5 +32,5 @@ cw-storage-plus = "2.0.0" cw-utils = "2.0.0" cw2 = "2.0.0" semver = "1.0.23" -thiserror = "1.0.63" +thiserror = "2.0.0" assert_matches = "1.5.0" diff --git a/sylvia-derive/Cargo.toml b/sylvia-derive/Cargo.toml index 4918d60c..c28dd224 100644 --- a/sylvia-derive/Cargo.toml +++ b/sylvia-derive/Cargo.toml @@ -19,17 +19,17 @@ cosmwasm_1_2 = [] proc-macro = true [dependencies] -syn = { version = "2.0.72", features = [ +syn = { version = "2.0.87", features = [ "fold", "visit", "full", "extra-traits", ] } -quote = "1.0.36" -proc-macro2 = "1.0.86" +quote = "1.0.37" +proc-macro2 = "1.0.89" convert_case = "0.6.0" proc-macro-error = "1.0.4" -proc-macro-crate = "3.1.0" +proc-macro-crate = "3.2.0" itertools = "0.13.0" [dev-dependencies] diff --git a/sylvia/tests/reply_data.rs b/sylvia/tests/reply_data.rs index 0b0d8f0d..e5412a84 100644 --- a/sylvia/tests/reply_data.rs +++ b/sylvia/tests/reply_data.rs @@ -1,5 +1,4 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::to_json_binary; use cw_storage_plus::Item; use cw_utils::{MsgInstantiateContractResponse, ParseReplyError}; use noop_contract::sv::{Executor, NoopContractInstantiateBuilder}; @@ -11,14 +10,22 @@ use sylvia::types::Remote; use sylvia::{contract, entry_points}; use thiserror::Error; +#[cw_serde] +pub struct ComplexData { + pub message: String, + pub number: u64, +} + #[allow(dead_code)] mod noop_contract { - use cosmwasm_std::{Binary, StdResult}; + use cosmwasm_std::{to_json_binary, Binary, StdResult}; use sylvia::ctx::{ExecCtx, InstantiateCtx}; use sylvia::{contract, entry_points}; use sylvia::cw_std::Response; + use crate::ComplexData; + pub struct NoopContract; #[entry_points] @@ -42,6 +49,15 @@ mod noop_contract { Ok(resp) } + + #[sv::msg(exec)] + fn noop_complex_data(&self, _ctx: ExecCtx) -> StdResult { + let data = ComplexData { + message: "Hello".to_string(), + number: 42, + }; + Ok(Response::new().set_data(to_json_binary(&data)?)) + } } } @@ -87,11 +103,7 @@ impl Contract { let sub_msg = InstantiateBuilder::noop_contract(remote_code_id)? .with_label("noop") .build() - .remote_instantiated(to_json_binary(&payload)?)?; - // TODO: Blocked by https://github.com/CosmWasm/cw-multi-test/pull/216. Uncomment when new - // MultiTest version is released. - // Payload is not currently forwarded in the MultiTest. - // .remote_instantiated(payload)?; + .remote_instantiated(payload)?; Ok(Response::new().add_submessage(sub_msg)) } @@ -114,16 +126,25 @@ impl Contract { Ok(Response::new().add_submessage(submsg)) } + #[sv::msg(exec)] + fn send_message_expecting_complex_data(&self, ctx: ExecCtx) -> Result { + let submsg = self + .remote + .load(ctx.deps.storage)? + .executor() + .noop_complex_data()? + .build() + .complex_data(Binary::default())?; + + Ok(Response::new().add_submessage(submsg)) + } + #[sv::msg(reply, reply_on=success)] fn remote_instantiated( &self, ctx: ReplyCtx, #[sv::data(instantiate)] data: MsgInstantiateContractResponse, - // TODO: Blocked by https://github.com/CosmWasm/cw-multi-test/pull/216. Uncomment when new - // MultiTest version is released. - // Payload is not currently forwarded in the MultiTest. - // _instantiate_payload: InstantiatePayload, - #[sv::payload(raw)] _payload: Binary, + _instantiate_payload: InstantiatePayload, ) -> Result { let remote_addr = Addr::unchecked(data.contract_address); @@ -183,6 +204,16 @@ impl Contract { Ok(Response::new()) } + #[sv::msg(reply, reply_on=success)] + fn complex_data( + &self, + _ctx: ReplyCtx, + #[sv::data] _data: ComplexData, + #[sv::payload(raw)] _payload: Binary, + ) -> Result { + Ok(Response::new()) + } + #[sv::msg(reply, reply_on=success)] fn no_data( &self, @@ -284,4 +315,10 @@ fn dispatch_replies() { .send_message_expecting_data(data, DATA_REPLY_ID) .call(&owner) .unwrap(); + + // Should deserialize custom data types + contract + .send_message_expecting_complex_data() + .call(&owner) + .unwrap(); } diff --git a/sylvia/tests/reply_dispatch.rs b/sylvia/tests/reply_dispatch.rs index bb7b9224..4a7c61e6 100644 --- a/sylvia/tests/reply_dispatch.rs +++ b/sylvia/tests/reply_dispatch.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_json_binary, BankMsg, CosmosMsg, Empty, SubMsgResult}; +use cosmwasm_std::{BankMsg, CosmosMsg, Empty, SubMsgResult}; use cw_storage_plus::Item; use cw_utils::{parse_instantiate_response_data, ParseReplyError}; use noop_contract::sv::{Executor, NoopContractInstantiateBuilder}; @@ -107,11 +107,7 @@ where let sub_msg = InstantiateBuilder::noop_contract(remote_code_id)? .with_label("noop") .build() - .remote_instantiated(to_json_binary(&payload)?)?; - // TODO: Blocked by https://github.com/CosmWasm/cw-multi-test/pull/216. Uncomment when new - // MultiTest version is released. - // Payload is not currently forwarded in the MultiTest. - // .remote_instantiated(payload)?; + .remote_instantiated(payload)?; Ok(Response::new().add_submessage(sub_msg)) } @@ -174,15 +170,13 @@ where should_fail: bool, ) -> Result, ContractError> { // Tuple can be used as a payload. - let payload = to_json_binary(&(42_u32, "Hello, world!".to_string()))?; - let msg = self .remote .load(ctx.deps.storage)? .executor() .noop(should_fail)? .build() - .always(payload)?; + .always(42_u32, "Hello, world!".to_string())?; Ok(Response::new().add_submessage(msg)) } @@ -216,11 +210,7 @@ where &self, ctx: ReplyCtx, #[sv::data(raw, opt)] data: Option, - // TODO: Blocked by https://github.com/CosmWasm/cw-multi-test/pull/216. Uncomment when new - // MultiTest version is released. - // Payload is not currently forwarded in the MultiTest. - // _instantiate_payload: InstantiatePayload, - #[sv::payload(raw)] _payload: Binary, + _instantiate_payload: InstantiatePayload, ) -> Result, ContractError> { self.last_reply .save(ctx.deps.storage, &REMOTE_INSTANTIATED_REPLY_ID)?; @@ -262,9 +252,8 @@ where &self, ctx: ReplyCtx, _result: SubMsgResult, - #[sv::payload(raw)] _payload: Binary, - // _first_part_payload: u32, - // _second_part_payload: String, + _first_part_payload: u32, + _second_part_payload: String, ) -> Result, ContractError> { self.last_reply.save(ctx.deps.storage, &ALWAYS_REPLY_ID)?; @@ -278,7 +267,7 @@ where to_address: remote_addr.as_ref().to_string(), amount: vec![], }); - let submsg = cosmos_msg.always(Binary::default())?; + let submsg = cosmos_msg.always(0, "payload".to_string())?; Ok(Response::new().add_submessage(submsg)) } } From da4a2736bc943dcb6cfbcc1a94bc83f9712a5b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Fri, 8 Nov 2024 16:39:34 +0100 Subject: [PATCH 2/2] test: Assert deserialized payload has proper value --- sylvia/tests/reply_dispatch.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sylvia/tests/reply_dispatch.rs b/sylvia/tests/reply_dispatch.rs index 4a7c61e6..ab4925ea 100644 --- a/sylvia/tests/reply_dispatch.rs +++ b/sylvia/tests/reply_dispatch.rs @@ -210,12 +210,16 @@ where &self, ctx: ReplyCtx, #[sv::data(raw, opt)] data: Option, - _instantiate_payload: InstantiatePayload, + instantiate_payload: InstantiatePayload, ) -> Result, ContractError> { self.last_reply .save(ctx.deps.storage, &REMOTE_INSTANTIATED_REPLY_ID)?; let init_data = parse_instantiate_response_data(&data.unwrap())?; let remote_addr = Addr::unchecked(init_data.contract_address); + assert_eq!( + &instantiate_payload.sender.to_string(), + "cosmwasm1fsgzj6t7udv8zhf6zj32mkqhcjcpv52yph5qsdcl0qt94jgdckqs2g053y" + ); self.remote .save(ctx.deps.storage, &Remote::new(remote_addr))?; @@ -252,10 +256,12 @@ where &self, ctx: ReplyCtx, _result: SubMsgResult, - _first_part_payload: u32, - _second_part_payload: String, + first_part_payload: u32, + second_part_payload: String, ) -> Result, ContractError> { self.last_reply.save(ctx.deps.storage, &ALWAYS_REPLY_ID)?; + assert_eq!(first_part_payload, 42_u32); + assert_eq!(second_part_payload, "Hello, world!".to_string()); Ok(Response::new()) } @@ -267,7 +273,7 @@ where to_address: remote_addr.as_ref().to_string(), amount: vec![], }); - let submsg = cosmos_msg.always(0, "payload".to_string())?; + let submsg = cosmos_msg.always(42_u32, "Hello, world!".to_string())?; Ok(Response::new().add_submessage(submsg)) } }