diff --git a/Cargo.lock b/Cargo.lock index 967762ef02..d576e05c0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -359,6 +359,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -400,13 +406,13 @@ dependencies = [ [[package]] name = "bip32" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30ed1d6f8437a487a266c8293aeb95b61a23261273e3e02912cdb8b68bf798b" +checksum = "7e141fb0f8be1c7b45887af94c88b182472b57c96b56773250ae00cd6a14a164" dependencies = [ - "bs58", + "bs58 0.5.0", "hmac 0.12.1", - "k256", + "k256 0.13.1", "once_cell", "pbkdf2", "rand_core 0.6.4", @@ -472,7 +478,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -486,7 +492,7 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -540,8 +546,14 @@ name = "bs58" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" dependencies = [ - "sha2 0.9.9", + "sha2 0.10.6", ] [[package]] @@ -567,6 +579,9 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] [[package]] name = "cast" @@ -844,8 +859,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2895653b4d9f1538a83970077cb01dfc77a4810524e51a110944688e916b18e" dependencies = [ - "prost 0.11.9", - "prost-types 0.11.9", + "prost", + "prost-types", "tonic", "tracing-core", ] @@ -862,7 +877,7 @@ dependencies = [ "futures", "hdrhistogram", "humantime 2.1.0", - "prost-types 0.11.9", + "prost-types", "serde", "serde_json", "thread_local", @@ -922,29 +937,27 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cosmos-sdk-proto" -version = "0.13.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61f3d2224c90ea78e1fa7444787761a549170c46b6b0ed09b93f9b7e4076a" +checksum = "73c9d2043a9e617b0d602fbc0a0ecd621568edbf3a9774890a6d562389bd8e1c" dependencies = [ - "prost 0.10.4", - "prost-types 0.10.1", + "prost", + "prost-types", "tendermint-proto", ] [[package]] name = "cosmrs" -version = "0.8.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d5890dac07a62337e5841adb8f2074a66a962a098a48df9460f64d483beaf4" +checksum = "af13955d6f356272e6def9ff5e2450a7650df536d8934f47052a20c76513d2f6" dependencies = [ "bip32", "cosmos-sdk-proto", - "ecdsa", + "ecdsa 0.16.8", "eyre", "getrandom 0.2.10", - "k256", - "prost 0.10.4", - "prost-types 0.10.1", + "k256 0.13.1", "rand_core 0.6.4", "serde", "serde_json", @@ -960,9 +973,9 @@ version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "ed25519-zebra", - "k256", + "k256 0.11.6", "rand_core 0.6.4", "thiserror", ] @@ -1208,6 +1221,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle 2.4.1", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1330,6 +1355,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "cw-controllers" version = "1.0.1" @@ -1493,6 +1531,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1557,11 +1605,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle 2.4.1", ] @@ -1637,10 +1686,24 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der 0.7.7", + "digest 0.10.7", + "elliptic-curve 0.13.5", + "rfc6979 0.4.0", + "signature 2.1.0", + "spki 0.7.2", ] [[package]] @@ -1650,7 +1713,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "serde", - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +dependencies = [ + "pkcs8 0.10.2", + "signature 2.1.0", +] + +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -1660,7 +1746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", - "ed25519", + "ed25519 1.5.3", "rand 0.7.3", "serde", "serde_bytes", @@ -1695,16 +1781,35 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "digest 0.10.6", + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", "ff 0.12.1", "generic-array 0.14.7", "group 0.12.1", - "pkcs8", + "pkcs8 0.9.0", "rand_core 0.6.4", - "sec1", + "sec1 0.3.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.2", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", "subtle 2.4.1", "zeroize", ] @@ -1900,6 +2005,16 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "figment" version = "0.10.8" @@ -2295,6 +2410,17 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.0", + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "h2" version = "0.3.19" @@ -2518,7 +2644,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2975,19 +3101,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2 0.10.6", - "sha3", ] [[package]] -name = "keccak" -version = "0.1.4" +name = "k256" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ - "cpufeatures", + "cfg-if", + "ecdsa 0.16.8", + "elliptic-curve 0.13.5", + "once_cell", + "sha2 0.10.6", + "signature 2.1.0", ] [[package]] @@ -3027,7 +3157,7 @@ name = "ledger" version = "0.1.0" dependencies = [ "bip32", - "k256", + "k256 0.13.1", "ledger-transport", "ledger-transport-hid", "thiserror", @@ -3405,7 +3535,7 @@ dependencies = [ "anyhow", "async-trait", "bip39", - "bs58", + "bs58 0.4.0", "cfg-if", "clap 4.2.7", "console-subscriber", @@ -3472,7 +3602,7 @@ dependencies = [ name = "nym-api-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmrs", "cosmwasm-std", "getset", @@ -3527,7 +3657,7 @@ dependencies = [ "anyhow", "cosmrs", "eyre", - "k256", + "k256 0.13.1", "nym-cli-commands", "nym-validator-client", "serde", @@ -3542,7 +3672,7 @@ dependencies = [ "anyhow", "base64 0.13.1", "bip39", - "bs58", + "bs58 0.4.0", "clap 4.2.7", "clap_complete", "clap_complete_fig", @@ -3565,7 +3695,7 @@ version = "1.0.0" dependencies = [ "base64 0.13.1", "bip39", - "bs58", + "bs58 0.4.0", "cfg-if", "clap 4.2.7", "comfy-table", @@ -3574,7 +3704,7 @@ dependencies = [ "cw-utils", "handlebars", "humantime-serde", - "k256", + "k256 0.13.1", "log", "nym-bin-common", "nym-coconut-bandwidth-contract-common", @@ -3697,7 +3827,7 @@ name = "nym-coconut" version = "0.5.0" dependencies = [ "bls12_381 0.6.0", - "bs58", + "bs58 0.4.0", "criterion", "digest 0.9.0", "doc-comment", @@ -3741,7 +3871,7 @@ dependencies = [ name = "nym-coconut-interface" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "getset", "nym-coconut", "serde", @@ -3765,7 +3895,7 @@ dependencies = [ name = "nym-contracts-common" version = "0.5.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "schemars", "serde", @@ -3824,10 +3954,10 @@ version = "0.4.0" dependencies = [ "aes 0.8.2", "blake3", - "bs58", + "bs58 0.4.0", "cipher 0.4.4", "ctr 0.9.2", - "digest 0.10.6", + "digest 0.10.7", "ed25519-dalek", "generic-array 0.14.7", "hkdf 0.12.3", @@ -3850,7 +3980,7 @@ version = "0.1.0" dependencies = [ "bitvec", "bls12_381 0.6.0", - "bs58", + "bs58 0.4.0", "criterion", "ff 0.11.1", "group 0.11.0", @@ -3883,7 +4013,7 @@ dependencies = [ "async-trait", "atty", "bip39", - "bs58", + "bs58 0.4.0", "clap 4.2.7", "colored", "dashmap 4.0.2", @@ -3960,7 +4090,7 @@ dependencies = [ name = "nym-gateway-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "futures", "generic-array 0.14.7", "log", @@ -4013,7 +4143,7 @@ dependencies = [ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "humantime-serde", "log", @@ -4033,7 +4163,7 @@ name = "nym-mixnode" version = "1.1.24" dependencies = [ "anyhow", - "bs58", + "bs58 0.4.0", "cfg-if", "clap 4.2.7", "colored", @@ -4151,7 +4281,7 @@ dependencies = [ "anyhow", "async-file-watcher", "async-trait", - "bs58", + "bs58 0.4.0", "clap 4.2.7", "dirs 4.0.0", "futures", @@ -4515,7 +4645,7 @@ dependencies = [ name = "nym-sphinx-anonymous-replies" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "nym-crypto", "nym-sphinx-addressing", "nym-sphinx-params", @@ -4654,7 +4784,7 @@ name = "nym-topology" version = "0.1.0" dependencies = [ "async-trait", - "bs58", + "bs58 0.4.0", "log", "nym-bin-common", "nym-crypto", @@ -4724,11 +4854,12 @@ dependencies = [ "nym-vesting-contract", "nym-vesting-contract-common", "openssl", - "prost 0.10.4", + "prost", "reqwest", "serde", "serde_json", "sha2 0.9.9", + "tendermint-rpc", "thiserror", "tokio", "ts-rs", @@ -5084,11 +5215,12 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "hmac 0.12.1", ] [[package]] @@ -5240,8 +5372,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", - "spki", + "der 0.6.1", + "spki 0.6.0", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.7", + "spki 0.7.2", ] [[package]] @@ -5402,16 +5544,6 @@ dependencies = [ "yansi", ] -[[package]] -name = "prost" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" -dependencies = [ - "bytes", - "prost-derive 0.10.1", -] - [[package]] name = "prost" version = "0.11.9" @@ -5419,20 +5551,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive 0.11.9", -] - -[[package]] -name = "prost-derive" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", + "prost-derive", ] [[package]] @@ -5448,23 +5567,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prost-types" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" -dependencies = [ - "bytes", - "prost 0.10.4", -] - [[package]] name = "prost-types" version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "prost 0.11.9", + "prost", ] [[package]] @@ -5866,11 +5975,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac 0.12.1", "zeroize", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle 2.4.1", +] + [[package]] name = "ring" version = "0.16.20" @@ -5892,18 +6011,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "ripemd160" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.7", ] [[package]] @@ -6233,10 +6341,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct", - "der", + "base16ct 0.1.1", + "der 0.6.1", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.9.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.7", + "generic-array 0.14.7", + "pkcs8 0.10.2", "subtle 2.4.1", "zeroize", ] @@ -6436,7 +6558,7 @@ checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -6447,7 +6569,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -6471,17 +6593,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.6", - "keccak", + "digest 0.10.7", ] [[package]] @@ -6529,7 +6641,17 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.7", "rand_core 0.6.4", ] @@ -6600,7 +6722,7 @@ dependencies = [ "aes 0.7.5", "arrayref", "blake2 0.8.1", - "bs58", + "bs58 0.4.0", "byteorder", "chacha", "curve25519-dalek", @@ -6637,7 +6759,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der 0.7.7", ] [[package]] @@ -6937,6 +7069,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "syn" version = "1.0.109" @@ -7001,28 +7139,28 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a199518e0366ba0aeb0d0e0a59dbd99ea0bdc14280f414ecc758c9228a454ad8" +checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" dependencies = [ - "async-trait", "bytes", - "ed25519", - "ed25519-dalek", + "digest 0.10.7", + "ed25519 2.2.1", + "ed25519-consensus", "flex-error", "futures", - "k256", + "k256 0.13.1", "num-traits", "once_cell", - "prost 0.10.4", - "prost-types 0.10.1", - "ripemd160", + "prost", + "prost-types", + "ripemd", "serde", "serde_bytes", "serde_json", "serde_repr", - "sha2 0.9.9", - "signature", + "sha2 0.10.6", + "signature 2.1.0", "subtle 2.4.1", "subtle-encoding", "tendermint-proto", @@ -7032,9 +7170,9 @@ dependencies = [ [[package]] name = "tendermint-config" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d8f6a64ae3b59ea3c73efad727271ee085b544b817d7f46901817ca6bb1773" +checksum = "71a72dbbea6dde12045d261f2c70c0de039125675e8a026c8d5ad34522756372" dependencies = [ "flex-error", "serde", @@ -7046,16 +7184,16 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b303d6387aaea38cea7ef924476d1f798573044e7b4f6ddd1166ac5184b2281" +checksum = "c0cec054567d16d85e8c3f6a3139963d1a66d9d3051ed545d31562550e9bcc3d" dependencies = [ "bytes", "flex-error", "num-derive", "num-traits", - "prost 0.10.4", - "prost-types 0.10.1", + "prost", + "prost-types", "serde", "serde_bytes", "subtle-encoding", @@ -7064,9 +7202,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.23.8" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3036f0b65baa11e767dabd22a0663e842b595b0a1903f149b7b8b1e09b2b443d" +checksum = "bd2cc789170db5a35d4e0bb2490035c03ef96df08f119bee25fd8dab5a09aa25" dependencies = [ "async-trait", "bytes", @@ -7079,9 +7217,11 @@ dependencies = [ "hyper-rustls", "peg", "pin-project", + "semver 1.0.17", "serde", "serde_bytes", "serde_json", + "subtle 2.4.1", "subtle-encoding", "tendermint", "tendermint-config", @@ -7438,7 +7578,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.11.9", + "prost", "tokio", "tokio-stream", "tower", diff --git a/Cargo.toml b/Cargo.toml index 8e40379227..fd137c6bdf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,7 +121,9 @@ cosmwasm-derive = "=1.2.5" cosmwasm-schema = "=1.2.5" cosmwasm-std = "=1.2.5" cosmwasm-storage = "=1.2.5" -cosmrs = "=0.8.0" +cosmrs = "=0.14.0" +# same version as used by cosmrs +tendermint-rpc = "=0.32" cw-utils = "=1.0.1" cw-storage-plus = "=1.0.1" cw2 = { version = "=1.0.1" } @@ -131,7 +133,7 @@ cw4 = { version = "=1.0.1" } cw-controllers = { version = "=1.0.1" } dotenvy = "0.15.6" generic-array = "0.14.7" -k256 = "0.11" +k256 = "0.13" getrandom = "0.2.10" lazy_static = "1.4.0" log = "0.4" diff --git a/clients/credential/Cargo.toml b/clients/credential/Cargo.toml index 8d161359ec..8ceb14bc98 100644 --- a/clients/credential/Cargo.toml +++ b/clients/credential/Cargo.toml @@ -21,5 +21,5 @@ nym-credential-storage = { path = "../../common/credential-storage" } nym-bin-common = { path = "../../common/bin-common"} nym-network-defaults = { path = "../../common/network-defaults" } nym-pemstore = { path = "../../common/pemstore" } -nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } +nym-validator-client = { path = "../../common/client-libs/validator-client" } diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index 0be4139630..6064304a90 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -48,7 +48,7 @@ nym-sphinx = { path = "../../common/nymsphinx" } nym-pemstore = { path = "../../common/pemstore" } nym-task = { path = "../../common/task" } nym-topology = { path = "../../common/topology" } -nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } +nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] } nym-client-websocket-requests = { path = "websocket-requests" } [dev-dependencies] diff --git a/clients/webassembly/Cargo.lock b/clients/webassembly/Cargo.lock index ceef50ba14..f0733eac1b 100644 --- a/clients/webassembly/Cargo.lock +++ b/clients/webassembly/Cargo.lock @@ -217,6 +217,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -237,13 +243,13 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bip32" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30ed1d6f8437a487a266c8293aeb95b61a23261273e3e02912cdb8b68bf798b" +checksum = "7e141fb0f8be1c7b45887af94c88b182472b57c96b56773250ae00cd6a14a164" dependencies = [ - "bs58", + "bs58 0.5.0", "hmac 0.12.1", - "k256", + "k256 0.13.1", "once_cell", "pbkdf2", "rand_core 0.6.4", @@ -309,7 +315,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -323,7 +329,7 @@ dependencies = [ "cc", "cfg-if 1.0.0", "constant_time_eq", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -377,8 +383,14 @@ name = "bs58" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" dependencies = [ - "sha2 0.9.9", + "sha2 0.10.6", ] [[package]] @@ -404,6 +416,9 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] [[package]] name = "cc" @@ -598,9 +613,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cosmos-sdk-proto" -version = "0.13.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61f3d2224c90ea78e1fa7444787761a549170c46b6b0ed09b93f9b7e4076a" +checksum = "73c9d2043a9e617b0d602fbc0a0ecd621568edbf3a9774890a6d562389bd8e1c" dependencies = [ "prost", "prost-types", @@ -609,18 +624,16 @@ dependencies = [ [[package]] name = "cosmrs" -version = "0.8.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d5890dac07a62337e5841adb8f2074a66a962a098a48df9460f64d483beaf4" +checksum = "af13955d6f356272e6def9ff5e2450a7650df536d8934f47052a20c76513d2f6" dependencies = [ "bip32", "cosmos-sdk-proto", - "ecdsa", + "ecdsa 0.16.8", "eyre", "getrandom 0.2.10", - "k256", - "prost", - "prost-types", + "k256 0.13.1", "rand_core 0.6.4", "serde", "serde_json", @@ -636,9 +649,9 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d076a08ec01ed23c4396aca98ec73a38fa1fee5f310465add52b4108181c7a8" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "ed25519-zebra", - "k256", + "k256 0.11.6", "rand_core 0.6.4", "thiserror", ] @@ -815,6 +828,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle 2.4.1", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -887,6 +912,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "cw-controllers" version = "1.0.1" @@ -1005,6 +1043,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1036,11 +1084,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle 2.4.1", ] @@ -1110,10 +1159,24 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der 0.7.7", + "digest 0.10.7", + "elliptic-curve 0.13.5", + "rfc6979 0.4.0", + "signature 2.1.0", + "spki 0.7.2", ] [[package]] @@ -1123,7 +1186,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "serde", - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +dependencies = [ + "pkcs8 0.10.2", + "signature 2.1.0", +] + +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -1133,7 +1219,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", - "ed25519", + "ed25519 1.5.3", "rand 0.7.3", "serde", "serde_bytes", @@ -1168,16 +1254,35 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "digest 0.10.6", + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", "ff 0.12.1", "generic-array 0.14.7", "group 0.12.1", - "pkcs8", + "pkcs8 0.9.0", "rand_core 0.6.4", - "sec1", + "sec1 0.3.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.2", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", "subtle 2.4.1", "zeroize", ] @@ -1300,6 +1405,16 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "flate2" version = "1.0.26" @@ -1603,6 +1718,17 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.0", + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "h2" version = "0.3.19" @@ -1786,7 +1912,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2062,19 +2188,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2 0.10.6", - "sha3", ] [[package]] -name = "keccak" -version = "0.1.4" +name = "k256" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ - "cpufeatures", + "cfg-if 1.0.0", + "ecdsa 0.16.8", + "elliptic-curve 0.13.5", + "once_cell", + "sha2 0.10.6", + "signature 2.1.0", ] [[package]] @@ -2290,7 +2420,7 @@ dependencies = [ name = "nym-api-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmrs", "cosmwasm-std", "getset", @@ -2382,7 +2512,7 @@ version = "1.1.1" dependencies = [ "anyhow", "async-trait", - "bs58", + "bs58 0.4.0", "console_error_panic_hook", "futures", "js-sys", @@ -2420,7 +2550,7 @@ name = "nym-coconut" version = "0.5.0" dependencies = [ "bls12_381 0.6.0", - "bs58", + "bs58 0.4.0", "digest 0.9.0", "ff 0.11.1", "getrandom 0.2.10", @@ -2461,7 +2591,7 @@ dependencies = [ name = "nym-coconut-interface" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "getset", "nym-coconut", "serde", @@ -2485,7 +2615,7 @@ dependencies = [ name = "nym-contracts-common" version = "0.5.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "schemars", "serde", @@ -2522,10 +2652,10 @@ version = "0.4.0" dependencies = [ "aes 0.8.2", "blake3", - "bs58", + "bs58 0.4.0", "cipher 0.4.4", "ctr 0.9.2", - "digest 0.10.6", + "digest 0.10.7", "ed25519-dalek", "generic-array 0.14.7", "hkdf 0.12.3", @@ -2547,7 +2677,7 @@ version = "0.1.0" dependencies = [ "bitvec", "bls12_381 0.6.0", - "bs58", + "bs58 0.4.0", "ff 0.11.1", "group 0.11.0", "lazy_static", @@ -2597,7 +2727,7 @@ dependencies = [ name = "nym-gateway-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "futures", "generic-array 0.14.7", "log", @@ -2629,7 +2759,7 @@ dependencies = [ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "humantime-serde", "log", @@ -2806,7 +2936,7 @@ dependencies = [ name = "nym-sphinx-anonymous-replies" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "nym-crypto", "nym-sphinx-addressing", "nym-sphinx-params", @@ -2930,7 +3060,7 @@ name = "nym-topology" version = "0.1.0" dependencies = [ "async-trait", - "bs58", + "bs58 0.4.0", "log", "nym-bin-common", "nym-crypto", @@ -2979,6 +3109,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.9.9", + "tendermint-rpc", "thiserror", "tokio", "url", @@ -3167,11 +3298,12 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "hmac 0.12.1", ] [[package]] @@ -3300,8 +3432,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", - "spki", + "der 0.6.1", + "spki 0.6.0", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.7", + "spki 0.7.2", ] [[package]] @@ -3384,9 +3526,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.10.4" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -3394,9 +3536,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.10.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", @@ -3407,11 +3549,10 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.10.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "bytes", "prost", ] @@ -3634,11 +3775,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac 0.12.1", "zeroize", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle 2.4.1", +] + [[package]] name = "ring" version = "0.16.20" @@ -3660,18 +3811,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "ripemd160" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.7", ] [[package]] @@ -3836,10 +3976,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct", - "der", + "base16ct 0.1.1", + "der 0.6.1", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.9.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.7", + "generic-array 0.14.7", + "pkcs8 0.10.2", "subtle 2.4.1", "zeroize", ] @@ -4024,7 +4178,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -4048,17 +4202,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.6", - "keccak", + "digest 0.10.7", ] [[package]] @@ -4076,7 +4220,17 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.7", "rand_core 0.6.4", ] @@ -4114,7 +4268,7 @@ dependencies = [ "aes 0.7.5", "arrayref", "blake2 0.8.1", - "bs58", + "bs58 0.4.0", "byteorder", "chacha", "curve25519-dalek", @@ -4151,7 +4305,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der 0.7.7", ] [[package]] @@ -4390,6 +4554,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "syn" version = "1.0.109" @@ -4433,28 +4603,28 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a199518e0366ba0aeb0d0e0a59dbd99ea0bdc14280f414ecc758c9228a454ad8" +checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" dependencies = [ - "async-trait", "bytes", - "ed25519", - "ed25519-dalek", + "digest 0.10.7", + "ed25519 2.2.1", + "ed25519-consensus", "flex-error", "futures", - "k256", + "k256 0.13.1", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", + "ripemd", "serde", "serde_bytes", "serde_json", "serde_repr", - "sha2 0.9.9", - "signature", + "sha2 0.10.6", + "signature 2.1.0", "subtle 2.4.1", "subtle-encoding", "tendermint-proto", @@ -4464,9 +4634,9 @@ dependencies = [ [[package]] name = "tendermint-config" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d8f6a64ae3b59ea3c73efad727271ee085b544b817d7f46901817ca6bb1773" +checksum = "71a72dbbea6dde12045d261f2c70c0de039125675e8a026c8d5ad34522756372" dependencies = [ "flex-error", "serde", @@ -4478,9 +4648,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b303d6387aaea38cea7ef924476d1f798573044e7b4f6ddd1166ac5184b2281" +checksum = "c0cec054567d16d85e8c3f6a3139963d1a66d9d3051ed545d31562550e9bcc3d" dependencies = [ "bytes", "flex-error", @@ -4496,9 +4666,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3036f0b65baa11e767dabd22a0663e842b595b0a1903f149b7b8b1e09b2b443d" +checksum = "d119d83a130537fc4a98c3c9eb6899ebe857fea4860400a61675bfb5f0b35129" dependencies = [ "async-trait", "bytes", @@ -4511,9 +4681,11 @@ dependencies = [ "hyper-rustls", "peg", "pin-project", + "semver 1.0.17", "serde", "serde_bytes", "serde_json", + "subtle 2.4.1", "subtle-encoding", "tendermint", "tendermint-config", diff --git a/common/bandwidth-controller/Cargo.toml b/common/bandwidth-controller/Cargo.toml index 40fe146d81..5b168d8b9f 100644 --- a/common/bandwidth-controller/Cargo.toml +++ b/common/bandwidth-controller/Cargo.toml @@ -18,7 +18,6 @@ nym-crypto = { path = "../crypto", features = ["rand", "asymmetric", "symmetric" nym-network-defaults = { path = "../network-defaults" } nym-validator-client = { path = "../client-libs/validator-client", default-features = false } - [target."cfg(not(target_arch = \"wasm32\"))".dependencies.nym-validator-client] path = "../client-libs/validator-client" -features = ["nyxd-client"] +features = ["signing"] diff --git a/common/bandwidth-controller/src/acquire/mod.rs b/common/bandwidth-controller/src/acquire/mod.rs index cfaf8dc473..cdf72c3b00 100644 --- a/common/bandwidth-controller/src/acquire/mod.rs +++ b/common/bandwidth-controller/src/acquire/mod.rs @@ -10,8 +10,8 @@ use nym_crypto::asymmetric::{encryption, identity}; use nym_network_defaults::VOUCHER_INFO; use nym_validator_client::nyxd::traits::CoconutBandwidthSigningClient; use nym_validator_client::nyxd::traits::DkgQueryClient; -use nym_validator_client::nyxd::tx::Hash; use nym_validator_client::nyxd::Coin; +use nym_validator_client::nyxd::Hash; use nym_validator_client::CoconutApiClient; use rand::rngs::OsRng; use state::{KeyPair, State}; diff --git a/common/client-core/Cargo.toml b/common/client-core/Cargo.toml index b8b1403d86..d5ae32dbd2 100644 --- a/common/client-core/Cargo.toml +++ b/common/client-core/Cargo.toml @@ -45,7 +45,7 @@ nym-network-defaults = { path = "../network-defaults" } [target."cfg(not(target_arch = \"wasm32\"))".dependencies.nym-validator-client] path = "../client-libs/validator-client" -features = ["nyxd-client"] +features = ["signing", "http-client"] [target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-stream] version = "0.1.11" diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index ac66916c46..31475887bc 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -35,27 +35,30 @@ nym-coconut-interface = { path = "../../coconut-interface" } nym-network-defaults = { path = "../../network-defaults" } nym-api-requests = { path = "../../../nym-api/nym-api-requests" } -# required for nyxd-client -# at some point it might be possible to make it wasm-compatible -# perhaps after https://github.com/cosmos/cosmos-rust/pull/97 is resolved (and tendermint-rs is updated) -async-trait = { workspace = true, optional = true } +async-trait = { workspace = true } bip39 = { workspace = true, features = ["rand"], optional = true } -nym-config = { path = "../../config", optional = true } -cosmrs = { workspace = true, features = ["rpc", "bip32", "cosmwasm"], optional = true } +nym-config = { path = "../../config" } +cosmrs = { workspace = true, features = ["bip32", "cosmwasm"] } +#cosmrs = { workspace = true, features = ["bip32", "rpc", "cosmwasm"], optional = true } # note that this has the same version as used by cosmrs + +# import it just for the `Client` trait +tendermint-rpc = { workspace = true } + eyre = { version = "0.6", optional = true } -cw3 = { workspace = true, optional = true } -cw4 = { workspace = true, optional = true } -prost = { version = "0.10", default-features = false, optional = true } -flate2 = { version = "1.0.20", optional = true } -sha2 = { version = "0.9.5", optional = true } -itertools = { version = "0.10", optional = true } +cw3 = { workspace = true } +cw4 = { workspace = true } +prost = { version = "0.11", default-features = false } +flate2 = { version = "1.0.20" } +sha2 = { version = "0.9.5" } +itertools = { version = "0.10" } zeroize = { version = "1.5.7", optional = true, features = ["zeroize_derive"] } -cosmwasm-std = { workspace = true, optional = true } +cosmwasm-std = { workspace = true } [dev-dependencies] bip39 = { workspace = true } -cosmrs = { workspace = true, features = ["rpc", "bip32"] } +#cosmrs = { workspace = true, features = ["rpc", "bip32"] } +cosmrs = { workspace = true, features = ["bip32"] } tokio = { version = "1.24.1", features = ["rt-multi-thread", "macros"] } ts-rs = "6.1.2" @@ -64,35 +67,23 @@ name = "offline_signing" # it should only really require the "signing" feature, # but that would require another round of refactoring to make it possible # (traits would need to be moved around and refactored themselves) -required-features = ["nyxd-client"] +required-features = ["http-client", "signing"] [[example]] name = "query_service_provider_directory" -required-features = ["nyxd-client"] +# TODO: validate the requirements +required-features = ["http-client", "signing"] [[example]] name = "query_name_service" -required-features = ["nyxd-client"] +# TODO: validate the requirements +required-features = ["http-client", "signing"] [features] -nyxd-client = [ - "async-trait", - "cosmrs", - "cosmwasm-std", - "cw3", - "cw4", - "flate2", - "itertools", - "openssl", - "prost", - "sha2", - "signing" -] +http-client = ["cosmrs/rpc", "openssl"] signing = [ "bip39", - "cosmrs", "eyre", - "nym-config", "zeroize" ] generate-ts = [] diff --git a/common/client-libs/validator-client/examples/offline_signing.rs b/common/client-libs/validator-client/examples/offline_signing.rs index d48db60e53..a21bfa4475 100644 --- a/common/client-libs/validator-client/examples/offline_signing.rs +++ b/common/client-libs/validator-client/examples/offline_signing.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use cosmrs::bank::MsgSend; -use cosmrs::rpc::{self, HttpClient}; +use cosmrs::rpc::HttpClient; use cosmrs::tx::Msg; use cosmrs::{tx, AccountId, Coin, Denom}; use nym_validator_client::nyxd::CosmWasmClient; @@ -54,7 +54,7 @@ async fn main() { denom, amount: 2500u32.into(), }, - 100000, + 100000u32, ); let tx_raw = tx_signer @@ -70,7 +70,7 @@ async fn main() { .unwrap(); // broadcast the tx - let res = rpc::Client::broadcast_tx_commit(&broadcaster, tx_bytes.into()) + let res = tendermint_rpc::client::Client::broadcast_tx_commit(&broadcaster, tx_bytes) .await .unwrap(); diff --git a/common/client-libs/validator-client/src/client.rs b/common/client-libs/validator-client/src/client.rs index 1ccf62a67e..54539403fb 100644 --- a/common/client-libs/validator-client/src/client.rs +++ b/common/client-libs/validator-client/src/client.rs @@ -16,37 +16,35 @@ pub use nym_mixnet_contract_common::{ }; use url::Url; -#[cfg(feature = "nyxd-client")] use crate::nyxd::traits::{DkgQueryClient, MixnetQueryClient}; -#[cfg(feature = "nyxd-client")] -use crate::nyxd::{self, CosmWasmClient, NyxdClient, QueryNyxdClient, SigningNyxdClient}; -#[cfg(feature = "nyxd-client")] -use crate::signing::direct_wallet::DirectSecp256k1HdWallet; -#[cfg(feature = "nyxd-client")] +#[cfg(feature = "http-client")] +use crate::nyxd::QueryNyxdClient; +use crate::nyxd::{self, CosmWasmClient, NyxdClient}; use nym_api_requests::models::MixNodeBondAnnotated; -#[cfg(feature = "nyxd-client")] use nym_coconut_dkg_common::{types::EpochId, verification_key::ContractVKShare}; -#[cfg(feature = "nyxd-client")] use nym_coconut_interface::Base58; -#[cfg(feature = "nyxd-client")] use nym_mixnet_contract_common::{ families::{Family, FamilyHead}, mixnode::MixNodeBond, pending_events::{PendingEpochEvent, PendingIntervalEvent}, Delegation, RewardedSetNodeStatus, UnbondedMixnode, }; -#[cfg(feature = "nyxd-client")] use nym_network_defaults::NymNetworkDetails; -#[cfg(feature = "nyxd-client")] use std::str::FromStr; -#[cfg(feature = "nyxd-client")] +#[cfg(all(feature = "signing", feature = "http-client"))] +use crate::nyxd::SigningNyxdClient; +#[cfg(all(feature = "signing", feature = "http-client"))] +use crate::signing::direct_wallet::DirectSecp256k1HdWallet; + #[must_use] #[derive(Debug, Clone)] pub struct Config { api_url: Url, nyxd_url: Url, + // TODO: until refactored, this is a dead field under some features + #[allow(dead_code)] nyxd_config: nyxd::Config, mixnode_page_limit: Option, @@ -55,7 +53,6 @@ pub struct Config { rewarded_set_page_limit: Option, } -#[cfg(feature = "nyxd-client")] impl Config { pub fn try_from_nym_network_details( details: &NymNetworkDetails, @@ -119,7 +116,6 @@ impl Config { } } -#[cfg(feature = "nyxd-client")] pub struct Client { mixnode_page_limit: Option, gateway_page_limit: Option, @@ -131,7 +127,7 @@ pub struct Client { pub nyxd: NyxdClient, } -#[cfg(feature = "nyxd-client")] +#[cfg(all(feature = "signing", feature = "http-client"))] impl Client> { pub fn new_signing( config: Config, @@ -165,7 +161,7 @@ impl Client> { } } -#[cfg(feature = "nyxd-client")] +#[cfg(feature = "http-client")] impl Client { pub fn new_query(config: Config) -> Result, ValidatorClientError> { let nym_api_client = nym_api::Client::new(config.api_url.clone()); @@ -189,7 +185,6 @@ impl Client { } // nyxd wrappers -#[cfg(feature = "nyxd-client")] impl Client { // use case: somebody initialised client without a contract in order to upload and initialise one // and now they want to actually use it without making new client @@ -572,7 +567,6 @@ impl Client { } // validator-api wrappers -#[cfg(feature = "nyxd-client")] impl Client { pub fn change_nym_api(&mut self, new_endpoint: Url) { self.nym_api.change_url(new_endpoint) @@ -635,11 +629,9 @@ pub struct CoconutApiClient { pub api_client: NymApiClient, pub verification_key: VerificationKey, pub node_id: NodeIndex, - #[cfg(feature = "nyxd-client")] pub cosmos_address: cosmrs::AccountId, } -#[cfg(feature = "nyxd-client")] impl CoconutApiClient { pub async fn all_coconut_api_clients( client: &C, diff --git a/common/client-libs/validator-client/src/connection_tester.rs b/common/client-libs/validator-client/src/connection_tester.rs index 5d89e86d05..800399d415 100644 --- a/common/client-libs/validator-client/src/connection_tester.rs +++ b/common/client-libs/validator-client/src/connection_tester.rs @@ -120,7 +120,7 @@ async fn test_nyxd_connection( ) .await { - Ok(Err(NyxdError::TendermintError(e))) => { + Ok(Err(NyxdError::TendermintErrorRpc(e))) => { // If we get a tendermint-rpc error, we classify the node as not contactable log::warn!("Checking: nyxd url: {url}: {}: {}", "failed".red(), e); false diff --git a/common/client-libs/validator-client/src/error.rs b/common/client-libs/validator-client/src/error.rs index 08da52c626..a675a27717 100644 --- a/common/client-libs/validator-client/src/error.rs +++ b/common/client-libs/validator-client/src/error.rs @@ -15,7 +15,6 @@ pub enum ValidatorClientError { #[error("One of the provided URLs was malformed - {0}")] MalformedUrlProvided(#[from] url::ParseError), - #[cfg(feature = "nyxd-client")] #[error("nyxd request failed - {0}")] NyxdError(#[from] crate::nyxd::error::NyxdError), diff --git a/common/client-libs/validator-client/src/lib.rs b/common/client-libs/validator-client/src/lib.rs index 5d18c251c0..ab0cff646e 100644 --- a/common/client-libs/validator-client/src/lib.rs +++ b/common/client-libs/validator-client/src/lib.rs @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 pub mod client; -#[cfg(feature = "nyxd-client")] +#[cfg(feature = "http-client")] pub mod connection_tester; pub mod error; pub mod nym_api; -#[cfg(feature = "nyxd-client")] pub mod nyxd; #[cfg(feature = "signing")] @@ -16,5 +15,4 @@ pub use crate::error::ValidatorClientError; pub use client::NymApiClient; pub use nym_api_requests::*; -#[cfg(feature = "nyxd-client")] pub use client::{Client, CoconutApiClient, Config}; diff --git a/common/client-libs/validator-client/src/nyxd/coin.rs b/common/client-libs/validator-client/src/nyxd/coin.rs index 3ac51997b8..f780bd32f3 100644 --- a/common/client-libs/validator-client/src/nyxd/coin.rs +++ b/common/client-libs/validator-client/src/nyxd/coin.rs @@ -52,7 +52,6 @@ impl<'a> Div for &'a Coin { } else { implicit_gas_limit.u128() as u64 } - .into() } } @@ -191,32 +190,32 @@ mod tests { let amount = Coin::new(3938, "unym"); let gas_price = "0.025unym".parse().unwrap(); let res = amount / gas_price; - assert_eq!(157520, res.value()); + assert_eq!(157520, res); let amount = Coin::new(1234567890, "unym"); let gas_price = "0.025unym".parse().unwrap(); let res = amount / gas_price; - assert_eq!(49382715600, res.value()); + assert_eq!(49382715600, res); let amount = Coin::new(1, "unym"); let gas_price = "0.025unym".parse().unwrap(); let res = amount / gas_price; - assert_eq!(40, res.value()); + assert_eq!(40, res); let amount = Coin::new(150_000_000, "unym"); let gas_price = "0.001234unym".parse().unwrap(); let res = amount / gas_price; - assert_eq!(121555915721, res.value()); + assert_eq!(121555915721, res); let amount = Coin::new(150_000_000, "unym"); let gas_price = "1unym".parse().unwrap(); let res = amount / gas_price; - assert_eq!(150_000_000, res.value()); + assert_eq!(150_000_000, res); let amount = Coin::new(150_000_000, "unym"); let gas_price = "1234.56unym".parse().unwrap(); let res = amount / gas_price; - assert_eq!(121500, res.value()); + assert_eq!(121500, res); } #[test] diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs index 9be833c68b..4a512a02db 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs @@ -1,15 +1,16 @@ -// Copyright 2021 - Nym Technologies SA +// Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 use crate::nyxd; use crate::nyxd::coin::Coin; use crate::nyxd::cosmwasm_client::helpers::{create_pagination, next_page_key}; use crate::nyxd::cosmwasm_client::types::{ - Account, Code, CodeDetails, Contract, ContractCodeHistoryEntry, ContractCodeId, - SequenceResponse, SimulateResponse, + Account, CodeDetails, Contract, ContractCodeId, SequenceResponse, SimulateResponse, }; use crate::nyxd::error::NyxdError; +use crate::nyxd::TendermintClient; use async_trait::async_trait; +use cosmrs::cosmwasm::{CodeInfoResponse, ContractCodeHistoryEntry}; use cosmrs::proto::cosmos::auth::v1beta1::{QueryAccountRequest, QueryAccountResponse}; use cosmrs::proto::cosmos::bank::v1beta1::{ QueryAllBalancesRequest, QueryAllBalancesResponse, QueryBalanceRequest, QueryBalanceResponse, @@ -18,22 +19,28 @@ use cosmrs::proto::cosmos::bank::v1beta1::{ use cosmrs::proto::cosmos::tx::v1beta1::{ SimulateRequest, SimulateResponse as ProtoSimulateResponse, }; -use cosmrs::proto::cosmwasm::wasm::v1::*; -use cosmrs::rpc::endpoint::block::Response as BlockResponse; -use cosmrs::rpc::endpoint::broadcast; -use cosmrs::rpc::endpoint::tx::Response as TxResponse; -use cosmrs::rpc::query::Query; -use cosmrs::rpc::{self, HttpClient, Order}; -use cosmrs::tendermint::abci::Transaction; -use cosmrs::tendermint::{abci, block, chain}; -use cosmrs::{tx, AccountId, Coin as CosmosCoin, Tx}; +use cosmrs::proto::cosmwasm::wasm::v1::{ + QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, + QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractInfoRequest, + QueryContractInfoResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, + QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, + QuerySmartContractStateResponse, +}; +use cosmrs::tendermint::{block, chain, Hash}; +use cosmrs::{AccountId, Coin as CosmosCoin, Tx}; use prost::Message; use serde::{Deserialize, Serialize}; -use std::convert::{TryFrom, TryInto}; +use std::convert::TryFrom; use std::time::Duration; +use tendermint_rpc::{ + endpoint::{block::Response as BlockResponse, broadcast, tx::Response as TxResponse}, + query::Query, + Order, +}; +#[cfg(feature = "http-client")] #[async_trait] -impl CosmWasmClient for HttpClient { +impl CosmWasmClient for cosmrs::rpc::HttpClient { fn broadcast_polling_rate(&self) -> Duration { Duration::from_secs(4) } @@ -44,7 +51,7 @@ impl CosmWasmClient for HttpClient { } #[async_trait] -pub trait CosmWasmClient: rpc::Client { +pub trait CosmWasmClient: TendermintClient { // this should probably get redesigned, but I'm leaving those like that temporarily to fix // the underlying issue more quickly fn broadcast_polling_rate(&self) -> Duration; @@ -55,7 +62,7 @@ pub trait CosmWasmClient: rpc::Client { // require proof? async fn make_abci_query( &self, - path: Option, + path: Option, req: Req, ) -> Result where @@ -81,7 +88,7 @@ pub trait CosmWasmClient: rpc::Client { // TODO: the return type should probably be changed to a non-proto, type-safe Account alternative async fn get_account(&self, address: &AccountId) -> Result, NyxdError> { - let path = Some("/cosmos.auth.v1beta1.Query/Account".parse().unwrap()); + let path = Some("/cosmos.auth.v1beta1.Query/Account".to_owned()); let req = QueryAccountRequest { address: address.to_string(), @@ -119,7 +126,7 @@ pub trait CosmWasmClient: rpc::Client { address: &AccountId, search_denom: String, ) -> Result, NyxdError> { - let path = Some("/cosmos.bank.v1beta1.Query/Balance".parse().unwrap()); + let path = Some("/cosmos.bank.v1beta1.Query/Balance".to_owned()); let req = QueryBalanceRequest { address: address.to_string(), @@ -137,7 +144,7 @@ pub trait CosmWasmClient: rpc::Client { } async fn get_all_balances(&self, address: &AccountId) -> Result, NyxdError> { - let path = Some("/cosmos.bank.v1beta1.Query/AllBalances".parse().unwrap()); + let path = Some("/cosmos.bank.v1beta1.Query/AllBalances".to_owned()); let mut raw_balances = Vec::new(); let mut pagination = None; @@ -168,7 +175,7 @@ pub trait CosmWasmClient: rpc::Client { } async fn get_total_supply(&self) -> Result, NyxdError> { - let path = Some("/cosmos.bank.v1beta1.Query/TotalSupply".parse().unwrap()); + let path = Some("/cosmos.bank.v1beta1.Query/TotalSupply".to_owned()); let mut supply = Vec::new(); let mut pagination = None; @@ -195,7 +202,7 @@ pub trait CosmWasmClient: rpc::Client { .map_err(|_| NyxdError::SerializationError("Coins".to_owned())) } - async fn get_tx(&self, id: tx::Hash) -> Result { + async fn get_tx(&self, id: Hash) -> Result { Ok(self.tx(id, false).await?) } @@ -231,30 +238,36 @@ pub trait CosmWasmClient: rpc::Client { } /// Broadcast a transaction, returning immediately. - async fn broadcast_tx_async( - &self, - tx: Transaction, - ) -> Result { - Ok(rpc::Client::broadcast_tx_async(self, tx).await?) + async fn broadcast_tx_async(&self, tx: T) -> Result + where + T: Into> + Send, + { + Ok(tendermint_rpc::client::Client::broadcast_tx_async(self, tx).await?) } /// Broadcast a transaction, returning the response from `CheckTx`. - async fn broadcast_tx_sync( - &self, - tx: Transaction, - ) -> Result { - Ok(rpc::Client::broadcast_tx_sync(self, tx).await?) + async fn broadcast_tx_sync(&self, tx: T) -> Result + where + T: Into> + Send, + { + Ok(tendermint_rpc::client::Client::broadcast_tx_sync(self, tx).await?) } /// Broadcast a transaction, returning the response from `DeliverTx`. - async fn broadcast_tx_commit( + async fn broadcast_tx_commit( &self, - tx: Transaction, - ) -> Result { - Ok(rpc::Client::broadcast_tx_commit(self, tx).await?) + tx: T, + ) -> Result + where + T: Into> + Send, + { + Ok(tendermint_rpc::client::Client::broadcast_tx_commit(self, tx).await?) } - async fn broadcast_tx(&self, tx: Transaction) -> Result { + async fn broadcast_tx(&self, tx: T) -> Result + where + T: Into> + Send, + { let broadcasted = CosmWasmClient::broadcast_tx_sync(self, tx).await?; if broadcasted.code.is_err() { @@ -290,8 +303,8 @@ pub trait CosmWasmClient: rpc::Client { } } - async fn get_codes(&self) -> Result, NyxdError> { - let path = Some("/cosmwasm.wasm.v1.Query/Codes".parse().unwrap()); + async fn get_codes(&self) -> Result, NyxdError> { + let path = Some("/cosmwasm.wasm.v1.Query/Codes".to_owned()); let mut raw_codes = Vec::new(); let mut pagination = None; @@ -311,14 +324,14 @@ pub trait CosmWasmClient: rpc::Client { } } - raw_codes + Ok(raw_codes .into_iter() .map(TryFrom::try_from) - .collect::>() + .collect::>()?) } async fn get_code_details(&self, code_id: ContractCodeId) -> Result { - let path = Some("/cosmwasm.wasm.v1.Query/Code".parse().unwrap()); + let path = Some("/cosmwasm.wasm.v1.Query/Code".to_owned()); let req = QueryCodeRequest { code_id }; @@ -333,7 +346,7 @@ pub trait CosmWasmClient: rpc::Client { } } async fn get_contracts(&self, code_id: ContractCodeId) -> Result, NyxdError> { - let path = Some("/cosmwasm.wasm.v1.Query/ContractsByCode".parse().unwrap()); + let path = Some("/cosmwasm.wasm.v1.Query/ContractsByCode".to_owned()); let mut raw_contracts = Vec::new(); let mut pagination = None; @@ -364,7 +377,7 @@ pub trait CosmWasmClient: rpc::Client { } async fn get_contract(&self, address: &AccountId) -> Result { - let path = Some("/cosmwasm.wasm.v1.Query/ContractInfo".parse().unwrap()); + let path = Some("/cosmwasm.wasm.v1.Query/ContractInfo".to_owned()); let req = QueryContractInfoRequest { address: address.to_string(), @@ -389,7 +402,7 @@ pub trait CosmWasmClient: rpc::Client { &self, address: &AccountId, ) -> Result, NyxdError> { - let path = Some("/cosmwasm.wasm.v1.Query/ContractHistory".parse().unwrap()); + let path = Some("/cosmwasm.wasm.v1.Query/ContractHistory".to_owned()); let mut raw_entries = Vec::new(); let mut pagination = None; @@ -412,10 +425,10 @@ pub trait CosmWasmClient: rpc::Client { } } - raw_entries + Ok(raw_entries .into_iter() .map(TryFrom::try_from) - .collect::>() + .collect::>()?) } async fn query_contract_raw( @@ -423,7 +436,7 @@ pub trait CosmWasmClient: rpc::Client { address: &AccountId, query_data: Vec, ) -> Result, NyxdError> { - let path = Some("/cosmwasm.wasm.v1.Query/RawContractState".parse().unwrap()); + let path = Some("/cosmwasm.wasm.v1.Query/RawContractState".to_owned()); let req = QueryRawContractStateRequest { address: address.to_string(), @@ -479,7 +492,7 @@ pub trait CosmWasmClient: rpc::Client { tx: Option, tx_bytes: Vec, ) -> Result { - let path = Some("/cosmos.tx.v1beta1.Service/Simulate".parse().unwrap()); + let path = Some("/cosmos.tx.v1beta1.Service/Simulate".to_owned()); let req = SimulateRequest { tx: tx.map(Into::into), diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs index 0dd7f98ead..64c2fd25fa 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs @@ -3,12 +3,7 @@ use crate::nyxd::error::NyxdError; use cosmrs::proto::cosmos::base::query::v1beta1::{PageRequest, PageResponse}; -use cosmrs::proto::cosmos::base::v1beta1::Coin as ProtoCoin; -use cosmrs::rpc::endpoint::broadcast; -use cosmrs::Coin; -use flate2::write::GzEncoder; -use flate2::Compression; -use std::io::Write; +use tendermint_rpc::endpoint::broadcast; pub(crate) trait CheckResponse: Sized { fn check_response(self) -> Result; @@ -21,7 +16,7 @@ impl CheckResponse for broadcast::tx_commit::Response { hash: self.hash, height: Some(self.height), code: self.check_tx.code.value(), - raw_log: self.check_tx.log.value().to_owned(), + raw_log: self.check_tx.log, }); } @@ -30,7 +25,7 @@ impl CheckResponse for broadcast::tx_commit::Response { hash: self.hash, height: Some(self.height), code: self.deliver_tx.code.value(), - raw_log: self.deliver_tx.log.value().to_owned(), + raw_log: self.deliver_tx.log, }); } @@ -45,7 +40,7 @@ impl CheckResponse for crate::nyxd::TxResponse { hash: self.hash, height: Some(self.height), code: self.tx_result.code.value(), - raw_log: self.tx_result.log.value().to_owned(), + raw_log: self.tx_result.log, }); } @@ -53,7 +48,12 @@ impl CheckResponse for crate::nyxd::TxResponse { } } +#[cfg(feature = "signing")] pub(crate) fn compress_wasm_code(code: &[u8]) -> Result, NyxdError> { + use flate2::write::GzEncoder; + use flate2::Compression; + use std::io::Write; + // using compression level 9, same as cosmjs, that optimises for size let mut encoder = GzEncoder::new(Vec::new(), Compression::best()); encoder @@ -83,14 +83,3 @@ pub(crate) fn next_page_key(pagination_info: Option) -> Option) -> Result, NyxdError> { - value - .into_iter() - .map(|proto_coin| { - Coin::try_from(&proto_coin).map_err(|_| NyxdError::MalformedCoin { - coin_representation: format!("{:?}", proto_coin), - }) - }) - .collect() -} diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs index 3912500f47..d16b3055c2 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 use crate::nyxd::error::NyxdError; -use cosmrs::tendermint::abci; use itertools::Itertools; use serde::{Deserialize, Serialize}; @@ -49,7 +48,7 @@ fn parse_raw_str_logs(raw: &str) -> Result, NyxdError> { Ok(logs) } -pub fn parse_raw_logs(raw: abci::Log) -> Result, NyxdError> { +pub fn parse_raw_logs(raw: String) -> Result, NyxdError> { parse_raw_str_logs(raw.as_ref()) } diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs index f668cc27a1..0a2d2c7c32 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs @@ -1,17 +1,22 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +#[cfg(feature = "http-client")] use crate::nyxd::error::NyxdError; -use crate::nyxd::GasPrice; +#[cfg(feature = "http-client")] use cosmrs::rpc::{Error as TendermintRpcError, HttpClient, HttpClientUrl}; +#[cfg(feature = "http-client")] use std::convert::TryInto; pub mod client; mod helpers; pub mod logs; -pub mod signing_client; pub mod types; +#[cfg(feature = "signing")] +pub mod signing_client; + +#[cfg(feature = "http-client")] pub fn connect(endpoint: U) -> Result where U: TryInto, @@ -19,10 +24,11 @@ where Ok(HttpClient::new(endpoint)?) } +#[cfg(all(feature = "signing", feature = "http-client"))] pub fn connect_with_signer( endpoint: U, signer: S, - gas_price: GasPrice, + gas_price: crate::nyxd::GasPrice, ) -> Result, NyxdError> where U: TryInto, diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs index 88919743cd..f4d6a41829 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs @@ -9,29 +9,37 @@ use crate::nyxd::error::NyxdError; use crate::nyxd::fee::{Fee, DEFAULT_SIMULATED_GAS_MULTIPLIER}; use crate::nyxd::{Coin, GasAdjustable, GasPrice, TxResponse}; use crate::signing::signer::OfflineSigner; -use crate::signing::tx_signer::TxSigner; use crate::signing::SignerData; use async_trait::async_trait; +use cosmrs::abci::GasInfo; use cosmrs::bank::MsgSend; use cosmrs::distribution::MsgWithdrawDelegatorReward; use cosmrs::feegrant::{ AllowedMsgAllowance, BasicAllowance, MsgGrantAllowance, MsgRevokeAllowance, }; use cosmrs::proto::cosmos::tx::signing::v1beta1::SignMode; -use cosmrs::rpc::endpoint::broadcast; -use cosmrs::rpc::{Error as TendermintRpcError, HttpClient, HttpClientUrl, SimpleRequest}; use cosmrs::staking::{MsgDelegate, MsgUndelegate}; -use cosmrs::tx::{self, Msg, Raw}; -use cosmrs::{cosmwasm, rpc, AccountId, Any, Tx}; +use cosmrs::tx::{self, Msg}; +use cosmrs::{cosmwasm, AccountId, Any, Tx}; use log::debug; use serde::Serialize; use sha2::Digest; use sha2::Sha256; use std::convert::TryInto; use std::time::{Duration, SystemTime}; +use tendermint_rpc::endpoint::broadcast; -const DEFAULT_BROADCAST_POLLING_RATE: Duration = Duration::from_secs(4); -const DEFAULT_BROADCAST_TIMEOUT: Duration = Duration::from_secs(60); +#[cfg(feature = "http-client")] +use crate::signing::tx_signer::TxSigner; + +#[cfg(feature = "http-client")] +use tendermint_rpc::{Error as TendermintRpcError, SimpleRequest}; + +#[cfg(feature = "http-client")] +use cosmrs::rpc::{HttpClient, HttpClientUrl}; + +pub const DEFAULT_BROADCAST_POLLING_RATE: Duration = Duration::from_secs(4); +pub const DEFAULT_BROADCAST_TIMEOUT: Duration = Duration::from_secs(60); fn empty_fee() -> tx::Fee { tx::Fee { @@ -123,7 +131,10 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .check_response()?; let logs = parse_raw_logs(tx_res.tx_result.log)?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; // TODO: should those strings be extracted into some constants? // the reason I think unwrap here is fine is that if the transaction succeeded and those @@ -184,8 +195,10 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .check_response()?; let logs = parse_raw_logs(tx_res.tx_result.log)?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); - + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; // TODO: should those strings be extracted into some constants? // the reason I think unwrap here is fine is that if the transaction succeeded and those // fields do not exist or address is malformed, there's no way we can recover, we're probably connected @@ -212,7 +225,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fee: Fee, memo: impl Into + Send + 'static, ) -> Result { - let change_admin_msg = cosmwasm::MsgUpdateAdmin { + let change_admin_msg = sealed::cosmwasm::MsgUpdateAdmin { sender: sender_address.clone(), new_admin: new_admin.clone(), contract: contract_address.clone(), @@ -225,8 +238,10 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .await? .check_response()?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); - + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; Ok(ChangeAdminResult { logs: parse_raw_logs(tx_res.tx_result.log)?, transaction_hash: tx_res.hash, @@ -241,7 +256,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fee: Fee, memo: impl Into + Send + 'static, ) -> Result { - let change_admin_msg = cosmwasm::MsgClearAdmin { + let change_admin_msg = sealed::cosmwasm::MsgClearAdmin { sender: sender_address.clone(), contract: contract_address.clone(), } @@ -253,8 +268,10 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .await? .check_response()?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); - + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; Ok(ChangeAdminResult { logs: parse_raw_logs(tx_res.tx_result.log)?, transaction_hash: tx_res.hash, @@ -288,8 +305,10 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .await? .check_response()?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); - + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; Ok(MigrateResult { logs: parse_raw_logs(tx_res.tx_result.log)?, transaction_hash: tx_res.hash, @@ -323,11 +342,13 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .await? .check_response()?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); - + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; Ok(ExecuteResult { logs: parse_raw_logs(tx_res.tx_result.log)?, - data: tx_res.tx_result.data, + data: tx_res.tx_result.data.into(), transaction_hash: tx_res.hash, gas_info, }) @@ -364,11 +385,13 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .await? .check_response()?; - let gas_info = GasInfo::new(tx_res.tx_result.gas_wanted, tx_res.tx_result.gas_used); - + let gas_info = GasInfo { + gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), + gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), + }; Ok(ExecuteResult { logs: parse_raw_logs(tx_res.tx_result.log)?, - data: tx_res.tx_result.data, + data: tx_res.tx_result.data.into(), transaction_hash: tx_res.hash, gas_info, }) @@ -602,7 +625,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .to_bytes() .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; - CosmWasmClient::broadcast_tx_async(self, tx_bytes.into()).await + CosmWasmClient::broadcast_tx_async(self, tx_bytes).await } /// Broadcast a transaction, returning the response from `CheckTx`. @@ -622,7 +645,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .to_bytes() .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; - CosmWasmClient::broadcast_tx_sync(self, tx_bytes.into()).await + CosmWasmClient::broadcast_tx_sync(self, tx_bytes).await } /// Broadcast a transaction, returning the response from `DeliverTx`. @@ -643,7 +666,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .to_bytes() .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; - CosmWasmClient::broadcast_tx_commit(self, tx_bytes.into()).await + CosmWasmClient::broadcast_tx_commit(self, tx_bytes).await } /// Broadcast a transaction to the network and monitors its inclusion in a block. @@ -664,7 +687,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .to_bytes() .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; - self.broadcast_tx(tx_bytes.into()).await + self.broadcast_tx(tx_bytes).await } async fn sign( @@ -709,6 +732,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { ) -> Result; } +#[cfg(feature = "http-client")] #[derive(Debug)] pub struct Client { // TODO: somehow nicely hide this guy if we decide to use our client in offline mode, @@ -722,6 +746,7 @@ pub struct Client { broadcast_timeout: Duration, } +#[cfg(feature = "http-client")] impl Client { pub fn connect_with_signer( endpoint: U, @@ -770,12 +795,13 @@ impl Client { } } +#[cfg(feature = "http-client")] #[async_trait] -impl rpc::Client for Client +impl tendermint_rpc::client::Client for Client where S: Send + Sync, { - async fn perform(&self, request: R) -> Result + async fn perform(&self, request: R) -> Result where R: SimpleRequest, { @@ -783,6 +809,7 @@ where } } +#[cfg(feature = "http-client")] #[async_trait] impl CosmWasmClient for Client where @@ -797,6 +824,7 @@ where } } +#[cfg(feature = "http-client")] #[async_trait] impl SigningCosmWasmClient for Client where @@ -820,7 +848,7 @@ where fee: tx::Fee, memo: impl Into + Send + 'static, signer_data: SignerData, - ) -> Result { + ) -> Result { Ok(self .tx_signer .sign_amino(signer_address, messages, fee, memo, signer_data)?) @@ -833,9 +861,173 @@ where fee: tx::Fee, memo: impl Into + Send + 'static, signer_data: SignerData, - ) -> Result { + ) -> Result { Ok(self .tx_signer .sign_direct(signer_address, messages, fee, memo, signer_data)?) } } + +// a temporary bypass until https://github.com/cosmos/cosmos-rust/pull/419 is merged +mod sealed { + pub mod cosmwasm { + use cosmrs::{proto, tx::Msg, AccountId, ErrorReport, Result}; + + /// MsgUpdateAdmin sets a new admin for a smart contract + #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] + pub struct MsgUpdateAdmin { + /// Sender is the that actor that signed the messages + pub sender: AccountId, + + /// NewAdmin address to be set + pub new_admin: AccountId, + + /// Contract is the address of the smart contract + pub contract: AccountId, + } + + impl Msg for MsgUpdateAdmin { + type Proto = proto::cosmwasm::wasm::v1::MsgUpdateAdmin; + } + + impl TryFrom for MsgUpdateAdmin { + type Error = ErrorReport; + + fn try_from( + proto: proto::cosmwasm::wasm::v1::MsgUpdateAdmin, + ) -> Result { + MsgUpdateAdmin::try_from(&proto) + } + } + + impl TryFrom<&proto::cosmwasm::wasm::v1::MsgUpdateAdmin> for MsgUpdateAdmin { + type Error = ErrorReport; + + fn try_from( + proto: &proto::cosmwasm::wasm::v1::MsgUpdateAdmin, + ) -> Result { + Ok(MsgUpdateAdmin { + sender: proto.sender.parse()?, + new_admin: proto.new_admin.parse()?, + contract: proto.contract.parse()?, + }) + } + } + + impl From for proto::cosmwasm::wasm::v1::MsgUpdateAdmin { + fn from(msg: MsgUpdateAdmin) -> proto::cosmwasm::wasm::v1::MsgUpdateAdmin { + proto::cosmwasm::wasm::v1::MsgUpdateAdmin::from(&msg) + } + } + + impl From<&MsgUpdateAdmin> for proto::cosmwasm::wasm::v1::MsgUpdateAdmin { + fn from(msg: &MsgUpdateAdmin) -> proto::cosmwasm::wasm::v1::MsgUpdateAdmin { + proto::cosmwasm::wasm::v1::MsgUpdateAdmin { + sender: msg.sender.to_string(), + new_admin: msg.new_admin.to_string(), + contract: msg.contract.to_string(), + } + } + } + + /// MsgUpdateAdminResponse returns empty data + #[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)] + pub struct MsgUpdateAdminResponse {} + + impl Msg for MsgUpdateAdminResponse { + type Proto = proto::cosmwasm::wasm::v1::MsgUpdateAdminResponse; + } + + impl TryFrom for MsgUpdateAdminResponse { + type Error = ErrorReport; + + fn try_from( + _proto: proto::cosmwasm::wasm::v1::MsgUpdateAdminResponse, + ) -> Result { + Ok(MsgUpdateAdminResponse {}) + } + } + + impl From for proto::cosmwasm::wasm::v1::MsgUpdateAdminResponse { + fn from( + _msg: MsgUpdateAdminResponse, + ) -> proto::cosmwasm::wasm::v1::MsgUpdateAdminResponse { + proto::cosmwasm::wasm::v1::MsgUpdateAdminResponse {} + } + } + + /// MsgClearAdmin removes any admin stored for a smart contract + #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] + pub struct MsgClearAdmin { + /// Sender is the that actor that signed the messages + pub sender: AccountId, + + /// Contract is the address of the smart contract + pub contract: AccountId, + } + + impl Msg for MsgClearAdmin { + type Proto = proto::cosmwasm::wasm::v1::MsgClearAdmin; + } + + impl TryFrom for MsgClearAdmin { + type Error = ErrorReport; + + fn try_from(proto: proto::cosmwasm::wasm::v1::MsgClearAdmin) -> Result { + MsgClearAdmin::try_from(&proto) + } + } + + impl TryFrom<&proto::cosmwasm::wasm::v1::MsgClearAdmin> for MsgClearAdmin { + type Error = ErrorReport; + + fn try_from(proto: &proto::cosmwasm::wasm::v1::MsgClearAdmin) -> Result { + Ok(MsgClearAdmin { + sender: proto.sender.parse()?, + contract: proto.contract.parse()?, + }) + } + } + + impl From for proto::cosmwasm::wasm::v1::MsgClearAdmin { + fn from(msg: MsgClearAdmin) -> proto::cosmwasm::wasm::v1::MsgClearAdmin { + proto::cosmwasm::wasm::v1::MsgClearAdmin::from(&msg) + } + } + + impl From<&MsgClearAdmin> for proto::cosmwasm::wasm::v1::MsgClearAdmin { + fn from(msg: &MsgClearAdmin) -> proto::cosmwasm::wasm::v1::MsgClearAdmin { + proto::cosmwasm::wasm::v1::MsgClearAdmin { + sender: msg.sender.to_string(), + contract: msg.contract.to_string(), + } + } + } + + /// MsgClearAdminResponse returns empty data + #[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)] + pub struct MsgClearAdminResponse {} + + impl Msg for MsgClearAdminResponse { + type Proto = proto::cosmwasm::wasm::v1::MsgClearAdminResponse; + } + + impl TryFrom for MsgClearAdminResponse { + type Error = ErrorReport; + + fn try_from( + _proto: proto::cosmwasm::wasm::v1::MsgClearAdminResponse, + ) -> Result { + Ok(MsgClearAdminResponse {}) + } + } + + impl From for proto::cosmwasm::wasm::v1::MsgClearAdminResponse { + fn from( + _msg: MsgClearAdminResponse, + ) -> proto::cosmwasm::wasm::v1::MsgClearAdminResponse { + proto::cosmwasm::wasm::v1::MsgClearAdminResponse {} + } + } + } +} diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs index dda27cd8ba..757c8ed201 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs @@ -3,36 +3,35 @@ // TODO: There's a significant argument to pull those out of the package and make a PR on https://github.com/cosmos/cosmos-rust/ -use crate::nyxd::cosmwasm_client::helpers::parse_proto_coin_vec; use crate::nyxd::cosmwasm_client::logs::Log; use crate::nyxd::error::NyxdError; -use cosmrs::crypto::PublicKey; +use cosmrs::auth::{BaseAccount, ModuleAccount}; +use cosmrs::cosmwasm::{CodeInfoResponse, ContractInfo}; use cosmrs::proto::cosmos::auth::v1beta1::{ BaseAccount as ProtoBaseAccount, ModuleAccount as ProtoModuleAccount, }; -use cosmrs::proto::cosmos::base::abci::v1beta1::{ - GasInfo as ProtoGasInfo, Result as ProtoAbciResult, -}; +use cosmrs::proto::cosmos::base::abci::v1beta1::Result as ProtoAbciResult; use cosmrs::proto::cosmos::tx::v1beta1::SimulateResponse as ProtoSimulateResponse; use cosmrs::proto::cosmos::vesting::v1beta1::{ BaseVestingAccount as ProtoBaseVestingAccount, ContinuousVestingAccount as ProtoContinuousVestingAccount, - DelayedVestingAccount as ProtoDelayedVestingAccount, Period as ProtoPeriod, + DelayedVestingAccount as ProtoDelayedVestingAccount, PeriodicVestingAccount as ProtoPeriodicVestingAccount, PermanentLockedAccount as ProtoPermanentLockedAccount, }; -use cosmrs::proto::cosmwasm::wasm::v1::{ - CodeInfoResponse, ContractCodeHistoryEntry as ProtoContractCodeHistoryEntry, - ContractCodeHistoryOperationType, ContractInfo as ProtoContractInfo, +use cosmrs::tendermint::{abci, Hash}; +use cosmrs::tx::{AccountNumber, SequenceNumber}; +use cosmrs::vesting::{ + BaseVestingAccount, ContinuousVestingAccount, DelayedVestingAccount, PeriodicVestingAccount, + PermanentLockedAccount, }; -use cosmrs::tendermint::abci; -use cosmrs::tendermint::abci::Data; -use cosmrs::tx::{AccountNumber, Gas, SequenceNumber}; -use cosmrs::{tx, AccountId, Any, Coin as CosmosCoin}; +use cosmrs::{AccountId, Any, Coin as CosmosCoin}; use prost::Message; use serde::Serialize; use std::convert::{TryFrom, TryInto}; +pub use cosmrs::abci::GasInfo; + pub type ContractCodeId = u64; #[derive(Serialize)] @@ -44,215 +43,6 @@ pub struct SequenceResponse { pub sequence: SequenceNumber, } -/// BaseAccount defines a base account type. It contains all the necessary fields -/// for basic account functionality. Any custom account type should extend this -/// type for additional functionality (e.g. vesting). -#[derive(Debug)] -pub struct BaseAccount { - /// Bech32 account address - pub address: AccountId, - pub pubkey: Option, - pub account_number: AccountNumber, - pub sequence: SequenceNumber, -} - -impl TryFrom for BaseAccount { - type Error = NyxdError; - - fn try_from(value: ProtoBaseAccount) -> Result { - let address: AccountId = value - .address - .parse() - .map_err(|_| NyxdError::MalformedAccountAddress(value.address.clone()))?; - - let pubkey = value - .pub_key - .map(PublicKey::try_from) - .transpose() - .map_err(|_| NyxdError::InvalidPublicKey(address.clone()))?; - - Ok(BaseAccount { - address, - pubkey, - account_number: value.account_number, - sequence: value.sequence, - }) - } -} - -/// ModuleAccount defines an account for modules that holds coins on a pool. -#[derive(Debug)] -pub struct ModuleAccount { - pub base_account: Option, - pub name: String, - pub permissions: Vec, -} - -impl TryFrom for ModuleAccount { - type Error = NyxdError; - - fn try_from(value: ProtoModuleAccount) -> Result { - let base_account = value.base_account.map(TryFrom::try_from).transpose()?; - - Ok(ModuleAccount { - base_account, - name: value.name, - permissions: value.permissions, - }) - } -} - -/// BaseVestingAccount implements the VestingAccount interface. It contains all -/// the necessary fields needed for any vesting account implementation. -#[derive(Debug)] -pub struct BaseVestingAccount { - pub base_account: Option, - pub original_vesting: Vec, - pub delegated_free: Vec, - pub delegated_vesting: Vec, - pub end_time: i64, -} - -impl TryFrom for BaseVestingAccount { - type Error = NyxdError; - - fn try_from(value: ProtoBaseVestingAccount) -> Result { - let base_account = value.base_account.map(TryFrom::try_from).transpose()?; - - let original_vesting = parse_proto_coin_vec(value.original_vesting)?; - let delegated_free = parse_proto_coin_vec(value.delegated_free)?; - let delegated_vesting = parse_proto_coin_vec(value.delegated_vesting)?; - - Ok(BaseVestingAccount { - base_account, - original_vesting, - delegated_free, - delegated_vesting, - end_time: value.end_time, - }) - } -} - -/// ContinuousVestingAccount implements the VestingAccount interface. It -/// continuously vests by unlocking coins linearly with respect to time. -#[derive(Debug)] -pub struct ContinuousVestingAccount { - pub base_vesting_account: Option, - pub start_time: i64, -} - -impl TryFrom for ContinuousVestingAccount { - type Error = NyxdError; - - fn try_from(value: ProtoContinuousVestingAccount) -> Result { - let base_vesting_account = value - .base_vesting_account - .map(TryFrom::try_from) - .transpose()?; - - Ok(ContinuousVestingAccount { - base_vesting_account, - start_time: value.start_time, - }) - } -} - -/// DelayedVestingAccount implements the VestingAccount interface. It vests all -/// coins after a specific time, but non prior. In other words, it keeps them -/// locked until a specified time. -#[derive(Debug)] -pub struct DelayedVestingAccount { - pub base_vesting_account: Option, -} - -impl TryFrom for DelayedVestingAccount { - type Error = NyxdError; - - fn try_from(value: ProtoDelayedVestingAccount) -> Result { - let base_vesting_account = value - .base_vesting_account - .map(TryFrom::try_from) - .transpose()?; - - Ok(DelayedVestingAccount { - base_vesting_account, - }) - } -} - -/// Period defines a length of time and amount of coins that will vest. -#[derive(Debug)] -pub struct Period { - pub length: i64, - pub amount: Vec, -} - -impl TryFrom for Period { - type Error = NyxdError; - - fn try_from(value: ProtoPeriod) -> Result { - Ok(Period { - length: value.length, - amount: parse_proto_coin_vec(value.amount)?, - }) - } -} - -/// PeriodicVestingAccount implements the VestingAccount interface. It -/// periodically vests by unlocking coins during each specified period. -#[derive(Debug)] -pub struct PeriodicVestingAccount { - pub base_vesting_account: Option, - pub start_time: i64, - pub vesting_periods: Vec, -} - -impl TryFrom for PeriodicVestingAccount { - type Error = NyxdError; - - fn try_from(value: ProtoPeriodicVestingAccount) -> Result { - let base_vesting_account = value - .base_vesting_account - .map(TryFrom::try_from) - .transpose()?; - - let vesting_periods = value - .vesting_periods - .into_iter() - .map(TryFrom::try_from) - .collect::>()?; - - Ok(PeriodicVestingAccount { - base_vesting_account, - start_time: value.start_time, - vesting_periods, - }) - } -} - -/// PermanentLockedAccount implements the VestingAccount interface. It does -/// not ever release coins, locking them indefinitely. Coins in this account can -/// still be used for delegating and for governance votes even while locked. -#[derive(Debug)] -pub struct PermanentLockedAccount { - pub base_vesting_account: Option, -} - -impl TryFrom for PermanentLockedAccount { - type Error = NyxdError; - - fn try_from(value: ProtoPermanentLockedAccount) -> Result { - let base_vesting_account = value - .base_vesting_account - .map(TryFrom::try_from) - .transpose()?; - - Ok(PermanentLockedAccount { - base_vesting_account, - }) - } -} - #[derive(Debug)] pub enum Account { Base(BaseAccount), @@ -335,183 +125,32 @@ impl TryFrom for Account { } } -#[derive(Debug)] -pub struct Code { - pub code_id: ContractCodeId, - - /// Bech32 account address - pub creator: AccountId, - - /// sha256 hash of the code stored - pub data_hash: Vec, -} - -impl TryFrom for Code { - type Error = NyxdError; - - fn try_from(value: CodeInfoResponse) -> Result { - let CodeInfoResponse { - code_id, - creator, - data_hash, - } = value; - - let creator = creator - .parse() - .map_err(|_| NyxdError::MalformedAccountAddress(creator))?; - - Ok(Code { - code_id, - creator, - data_hash, - }) - } -} - #[derive(Debug)] pub struct CodeDetails { - pub code_info: Code, + pub code_info: CodeInfoResponse, /// The original wasm bytes pub data: Vec, } impl CodeDetails { - pub fn new(code_info: Code, data: Vec) -> Self { + pub fn new(code_info: CodeInfoResponse, data: Vec) -> Self { CodeDetails { code_info, data } } } -#[derive(Debug)] -pub(crate) struct ContractInfo { - code_id: ContractCodeId, - creator: AccountId, - admin: Option, - label: String, -} - -impl TryFrom for ContractInfo { - type Error = NyxdError; - - fn try_from(value: ProtoContractInfo) -> Result { - let ProtoContractInfo { - code_id, - creator, - admin, - label, - .. - } = value; - - let admin = if admin.is_empty() { - None - } else { - Some( - admin - .parse() - .map_err(|_| NyxdError::MalformedAccountAddress(admin))?, - ) - }; - - Ok(ContractInfo { - code_id, - creator: creator - .parse() - .map_err(|_| NyxdError::MalformedAccountAddress(creator))?, - admin, - label, - }) - } -} - #[derive(Debug)] pub struct Contract { pub address: AccountId, - pub code_id: ContractCodeId, - - /// Bech32 account address - pub creator: AccountId, - - /// Bech32-encoded admin address - pub admin: Option, - - pub label: String, + pub contract_info: ContractInfo, } impl Contract { pub(crate) fn new(address: AccountId, contract_info: ContractInfo) -> Self { Contract { address, - code_id: contract_info.code_id, - creator: contract_info.creator, - admin: contract_info.admin, - label: contract_info.label, - } - } -} - -#[derive(Clone, Copy, Debug)] -pub enum ContractCodeHistoryEntryOperation { - Init, - Genesis, - Migrate, -} - -#[derive(Debug)] -pub struct ContractCodeHistoryEntry { - /// The source of this history entry - pub operation: ContractCodeHistoryEntryOperation, - pub code_id: ContractCodeId, - pub msg_json: String, -} - -impl TryFrom for ContractCodeHistoryEntry { - type Error = NyxdError; - - fn try_from(value: ProtoContractCodeHistoryEntry) -> Result { - let operation = match ContractCodeHistoryOperationType::from_i32(value.operation) - .ok_or(NyxdError::InvalidContractHistoryOperation)? - { - ContractCodeHistoryOperationType::Unspecified => { - return Err(NyxdError::InvalidContractHistoryOperation) - } - ContractCodeHistoryOperationType::Init => ContractCodeHistoryEntryOperation::Init, - ContractCodeHistoryOperationType::Genesis => ContractCodeHistoryEntryOperation::Genesis, - ContractCodeHistoryOperationType::Migrate => ContractCodeHistoryEntryOperation::Migrate, - }; - - Ok(ContractCodeHistoryEntry { - operation, - code_id: value.code_id, - msg_json: String::from_utf8(value.msg) - .map_err(|_| NyxdError::DeserializationError("Contract history msg".to_owned()))?, - }) - } -} - -#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Serialize)] -pub struct GasInfo { - /// GasWanted is the maximum units of work we allow this tx to perform. - pub gas_wanted: Gas, - - /// GasUsed is the amount of gas actually consumed. - pub gas_used: Gas, -} - -impl From for GasInfo { - fn from(value: ProtoGasInfo) -> Self { - GasInfo { - gas_wanted: value.gas_wanted.into(), - gas_used: value.gas_used.into(), - } - } -} - -impl GasInfo { - pub fn new(gas_wanted: Gas, gas_used: Gas) -> Self { - GasInfo { - gas_wanted, - gas_used, + contract_info, } } } @@ -535,31 +174,15 @@ impl TryFrom for AbciResult { type Error = NyxdError; fn try_from(value: ProtoAbciResult) -> Result { - let mut events = Vec::with_capacity(value.events.len()); - - for proto_event in value.events.into_iter() { - let type_str = proto_event.r#type; - - let mut attributes = Vec::with_capacity(proto_event.attributes.len()); - for proto_attribute in proto_event.attributes.into_iter() { - let stringified_ked = String::from_utf8(proto_attribute.key) - .map_err(|_| NyxdError::DeserializationError("EventAttributeKey".to_owned()))?; - let stringified_value = String::from_utf8(proto_attribute.value) - .map_err(|_| NyxdError::DeserializationError("EventAttributeKey".to_owned()))?; - - attributes.push(abci::tag::Tag { - key: stringified_ked.parse().unwrap(), - value: stringified_value.parse().unwrap(), - }) - } - - events.push(abci::Event { - type_str, - attributes, - }) - } + let events = value + .events + .into_iter() + .map(TryInto::try_into) + .collect::, _>>()?; + #[allow(deprecated)] Ok(AbciResult { + // TODO: make sure this actually works since technically we're converting from 0.37 protobuf definition as opposed to 0.34... data: value.data, log: value.log, events, @@ -578,7 +201,10 @@ impl TryFrom for SimulateResponse { fn try_from(value: ProtoSimulateResponse) -> Result { Ok(SimulateResponse { - gas_info: value.gas_info.map(|gas_info| gas_info.into()), + gas_info: value + .gas_info + .map(|gas_info| gas_info.try_into()) + .transpose()?, result: value.result.map(|result| result.try_into()).transpose()?, }) } @@ -608,7 +234,7 @@ pub struct UploadResult { pub logs: Vec, /// Transaction hash (might be used as transaction ID) - pub transaction_hash: tx::Hash, + pub transaction_hash: Hash, pub gas_info: GasInfo, } @@ -645,7 +271,7 @@ pub struct InstantiateResult { pub logs: Vec, /// Transaction hash (might be used as transaction ID) - pub transaction_hash: tx::Hash, + pub transaction_hash: Hash, pub gas_info: GasInfo, } @@ -655,7 +281,7 @@ pub struct ChangeAdminResult { pub logs: Vec, /// Transaction hash (might be used as transaction ID) - pub transaction_hash: tx::Hash, + pub transaction_hash: Hash, pub gas_info: GasInfo, } @@ -665,7 +291,7 @@ pub struct MigrateResult { pub logs: Vec, /// Transaction hash (might be used as transaction ID) - pub transaction_hash: tx::Hash, + pub transaction_hash: Hash, pub gas_info: GasInfo, } @@ -674,10 +300,10 @@ pub struct MigrateResult { pub struct ExecuteResult { pub logs: Vec, - pub data: Data, + pub data: Vec, /// Transaction hash (might be used as transaction ID) - pub transaction_hash: tx::Hash, + pub transaction_hash: Hash, pub gas_info: GasInfo, } diff --git a/common/client-libs/validator-client/src/nyxd/error.rs b/common/client-libs/validator-client/src/nyxd/error.rs index b778a56188..b63be6e75c 100644 --- a/common/client-libs/validator-client/src/nyxd/error.rs +++ b/common/client-libs/validator-client/src/nyxd/error.rs @@ -2,34 +2,39 @@ // SPDX-License-Identifier: Apache-2.0 use crate::nyxd::cosmwasm_client::types::ContractCodeId; +use cosmrs::tendermint::Hash; use cosmrs::{ - rpc::endpoint::abci_query::AbciQuery, - tendermint::{ - abci::{self, Code as AbciCode}, - block, - }, - tx, AccountId, + tendermint::{abci::Code as AbciCode, block}, + AccountId, }; +use std::{io, time::Duration}; +use tendermint_rpc::endpoint::abci_query::AbciQuery; use thiserror::Error; +#[cfg(feature = "signing")] use crate::signing::direct_wallet::DirectSecp256k1HdWalletError; -pub use cosmrs::rpc::{ + +pub use cosmrs::tendermint::error::Error as TendermintError; +pub use tendermint_rpc::{ error::{Error as TendermintRpcError, ErrorDetail as TendermintRpcErrorDetail}, response_error::{Code, ResponseError}, }; -use std::{io, time::Duration}; #[derive(Debug, Error)] pub enum NyxdError { #[error("No contract address is available to perform the call: {0}")] NoContractAddressAvailable(String), + #[cfg(feature = "signing")] #[error(transparent)] WalletError(#[from] DirectSecp256k1HdWalletError), - #[error("There was an issue on the cosmrs side - {0}")] + #[error("There was an issue on the cosmrs side: {0}")] CosmrsError(#[from] cosmrs::Error), + #[error("There was an issue on the cosmrs side: {0}")] + CosmrsErrorReport(#[from] cosmrs::ErrorReport), + #[error("Failed to derive account address")] AccountDerivationError, @@ -43,7 +48,10 @@ pub enum NyxdError { InvalidTxHash(String), #[error("Tendermint RPC request failed - {0}")] - TendermintError(#[from] TendermintRpcError), + TendermintErrorRpc(#[from] TendermintRpcError), + + #[error("tendermint library failure: {0}")] + TendermintError(#[from] TendermintError), #[error("Failed when attempting to serialize data ({0})")] SerializationError(String), @@ -91,7 +99,7 @@ pub enum NyxdError { "Error when broadcasting tx {hash} at height {height:?}. Error occurred during CheckTx phase. Code: {code}; Raw log: {raw_log}" )] BroadcastTxErrorCheckTx { - hash: tx::Hash, + hash: Hash, height: Option, code: u32, raw_log: String, @@ -101,7 +109,7 @@ pub enum NyxdError { "Error when broadcasting tx {hash} at height {height:?}. Error occurred during DeliverTx phase. Code: {code}; Raw log: {raw_log}" )] BroadcastTxErrorDeliverTx { - hash: tx::Hash, + hash: Hash, height: Option, code: u32, raw_log: String, @@ -116,7 +124,7 @@ pub enum NyxdError { #[error("Abci query failed with code {code} - {log}")] AbciError { code: u32, - log: abci::Log, + log: String, pretty_log: Option, }, @@ -130,7 +138,7 @@ pub enum NyxdError { NoBaseAccountInformationAvailable, #[error("Transaction with ID {hash} has been submitted but not yet found on the chain. You might want to check for it later. There was a total wait of {} seconds", .timeout.as_secs())] - BroadcastTimeout { hash: tx::Hash, timeout: Duration }, + BroadcastTimeout { hash: Hash, timeout: Duration }, #[error("Cosmwasm std error: {0}")] CosmwasmStdError(#[from] cosmwasm_std::StdError), @@ -148,7 +156,7 @@ pub fn parse_abci_query_result(query_result: AbciQuery) -> Result Ok(query_result), AbciCode::Err(code) => Err(NyxdError::AbciError { - code, + code: code.into(), log: query_result.log.clone(), pretty_log: try_parse_abci_log(&query_result.log), }), @@ -157,11 +165,8 @@ pub fn parse_abci_query_result(query_result: AbciQuery) -> Result Option { - if log - .value() - .contains("Maximum amount of locked coins has already been pledged") - { +fn try_parse_abci_log(log: &str) -> Option { + if log.contains("Maximum amount of locked coins has already been pledged") { Some("Maximum amount of locked tokens has already been used. You can only use up to 10% of your locked tokens for bonding and delegating.".to_string()) } else { None @@ -171,7 +176,7 @@ fn try_parse_abci_log(log: &abci::Log) -> Option { impl NyxdError { pub fn is_tendermint_response_timeout(&self) -> bool { match &self { - NyxdError::TendermintError(TendermintRpcError( + NyxdError::TendermintErrorRpc(TendermintRpcError( TendermintRpcErrorDetail::Response(err), _, )) => { @@ -198,7 +203,7 @@ impl NyxdError { pub fn is_tendermint_response_duplicate(&self) -> bool { match &self { - NyxdError::TendermintError(TendermintRpcError( + NyxdError::TendermintErrorRpc(TendermintRpcError( TendermintRpcErrorDetail::Response(err), _, )) => { diff --git a/common/client-libs/validator-client/src/nyxd/fee/gas_price.rs b/common/client-libs/validator-client/src/nyxd/fee/gas_price.rs index 10ae3a7bb7..caccceb436 100644 --- a/common/client-libs/validator-client/src/nyxd/fee/gas_price.rs +++ b/common/client-libs/validator-client/src/nyxd/fee/gas_price.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use crate::nyxd::error::NyxdError; -use cosmrs::tx::Gas; use cosmrs::Coin; +use cosmrs::Gas; use cosmwasm_std::{Decimal, Fraction, Uint128}; use nym_config::defaults; use std::ops::Mul; @@ -25,7 +25,7 @@ impl<'a> Mul for &'a GasPrice { type Output = Coin; fn mul(self, gas_limit: Gas) -> Self::Output { - let limit_uint128 = Uint128::from(gas_limit.value()); + let limit_uint128 = Uint128::from(gas_limit); let mut amount = self.amount * limit_uint128; let gas_price_numerator = self.amount.numerator(); @@ -122,7 +122,7 @@ mod tests { fn gas_limit_multiplication() { // real world example that caused an issue when the result was rounded down let gas_price: GasPrice = "0.025upunk".parse().unwrap(); - let gas_limit: Gas = 157500u64.into(); + let gas_limit: Gas = 157500u64; let fee = &gas_price * gas_limit; // the failing behaviour was result value of 3937 diff --git a/common/client-libs/validator-client/src/nyxd/fee/mod.rs b/common/client-libs/validator-client/src/nyxd/fee/mod.rs index 6b857f8a66..0d67544203 100644 --- a/common/client-libs/validator-client/src/nyxd/fee/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/fee/mod.rs @@ -116,8 +116,8 @@ impl GasAdjustable for Gas { if adjustment == 1.0 { *self } else { - let adjusted = (self.value() as f32 * adjustment).ceil(); - (adjusted as u64).into() + let adjusted = (*self as f32 * adjustment).ceil(); + adjusted as u64 } } } @@ -125,9 +125,9 @@ impl GasAdjustable for Gas { // a workaround to provide serde implementation for tx::Fee. We don't want to ever expose any of those // types to the public and ideally they will get replaced by proper implementation inside comrs mod sealed { - use cosmrs::tx::{self, Gas}; - use cosmrs::Coin as CosmosCoin; + use cosmrs::tx::{self}; use cosmrs::{AccountId, Denom as CosmosDenom}; + use cosmrs::{Coin as CosmosCoin, Gas}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[derive(Serialize, Deserialize, Clone)] diff --git a/common/client-libs/validator-client/src/nyxd/mod.rs b/common/client-libs/validator-client/src/nyxd/mod.rs index 0d90eb2387..404124df8d 100644 --- a/common/client-libs/validator-client/src/nyxd/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/mod.rs @@ -1,51 +1,67 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nyxd::cosmwasm_client::signing_client; -use crate::nyxd::cosmwasm_client::types::{ - Account, ChangeAdminResult, ContractCodeId, ExecuteResult, InstantiateOptions, - InstantiateResult, MigrateResult, SequenceResponse, SimulateResponse, UploadResult, -}; +use crate::nyxd::cosmwasm_client::types::Account; use crate::nyxd::error::NyxdError; -use crate::nyxd::fee::DEFAULT_SIMULATED_GAS_MULTIPLIER; -use crate::signing::direct_wallet::DirectSecp256k1HdWallet; -use crate::signing::signer::OfflineSigner; -use cosmrs::cosmwasm; -use cosmrs::rpc::endpoint::block::Response as BlockResponse; -use cosmrs::rpc::query::Query; -use cosmrs::rpc::Error as TendermintRpcError; -use cosmrs::rpc::HttpClientUrl; -use cosmrs::tx::Msg; use log::{debug, trace}; use nym_network_defaults::{ChainDetails, NymNetworkDetails}; use serde::{Deserialize, Serialize}; -use std::convert::TryInto; -use std::time::SystemTime; +use tendermint_rpc::{endpoint::block::Response as BlockResponse, query::Query}; + +#[cfg(feature = "http-client")] +use tendermint_rpc::Error as TendermintRpcError; pub use crate::nyxd::cosmwasm_client::client::CosmWasmClient; -pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient; pub use crate::nyxd::fee::Fee; pub use coin::Coin; pub use cosmrs::bank::MsgSend; -pub use cosmrs::rpc::endpoint::tx::Response as TxResponse; -pub use cosmrs::rpc::endpoint::validators::Response as ValidatorResponse; -pub use cosmrs::rpc::HttpClient as QueryNyxdClient; -pub use cosmrs::rpc::Paging; -pub use cosmrs::tendermint::abci::responses::{DeliverTx, Event}; -pub use cosmrs::tendermint::abci::tag::Tag; +pub use cosmrs::tendermint::abci::{response::DeliverTx, Event, EventAttribute}; pub use cosmrs::tendermint::block::Height; -pub use cosmrs::tendermint::hash; +pub use cosmrs::tendermint::hash::{self, Algorithm, Hash}; pub use cosmrs::tendermint::validator::Info as TendermintValidatorInfo; pub use cosmrs::tendermint::Time as TendermintTime; -pub use cosmrs::tx::{self, Gas}; +pub use cosmrs::tx::{self}; pub use cosmrs::Coin as CosmosCoin; +pub use cosmrs::Gas; pub use cosmrs::{bip32, AccountId, Denom}; -use cosmwasm_std::Addr; pub use cosmwasm_std::Coin as CosmWasmCoin; pub use fee::{gas_price::GasPrice, GasAdjustable, GasAdjustment}; -pub use signing_client::Client as SigningNyxdClient; -pub use traits::{VestingQueryClient, VestingSigningClient}; +pub use tendermint_rpc::{client::Client as TendermintClient, Request, Response, SimpleRequest}; +pub use tendermint_rpc::{ + endpoint::{tx::Response as TxResponse, validators::Response as ValidatorResponse}, + Paging, +}; +#[cfg(feature = "http-client")] +pub use cosmrs::rpc::{HttpClient as QueryNyxdClient, HttpClientUrl}; + +#[cfg(all(feature = "signing", feature = "http-client"))] +use crate::nyxd::cosmwasm_client::signing_client; +#[cfg(feature = "signing")] +use crate::nyxd::cosmwasm_client::types::{ + ChangeAdminResult, ContractCodeId, ExecuteResult, InstantiateOptions, InstantiateResult, + MigrateResult, SequenceResponse, SimulateResponse, UploadResult, +}; +#[cfg(all(feature = "signing", feature = "http-client"))] +use crate::signing::direct_wallet::DirectSecp256k1HdWallet; +#[cfg(all(feature = "signing", feature = "http-client"))] +use crate::signing::signer::OfflineSigner; +#[cfg(feature = "signing")] +use cosmrs::cosmwasm; +#[cfg(feature = "signing")] +use cosmrs::tx::Msg; +#[cfg(feature = "signing")] +use cosmwasm_std::Addr; +#[cfg(feature = "signing")] +use std::time::SystemTime; + +#[cfg(feature = "signing")] +pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient; + +#[cfg(all(feature = "signing", feature = "http-client"))] +pub use signing_client::Client as SigningNyxdClient; + +#[cfg(all(feature = "signing", feature = "http-client"))] pub type DirectSigningNyxdClient = SigningNyxdClient; pub mod coin; @@ -152,10 +168,13 @@ impl Config { pub struct NyxdClient { client: C, config: Config, + // TODO: refactor because that field is only really used for signing + #[allow(dead_code)] client_address: Option>, simulated_gas_multiplier: f32, } +#[cfg(feature = "http-client")] impl NyxdClient { pub fn connect(config: Config, endpoint: U) -> Result, NyxdError> where @@ -165,11 +184,12 @@ impl NyxdClient { client: QueryNyxdClient::new(endpoint)?, config, client_address: None, - simulated_gas_multiplier: DEFAULT_SIMULATED_GAS_MULTIPLIER, + simulated_gas_multiplier: crate::nyxd::fee::DEFAULT_SIMULATED_GAS_MULTIPLIER, }) } } +#[cfg(all(feature = "signing", feature = "http-client"))] impl NyxdClient> { // TODO: rename this one pub fn connect_with_mnemonic( @@ -187,12 +207,14 @@ impl NyxdClient> { } } +#[cfg(all(feature = "signing", feature = "http-client"))] impl NyxdClient> where S: OfflineSigner, // I have no idea why S::Error: Into bound wouldn't do the trick NyxdError: From, { + #[cfg(feature = "http-client")] pub fn connect_with_signer( config: Config, endpoint: U, @@ -214,10 +236,11 @@ where client: SigningNyxdClient::connect_with_signer(endpoint, signer, gas_price)?, config, client_address: Some(client_address), - simulated_gas_multiplier: DEFAULT_SIMULATED_GAS_MULTIPLIER, + simulated_gas_multiplier: crate::nyxd::fee::DEFAULT_SIMULATED_GAS_MULTIPLIER, }) } + #[cfg(feature = "http-client")] pub fn change_endpoint(&mut self, new_endpoint: U) -> Result<(), NyxdError> where U: TryInto, @@ -230,133 +253,47 @@ where } } -impl NyxdClient { - pub fn current_config(&self) -> &Config { - &self.config - } - - pub fn current_chain_details(&self) -> &ChainDetails { - &self.config.chain_details - } - - pub fn set_mixnet_contract_address(&mut self, address: AccountId) { - self.config.mixnet_contract_address = Some(address); - } - - pub fn set_vesting_contract_address(&mut self, address: AccountId) { - self.config.vesting_contract_address = Some(address); - } - - pub fn set_bandwidth_claim_contract_address(&mut self, address: AccountId) { - self.config.bandwidth_claim_contract_address = Some(address); - } - - pub fn set_coconut_bandwidth_contract_address(&mut self, address: AccountId) { - self.config.coconut_bandwidth_contract_address = Some(address); - } - - pub fn set_multisig_contract_address(&mut self, address: AccountId) { - self.config.multisig_contract_address = Some(address); - } - - pub fn set_service_provider_contract_address(&mut self, address: AccountId) { - self.config.service_provider_contract_address = Some(address); - } - - // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits - // note: what unwrap is doing here is just moving a failure that would have normally - // occurred in `connect` when attempting to parse an empty address, - // so it's not introducing new source of failure (just moves it) - pub fn mixnet_contract_address(&self) -> &AccountId { - self.config.mixnet_contract_address.as_ref().unwrap() - } - - // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits - // note: what unwrap is doing here is just moving a failure that would have normally - // occurred in `connect` when attempting to parse an empty address, - // so it's not introducing new source of failure (just moves it) - pub fn vesting_contract_address(&self) -> &AccountId { - self.config.vesting_contract_address.as_ref().unwrap() - } - - // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits - // note: what unwrap is doing here is just moving a failure that would have normally - // occurred in `connect` when attempting to parse an empty address, - // so it's not introducing new source of failure (just moves it) - pub fn bandwidth_claim_contract_address(&self) -> &AccountId { - self.config - .bandwidth_claim_contract_address - .as_ref() - .unwrap() - } - - // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits - // note: what unwrap is doing here is just moving a failure that would have normally - // occurred in `connect` when attempting to parse an empty address, - // so it's not introducing new source of failure (just moves it) - pub fn coconut_bandwidth_contract_address(&self) -> &AccountId { - self.config - .coconut_bandwidth_contract_address - .as_ref() - .unwrap() - } - - pub fn group_contract_address(&self) -> &AccountId { - self.config.group_contract_address.as_ref().unwrap() - } - - // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits - // note: what unwrap is doing here is just moving a failure that would have normally - // occurred in `connect` when attempting to parse an empty address, - // so it's not introducing new source of failure (just moves it) - pub fn multisig_contract_address(&self) -> &AccountId { - self.config.multisig_contract_address.as_ref().unwrap() - } - - // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits - // note: what unwrap is doing here is just moving a failure that would have normally - // occurred in `connect` when attempting to parse an empty address, - // so it's not introducing new source of failure (just moves it) - pub fn coconut_dkg_contract_address(&self) -> &AccountId { - self.config.coconut_dkg_contract_address.as_ref().unwrap() - } - - // The service provider directory contract is optional, so we return an Option not a Result - pub fn service_provider_contract_address(&self) -> Option<&AccountId> { - self.config.service_provider_contract_address.as_ref() - } - - // The name service contract is optional, so we return an Option not a Result - pub fn name_service_contract_address(&self) -> Option<&AccountId> { - self.config.name_service_contract_address.as_ref() - } - - pub fn set_simulated_gas_multiplier(&mut self, multiplier: f32) { - self.simulated_gas_multiplier = multiplier; - } - - pub async fn query_contract_smart( - &self, - contract: &AccountId, - query_msg: &M, - ) -> Result +#[cfg(feature = "signing")] +impl NyxdClient +where + C: SigningCosmWasmClient + Sync, +{ + pub fn address(&self) -> &AccountId where - C: CosmWasmClient + Sync, - M: ?Sized + Serialize + Sync, - for<'a> T: Deserialize<'a>, + C: SigningCosmWasmClient, { - self.client.query_contract_smart(contract, query_msg).await + // if this is a signing client (as required by the trait bound), it must have the address set + &self.client_address.as_ref().unwrap()[0] } - pub async fn query_contract_raw( - &self, - contract: &AccountId, - query_data: Vec, - ) -> Result, NyxdError> + pub fn cw_address(&self) -> Addr where - C: CosmWasmClient + Sync, + C: SigningCosmWasmClient, { - self.client.query_contract_raw(contract, query_data).await + // the call to unchecked is fine here as we're converting directly from `AccountId` + // which must have been a valid bech32 address + Addr::unchecked(self.address().as_ref()) + } + + pub async fn account_sequence(&self) -> Result + where + C: SigningCosmWasmClient + Sync, + { + self.client.get_sequence(self.address()).await + } + + pub fn signer(&self) -> &::Signer + where + C: SigningCosmWasmClient, + { + self.client.signer() + } + + pub fn gas_price(&self) -> &GasPrice + where + C: SigningCosmWasmClient, + { + self.client.gas_price() } pub fn wrap_contract_execute_message( @@ -377,175 +314,6 @@ impl NyxdClient { }) } - pub fn address(&self) -> &AccountId - where - C: SigningCosmWasmClient, - { - // if this is a signing client (as required by the trait bound), it must have the address set - &self.client_address.as_ref().unwrap()[0] - } - - pub fn cw_address(&self) -> Addr - where - C: SigningCosmWasmClient, - { - // the call to unchecked is fine here as we're converting directly from `AccountId` - // which must have been a valid bech32 address - Addr::unchecked(self.address().as_ref()) - } - - pub fn signer(&self) -> &::Signer - where - C: SigningCosmWasmClient, - { - self.client.signer() - } - - pub fn gas_price(&self) -> &GasPrice - where - C: SigningCosmWasmClient, - { - self.client.gas_price() - } - - pub fn gas_adjustment(&self) -> GasAdjustment { - self.simulated_gas_multiplier - } - - // ============= - // CHAIN RELATED - // ============= - - // CHAIN QUERIES - - pub async fn account_sequence(&self) -> Result - where - C: SigningCosmWasmClient + Sync, - { - self.client.get_sequence(self.address()).await - } - - pub async fn get_account_details( - &self, - address: &AccountId, - ) -> Result, NyxdError> - where - C: CosmWasmClient + Sync, - { - self.client.get_account(address).await - } - - pub async fn get_account_public_key( - &self, - address: &AccountId, - ) -> Result, NyxdError> - where - C: CosmWasmClient + Sync, - { - if let Some(account) = self.client.get_account(address).await? { - let base_account = account.try_get_base_account()?; - return Ok(base_account.pubkey); - } - - Ok(None) - } - - pub async fn get_current_block_timestamp(&self) -> Result - where - C: CosmWasmClient + Sync, - { - self.get_block_timestamp(None).await - } - - pub async fn get_block_timestamp( - &self, - height: Option, - ) -> Result - where - C: CosmWasmClient + Sync, - { - Ok(self.client.get_block(height).await?.block.header.time) - } - - pub async fn get_block(&self, height: Option) -> Result - where - C: CosmWasmClient + Sync, - { - self.client.get_block(height).await - } - - pub async fn get_current_block_height(&self) -> Result - where - C: CosmWasmClient + Sync, - { - self.client.get_height().await - } - - /// Obtains the hash of a block specified by the provided height. - /// - /// # Arguments - /// - /// * `height`: height of the block for which we want to obtain the hash. - pub async fn get_block_hash(&self, height: u32) -> Result - where - C: CosmWasmClient + Sync, - { - self.client - .get_block(Some(height)) - .await - .map(|block| block.block_id.hash) - } - - pub async fn get_validators( - &self, - height: u64, - paging: Paging, - ) -> Result - where - C: CosmWasmClient + Sync, - { - Ok(self.client.validators(height as u32, paging).await?) - } - - pub async fn get_balance( - &self, - address: &AccountId, - denom: String, - ) -> Result, NyxdError> - where - C: CosmWasmClient + Sync, - { - self.client.get_balance(address, denom).await - } - - pub async fn get_all_balances(&self, address: &AccountId) -> Result, NyxdError> - where - C: CosmWasmClient + Sync, - { - self.client.get_all_balances(address).await - } - - pub async fn get_tx(&self, id: tx::Hash) -> Result - where - C: CosmWasmClient + Sync, - { - self.client.get_tx(id).await - } - - pub async fn search_tx(&self, query: Query) -> Result, NyxdError> - where - C: CosmWasmClient + Sync, - { - self.client.search_tx(query).await - } - - pub async fn get_total_supply(&self) -> Result, NyxdError> - where - C: CosmWasmClient + Sync, - { - self.client.get_total_supply().await - } - pub async fn simulate(&self, messages: I) -> Result where C: SigningCosmWasmClient + Sync, @@ -762,3 +530,264 @@ impl NyxdClient { .await } } + +impl NyxdClient { + pub fn current_config(&self) -> &Config { + &self.config + } + + pub fn current_chain_details(&self) -> &ChainDetails { + &self.config.chain_details + } + + pub fn set_mixnet_contract_address(&mut self, address: AccountId) { + self.config.mixnet_contract_address = Some(address); + } + + pub fn set_vesting_contract_address(&mut self, address: AccountId) { + self.config.vesting_contract_address = Some(address); + } + + pub fn set_bandwidth_claim_contract_address(&mut self, address: AccountId) { + self.config.bandwidth_claim_contract_address = Some(address); + } + + pub fn set_coconut_bandwidth_contract_address(&mut self, address: AccountId) { + self.config.coconut_bandwidth_contract_address = Some(address); + } + + pub fn set_multisig_contract_address(&mut self, address: AccountId) { + self.config.multisig_contract_address = Some(address); + } + + pub fn set_service_provider_contract_address(&mut self, address: AccountId) { + self.config.service_provider_contract_address = Some(address); + } + + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits + // note: what unwrap is doing here is just moving a failure that would have normally + // occurred in `connect` when attempting to parse an empty address, + // so it's not introducing new source of failure (just moves it) + pub fn mixnet_contract_address(&self) -> &AccountId { + self.config.mixnet_contract_address.as_ref().unwrap() + } + + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits + // note: what unwrap is doing here is just moving a failure that would have normally + // occurred in `connect` when attempting to parse an empty address, + // so it's not introducing new source of failure (just moves it) + pub fn vesting_contract_address(&self) -> &AccountId { + self.config.vesting_contract_address.as_ref().unwrap() + } + + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits + // note: what unwrap is doing here is just moving a failure that would have normally + // occurred in `connect` when attempting to parse an empty address, + // so it's not introducing new source of failure (just moves it) + pub fn bandwidth_claim_contract_address(&self) -> &AccountId { + self.config + .bandwidth_claim_contract_address + .as_ref() + .unwrap() + } + + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits + // note: what unwrap is doing here is just moving a failure that would have normally + // occurred in `connect` when attempting to parse an empty address, + // so it's not introducing new source of failure (just moves it) + pub fn coconut_bandwidth_contract_address(&self) -> &AccountId { + self.config + .coconut_bandwidth_contract_address + .as_ref() + .unwrap() + } + + pub fn group_contract_address(&self) -> &AccountId { + self.config.group_contract_address.as_ref().unwrap() + } + + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits + // note: what unwrap is doing here is just moving a failure that would have normally + // occurred in `connect` when attempting to parse an empty address, + // so it's not introducing new source of failure (just moves it) + pub fn multisig_contract_address(&self) -> &AccountId { + self.config.multisig_contract_address.as_ref().unwrap() + } + + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits + // note: what unwrap is doing here is just moving a failure that would have normally + // occurred in `connect` when attempting to parse an empty address, + // so it's not introducing new source of failure (just moves it) + pub fn coconut_dkg_contract_address(&self) -> &AccountId { + self.config.coconut_dkg_contract_address.as_ref().unwrap() + } + + // The service provider directory contract is optional, so we return an Option not a Result + pub fn service_provider_contract_address(&self) -> Option<&AccountId> { + self.config.service_provider_contract_address.as_ref() + } + + // The name service contract is optional, so we return an Option not a Result + pub fn name_service_contract_address(&self) -> Option<&AccountId> { + self.config.name_service_contract_address.as_ref() + } + + pub fn set_simulated_gas_multiplier(&mut self, multiplier: f32) { + self.simulated_gas_multiplier = multiplier; + } + + pub async fn query_contract_smart( + &self, + contract: &AccountId, + query_msg: &M, + ) -> Result + where + C: CosmWasmClient + Sync, + M: ?Sized + Serialize + Sync, + for<'a> T: Deserialize<'a>, + { + self.client.query_contract_smart(contract, query_msg).await + } + + pub async fn query_contract_raw( + &self, + contract: &AccountId, + query_data: Vec, + ) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + self.client.query_contract_raw(contract, query_data).await + } + + pub fn gas_adjustment(&self) -> GasAdjustment { + self.simulated_gas_multiplier + } + + // ============= + // CHAIN RELATED + // ============= + + // CHAIN QUERIES + + pub async fn get_account_details( + &self, + address: &AccountId, + ) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + self.client.get_account(address).await + } + + pub async fn get_account_public_key( + &self, + address: &AccountId, + ) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + if let Some(account) = self.client.get_account(address).await? { + let base_account = account.try_get_base_account()?; + return Ok(base_account.pubkey); + } + + Ok(None) + } + + pub async fn get_current_block_timestamp(&self) -> Result + where + C: CosmWasmClient + Sync, + { + self.get_block_timestamp(None).await + } + + pub async fn get_block_timestamp( + &self, + height: Option, + ) -> Result + where + C: CosmWasmClient + Sync, + { + Ok(self.client.get_block(height).await?.block.header.time) + } + + pub async fn get_block(&self, height: Option) -> Result + where + C: CosmWasmClient + Sync, + { + self.client.get_block(height).await + } + + pub async fn get_current_block_height(&self) -> Result + where + C: CosmWasmClient + Sync, + { + self.client.get_height().await + } + + /// Obtains the hash of a block specified by the provided height. + /// + /// # Arguments + /// + /// * `height`: height of the block for which we want to obtain the hash. + pub async fn get_block_hash(&self, height: u32) -> Result + where + C: CosmWasmClient + Sync, + { + self.client + .get_block(Some(height)) + .await + .map(|block| block.block_id.hash) + } + + pub async fn get_validators( + &self, + height: u64, + paging: Paging, + ) -> Result + where + C: CosmWasmClient + Sync, + { + Ok(self.client.validators(height as u32, paging).await?) + } + + pub async fn get_balance( + &self, + address: &AccountId, + denom: String, + ) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + self.client.get_balance(address, denom).await + } + + pub async fn get_all_balances(&self, address: &AccountId) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + self.client.get_all_balances(address).await + } + + pub async fn get_tx(&self, id: Hash) -> Result + where + C: CosmWasmClient + Sync, + { + self.client.get_tx(id).await + } + + pub async fn search_tx(&self, query: Query) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + self.client.search_tx(query).await + } + + pub async fn get_total_supply(&self) -> Result, NyxdError> + where + C: CosmWasmClient + Sync, + { + self.client.get_total_supply().await + } +} diff --git a/common/client-libs/validator-client/src/nyxd/traits/mod.rs b/common/client-libs/validator-client/src/nyxd/traits/mod.rs index 55fc8c9215..9f6dac5354 100644 --- a/common/client-libs/validator-client/src/nyxd/traits/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/mod.rs @@ -8,19 +8,24 @@ mod dkg_query_client; mod group_query_client; mod mixnet_query_client; mod multisig_query_client; +mod name_service_query_client; +mod sp_directory_query_client; mod vesting_query_client; +#[cfg(feature = "signing")] mod coconut_bandwidth_signing_client; +#[cfg(feature = "signing")] mod dkg_signing_client; +#[cfg(feature = "signing")] mod mixnet_signing_client; +#[cfg(feature = "signing")] mod multisig_signing_client; -mod vesting_signing_client; - -mod sp_directory_query_client; -mod sp_directory_signing_client; - -mod name_service_query_client; +#[cfg(feature = "signing")] mod name_service_signing_client; +#[cfg(feature = "signing")] +mod sp_directory_signing_client; +#[cfg(feature = "signing")] +mod vesting_signing_client; pub use coconut_bandwidth_query_client::CoconutBandwidthQueryClient; pub use dkg_query_client::DkgQueryClient; @@ -31,10 +36,17 @@ pub use name_service_query_client::NameServiceQueryClient; pub use sp_directory_query_client::SpDirectoryQueryClient; pub use vesting_query_client::VestingQueryClient; +#[cfg(feature = "signing")] pub use coconut_bandwidth_signing_client::CoconutBandwidthSigningClient; +#[cfg(feature = "signing")] pub use dkg_signing_client::DkgSigningClient; +#[cfg(feature = "signing")] pub use mixnet_signing_client::MixnetSigningClient; +#[cfg(feature = "signing")] pub use multisig_signing_client::MultisigSigningClient; +#[cfg(feature = "signing")] pub use name_service_signing_client::NameServiceSigningClient; +#[cfg(feature = "signing")] pub use sp_directory_signing_client::SpDirectorySigningClient; +#[cfg(feature = "signing")] pub use vesting_signing_client::VestingSigningClient; diff --git a/common/client-libs/validator-client/src/signing/mod.rs b/common/client-libs/validator-client/src/signing/mod.rs index f2301db26e..d9fa0c30e4 100644 --- a/common/client-libs/validator-client/src/signing/mod.rs +++ b/common/client-libs/validator-client/src/signing/mod.rs @@ -63,7 +63,6 @@ impl SignerData { } } - #[cfg(feature = "nyxd-client")] pub fn new_from_sequence_response( response: crate::nyxd::cosmwasm_client::types::SequenceResponse, chain_id: chain::Id, diff --git a/common/commands/Cargo.toml b/common/commands/Cargo.toml index d57e1c47ac..28f319b875 100644 --- a/common/commands/Cargo.toml +++ b/common/commands/Cargo.toml @@ -28,7 +28,7 @@ tap = "1" cosmrs = { workspace = true } cosmwasm-std = { workspace = true } -nym-validator-client = { path = "../client-libs/validator-client", features = ["nyxd-client"] } +nym-validator-client = { path = "../client-libs/validator-client", features = ["signing", "http-client"] } nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] } nym-crypto = { path = "../../common/crypto", features = ["asymmetric"] } nym-network-defaults = { path = "../network-defaults" } diff --git a/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs b/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs index 87ecdfb3f8..ec10a60193 100644 --- a/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs @@ -6,7 +6,7 @@ use log::info; use nym_mixnet_contract_common::{Coin, MixId}; use nym_validator_client::nyxd::traits::MixnetQueryClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs b/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs index cd1521dea6..4f8dac045e 100644 --- a/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs @@ -5,7 +5,7 @@ use clap::Parser; use log::info; use nym_mixnet_contract_common::MixId; use nym_validator_client::nyxd::traits::MixnetQueryClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs b/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs index 6d3c480296..e734ddc97d 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs @@ -6,7 +6,7 @@ use clap::Parser; use log::info; use nym_mixnet_contract_common::GatewayConfigUpdate; use nym_validator_client::nyxd::traits::MixnetQueryClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs b/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs index d6625a878b..21f771c0b3 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs @@ -7,7 +7,7 @@ use log::{info, warn}; use nym_contracts_common::signing::MessageSignature; use nym_mixnet_contract_common::{Coin, Gateway}; use nym_network_defaults::{DEFAULT_CLIENT_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT}; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/create_family.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/create_family.rs index 6a3dc6d2da..f5ff9e3419 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/create_family.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/create_family.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use nym_validator_client::nyxd::traits::MixnetSigningClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs index e585fe2ec3..8b888e8bd6 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/join_family.rs @@ -8,7 +8,7 @@ use nym_contracts_common::signing::MessageSignature; use nym_crypto::asymmetric::identity; use nym_mixnet_contract_common::families::FamilyHead; use nym_validator_client::nyxd::traits::MixnetSigningClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/kick_family_member.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/kick_family_member.rs index 0dc0b840d1..9305c56918 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/kick_family_member.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/kick_family_member.rs @@ -6,7 +6,7 @@ use clap::Parser; use log::info; use nym_crypto::asymmetric::identity; use nym_validator_client::nyxd::traits::MixnetSigningClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs b/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs index 1ffb2c46b6..5cb06e7762 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/families/leave_family.rs @@ -7,7 +7,7 @@ use log::info; use nym_crypto::asymmetric::identity; use nym_mixnet_contract_common::families::FamilyHead; use nym_validator_client::nyxd::traits::MixnetSigningClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs b/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs index e4af971aa3..5b956b929f 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs @@ -6,7 +6,7 @@ use clap::Parser; use log::info; use nym_mixnet_contract_common::MixNodeConfigUpdate; use nym_validator_client::nyxd::traits::MixnetQueryClient; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs b/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs index dd172c8d51..9928dec18f 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs @@ -11,7 +11,7 @@ use nym_mixnet_contract_common::{MixNode, Percent}; use nym_network_defaults::{ DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT, }; -use nym_validator_client::nyxd::{CosmWasmCoin, VestingSigningClient}; +use nym_validator_client::nyxd::{traits::VestingSigningClient, CosmWasmCoin}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/vesting_decrease_pledge.rs b/common/commands/src/validator/mixnet/operators/mixnode/vesting_decrease_pledge.rs index 131e210646..d38d7f61dc 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/vesting_decrease_pledge.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/vesting_decrease_pledge.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use nym_mixnet_contract_common::Coin; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/vesting_pledge_more.rs b/common/commands/src/validator/mixnet/operators/mixnode/vesting_pledge_more.rs index b0839f97de..0774fd89d6 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/vesting_pledge_more.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/vesting_pledge_more.rs @@ -4,7 +4,7 @@ use clap::Parser; use log::info; use nym_mixnet_contract_common::Coin; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs b/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs index be2d99a35c..49f717a5af 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs @@ -4,7 +4,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; -use nym_validator_client::nyxd::VestingSigningClient; +use nym_validator_client::nyxd::traits::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/signature/helpers.rs b/common/commands/src/validator/signature/helpers.rs index 1c2d05c9e1..d612c0f994 100644 --- a/common/commands/src/validator/signature/helpers.rs +++ b/common/commands/src/validator/signature/helpers.rs @@ -10,7 +10,7 @@ pub fn secp256k1_verify_with_public_key( public_key_as_bytes: &[u8], signature_as_hex: String, message: String, -) -> Result<(), k256::ecdsa::signature::Error> { +) -> Result<(), k256::ecdsa::Error> { let verifying_key = VerifyingKey::from_sec1_bytes(public_key_as_bytes)?; let signature = Signature::from_str(&signature_as_hex)?; let message_as_bytes = message.into_bytes(); diff --git a/common/commands/src/validator/transactions/get_transaction.rs b/common/commands/src/validator/transactions/get_transaction.rs index 3d1b53e7b2..6ad1bbbd2f 100644 --- a/common/commands/src/validator/transactions/get_transaction.rs +++ b/common/commands/src/validator/transactions/get_transaction.rs @@ -6,7 +6,7 @@ use std::str::FromStr; use crate::context::QueryClient; use crate::utils::show_error; -use cosmrs::tx::Hash; +use cosmrs::tendermint::Hash; use serde_json::json; #[derive(Debug, Parser)] diff --git a/common/commands/src/validator/vesting/balance.rs b/common/commands/src/validator/vesting/balance.rs index 3d5c340027..d5f5af20fe 100644 --- a/common/commands/src/validator/vesting/balance.rs +++ b/common/commands/src/validator/vesting/balance.rs @@ -5,7 +5,7 @@ use clap::Parser; use cosmrs::AccountId; use log::{error, info}; -use nym_validator_client::nyxd::{Coin, VestingQueryClient}; +use nym_validator_client::nyxd::{traits::VestingQueryClient, Coin}; use crate::context::QueryClient; use crate::utils::show_error; diff --git a/common/commands/src/validator/vesting/create_vesting_schedule.rs b/common/commands/src/validator/vesting/create_vesting_schedule.rs index e861cc227e..524cdf67e1 100644 --- a/common/commands/src/validator/vesting/create_vesting_schedule.rs +++ b/common/commands/src/validator/vesting/create_vesting_schedule.rs @@ -8,8 +8,8 @@ use log::info; use nym_mixnet_contract_common::Coin; use nym_network_defaults::NymNetworkDetails; +use nym_validator_client::nyxd::traits::VestingSigningClient; use nym_validator_client::nyxd::AccountId; -use nym_validator_client::nyxd::VestingSigningClient; use nym_validator_client::nyxd::{CosmosCoin, Denom}; use nym_vesting_contract_common::messages::VestingSpecification; use nym_vesting_contract_common::PledgeCap; diff --git a/common/commands/src/validator/vesting/query_vesting_schedule.rs b/common/commands/src/validator/vesting/query_vesting_schedule.rs index 397d4b9075..9c8facfb70 100644 --- a/common/commands/src/validator/vesting/query_vesting_schedule.rs +++ b/common/commands/src/validator/vesting/query_vesting_schedule.rs @@ -6,7 +6,7 @@ use cosmrs::AccountId; use cosmwasm_std::Coin as CosmWasmCoin; use log::{error, info}; -use nym_validator_client::nyxd::{Coin, VestingQueryClient}; +use nym_validator_client::nyxd::{traits::VestingQueryClient, Coin}; use crate::context::QueryClient; use crate::utils::show_error; diff --git a/common/commands/src/validator/vesting/withdraw_vested.rs b/common/commands/src/validator/vesting/withdraw_vested.rs index d98a958cf1..a85e960a1a 100644 --- a/common/commands/src/validator/vesting/withdraw_vested.rs +++ b/common/commands/src/validator/vesting/withdraw_vested.rs @@ -4,7 +4,10 @@ use clap::Parser; use log::info; -use nym_validator_client::nyxd::{Coin, VestingQueryClient, VestingSigningClient}; +use nym_validator_client::nyxd::{ + traits::{VestingQueryClient, VestingSigningClient}, + Coin, +}; use crate::context::SigningClient; use crate::utils::show_error; diff --git a/common/credentials/src/coconut/bandwidth.rs b/common/credentials/src/coconut/bandwidth.rs index 9c87e75341..7e458456df 100644 --- a/common/credentials/src/coconut/bandwidth.rs +++ b/common/credentials/src/coconut/bandwidth.rs @@ -6,14 +6,14 @@ // right now this has no double-spending protection, spender binding, etc // it's the simplest possible case +use cosmrs::tendermint::hash::Algorithm; +use cosmrs::tendermint::Hash; use nym_coconut_interface::{ hash_to_scalar, prepare_blind_sign, Attribute, BlindSignRequest, Credential, Parameters, PrivateAttribute, PublicAttribute, Signature, VerificationKey, }; use nym_crypto::asymmetric::{encryption, identity}; -use cosmrs::tx::Hash; - use super::utils::prepare_credential_for_spending; use crate::error::Error; @@ -129,7 +129,9 @@ impl BandwidthVoucher { let binding_number = Option::::from(PrivateAttribute::from_bytes(&buff)) .ok_or_else(scalar_err)?; buff.copy_from_slice(&bytes[2 * 32..3 * 32]); - let tx_hash = Hash::new(buff); + let tx_hash = Hash::from_bytes(Algorithm::Sha256, &buff).map_err(|_| { + Error::BandwidthVoucherDeserializationError(String::from("Invalid transaction Hash")) + })?; buff.copy_from_slice(&bytes[3 * 32..4 * 32]); let signing_key = identity::PrivateKey::from_bytes(&buff).map_err(|_| { Error::BandwidthVoucherDeserializationError(String::from("Invalid key")) @@ -282,6 +284,7 @@ pub fn prepare_for_spending( #[cfg(test)] mod test { use super::*; + use cosmrs::tendermint::hash::Algorithm; use nym_coconut_interface::Base58; use rand::rngs::OsRng; @@ -292,7 +295,7 @@ mod test { ¶ms, "1234".to_string(), "voucher info".to_string(), - Hash::new([0; 32]), + Hash::from_bytes(Algorithm::Sha256, &[0; 32]).unwrap(), identity::PrivateKey::from_base58_string( identity::KeyPair::new(&mut rng) .private_key() diff --git a/common/ledger/Cargo.toml b/common/ledger/Cargo.toml index dda242bf14..5ea9badd52 100644 --- a/common/ledger/Cargo.toml +++ b/common/ledger/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bip32 = "0.4.0" +bip32 = "0.5.1" k256 = { workspace = true } ledger-transport = "0.10.0" ledger-transport-hid = "0.10.0" diff --git a/common/ledger/src/addr_secp256k1.rs b/common/ledger/src/addr_secp256k1.rs index 682161be9d..d6c5957481 100644 --- a/common/ledger/src/addr_secp256k1.rs +++ b/common/ledger/src/addr_secp256k1.rs @@ -27,7 +27,7 @@ impl TryFrom>> for AddrSecp256k1Response { } let (pub_key, addr) = bytes.split_at(33); - let public_key = k256::PublicKey::from_bytes( + let public_key = PublicKey::from_bytes( PublicKeyBytes::try_from(pub_key).expect("Public key should be 33 bytes"), )?; let address = String::from_utf8(addr.to_vec()).unwrap(); diff --git a/common/mixnode-common/Cargo.toml b/common/mixnode-common/Cargo.toml index 9a3f0ce851..62fec9422a 100644 --- a/common/mixnode-common/Cargo.toml +++ b/common/mixnode-common/Cargo.toml @@ -36,9 +36,7 @@ nym-sphinx-framing = { path = "../nymsphinx/framing" } nym-sphinx-params = { path = "../nymsphinx/params" } nym-sphinx-types = { path = "../nymsphinx/types" } nym-task = { path = "../task" } -nym-validator-client = { path = "../client-libs/validator-client", features = [ - "nyxd-client", -] } +nym-validator-client = { path = "../client-libs/validator-client" } nym-bin-common = { path = "../bin-common" } cfg-if = "1.0.0" diff --git a/common/socks5-client-core/Cargo.toml b/common/socks5-client-core/Cargo.toml index 1057955242..9ca792f8b1 100644 --- a/common/socks5-client-core/Cargo.toml +++ b/common/socks5-client-core/Cargo.toml @@ -26,7 +26,7 @@ nym-service-providers-common = { path = "../../service-providers/common" } nym-socks5-requests = { path = "../socks5/requests" } nym-sphinx = { path = "../nymsphinx" } nym-task = { path = "../task" } -nym-validator-client = { path = "../client-libs/validator-client", features = ["nyxd-client"] } +nym-validator-client = { path = "../client-libs/validator-client" } [features] default = [] diff --git a/common/types/Cargo.toml b/common/types/Cargo.toml index 0dd4879310..c99bbf3e30 100644 --- a/common/types/Cargo.toml +++ b/common/types/Cargo.toml @@ -22,9 +22,7 @@ ts-rs = "6.1.2" cosmwasm-std = { workspace = true } cosmrs = { workspace = true } -nym-validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nyxd-client", -] } +nym-validator-client = { path = "../../common/client-libs/validator-client" } nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" } nym-vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } nym-config = { path = "../../common/config" } diff --git a/common/types/src/gas.rs b/common/types/src/gas.rs index cf63a32d60..9c389cc863 100644 --- a/common/types/src/gas.rs +++ b/common/types/src/gas.rs @@ -1,4 +1,4 @@ -use cosmrs::tx::Gas as CosmrsGas; +use cosmrs::Gas as CosmrsGas; use nym_validator_client::nyxd::cosmwasm_client::types::GasInfo as ValidatorClientGasInfo; use serde::{Deserialize, Serialize}; @@ -21,8 +21,14 @@ impl Gas { impl From for Gas { fn from(gas: CosmrsGas) -> Self { + Gas { gas_units: gas } + } +} + +impl From for Gas { + fn from(value: i64) -> Self { Gas { - gas_units: gas.value(), + gas_units: value.try_into().unwrap_or_default(), } } } diff --git a/explorer-api/Cargo.toml b/explorer-api/Cargo.toml index a317ccbe1b..5e1dec9f48 100644 --- a/explorer-api/Cargo.toml +++ b/explorer-api/Cargo.toml @@ -34,4 +34,4 @@ nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-co nym-network-defaults = { path = "../common/network-defaults" } nym-bin-common = { path = "../common/bin-common"} nym-task = { path = "../common/task" } -nym-validator-client = { path = "../common/client-libs/validator-client", features=["nyxd-client"] } +nym-validator-client = { path = "../common/client-libs/validator-client", features=["http-client"] } diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 41bd7ecfe3..763b3ab676 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -60,7 +60,7 @@ nym-sphinx = { path = "../common/nymsphinx" } nym-statistics-common = { path = "../common/statistics" } nym-task = { path = "../common/task" } nym-types = { path = "../common/types" } -nym-validator-client = { path = "../common/client-libs/validator-client", features = [ "nyxd-client" ] } +nym-validator-client = { path = "../common/client-libs/validator-client" } [build-dependencies] tokio = { version = "1.24.1", features = ["rt-multi-thread", "macros"] } diff --git a/integrations/bity/Cargo.toml b/integrations/bity/Cargo.toml index 4ae51337c9..db8bdc9420 100644 --- a/integrations/bity/Cargo.toml +++ b/integrations/bity/Cargo.toml @@ -14,9 +14,7 @@ eyre = "0.6.5" cosmrs = { workspace = true } nym-cli-commands = { path = "../../common/commands" } -nym-validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nyxd-client", -] } +nym-validator-client = { path = "../../common/client-libs/validator-client" } [dev-dependencies] anyhow = "1" diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index 4cfec3402a..f9b378f59d 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -92,7 +92,7 @@ nym-task = { path = "../common/task" } nym-topology = { path = "../common/topology" } nym-api-requests = { path = "nym-api-requests" } nym-validator-client = { path = "../common/client-libs/validator-client", features = [ - "nyxd-client", + "http-client", "signing" ] } nym-bin-common = { path = "../common/bin-common" } nym-node-tester-utils = { path = "../common/node-tester-utils" } diff --git a/nym-api/src/coconut/deposit.rs b/nym-api/src/coconut/deposit.rs index 685fee70f3..3d6b8fb2de 100644 --- a/nym-api/src/coconut/deposit.rs +++ b/nym-api/src/coconut/deposit.rs @@ -35,14 +35,14 @@ pub async fn extract_encryption_key( .tx_result .events .iter() - .find(|event| event.type_str == format!("wasm-{}", DEPOSITED_FUNDS_EVENT_TYPE)) + .find(|event| event.kind == format!("wasm-{}", DEPOSITED_FUNDS_EVENT_TYPE)) .ok_or(CoconutError::DepositEventNotFound)? .attributes .as_ref(); - let deposit_value = attributes + let deposit_value: &str = attributes .iter() - .find(|tag| tag.key.as_ref() == DEPOSIT_VALUE) + .find(|tag| tag.key == DEPOSIT_VALUE) .ok_or(CoconutError::DepositValueNotFound)? .value .as_ref(); @@ -54,9 +54,9 @@ pub async fn extract_encryption_key( )); } - let deposit_info = attributes + let deposit_info: &str = attributes .iter() - .find(|tag| tag.key.as_ref() == DEPOSIT_INFO) + .find(|tag| tag.key == DEPOSIT_INFO) .ok_or(CoconutError::DepositInfoNotFound)? .value .as_ref(); @@ -69,21 +69,19 @@ pub async fn extract_encryption_key( } let verification_key = identity::PublicKey::from_base58_string( - attributes + &attributes .iter() - .find(|tag| tag.key.as_ref() == DEPOSIT_IDENTITY_KEY) + .find(|tag| tag.key == DEPOSIT_IDENTITY_KEY) .ok_or(CoconutError::DepositVerifKeyNotFound)? - .value - .as_ref(), + .value, )?; let encryption_key = encryption::PublicKey::from_base58_string( - attributes + &attributes .iter() - .find(|tag| tag.key.as_ref() == DEPOSIT_ENCRYPTION_KEY) + .find(|tag| tag.key == DEPOSIT_ENCRYPTION_KEY) .ok_or(CoconutError::DepositEncrKeyNotFound)? - .value - .as_ref(), + .value, )?; verification_key.verify(&message, &signature)?; @@ -97,8 +95,8 @@ mod test { use crate::coconut::tests::tx_entry_fixture; use nym_coconut::{prepare_blind_sign, BlindSignRequest, Parameters}; use nym_config::defaults::VOUCHER_INFO; - use nym_validator_client::nyxd::tx::Hash; - use nym_validator_client::nyxd::{Event, Tag}; + use nym_validator_client::nyxd::Hash; + use nym_validator_client::nyxd::{Event, EventAttribute}; use rand_07::rngs::OsRng; use std::str::FromStr; @@ -182,7 +180,7 @@ mod test { ); tx_entry.tx_result.events.push(Event { - type_str: format!("wasm-{}", DEPOSITED_FUNDS_EVENT_TYPE), + kind: format!("wasm-{}", DEPOSITED_FUNDS_EVENT_TYPE), attributes: vec![], }); let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -193,9 +191,10 @@ mod test { CoconutError::DepositValueNotFound.to_string(), ); - tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![Tag { + tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "10".parse().unwrap(), + index: false, }]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) .await @@ -206,9 +205,10 @@ mod test { .to_string(), ); - tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![Tag { + tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) .await @@ -219,13 +219,15 @@ mod test { ); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: "bandwidth deposit info".parse().unwrap(), + index: false, }, ]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -241,13 +243,15 @@ mod test { ); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, ]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -259,17 +263,20 @@ mod test { ); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_IDENTITY_KEY.parse().unwrap(), value: "verification key".parse().unwrap(), + index: false, }, ]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -284,19 +291,22 @@ mod test { )); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_IDENTITY_KEY.parse().unwrap(), value: "2eSxwquNJb2nZTEW5p4rbqjHfBaz9UaNhjHHiexPN4He" .parse() .unwrap(), + index: false, }, ]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -308,23 +318,27 @@ mod test { ); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_IDENTITY_KEY.parse().unwrap(), value: "6EJGMdEq7t8Npz54uPkftGsdmj7DKntLVputAnDfVZB2" .parse() .unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_ENCRYPTION_KEY.parse().unwrap(), value: "encryption key".parse().unwrap(), + index: false, }, ]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -340,23 +354,27 @@ mod test { let expected_encryption_key = "HxnTpWTkgigSTAysVKLE8pEiUULHdTT1BxFfzfJvQRi6"; tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_IDENTITY_KEY.parse().unwrap(), value: "6EJGMdEq7t8Npz54uPkftGsdmj7DKntLVputAnDfVZB2" .parse() .unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_ENCRYPTION_KEY.parse().unwrap(), value: expected_encryption_key.parse().unwrap(), + index: false, }, ]; let err = extract_encryption_key(&correct_request, tx_entry.clone()) @@ -405,25 +423,29 @@ mod test { 4, ); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_IDENTITY_KEY.parse().unwrap(), value: "64auwDkWan7R8yH1Mwe9dS4qXgrDBCUNDg3Q4KFnd2P5" .parse() .unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_ENCRYPTION_KEY.parse().unwrap(), value: "HxnTpWTkgigSTAysVKLE8pEiUULHdTT1BxFfzfJvQRi6" .parse() .unwrap(), + index: false, }, ]; let encryption_key = extract_encryption_key(&correct_request, tx_entry.clone()) diff --git a/nym-api/src/coconut/helpers.rs b/nym-api/src/coconut/helpers.rs index 225d04bc3b..775e761fea 100644 --- a/nym-api/src/coconut/helpers.rs +++ b/nym-api/src/coconut/helpers.rs @@ -11,7 +11,7 @@ pub(crate) fn accepted_vote_err(ret: Result<(), CoconutError>) -> Result<(), Coc let accepted_err = nym_multisig_contract_common::error::ContractError::NotOpen {}.to_string(); // If redundant voting is not the case, error out on all other error variants - if !log.value().contains(&accepted_err) { + if !log.contains(&accepted_err) { ret?; } } diff --git a/nym-api/src/coconut/tests.rs b/nym-api/src/coconut/tests.rs index 0648e9c8ca..37153f1370 100644 --- a/nym-api/src/coconut/tests.rs +++ b/nym-api/src/coconut/tests.rs @@ -28,7 +28,9 @@ use nym_validator_client::nym_api::routes::{ API_VERSION, BANDWIDTH, COCONUT_BLIND_SIGN, COCONUT_ROUTES, COCONUT_VERIFY_BANDWIDTH_CREDENTIAL, }; use nym_validator_client::nyxd::Coin; -use nym_validator_client::nyxd::{tx::Hash, AccountId, DeliverTx, Event, Fee, Tag, TxResponse}; +use nym_validator_client::nyxd::{ + AccountId, Algorithm, DeliverTx, Event, EventAttribute, Fee, Hash, TxResponse, +}; use crate::coconut::State; use crate::support::storage::NymApiStorage; @@ -365,7 +367,7 @@ impl super::client::Client for DummyClient { .add_attribute(NODE_INDEX, assigned_index.to_string())], }], data: Default::default(), - transaction_hash: Hash::new([0; 32]), + transaction_hash: Hash::from_bytes(Algorithm::Sha256, &[0; 32]).unwrap(), gas_info: Default::default(), }) } @@ -389,7 +391,7 @@ impl super::client::Client for DummyClient { Ok(ExecuteResult { logs: vec![], data: Default::default(), - transaction_hash: Hash::new([0; 32]), + transaction_hash: Hash::from_bytes(Algorithm::Sha256, &[0; 32]).unwrap(), gas_info: Default::default(), }) } @@ -457,7 +459,7 @@ impl super::client::Client for DummyClient { .add_attribute(DKG_PROPOSAL_ID, proposal_id.to_string())], }], data: Default::default(), - transaction_hash: Hash::new([0; 32]), + transaction_hash: Hash::from_bytes(Algorithm::Sha256, &[0; 32]).unwrap(), gas_info: Default::default(), }) } @@ -498,7 +500,7 @@ pub fn tx_entry_fixture(tx_hash: &str) -> TxResponse { events: vec![], codespace: Default::default(), }, - tx: vec![].into(), + tx: vec![], proof: None, } } @@ -749,33 +751,37 @@ async fn blind_sign_correct() { let mut tx_entry = tx_entry_fixture(&tx_hash.to_string()); tx_entry.tx_result.events.push(Event { - type_str: format!("wasm-{}", DEPOSITED_FUNDS_EVENT_TYPE), + kind: format!("wasm-{}", DEPOSITED_FUNDS_EVENT_TYPE), attributes: vec![], }); tx_entry.tx_result.events.get_mut(0).unwrap().attributes = vec![ - Tag { + EventAttribute { key: DEPOSIT_VALUE.parse().unwrap(), value: "1234".parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_INFO.parse().unwrap(), value: VOUCHER_INFO.parse().unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_IDENTITY_KEY.parse().unwrap(), value: identity_keypair .public_key() .to_base58_string() .parse() .unwrap(), + index: false, }, - Tag { + EventAttribute { key: DEPOSIT_ENCRYPTION_KEY.parse().unwrap(), value: encryption_keypair .public_key() .to_base58_string() .parse() .unwrap(), + index: false, }, ]; tx_db diff --git a/nym-api/src/support/nyxd/mod.rs b/nym-api/src/support/nyxd/mod.rs index 8d2fe53dc5..e35098ee1f 100644 --- a/nym-api/src/support/nyxd/mod.rs +++ b/nym-api/src/support/nyxd/mod.rs @@ -35,13 +35,13 @@ use nym_validator_client::nyxd::{ cosmwasm_client::types::ExecuteResult, traits::{ CoconutBandwidthQueryClient, DkgQueryClient, DkgSigningClient, GroupQueryClient, - MultisigQueryClient, MultisigSigningClient, NameServiceQueryClient, + MultisigQueryClient, MultisigSigningClient, NameServiceQueryClient, VestingQueryClient, }, Fee, }; use nym_validator_client::nyxd::{ hash::{Hash, SHA256_HASH_SIZE}, - AccountId, Coin, DirectSigningNyxdClient, TendermintTime, VestingQueryClient, + AccountId, Coin, DirectSigningNyxdClient, TendermintTime, }; use nym_validator_client::ValidatorClientError; use nym_vesting_contract_common::AccountVestingCoins; @@ -321,8 +321,8 @@ impl crate::coconut::client::Client for Client { &self, tx_hash: &str, ) -> crate::coconut::error::Result { - let tx_hash = tx_hash - .parse::() + let tx_hash: Hash = tx_hash + .parse() .map_err(|_| CoconutError::TxHashParseError)?; Ok(self.0.read().await.nyxd.get_tx(tx_hash).await?) } diff --git a/nym-connect/desktop/Cargo.lock b/nym-connect/desktop/Cargo.lock index 89bfdbc8f3..5f48b27bd0 100644 --- a/nym-connect/desktop/Cargo.lock +++ b/nym-connect/desktop/Cargo.lock @@ -226,6 +226,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -255,13 +261,13 @@ dependencies = [ [[package]] name = "bip32" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30ed1d6f8437a487a266c8293aeb95b61a23261273e3e02912cdb8b68bf798b" +checksum = "7e141fb0f8be1c7b45887af94c88b182472b57c96b56773250ae00cd6a14a164" dependencies = [ - "bs58", + "bs58 0.5.0", "hmac 0.12.1", - "k256", + "k256 0.13.1", "once_cell", "pbkdf2", "rand_core 0.6.4", @@ -278,8 +284,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes", - "rand 0.8.5", - "rand_core 0.6.4", + "rand 0.7.3", + "rand_core 0.5.1", "serde", "unicode-normalization", "zeroize", @@ -338,7 +344,7 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -419,8 +425,14 @@ name = "bs58" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" dependencies = [ - "sha2 0.9.9", + "sha2 0.10.6", ] [[package]] @@ -462,6 +474,9 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] [[package]] name = "cairo-rs" @@ -786,9 +801,9 @@ dependencies = [ [[package]] name = "cosmos-sdk-proto" -version = "0.13.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61f3d2224c90ea78e1fa7444787761a549170c46b6b0ed09b93f9b7e4076a" +checksum = "73c9d2043a9e617b0d602fbc0a0ecd621568edbf3a9774890a6d562389bd8e1c" dependencies = [ "prost", "prost-types", @@ -797,18 +812,16 @@ dependencies = [ [[package]] name = "cosmrs" -version = "0.8.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d5890dac07a62337e5841adb8f2074a66a962a098a48df9460f64d483beaf4" +checksum = "af13955d6f356272e6def9ff5e2450a7650df536d8934f47052a20c76513d2f6" dependencies = [ "bip32", "cosmos-sdk-proto", - "ecdsa", + "ecdsa 0.16.8", "eyre", "getrandom 0.2.10", - "k256", - "prost", - "prost-types", + "k256 0.13.1", "rand_core 0.6.4", "serde", "serde_json", @@ -824,9 +837,9 @@ version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "ed25519-zebra", - "k256", + "k256 0.11.6", "rand_core 0.6.4", "thiserror", ] @@ -1003,6 +1016,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle 2.4.1", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1111,6 +1136,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "cw-controllers" version = "1.0.1" @@ -1285,6 +1323,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1329,11 +1377,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle 2.4.1", ] @@ -1451,10 +1500,24 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der 0.7.7", + "digest 0.10.7", + "elliptic-curve 0.13.5", + "rfc6979 0.4.0", + "signature 2.1.0", + "spki 0.7.2", ] [[package]] @@ -1463,7 +1526,30 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +dependencies = [ + "pkcs8 0.10.2", + "signature 2.1.0", +] + +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -1473,7 +1559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", - "ed25519", + "ed25519 1.5.3", "rand 0.7.3", "serde", "sha2 0.9.9", @@ -1507,16 +1593,35 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "digest 0.10.6", + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", "ff 0.12.1", "generic-array 0.14.7", "group 0.12.1", - "pkcs8", + "pkcs8 0.9.0", "rand_core 0.6.4", - "sec1", + "sec1 0.3.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.2", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", "subtle 2.4.1", "zeroize", ] @@ -1661,6 +1766,16 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "field-offset" version = "0.3.5" @@ -2000,6 +2115,7 @@ dependencies = [ "serde", "typenum", "version_check", + "zeroize", ] [[package]] @@ -2211,6 +2327,17 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.0", + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "gtk" version = "0.15.5" @@ -2455,7 +2582,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2874,19 +3001,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2 0.10.6", - "sha3", ] [[package]] -name = "keccak" -version = "0.1.4" +name = "k256" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ - "cpufeatures", + "cfg-if", + "ecdsa 0.16.8", + "elliptic-curve 0.13.5", + "once_cell", + "sha2 0.10.6", + "signature 2.1.0", ] [[package]] @@ -3373,7 +3504,7 @@ dependencies = [ name = "nym-api-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmrs", "cosmwasm-std", "getset", @@ -3464,7 +3595,7 @@ name = "nym-coconut" version = "0.5.0" dependencies = [ "bls12_381 0.6.0", - "bs58", + "bs58 0.4.0", "digest 0.9.0", "ff 0.11.1", "getrandom 0.2.10", @@ -3505,7 +3636,7 @@ dependencies = [ name = "nym-coconut-interface" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "getset", "nym-coconut", "serde", @@ -3564,7 +3695,6 @@ dependencies = [ "tauri-codegen", "tauri-macros", "tempfile", - "tendermint-rpc", "thiserror", "time", "tokio", @@ -3578,7 +3708,7 @@ dependencies = [ name = "nym-contracts-common" version = "0.5.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "schemars", "serde", @@ -3615,10 +3745,10 @@ version = "0.4.0" dependencies = [ "aes 0.8.2", "blake3", - "bs58", + "bs58 0.4.0", "cipher 0.4.4", "ctr 0.9.2", - "digest 0.10.6", + "digest 0.10.7", "ed25519-dalek", "generic-array 0.14.7", "hkdf 0.12.3", @@ -3638,7 +3768,7 @@ version = "0.1.0" dependencies = [ "bitvec", "bls12_381 0.6.0", - "bs58", + "bs58 0.4.0", "ff 0.11.1", "group 0.11.0", "lazy_static", @@ -3688,7 +3818,7 @@ dependencies = [ name = "nym-gateway-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "futures", "generic-array 0.14.7", "log", @@ -3720,7 +3850,7 @@ dependencies = [ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "humantime-serde", "log", @@ -3951,7 +4081,7 @@ dependencies = [ name = "nym-sphinx-anonymous-replies" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "nym-crypto", "nym-sphinx-addressing", "nym-sphinx-params", @@ -4060,7 +4190,7 @@ name = "nym-topology" version = "0.1.0" dependencies = [ "async-trait", - "bs58", + "bs58 0.4.0", "log", "nym-bin-common", "nym-crypto", @@ -4109,6 +4239,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.9.9", + "tendermint-rpc", "thiserror", "tokio", "url", @@ -4409,11 +4540,12 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "hmac 0.12.1", ] [[package]] @@ -4640,8 +4772,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", - "spki", + "der 0.6.1", + "spki 0.6.0", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.7", + "spki 0.7.2", ] [[package]] @@ -4760,9 +4902,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.10.4" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -4770,9 +4912,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.10.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", @@ -4783,11 +4925,10 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.10.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "bytes", "prost", ] @@ -5045,11 +5186,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac 0.12.1", "zeroize", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle 2.4.1", +] + [[package]] name = "rfd" version = "0.10.0" @@ -5095,18 +5246,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "ripemd160" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.7", ] [[package]] @@ -5318,10 +5458,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct", - "der", + "base16ct 0.1.1", + "der 0.6.1", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.9.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.7", + "generic-array 0.14.7", + "pkcs8 0.10.2", "subtle 2.4.1", "zeroize", ] @@ -5702,7 +5856,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -5726,17 +5880,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.6", - "keccak", + "digest 0.10.7", ] [[package]] @@ -5763,7 +5907,17 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.7", "rand_core 0.6.4", ] @@ -5835,7 +5989,7 @@ dependencies = [ "aes 0.7.5", "arrayref", "blake2", - "bs58", + "bs58 0.4.0", "byteorder", "chacha", "curve25519-dalek", @@ -5872,7 +6026,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der 0.7.7", ] [[package]] @@ -6182,6 +6346,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "syn" version = "1.0.109" @@ -6511,28 +6681,28 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a199518e0366ba0aeb0d0e0a59dbd99ea0bdc14280f414ecc758c9228a454ad8" +checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" dependencies = [ - "async-trait", "bytes", - "ed25519", - "ed25519-dalek", + "digest 0.10.7", + "ed25519 2.2.1", + "ed25519-consensus", "flex-error", "futures", - "k256", + "k256 0.13.1", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", + "ripemd", "serde", "serde_bytes", "serde_json", "serde_repr", - "sha2 0.9.9", - "signature", + "sha2 0.10.6", + "signature 2.1.0", "subtle 2.4.1", "subtle-encoding", "tendermint-proto", @@ -6542,9 +6712,9 @@ dependencies = [ [[package]] name = "tendermint-config" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d8f6a64ae3b59ea3c73efad727271ee085b544b817d7f46901817ca6bb1773" +checksum = "71a72dbbea6dde12045d261f2c70c0de039125675e8a026c8d5ad34522756372" dependencies = [ "flex-error", "serde", @@ -6556,9 +6726,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b303d6387aaea38cea7ef924476d1f798573044e7b4f6ddd1166ac5184b2281" +checksum = "c0cec054567d16d85e8c3f6a3139963d1a66d9d3051ed545d31562550e9bcc3d" dependencies = [ "bytes", "flex-error", @@ -6574,9 +6744,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3036f0b65baa11e767dabd22a0663e842b595b0a1903f149b7b8b1e09b2b443d" +checksum = "d119d83a130537fc4a98c3c9eb6899ebe857fea4860400a61675bfb5f0b35129" dependencies = [ "async-trait", "bytes", @@ -6589,9 +6759,11 @@ dependencies = [ "hyper-rustls", "peg", "pin-project", + "semver 1.0.17", "serde", "serde_bytes", "serde_json", + "subtle 2.4.1", "subtle-encoding", "tendermint", "tendermint-config", diff --git a/nym-connect/desktop/src-tauri/Cargo.toml b/nym-connect/desktop/src-tauri/Cargo.toml index edce6a2bb6..c3c1b0a895 100644 --- a/nym-connect/desktop/src-tauri/Cargo.toml +++ b/nym-connect/desktop/src-tauri/Cargo.toml @@ -37,7 +37,7 @@ serde_json = "1.0" serde_repr = "0.1" tap = "1.0.1" tauri = { version = "^1.2.2", features = ["clipboard-write-text", "macos-private-api", "notification-all", "shell-open", "system-tray", "updater", "window-close", "window-minimize", "window-start-dragging"] } -tendermint-rpc = "0.23.0" +#tendermint-rpc = "0.23.0" thiserror = "1.0" time = { version = "0.3.17", features = ["local-offset"] } tokio = { version = "1.24.1", features = ["sync", "time"] } diff --git a/nym-connect/mobile/src-tauri/Cargo.toml b/nym-connect/mobile/src-tauri/Cargo.toml index 0817f11d62..28ea437cdc 100644 --- a/nym-connect/mobile/src-tauri/Cargo.toml +++ b/nym-connect/mobile/src-tauri/Cargo.toml @@ -43,7 +43,7 @@ serde_repr = "0.1" tap = "1.0.1" # tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] } tauri = { version = "2.0.0-alpha.3", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] } -tendermint-rpc = "0.23.0" +#tendermint-rpc = "0.23.0" thiserror = "1.0" time = { version = "0.3.17", features = ["local-offset"] } tokio = { version = "1.24.1", features = ["sync", "time"] } diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 14bc9eb0e6..2da872c4fc 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -200,6 +200,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -220,13 +226,13 @@ checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b" [[package]] name = "bip32" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30ed1d6f8437a487a266c8293aeb95b61a23261273e3e02912cdb8b68bf798b" +checksum = "7e141fb0f8be1c7b45887af94c88b182472b57c96b56773250ae00cd6a14a164" dependencies = [ - "bs58", + "bs58 0.5.0", "hmac 0.12.1", - "k256", + "k256 0.13.1", "once_cell", "pbkdf2", "rand_core 0.6.4", @@ -292,7 +298,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -306,7 +312,7 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -373,8 +379,14 @@ name = "bs58" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" dependencies = [ - "sha2 0.9.9", + "sha2 0.10.6", ] [[package]] @@ -416,6 +428,9 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] [[package]] name = "cairo-rs" @@ -740,9 +755,9 @@ dependencies = [ [[package]] name = "cosmos-sdk-proto" -version = "0.13.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61f3d2224c90ea78e1fa7444787761a549170c46b6b0ed09b93f9b7e4076a" +checksum = "73c9d2043a9e617b0d602fbc0a0ecd621568edbf3a9774890a6d562389bd8e1c" dependencies = [ "prost", "prost-types", @@ -751,18 +766,16 @@ dependencies = [ [[package]] name = "cosmrs" -version = "0.8.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d5890dac07a62337e5841adb8f2074a66a962a098a48df9460f64d483beaf4" +checksum = "af13955d6f356272e6def9ff5e2450a7650df536d8934f47052a20c76513d2f6" dependencies = [ "bip32", "cosmos-sdk-proto", - "ecdsa", + "ecdsa 0.16.8", "eyre", "getrandom 0.2.10", - "k256", - "prost", - "prost-types", + "k256 0.13.1", "rand_core 0.6.4", "serde", "serde_json", @@ -778,9 +791,9 @@ version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75836a10cb9654c54e77ee56da94d592923092a10b369cdb0dbd56acefc16340" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", "ed25519-zebra", - "k256", + "k256 0.11.6", "rand_core 0.6.4", "thiserror", ] @@ -917,6 +930,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle 2.4.1", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1031,6 +1056,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "cw-controllers" version = "1.0.1" @@ -1171,6 +1209,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1215,11 +1263,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.3", + "const-oid", "crypto-common", "subtle 2.4.1", ] @@ -1331,10 +1380,24 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der 0.7.7", + "digest 0.10.7", + "elliptic-curve 0.13.5", + "rfc6979 0.4.0", + "signature 2.1.0", + "spki 0.7.2", ] [[package]] @@ -1343,7 +1406,30 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +dependencies = [ + "pkcs8 0.10.2", + "signature 2.1.0", +] + +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -1353,7 +1439,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", - "ed25519", + "ed25519 1.5.3", "rand 0.7.3", "serde", "sha2 0.9.9", @@ -1387,16 +1473,35 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "digest 0.10.6", + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", "ff 0.12.1", "generic-array 0.14.7", "group 0.12.1", - "pkcs8", + "pkcs8 0.9.0", "rand_core 0.6.4", - "sec1", + "sec1 0.3.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.2", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", "subtle 2.4.1", "zeroize", ] @@ -1519,6 +1624,16 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "field-offset" version = "0.3.4" @@ -2005,6 +2120,17 @@ dependencies = [ "subtle 2.4.1", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.0", + "rand_core 0.6.4", + "subtle 2.4.1", +] + [[package]] name = "gtk" version = "0.15.5" @@ -2204,7 +2330,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -2589,19 +2715,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2 0.10.6", - "sha3", ] [[package]] -name = "keccak" -version = "0.1.4" +name = "k256" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ - "cpufeatures", + "cfg-if", + "ecdsa 0.16.8", + "elliptic-curve 0.13.5", + "once_cell", + "sha2 0.10.6", + "signature 2.1.0", ] [[package]] @@ -2990,7 +3120,7 @@ dependencies = [ name = "nym-api-requests" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmrs", "cosmwasm-std", "getset", @@ -3020,7 +3150,7 @@ name = "nym-coconut" version = "0.5.0" dependencies = [ "bls12_381", - "bs58", + "bs58 0.4.0", "digest 0.9.0", "ff 0.11.1", "getrandom 0.2.10", @@ -3061,7 +3191,7 @@ dependencies = [ name = "nym-coconut-interface" version = "0.1.0" dependencies = [ - "bs58", + "bs58 0.4.0", "getset", "nym-coconut", "serde", @@ -3085,7 +3215,7 @@ dependencies = [ name = "nym-contracts-common" version = "0.5.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "schemars", "serde", @@ -3096,7 +3226,7 @@ dependencies = [ name = "nym-crypto" version = "0.4.0" dependencies = [ - "bs58", + "bs58 0.4.0", "ed25519-dalek", "nym-pemstore", "nym-sphinx-types", @@ -3113,7 +3243,7 @@ version = "0.1.0" dependencies = [ "bitvec", "bls12_381", - "bs58", + "bs58 0.4.0", "ff 0.11.1", "group 0.11.0", "lazy_static", @@ -3143,7 +3273,7 @@ dependencies = [ name = "nym-mixnet-contract-common" version = "0.6.0" dependencies = [ - "bs58", + "bs58 0.4.0", "cosmwasm-std", "humantime-serde", "log", @@ -3321,6 +3451,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.9.9", + "tendermint-rpc", "thiserror", "tokio", "url", @@ -3393,7 +3524,7 @@ dependencies = [ [[package]] name = "nym_wallet" -version = "1.2.5" +version = "1.2.6" dependencies = [ "async-trait", "base64 0.13.1", @@ -3408,7 +3539,7 @@ dependencies = [ "fern", "futures", "itertools", - "k256", + "k256 0.13.1", "log", "nym-coconut-interface", "nym-config", @@ -3434,7 +3565,6 @@ dependencies = [ "tauri-codegen", "tauri-macros", "tempfile", - "tendermint-rpc", "thiserror", "time", "tokio", @@ -3666,11 +3796,12 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "hmac 0.12.1", ] [[package]] @@ -3897,8 +4028,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", - "spki", + "der 0.6.1", + "spki 0.6.0", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.7", + "spki 0.7.2", ] [[package]] @@ -4029,9 +4170,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.10.4" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -4039,9 +4180,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.10.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", @@ -4052,11 +4193,10 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.10.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "bytes", "prost", ] @@ -4316,11 +4456,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac 0.12.1", "zeroize", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle 2.4.1", +] + [[package]] name = "rfd" version = "0.10.0" @@ -4366,18 +4516,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "ripemd160" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.7", ] [[package]] @@ -4526,10 +4665,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct", - "der", + "base16ct 0.1.1", + "der 0.6.1", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.9.0", + "subtle 2.4.1", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.7", + "generic-array 0.14.7", + "pkcs8 0.10.2", "subtle 2.4.1", "zeroize", ] @@ -4767,7 +4920,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -4791,17 +4944,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.6", - "keccak", + "digest 0.10.7", ] [[package]] @@ -4828,7 +4971,17 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.7", "rand_core 0.6.4", ] @@ -4900,7 +5053,7 @@ dependencies = [ "aes 0.7.5", "arrayref", "blake2 0.8.1", - "bs58", + "bs58 0.4.0", "byteorder", "chacha", "curve25519-dalek", @@ -4928,7 +5081,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der 0.7.7", ] [[package]] @@ -5027,6 +5190,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "syn" version = "1.0.107" @@ -5343,28 +5512,28 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a199518e0366ba0aeb0d0e0a59dbd99ea0bdc14280f414ecc758c9228a454ad8" +checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" dependencies = [ - "async-trait", "bytes", - "ed25519", - "ed25519-dalek", + "digest 0.10.7", + "ed25519 2.2.1", + "ed25519-consensus", "flex-error", "futures", - "k256", + "k256 0.13.1", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", + "ripemd", "serde", "serde_bytes", "serde_json", "serde_repr", - "sha2 0.9.9", - "signature", + "sha2 0.10.6", + "signature 2.1.0", "subtle 2.4.1", "subtle-encoding", "tendermint-proto", @@ -5374,9 +5543,9 @@ dependencies = [ [[package]] name = "tendermint-config" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d8f6a64ae3b59ea3c73efad727271ee085b544b817d7f46901817ca6bb1773" +checksum = "71a72dbbea6dde12045d261f2c70c0de039125675e8a026c8d5ad34522756372" dependencies = [ "flex-error", "serde", @@ -5388,9 +5557,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b303d6387aaea38cea7ef924476d1f798573044e7b4f6ddd1166ac5184b2281" +checksum = "c0cec054567d16d85e8c3f6a3139963d1a66d9d3051ed545d31562550e9bcc3d" dependencies = [ "bytes", "flex-error", @@ -5406,9 +5575,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.23.8" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3036f0b65baa11e767dabd22a0663e842b595b0a1903f149b7b8b1e09b2b443d" +checksum = "d119d83a130537fc4a98c3c9eb6899ebe857fea4860400a61675bfb5f0b35129" dependencies = [ "async-trait", "bytes", @@ -5421,9 +5590,11 @@ dependencies = [ "hyper-rustls", "peg", "pin-project", + "semver 1.0.16", "serde", "serde_bytes", "serde_json", + "subtle 2.4.1", "subtle-encoding", "tendermint", "tendermint-config", diff --git a/nym-wallet/nym-wallet-types/Cargo.toml b/nym-wallet/nym-wallet-types/Cargo.toml index 99d0ef784b..63a4aa5daf 100644 --- a/nym-wallet/nym-wallet-types/Cargo.toml +++ b/nym-wallet/nym-wallet-types/Cargo.toml @@ -11,15 +11,13 @@ serde_json = "1.0" strum = { version = "0.23", features = ["derive"] } ts-rs = "6.1.2" -cosmwasm-std = "1.0.0" -cosmrs = "=0.8.0" +cosmwasm-std = "1.2.0" +cosmrs = "=0.14.0" nym-config = { path = "../../common/config" } nym-network-defaults = { path = "../../common/network-defaults" } nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" } -nym-validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nyxd-client", -] } +nym-validator-client = { path = "../../common/client-libs/validator-client" } nym-vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } # Used for Type conversion, can be extracted but its a lot of work nym-vesting-contract = { path = "../../contracts/vesting" } diff --git a/nym-wallet/src-tauri/Cargo.toml b/nym-wallet/src-tauri/Cargo.toml index 5e6c9c7318..19b5f0e3c9 100644 --- a/nym-wallet/src-tauri/Cargo.toml +++ b/nym-wallet/src-tauri/Cargo.toml @@ -38,21 +38,21 @@ serde_json = "1.0" serde_repr = "0.1" strum = { version = "0.23", features = ["derive"] } tauri = { version = "=1.2.3", features = ["clipboard-all", "shell-open", "updater", "window-maximize", "window-print"] } -tendermint-rpc = "0.23.0" +#tendermint-rpc = "0.23.0" time = { version = "0.3.17", features = ["local-offset"] } thiserror = "1.0" tokio = { version = "1.10", features = ["full"] } toml = "0.5.8" url = "2.2" -k256 = { version = "0.11", features = ["ecdsa", "sha256"] } +k256 = { version = "0.13", features = ["ecdsa", "sha256"] } base64 = "0.13" zeroize = { version = "1.5", features = ["zeroize_derive", "serde"] } -cosmwasm-std = "1.0.0" -cosmrs = "=0.8.0" +cosmwasm-std = "1.2.0" +cosmrs = "=0.14.0" nym-validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nyxd-client", + "signing", "http-client" ] } nym-crypto = { path = "../../common/crypto", features = ["asymmetric"] } nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" } diff --git a/nym-wallet/src-tauri/src/error.rs b/nym-wallet/src-tauri/src/error.rs index 8cee3018d5..3d9374c22a 100644 --- a/nym-wallet/src-tauri/src/error.rs +++ b/nym-wallet/src-tauri/src/error.rs @@ -1,4 +1,5 @@ use nym_contracts_common::signing::SigningAlgorithm; +use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity::Ed25519RecoveryError; use nym_types::error::TypesError; use nym_validator_client::nym_api::error::NymAPIError; @@ -25,7 +26,7 @@ pub enum BackendError { #[error("{source}")] TendermintError { #[from] - source: tendermint_rpc::Error, + source: cosmrs::rpc::Error, }, #[error("{pretty_error}")] NyxdError { @@ -149,6 +150,9 @@ pub enum BackendError { #[error(transparent)] Ed25519Recovery(#[from] Ed25519RecoveryError), + #[error("failed to verify ed25519 signature: {0}")] + Ed25519SignatureError(#[from] identity::SignatureError), + #[error("This command ({name}) has been removed. Please try to use {alternative} instead.")] RemovedCommand { name: String, alternative: String }, } diff --git a/nym-wallet/src-tauri/src/main.rs b/nym-wallet/src-tauri/src/main.rs index 87c961b38e..dd7cb4558c 100644 --- a/nym-wallet/src-tauri/src/main.rs +++ b/nym-wallet/src-tauri/src/main.rs @@ -103,7 +103,6 @@ fn main() { utils::owns_gateway, utils::owns_mixnode, utils::get_env, - utils::get_old_and_incorrect_hardcoded_fee, utils::try_convert_pubkey_to_mix_id, utils::default_mixnode_cost_params, nym_api::status::compute_mixnode_reward_estimation, diff --git a/nym-wallet/src-tauri/src/operations/simulate/mod.rs b/nym-wallet/src-tauri/src/operations/simulate/mod.rs index b3e032d000..5662f56fda 100644 --- a/nym-wallet/src-tauri/src/operations/simulate/mod.rs +++ b/nym-wallet/src-tauri/src/operations/simulate/mod.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use cosmrs::tx; -use cosmrs::tx::Gas; +use cosmrs::Gas; use nym_types::fees::FeeDetails; use nym_validator_client::nyxd::cosmwasm_client::types::GasInfo; use nym_validator_client::nyxd::{CosmosCoin, Fee, GasAdjustable, GasAdjustment, GasPrice}; diff --git a/nym-wallet/src-tauri/src/operations/vesting/bond.rs b/nym-wallet/src-tauri/src/operations/vesting/bond.rs index 38583a877b..f2077e5694 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/bond.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/bond.rs @@ -1,19 +1,17 @@ -use std::cmp::Ordering; - use crate::error::BackendError; use crate::nyxd_client; +use crate::operations::helpers::{ + verify_gateway_bonding_sign_payload, verify_mixnode_bonding_sign_payload, +}; use crate::state::WalletState; use crate::{Gateway, MixNode}; use nym_contracts_common::signing::MessageSignature; use nym_mixnet_contract_common::{GatewayConfigUpdate, MixNodeConfigUpdate}; - -use crate::operations::helpers::{ - verify_gateway_bonding_sign_payload, verify_mixnode_bonding_sign_payload, -}; use nym_types::currency::DecCoin; use nym_types::mixnode::MixNodeCostParams; use nym_types::transaction::TransactionExecuteResult; -use nym_validator_client::nyxd::{Fee, VestingSigningClient}; +use nym_validator_client::nyxd::{traits::VestingSigningClient, Fee}; +use std::cmp::Ordering; #[tauri::command] pub async fn vesting_bond_gateway( diff --git a/nym-wallet/src-tauri/src/operations/vesting/delegate.rs b/nym-wallet/src-tauri/src/operations/vesting/delegate.rs index 2cc873499a..ff7c33710f 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/delegate.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/delegate.rs @@ -6,7 +6,7 @@ use crate::state::WalletState; use nym_mixnet_contract_common::MixId; use nym_types::currency::DecCoin; use nym_types::transaction::TransactionExecuteResult; -use nym_validator_client::nyxd::{Fee, VestingSigningClient}; +use nym_validator_client::nyxd::{traits::VestingSigningClient, Fee}; #[tauri::command] pub async fn vesting_delegate_to_mixnode( diff --git a/nym-wallet/src-tauri/src/operations/vesting/queries.rs b/nym-wallet/src-tauri/src/operations/vesting/queries.rs index b8ed343554..a24e26d001 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/queries.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/queries.rs @@ -8,7 +8,7 @@ use cosmwasm_std::Timestamp; use nym_types::currency::DecCoin; use nym_types::vesting::VestingAccountInfo; use nym_types::vesting::{OriginalVestingResponse, PledgeData}; -use nym_validator_client::nyxd::VestingQueryClient; +use nym_validator_client::nyxd::traits::VestingQueryClient; use nym_vesting_contract_common::Period; #[tauri::command] diff --git a/nym-wallet/src-tauri/src/operations/vesting/rewards.rs b/nym-wallet/src-tauri/src/operations/vesting/rewards.rs index 7d64fafed4..dbedb302e3 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/rewards.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/rewards.rs @@ -5,8 +5,8 @@ use crate::error::BackendError; use crate::state::WalletState; use nym_mixnet_contract_common::MixId; use nym_types::transaction::TransactionExecuteResult; +use nym_validator_client::nyxd::traits::VestingSigningClient; use nym_validator_client::nyxd::Fee; -use nym_validator_client::nyxd::VestingSigningClient; #[tauri::command] pub async fn vesting_claim_operator_reward( diff --git a/nym-wallet/src-tauri/src/utils.rs b/nym-wallet/src-tauri/src/utils.rs index 9fe353302c..e5aed4e092 100644 --- a/nym-wallet/src-tauri/src/utils.rs +++ b/nym-wallet/src-tauri/src/utils.rs @@ -9,9 +9,7 @@ use nym_mixnet_contract_common::{IdentityKey, MixId, Percent}; use nym_types::currency::DecCoin; use nym_types::mixnode::MixNodeCostParams; use nym_validator_client::nyxd::traits::MixnetQueryClient; -use nym_validator_client::nyxd::{tx, Coin, CosmosCoin, Gas, GasPrice}; use nym_wallet_types::app::AppEnv; -use serde::{Deserialize, Serialize}; fn get_env_as_option(key: &str) -> Option { match ::std::env::var(key) { @@ -79,116 +77,3 @@ pub async fn default_mixnode_cost_params( }, }) } - -#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize)] -pub enum Operation { - Upload, - Init, - Migrate, - ChangeAdmin, - Send, - - BondMixnode, - BondMixnodeOnBehalf, - UnbondMixnode, - UnbondMixnodeOnBehalf, - UpdateMixnodeConfig, - DelegateToMixnode, - DelegateToMixnodeOnBehalf, - UndelegateFromMixnode, - UndelegateFromMixnodeOnBehalf, - - BondGateway, - BondGatewayOnBehalf, - UnbondGateway, - UnbondGatewayOnBehalf, - - UpdateContractSettings, - - BeginMixnodeRewarding, - FinishMixnodeRewarding, - - TrackUnbondGateway, - TrackUnbondMixnode, - WithdrawVestedCoins, - TrackUndelegation, - CreatePeriodicVestingAccount, - - AdvanceCurrentInterval, - AdvanceCurrentEpoch, - WriteRewardedSet, - ClearRewardedSet, - UpdateMixnetAddress, - CheckpointMixnodes, - ReconcileDelegations, -} - -impl Operation { - fn default_gas_limit(&self) -> Gas { - match self { - Operation::Upload => 3_000_000u64.into(), - Operation::Init => 500_000u64.into(), - Operation::Migrate => 200_000u64.into(), - Operation::ChangeAdmin => 80_000u64.into(), - Operation::Send => 80_000u64.into(), - - Operation::BondMixnode => 175_000u64.into(), - Operation::BondMixnodeOnBehalf => 200_000u64.into(), - Operation::UnbondMixnode => 175_000u64.into(), - Operation::UnbondMixnodeOnBehalf => 175_000u64.into(), - Operation::UpdateMixnodeConfig => 175_000u64.into(), - Operation::DelegateToMixnode => 175_000u64.into(), - Operation::DelegateToMixnodeOnBehalf => 175_000u64.into(), - Operation::UndelegateFromMixnode => 175_000u64.into(), - Operation::UndelegateFromMixnodeOnBehalf => 175_000u64.into(), - - Operation::BondGateway => 175_000u64.into(), - Operation::BondGatewayOnBehalf => 200_000u64.into(), - Operation::UnbondGateway => 175_000u64.into(), - Operation::UnbondGatewayOnBehalf => 200_000u64.into(), - - Operation::UpdateContractSettings => 175_000u64.into(), - Operation::BeginMixnodeRewarding => 175_000u64.into(), - Operation::FinishMixnodeRewarding => 175_000u64.into(), - Operation::TrackUnbondGateway => 175_000u64.into(), - Operation::TrackUnbondMixnode => 175_000u64.into(), - Operation::WithdrawVestedCoins => 175_000u64.into(), - Operation::TrackUndelegation => 175_000u64.into(), - Operation::CreatePeriodicVestingAccount => 175_000u64.into(), - Operation::AdvanceCurrentInterval => 175_000u64.into(), - Operation::WriteRewardedSet => 175_000u64.into(), - Operation::ClearRewardedSet => 175_000u64.into(), - Operation::UpdateMixnetAddress => 80_000u64.into(), - Operation::CheckpointMixnodes => 175_000u64.into(), - Operation::ReconcileDelegations => 500_000u64.into(), - Operation::AdvanceCurrentEpoch => 175_000u64.into(), - } - } - - fn calculate_fee(gas_price: &GasPrice, gas_limit: Gas) -> CosmosCoin { - gas_price * gas_limit - } - - fn determine_custom_fee(gas_price: &GasPrice, gas_limit: Gas) -> tx::Fee { - let fee = Self::calculate_fee(gas_price, gas_limit); - tx::Fee::from_amount_and_gas(fee, gas_limit) - } - - fn default_fee(&self, gas_price: &GasPrice) -> tx::Fee { - Self::determine_custom_fee(gas_price, self.default_gas_limit()) - } -} - -#[tauri::command] -pub async fn get_old_and_incorrect_hardcoded_fee( - state: tauri::State<'_, WalletState>, - operation: Operation, -) -> Result { - let guard = state.read().await; - let mut approximate_fee = operation.default_fee(guard.current_client()?.nyxd.gas_price()); - // on all our chains it should only ever contain a single type of currency - assert_eq!(approximate_fee.amount.len(), 1); - let coin: Coin = approximate_fee.amount.pop().unwrap().into(); - log::info!("hardcoded fee for {:?} is {:?}", operation, coin); - guard.attempt_convert_to_display_dec_coin(coin) -} diff --git a/sdk/rust/nym-sdk/Cargo.toml b/sdk/rust/nym-sdk/Cargo.toml index 94f6656df5..7aaced99aa 100644 --- a/sdk/rust/nym-sdk/Cargo.toml +++ b/sdk/rust/nym-sdk/Cargo.toml @@ -18,7 +18,7 @@ nym-sphinx = { path = "../../../common/nymsphinx" } nym-task = { path = "../../../common/task" } nym-topology = { path = "../../../common/topology" } nym-socks5-client-core = { path = "../../../common/socks5-client-core" } -nym-validator-client = { path = "../../../common/client-libs/validator-client", features = ["nyxd-client"] } +nym-validator-client = { path = "../../../common/client-libs/validator-client", features = ["http-client"] } futures = "0.3" log = { workspace = true } diff --git a/tools/nym-cli/Cargo.toml b/tools/nym-cli/Cargo.toml index 4dd1d9197f..ea5cad9e65 100644 --- a/tools/nym-cli/Cargo.toml +++ b/tools/nym-cli/Cargo.toml @@ -22,5 +22,5 @@ tap = "1" nym-cli-commands = { path = "../../common/commands" } nym-bin-common = { path = "../../common/bin-common"} -nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } +nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] } nym-network-defaults = { path = "../../common/network-defaults" } diff --git a/tools/ts-rs-cli/Cargo.toml b/tools/ts-rs-cli/Cargo.toml index 366bbe3ef4..41f9ead98d 100644 --- a/tools/ts-rs-cli/Cargo.toml +++ b/tools/ts-rs-cli/Cargo.toml @@ -11,7 +11,7 @@ ts-rs = "6.1.2" walkdir = "2" nym-validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nyxd-client", "generate-ts" + "generate-ts" ] } nym-api-requests = { path = "../../nym-api/nym-api-requests", features = ["generate-ts"] } nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", features = [ "generate-ts" ]}