diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index af5698e..0000000 --- a/.cargo/config +++ /dev/null @@ -1,4 +0,0 @@ -[alias] -wasm = "build --release --lib --target wasm32-unknown-unknown" -unit-test = "test --lib" -schema = "run --bin schema" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 20e8f4e..2ae8d57 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.73.0 components: clippy profile: minimal override: true @@ -30,7 +30,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.73.0 components: rustfmt profile: minimal override: true @@ -45,7 +45,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.73.0 profile: minimal - run: make test env: diff --git a/.gitignore b/.gitignore index 9e84883..79c00ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Build results /target -/schema +schema /artifacts /cache /node_modules diff --git a/Cargo.lock b/Cargo.lock index 36b5258..c45f7b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", @@ -33,9 +33,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.21.3" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -69,21 +69,21 @@ dependencies = [ [[package]] name = "bnum" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128a44527fc0d6abf05f9eda748b9027536e12dff93f5acc8449f51583309350" +checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" dependencies = [ "serde", ] @@ -102,9 +102,9 @@ checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "cosmos-sdk-proto" -version = "0.16.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4776e787b24d9568dd61d3237eeb4eb321d622fb881b858c7b82806420e87d4" +checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" dependencies = [ "prost", "prost-types", @@ -113,11 +113,12 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca101fbf2f76723711a30ea3771ef312ec3ec254ad021b237871ed802f9f175" +checksum = "d8bb3c77c3b7ce472056968c745eb501c440fbc07be5004eba02782c35bfbbe3" dependencies = [ "digest 0.10.7", + "ecdsa", "ed25519-zebra", "k256", "rand_core 0.6.4", @@ -126,18 +127,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c73d2dd292f60e42849d2b07c03d809cf31e128a4299a805abd6d24553bcaaf5" +checksum = "fea73e9162e6efde00018d55ed0061e93a108b5d6ec4548b4f8ce3c706249687" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce34a08020433989af5cc470104f6bd22134320fe0221bd8aeb919fd5ec92d5" +checksum = "0df41ea55f2946b6b43579659eec048cc2f66e8c8e2e3652fc5e5e476f673856" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -148,9 +149,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96694ec781a7dd6dea1f968a2529ade009c21ad999c88b5f53d6cc495b3b96f7" +checksum = "43609e92ce1b9368aa951b334dd354a2d0dd4d484931a5f83ae10e12a26c8ba9" dependencies = [ "proc-macro2", "quote", @@ -159,11 +160,12 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a44d3f9c25b2f864737c6605a98f2e4675d53fd8bbc7cf4d7c02475661a793d" +checksum = "04d6864742e3a7662d024b51a94ea81c9af21db6faea2f9a6d2232bb97c6e53e" dependencies = [ "base64", + "bech32", "bnum", "cosmwasm-crypto", "cosmwasm-derive", @@ -172,25 +174,26 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm", - "sha2 0.10.7", + "serde-json-wasm 0.5.1", + "sha2 0.10.8", + "static_assertions", "thiserror", ] [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] [[package]] name = "crypto-bigint" -version = "0.5.2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -223,9 +226,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0e92a069d62067f3472c62e30adedb4cab1754725c0f2a682b3128d2bf3c79" +checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c" dependencies = [ "cosmwasm-std", "schemars", @@ -234,14 +237,15 @@ dependencies = [ [[package]] name = "cw2" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ac2dc7a55ad64173ca1e0a46697c31b7a5c51342f55a1e84a724da4eb99908" +checksum = "c6c120b24fbbf5c3bedebb97f2cc85fbfa1c3287e09223428e7e597b5293c1fa" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus", "schemars", + "semver", "serde", "thiserror", ] @@ -258,9 +262,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +dependencies = [ + "powerfmt", +] [[package]] name = "derivative" @@ -296,15 +303,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.13" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest 0.10.7", @@ -337,9 +344,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" -version = "0.13.5" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", @@ -392,9 +399,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -438,9 +445,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -453,23 +460,23 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "k256" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.7", + "sha2 0.10.8", "signature", ] [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "lido-satellite" @@ -485,22 +492,18 @@ dependencies = [ [[package]] name = "neutron-sdk" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfc6f92cae61b5af9014c09b7bac25ac95b7442be38441a7103377a8edfd37c" +checksum = "583150155911cb93ef38108259bcfdf19b85b75ef9e98dcd88927fcf24a809b3" dependencies = [ - "base64", "bech32", "cosmos-sdk-proto", "cosmwasm-schema", "cosmwasm-std", - "cw-storage-plus", - "prost", "protobuf", "schemars", "serde", - "serde-json-wasm", - "serde_json", + "serde-json-wasm 1.0.0", "thiserror", ] @@ -517,9 +520,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -552,20 +555,26 @@ dependencies = [ "spki", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", "prost-derive", @@ -573,33 +582,32 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] name = "prost-types" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ "prost", ] [[package]] name = "protobuf" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" +checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" dependencies = [ - "bytes", "once_cell", "protobuf-support", "thiserror", @@ -607,9 +615,9 @@ dependencies = [ [[package]] name = "protobuf-support" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" dependencies = [ "thiserror", ] @@ -656,9 +664,9 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "schemars" -version = "0.8.13" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" dependencies = [ "dyn-clone", "schemars_derive", @@ -668,9 +676,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.13" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" dependencies = [ "proc-macro2", "quote", @@ -692,11 +700,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + [[package]] name = "serde" -version = "1.0.188" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -710,6 +724,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-json-wasm" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83c37d03f3b0f6b5f77c11af1e7c772de1c9af83e50bef7bb6069601900ba67b" +dependencies = [ + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.12" @@ -721,13 +744,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.39", ] [[package]] @@ -743,9 +766,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -767,9 +790,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -778,9 +801,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -788,14 +811,20 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "subtle" version = "2.5.0" @@ -824,9 +853,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -835,9 +864,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.27.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5895470f28c530f8ae8c4071bf8190304ce00bd131d25e81730453124a3375c" +checksum = "2cc728a4f9e891d71adf66af6ecaece146f9c7a11312288a3107b3e1d6979aaf" dependencies = [ "bytes", "flex-error", @@ -853,61 +882,62 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.39", ] [[package]] name = "time" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", + "powerfmt", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -923,6 +953,6 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index bb2e991..64f7e68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ "contracts/cosmwasm/*" ] +resolver = "2" [workspace.package] authors = ["Murad Karammaev "] @@ -17,3 +18,11 @@ codegen-units = 1 panic = 'abort' incremental = false overflow-checks = true + +[workspace.dependencies] +cosmwasm-schema = "1.5.0" +cosmwasm-std = "1.5.0" +cw-storage-plus = "1.2.0" +neutron-sdk = "0.7.0" +cw2 = "1.1.2" +thiserror = "1.0.50" diff --git a/Makefile b/Makefile index 7699dc0..ae90b36 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ .PHONY: schema test clippy proto-gen build fmt schema: - @cargo schema + @find contracts/cosmwasm/* -maxdepth 0 -type d \( ! -name . \) -exec bash -c "cd '{}' && cargo schema" \; test: - @cargo unit-test + @cargo test clippy: @cargo clippy --all --all-targets -- -D warnings @@ -16,10 +16,17 @@ check_contracts: @cargo install cosmwasm-check @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron artifacts/*.wasm +doc: + @cargo doc + compile: - @scripts/build_release.sh + @docker run --rm -v "$(CURDIR)":/code \ + --mount type=volume,source="$(notdir $(CURDIR))_cache",target=/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + --platform linux/amd64 \ + cosmwasm/workspace-optimizer:0.15.0 -build: schema clippy fmt test compile check_contracts +build: schema doc clippy fmt test compile check_contracts lint-sol: @npx solhint contracts/solidity/gmp-helper/gmp-helper.sol diff --git a/contracts/cosmwasm/lido-satellite/.cargo/config b/contracts/cosmwasm/lido-satellite/.cargo/config new file mode 100644 index 0000000..f11478a --- /dev/null +++ b/contracts/cosmwasm/lido-satellite/.cargo/config @@ -0,0 +1,2 @@ +[alias] +schema = "run --bin lido-satellite-schema" diff --git a/contracts/cosmwasm/lido-satellite/Cargo.toml b/contracts/cosmwasm/lido-satellite/Cargo.toml index 94c5bc4..f769921 100644 --- a/contracts/cosmwasm/lido-satellite/Cargo.toml +++ b/contracts/cosmwasm/lido-satellite/Cargo.toml @@ -12,9 +12,9 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-schema = "1.4.0" -cosmwasm-std = "1.4.0" -cw-storage-plus = "1.1.0" -neutron-sdk = "0.6.1" -cw2 = "1.1.0" -thiserror = "1.0.48" +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +neutron-sdk = { workspace = true } +cw2 = { workspace = true } +thiserror = { workspace = true } diff --git a/contracts/cosmwasm/lido-satellite/src/bin/schema.rs b/contracts/cosmwasm/lido-satellite/src/bin/lido-satellite-schema.rs similarity index 100% rename from contracts/cosmwasm/lido-satellite/src/bin/schema.rs rename to contracts/cosmwasm/lido-satellite/src/bin/lido-satellite-schema.rs diff --git a/contracts/cosmwasm/lido-satellite/src/execute.rs b/contracts/cosmwasm/lido-satellite/src/execute.rs index 0e67916..949a6fd 100644 --- a/contracts/cosmwasm/lido-satellite/src/execute.rs +++ b/contracts/cosmwasm/lido-satellite/src/execute.rs @@ -59,7 +59,7 @@ pub(crate) fn execute_burn( ])) } -fn find_denom<'a>(funds: &'a [Coin], target_denom: &str) -> ContractResult> { +pub fn find_denom<'a>(funds: &'a [Coin], target_denom: &str) -> ContractResult> { match funds.len() { 0 => Ok(None), 1 => Ok({ diff --git a/contracts/cosmwasm/lido-satellite/src/lib.rs b/contracts/cosmwasm/lido-satellite/src/lib.rs index 40e615f..e274c97 100644 --- a/contracts/cosmwasm/lido-satellite/src/lib.rs +++ b/contracts/cosmwasm/lido-satellite/src/lib.rs @@ -5,8 +5,8 @@ pub mod state; pub use crate::error::{ContractError, ContractResult}; -mod execute; -mod query; +pub mod execute; +pub mod query; #[cfg(test)] mod tests; diff --git a/contracts/cosmwasm/lido-satellite/src/query.rs b/contracts/cosmwasm/lido-satellite/src/query.rs index be2f9bf..fc40609 100644 --- a/contracts/cosmwasm/lido-satellite/src/query.rs +++ b/contracts/cosmwasm/lido-satellite/src/query.rs @@ -1,10 +1,10 @@ use crate::{msg::ConfigResponse, state::CONFIG, ContractResult}; -use cosmwasm_std::{to_binary, Binary, Deps}; +use cosmwasm_std::{to_json_binary, Binary, Deps}; use neutron_sdk::bindings::query::NeutronQuery; pub(crate) fn query_config(deps: Deps) -> ContractResult { let config = CONFIG.load(deps.storage)?; - Ok(to_binary(&ConfigResponse { + Ok(to_json_binary(&ConfigResponse { bridged_denom: config.bridged_denom, canonical_denom: config.canonical_denom, })?) diff --git a/contracts/cosmwasm/lido-satellite/src/tests/query/config.rs b/contracts/cosmwasm/lido-satellite/src/tests/query/config.rs index d0a6256..dd84a67 100644 --- a/contracts/cosmwasm/lido-satellite/src/tests/query/config.rs +++ b/contracts/cosmwasm/lido-satellite/src/tests/query/config.rs @@ -3,13 +3,13 @@ use crate::{ msg::{ConfigResponse, QueryMsg}, tests::helpers::{instantiate_wrapper, VALID_IBC_DENOM}, }; -use cosmwasm_std::from_binary; +use cosmwasm_std::from_json; #[test] fn corresponds_to_instantiate_params() { let (_result, deps, env) = instantiate_wrapper(VALID_IBC_DENOM, "eth"); let config_response: ConfigResponse = - from_binary(&query(deps.as_ref(), env, QueryMsg::Config {}).unwrap()).unwrap(); + from_json(query(deps.as_ref(), env, QueryMsg::Config {}).unwrap()).unwrap(); assert_eq!( config_response, ConfigResponse { diff --git a/integration_test.bash b/integration_test.bash index 3600449..d976be3 100755 --- a/integration_test.bash +++ b/integration_test.bash @@ -18,21 +18,22 @@ trap finish EXIT CONTRACT_PATH="artifacts/lido_satellite.wasm" MAIN_WALLET="demowallet1" -MAIN_WALLET_ADDR="neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2" +MAIN_WALLET_ADDR_NEUTRON="neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2" +MAIN_WALLET_ADDR_GAIA="cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud" SECOND_WALLET="demowallet2" -SECOND_WALLET_ADDR="neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf" +SECOND_WALLET_ADDR_NEUTRON="neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf" NEUTRON_HOME="../neutron/data/test-1" NEUTRON_NODE="tcp://0.0.0.0:26657" NEUTRON_CHAIN_ID="test-1" GAIA_HOME="../neutron/data/test-2" GAIA_NODE="tcp://0.0.0.0:16657" GAIA_CHAIN_ID="test-2" -IBC_DENOM="ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" +ATOM_ON_NEUTRON_IBC_DENOM="ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" declare -a ntx=( "--home" "$NEUTRON_HOME" "--keyring-backend" "test" - "--broadcast-mode" "block" + "--broadcast-mode" "sync" "--gas" "10000000" "--gas-prices" "0.0025untrn" "--node" "$NEUTRON_NODE" @@ -44,7 +45,7 @@ declare -a ntx=( declare -a gtx=( "--home" "$GAIA_HOME" "--keyring-backend" "test" - "--broadcast-mode" "block" + "--broadcast-mode" "sync" "--gas" "10000000" "--gas-prices" "0.0025uatom" "--node" "$GAIA_NODE" @@ -58,103 +59,156 @@ declare -a nq=( "--output" "json" ) +declare -a gq=( + "--node" "$GAIA_NODE" + "--output" "json" +) + +wait_gtx() { + wait_tx "gaiad" "gq" +} + +wait_ntx() { + wait_tx "neutrond" "nq" +} + +wait_tx() { + local aname + local q + local txhash + local attempts + aname="$2[@]" + q=("${!aname}") + txhash="$(jq -r '.txhash' /dev/null; do + ((attempts-=1)) || { + echo "tx $txhash still not included in block" 1>&2 + exit 1 + } + sleep 0.1 + done +} + select_attr() { printf '.logs[0].events[] | select(.type == "%s").attributes[] | select(.key == "%s").value' "$1" "$2" } assert_success() { + local tx_status local code - code="$(jq -r '.code' /dev/null + ((seq+=1)) +fi +if [[ "$(get_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" -lt 10000 ]]; then + gaiad tx ibc-transfer transfer "transfer" "channel-0" "$SECOND_WALLET_ADDR_NEUTRON" 10000uatom --from demowallet1 "${gtx[@]}" -s "$seq" >/dev/null +fi +((attempts=200)) +while [[ "$(get_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" -lt 20000 ]]; do + echo -n "." + ((attempts=attempts-1)) || { + echo "seems like IBC transfer failed" 1>&2 + exit 1 + } + sleep 0.1 +done +while [[ "$(get_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" -lt 10000 ]]; do + echo -n "." + ((attempts=attempts-1)) || { + echo "seems like IBC transfer failed" 1>&2 + exit 1 + } + sleep 0.1 done echo " done" -main_balance_before="$(get_balance "$MAIN_WALLET_ADDR" "$IBC_DENOM")" -second_balance_before="$(get_balance "$SECOND_WALLET_ADDR" "$IBC_DENOM")" +main_balance_before="$(get_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" +second_balance_before="$(get_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" echo "Balance of main wallet: $main_balance_before" echo "Balance of second wallet: $second_balance_before" echo -code_id="$(neutrond tx wasm store "$CONTRACT_PATH" --from "$MAIN_WALLET" "${ntx[@]}" | jq -r "$(select_attr "store_code" "code_id")")" +code_id="$(neutrond tx wasm store "$CONTRACT_PATH" --from "$MAIN_WALLET" "${ntx[@]}" | wait_ntx | jq -r "$(select_attr "store_code" "code_id")")" echo "Code ID: $code_id" -msg="$(printf '{"bridged_denom":"%s","canonical_subdenom":"steth"}' "$IBC_DENOM")" -contract_address="$(neutrond tx wasm instantiate "$code_id" "$msg" --amount 1000000untrn --no-admin --label steth --from "$MAIN_WALLET" "${ntx[@]}" | jq -r "$(select_attr "instantiate" "_contract_address")")" +msg="$(printf '{"bridged_denom":"%s","canonical_subdenom":"steth"}' "$ATOM_ON_NEUTRON_IBC_DENOM")" +contract_address="$(neutrond tx wasm instantiate "$code_id" "$msg" --amount 1000000untrn --no-admin --label steth --from "$MAIN_WALLET" "${ntx[@]}" | wait_ntx | jq -r "$(select_attr "instantiate" "_contract_address")")" echo "Contract address: $contract_address" echo echo "Mint 1000 steth to main account" -neutrond tx wasm execute "$contract_address" '{"mint":{}}' --amount "1000$IBC_DENOM" --from "$MAIN_WALLET" "${ntx[@]}" | assert_success -assert_balance "$MAIN_WALLET_ADDR" "factory/$contract_address/steth" "1000" -assert_balance "$contract_address" "$IBC_DENOM" "1000" +neutrond tx wasm execute "$contract_address" '{"mint":{}}' --amount "1000$ATOM_ON_NEUTRON_IBC_DENOM" --from "$MAIN_WALLET" "${ntx[@]}" | wait_ntx | assert_success +assert_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "1000" +assert_balance_neutron "$contract_address" "$ATOM_ON_NEUTRON_IBC_DENOM" "1000" echo echo "Mint 2000 more steth to main account" -neutrond tx wasm execute "$contract_address" '{"mint":{}}' --amount "2000$IBC_DENOM" --from "$MAIN_WALLET" "${ntx[@]}" | assert_success -assert_balance "$MAIN_WALLET_ADDR" "factory/$contract_address/steth" "3000" -assert_balance "$contract_address" "$IBC_DENOM" "3000" +neutrond tx wasm execute "$contract_address" '{"mint":{}}' --amount "2000$ATOM_ON_NEUTRON_IBC_DENOM" --from "$MAIN_WALLET" "${ntx[@]}" | wait_ntx | assert_success +assert_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "3000" +assert_balance_neutron "$contract_address" "$ATOM_ON_NEUTRON_IBC_DENOM" "3000" echo echo "Mint 1500 steth to second account" -neutrond tx wasm execute "$contract_address" '{"mint":{}}' --amount "1500$IBC_DENOM" --from "$SECOND_WALLET" "${ntx[@]}" | assert_success -assert_balance "$MAIN_WALLET_ADDR" "factory/$contract_address/steth" "3000" -assert_balance "$SECOND_WALLET_ADDR" "factory/$contract_address/steth" "1500" -assert_balance "$contract_address" "$IBC_DENOM" "4500" +neutrond tx wasm execute "$contract_address" '{"mint":{}}' --amount "1500$ATOM_ON_NEUTRON_IBC_DENOM" --from "$SECOND_WALLET" "${ntx[@]}" | wait_ntx | assert_success +assert_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "3000" +assert_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "1500" +assert_balance_neutron "$contract_address" "$ATOM_ON_NEUTRON_IBC_DENOM" "4500" echo -echo "Burn 200 steth from main account and send $IBC_DENOM to second account" -msg="$(printf '{"burn":{"receiver":"%s"}}' "$SECOND_WALLET_ADDR")" -neutrond tx wasm execute "$contract_address" "$msg" --amount "200factory/$contract_address/steth" --from "$MAIN_WALLET" "${ntx[@]}" | assert_success -assert_balance "$MAIN_WALLET_ADDR" "factory/$contract_address/steth" "2800" -assert_balance "$SECOND_WALLET_ADDR" "factory/$contract_address/steth" "1500" -assert_balance "$contract_address" "$IBC_DENOM" "4300" +echo "Burn 200 steth from main account and send $ATOM_ON_NEUTRON_IBC_DENOM to second account" +msg="$(printf '{"burn":{"receiver":"%s"}}' "$SECOND_WALLET_ADDR_NEUTRON")" +neutrond tx wasm execute "$contract_address" "$msg" --amount "200factory/$contract_address/steth" --from "$MAIN_WALLET" "${ntx[@]}" | wait_ntx | assert_success +assert_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "2800" +assert_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "1500" +assert_balance_neutron "$contract_address" "$ATOM_ON_NEUTRON_IBC_DENOM" "4300" echo echo "Send 300 steth from main account to second account" -neutrond tx bank send "$MAIN_WALLET" "$SECOND_WALLET_ADDR" "300factory/$contract_address/steth" "${ntx[@]}" | assert_success -assert_balance "$MAIN_WALLET_ADDR" "factory/$contract_address/steth" "2500" -assert_balance "$SECOND_WALLET_ADDR" "factory/$contract_address/steth" "1800" -assert_balance "$contract_address" "$IBC_DENOM" "4300" +neutrond tx bank send "$MAIN_WALLET" "$SECOND_WALLET_ADDR_NEUTRON" "300factory/$contract_address/steth" "${ntx[@]}" | wait_ntx | assert_success +assert_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "2500" +assert_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "1800" +assert_balance_neutron "$contract_address" "$ATOM_ON_NEUTRON_IBC_DENOM" "4300" echo echo "Burn 1800 steth from second account" -neutrond tx wasm execute "$contract_address" '{"burn":{}}' --amount "1800factory/$contract_address/steth" --from "$SECOND_WALLET" "${ntx[@]}" | assert_success -assert_balance "$MAIN_WALLET_ADDR" "factory/$contract_address/steth" "2500" -assert_balance "$SECOND_WALLET_ADDR" "factory/$contract_address/steth" "0" -assert_balance "$contract_address" "$IBC_DENOM" "2500" +neutrond tx wasm execute "$contract_address" '{"burn":{}}' --amount "1800factory/$contract_address/steth" --from "$SECOND_WALLET" "${ntx[@]}" | wait_ntx | assert_success +assert_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "2500" +assert_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "factory/$contract_address/steth" "0" +assert_balance_neutron "$contract_address" "$ATOM_ON_NEUTRON_IBC_DENOM" "2500" echo -main_balance_after="$(get_balance "$MAIN_WALLET_ADDR" "$IBC_DENOM")" -second_balance_after="$(get_balance "$SECOND_WALLET_ADDR" "$IBC_DENOM")" +main_balance_after="$(get_balance_neutron "$MAIN_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" +second_balance_after="$(get_balance_neutron "$SECOND_WALLET_ADDR_NEUTRON" "$ATOM_ON_NEUTRON_IBC_DENOM")" echo "Balance of main wallet: $main_balance_after" echo "Balance of second wallet: $second_balance_after" @@ -164,14 +218,14 @@ second_diff="$(python -c "print(${second_balance_after}-${second_balance_before} echo if [[ $main_diff -eq -3000 ]]; then - echo "[OK] Main wallet has lost 3000 $IBC_DENOM" + echo "[OK] Main wallet has lost 3000 $ATOM_ON_NEUTRON_IBC_DENOM" else - echo "[FAIL] Main wallet $IBC_DENOM diff: $main_diff, expected diff: -3000" + echo "[FAIL] Main wallet $ATOM_ON_NEUTRON_IBC_DENOM diff: $main_diff, expected diff: -3000" exit 1 fi if [[ $second_diff -eq 500 ]]; then - echo "[OK] Second wallet has earned 500 $IBC_DENOM" + echo "[OK] Second wallet has earned 500 $ATOM_ON_NEUTRON_IBC_DENOM" else - echo "[FAIL] Second wallet $IBC_DENOM diff: $second_diff, expected diff: 500" + echo "[FAIL] Second wallet $ATOM_ON_NEUTRON_IBC_DENOM diff: $second_diff, expected diff: 500" exit 1 fi diff --git a/rust-toolchain.toml b/rust-toolchain.toml index aa46426..8142c30 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.71.0" +channel = "1.73.0" diff --git a/scripts/build_release.sh b/scripts/build_release.sh deleted file mode 100755 index 988c45a..0000000 --- a/scripts/build_release.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -set -e - -docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/workspace-optimizer:0.14.0