From 40760f3ac1d6b3b927797030a5b4428b71f41c35 Mon Sep 17 00:00:00 2001 From: swelf Date: Mon, 11 Nov 2024 20:02:02 +0300 Subject: [PATCH 1/9] added dynamicfee ccv globalfee params permissions --- .github/workflows/build.yml | 4 +- .github/workflows/tests.yml | 6 +- Cargo.lock | 568 +++++++- Makefile | 2 +- .../dao/neutron-chain-manager/Cargo.toml | 5 +- .../schema/neutron-chain-manager.json | 845 +++++++----- .../schema/raw/execute.json | 691 +++++----- .../schema/raw/response_to_strategies.json | 152 +++ .../src/adminmodule_module_types.rs | 2 - .../dao/neutron-chain-manager/src/contract.rs | 326 +++-- .../src/cron_module_types.rs | 41 - .../src/dex_module_types.rs | 42 - .../dao/neutron-chain-manager/src/lib.rs | 4 - .../dao/neutron-chain-manager/src/msg.rs | 113 ++ .../src/testing/mock_querier.rs | 163 ++- .../neutron-chain-manager/src/testing/mod.rs | 1 + .../src/testing/tests.rs | 1148 ++++++++++++++++- .../src/tokenfactory_module_types.rs | 48 - packages/cw-paginate/src/lib.rs | 2 +- rust-toolchain.toml | 2 +- 20 files changed, 3214 insertions(+), 951 deletions(-) delete mode 100644 contracts/dao/neutron-chain-manager/src/adminmodule_module_types.rs delete mode 100644 contracts/dao/neutron-chain-manager/src/cron_module_types.rs delete mode 100644 contracts/dao/neutron-chain-manager/src/dex_module_types.rs delete mode 100644 contracts/dao/neutron-chain-manager/src/tokenfactory_module_types.rs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 024b8968..f39ff827 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: inputs: toolchain: description: 'Default Rust Toolchain' - default: "1.73.0" + default: "1.78.0" required: true type: string target: @@ -31,7 +31,7 @@ on: type: string env: - TOOLCHAIN: ${{ inputs.toolchain || '1.73.0' }} + TOOLCHAIN: ${{ inputs.toolchain || '1.78.0' }} TARGET: ${{ inputs.target || 'wasm32-unknown-unknown' }} REF: ${{ github.event_name == 'push' && github.ref || inputs.branch || 'main' }} ID: ${{ inputs.id || 'scheduled' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 62f2494f..12551263 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.73.0 + toolchain: 1.78.0 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.73.0 + toolchain: 1.78.0 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.73.0 + toolchain: 1.78.0 profile: minimal - run: cargo fetch --verbose - run: cargo build diff --git a/Cargo.lock b/Cargo.lock index f1c90522..ed3d412c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,6 +13,24 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -34,6 +52,127 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rayon", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", + "rayon", +] + [[package]] name = "astroport" version = "2.0.0" @@ -247,6 +386,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +[[package]] +name = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + [[package]] name = "block-buffer" version = "0.9.0" @@ -273,9 +418,9 @@ checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d" [[package]] name = "bnum" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f" +checksum = "3e31ea183f6ee62ac8b8a8cf7feddd766317adfb13ff469de57ce033efd6a790" [[package]] name = "bumpalo" @@ -346,6 +491,12 @@ dependencies = [ "tendermint-proto", ] +[[package]] +name = "cosmwasm-core" +version = "2.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6ceb8624260d0d3a67c4e1a1d43fc7e9406720afbcb124521501dd138f90aa" + [[package]] name = "cosmwasm-crypto" version = "1.5.2" @@ -354,7 +505,7 @@ checksum = "8ed6aa9f904de106fa16443ad14ec2abe75e94ba003bb61c681c0e43d4c58d2a" dependencies = [ "digest 0.10.7", "ecdsa 0.16.9", - "ed25519-zebra", + "ed25519-zebra 3.1.0", "k256 0.13.3", "rand_core 0.6.4", "thiserror", @@ -362,14 +513,24 @@ dependencies = [ [[package]] name = "cosmwasm-crypto" -version = "2.0.4" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7a339f6b59ff7ad4ae05a70512a4f3c19bf8fcc845d46bfef90f4ec0810f72c" +checksum = "4125381e5fd7fefe9f614640049648088015eca2b60d861465329a5d87dfa538" dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "cosmwasm-core", "digest 0.10.7", - "ed25519-zebra", + "ecdsa 0.16.9", + "ed25519-zebra 4.0.3", "k256 0.13.3", + "num-traits", + "p256", "rand_core 0.6.4", + "rayon", + "sha2 0.10.8", "thiserror", ] @@ -384,11 +545,13 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "2.0.4" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d3bfea6af94a83880fb05478135ed0c256d9a2fcde58c595a10d64dcb9c925d" +checksum = "1b5658b1dc64e10b56ae7a449f678f96932a96f6cfad1769d608d1d1d656480a" dependencies = [ - "syn 1.0.109", + "proc-macro2", + "quote", + "syn 2.0.68", ] [[package]] @@ -406,11 +569,11 @@ dependencies = [ [[package]] name = "cosmwasm-schema" -version = "2.0.4" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "101d0739564bd34cba9b84bf73665f0822487ae3b29b2dd59930608ed3aafd43" +checksum = "f86b4d949b6041519c58993a73f4bbfba8083ba14f7001eae704865a09065845" dependencies = [ - "cosmwasm-schema-derive 2.0.4", + "cosmwasm-schema-derive 2.1.4", "schemars", "serde", "serde_json", @@ -430,13 +593,13 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "2.0.4" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4be75f60158478da2c5d319ed59295bca1687ad50c18215a0485aa91a995ea" +checksum = "c8ef1b5835a65fcca3ab8b9a02b4f4dacc78e233a5c2f20b270efb9db0666d12" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.68", ] [[package]] @@ -446,7 +609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad011ae7447188e26e4a7dbca2fcd0fc186aa21ae5c86df0503ea44c78f9e469" dependencies = [ "base64 0.21.7", - "bech32", + "bech32 0.9.1", "bnum 0.8.1", "cosmwasm-crypto 1.5.2", "cosmwasm-derive 1.5.5", @@ -463,18 +626,19 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "2.0.4" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded932165de44cd0717979c34fc3b84d8e8066b8dde4f5bd78f96a643b090f90" +checksum = "70eb7ab0c1e99dd6207496963ba2a457c4128ac9ad9c72a83f8d9808542b849b" dependencies = [ - "base64 0.21.7", - "bech32", - "bnum 0.10.0", - "cosmwasm-crypto 2.0.4", - "cosmwasm-derive 2.0.4", - "derivative", - "forward_ref", + "base64 0.22.1", + "bech32 0.11.0", + "bnum 0.11.0", + "cosmwasm-core", + "cosmwasm-crypto 2.1.4", + "cosmwasm-derive 2.1.4", + "derive_more", "hex", + "rand_core 0.6.4", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -525,6 +689,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crunchy" version = "0.2.2" @@ -578,6 +767,33 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "cw-address-like" version = "1.0.4" @@ -812,7 +1028,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1" dependencies = [ - "cosmwasm-std 2.0.4", + "cosmwasm-std 2.1.4", "schemars", "serde", ] @@ -880,8 +1096,8 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec" dependencies = [ - "cosmwasm-schema 2.0.4", - "cosmwasm-std 2.0.4", + "cosmwasm-schema 2.1.4", + "cosmwasm-std 2.1.4", "schemars", "serde", "thiserror", @@ -946,8 +1162,8 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b04852cd38f044c0751259d5f78255d07590d136b8a86d4e09efdd7666bd6d27" dependencies = [ - "cosmwasm-schema 2.0.4", - "cosmwasm-std 2.0.4", + "cosmwasm-schema 2.1.4", + "cosmwasm-std 2.1.4", "cw-storage-plus 2.0.0", "schemars", "semver", @@ -1188,7 +1404,7 @@ dependencies = [ "cw721 0.18.0", "cwd-interface", "cwd-macros", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "schemars", "serde", @@ -1270,7 +1486,7 @@ dependencies = [ "cwd-proposal-hooks", "cwd-proposal-single", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1292,7 +1508,7 @@ dependencies = [ "cwd-proposal-single", "cwd-voting", "neutron-dao-pre-propose-overrule", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-timelock-single", "schemars", @@ -1319,7 +1535,7 @@ dependencies = [ "cwd-proposal-hooks", "cwd-proposal-single", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -1364,7 +1580,7 @@ dependencies = [ "cwd-testing", "cwd-vote-hooks", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-vault", "neutron-voting-registry", "rand", @@ -1403,7 +1619,7 @@ dependencies = [ "cwd-testing", "cwd-vote-hooks", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-vault", "neutron-voting-registry", @@ -1427,7 +1643,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-security-subdao-pre-propose", "neutron-subdao-core", "neutron-subdao-proposal-single", @@ -1454,7 +1670,7 @@ dependencies = [ "cwd-macros", "cwd-voting", "exec-control", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1477,7 +1693,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1513,7 +1729,7 @@ dependencies = [ "cwd-subdao-pre-propose-single", "cwd-vote-hooks", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1542,7 +1758,7 @@ dependencies = [ "cwd-proposal-single", "cwd-voting", "neutron-dao-pre-propose-overrule", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "neutron-subdao-core", "neutron-subdao-pre-propose-single", "neutron-subdao-proposal-single", @@ -1604,7 +1820,7 @@ dependencies = [ "cwd-core", "cwd-interface", "cwd-macros", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", "thiserror", @@ -1686,6 +1902,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "unicode-xid", +] + [[package]] name = "digest" version = "0.9.0" @@ -1745,13 +1982,22 @@ dependencies = [ "spki 0.7.3", ] +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "signature 2.2.0", +] + [[package]] name = "ed25519-zebra" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 3.2.0", "hashbrown 0.12.3", "hex", "rand_core 0.6.4", @@ -1760,6 +2006,21 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ed25519-zebra" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" +dependencies = [ + "curve25519-dalek 4.1.3", + "ed25519", + "hashbrown 0.14.5", + "hex", + "rand_core 0.6.4", + "sha2 0.10.8", + "zeroize", +] + [[package]] name = "either" version = "1.13.0" @@ -1841,6 +2102,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "flex-error" version = "0.4.4" @@ -1912,7 +2179,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.8", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.11", ] [[package]] @@ -1920,6 +2196,10 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", +] [[package]] name = "heck" @@ -2158,8 +2438,8 @@ name = "neutron-chain-manager" version = "0.4.0" dependencies = [ "anyhow", - "cosmwasm-schema 2.0.4", - "cosmwasm-std 2.0.4", + "cosmwasm-schema 2.1.4", + "cosmwasm-std 2.1.4", "cosmwasm-storage", "cw-controllers", "cw-multi-test", @@ -2169,7 +2449,8 @@ dependencies = [ "cw2 2.0.0", "cwd-interface", "cwd-macros", - "neutron-sdk 0.10.0 (git+https://github.com/neutron-org/neutron-sdk.git?branch=main)", + "neutron-sdk 0.11.0", + "neutron-std", "prost 0.9.0", "schemars", "serde", @@ -2253,7 +2534,7 @@ dependencies = [ "cw20 0.13.4", "cwd-macros", "exec-control", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", "thiserror", @@ -2265,7 +2546,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26fb513aae0c82b3185228e96664d8312e79c3aa763f6ebdc70cf4b8d513d533" dependencies = [ - "bech32", + "bech32 0.9.1", "cosmos-sdk-proto", "cosmwasm-schema 1.5.5", "cosmwasm-std 1.5.2", @@ -2283,18 +2564,21 @@ dependencies = [ [[package]] name = "neutron-sdk" -version = "0.10.0" -source = "git+https://github.com/neutron-org/neutron-sdk.git?branch=main#6043a8bd412e2213f0b6a31f90b852685c8792cc" +version = "0.11.0" +source = "git+https://github.com/neutron-org/neutron-sdk.git?branch=main#38197fb61ca4180ca695a5d215d31309813046d6" dependencies = [ - "bech32", + "bech32 0.9.1", + "chrono", "cosmos-sdk-proto", - "cosmwasm-schema 2.0.4", - "cosmwasm-std 2.0.4", + "cosmwasm-schema 2.1.4", + "cosmwasm-std 2.1.4", + "neutron-std-derive 0.20.1 (git+https://github.com/neutron-org/neutron-sdk.git?branch=main)", "prost 0.12.6", "prost-types", "protobuf 3.3.0", "schemars", "serde", + "serde-cw-value", "serde-json-wasm 1.0.1", "serde_json", "speedate", @@ -2311,11 +2595,59 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", ] +[[package]] +name = "neutron-std" +version = "4.2.2-rc" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#431b87f7f89797450f0ca2dd413b27e713335235" +dependencies = [ + "bech32 0.9.1", + "chrono", + "cosmos-sdk-proto", + "cosmwasm-schema 2.1.4", + "cosmwasm-std 2.1.4", + "neutron-std-derive 0.20.1 (git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf)", + "prost 0.12.6", + "prost-types", + "protobuf 3.3.0", + "schemars", + "serde", + "serde-cw-value", + "serde-json-wasm 1.0.1", + "serde_json", + "speedate", + "tendermint-proto", + "thiserror", +] + +[[package]] +name = "neutron-std-derive" +version = "0.20.1" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#431b87f7f89797450f0ca2dd413b27e713335235" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "neutron-std-derive" +version = "0.20.1" +source = "git+https://github.com/neutron-org/neutron-sdk.git?branch=main#38197fb61ca4180ca695a5d215d31309813046d6" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types", + "quote", + "syn 1.0.109", +] + [[package]] name = "neutron-subdao-core" version = "0.1.1" @@ -2327,7 +2659,7 @@ dependencies = [ "cwd-interface", "cwd-macros", "exec-control", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", "thiserror", @@ -2341,7 +2673,7 @@ dependencies = [ "cwd-interface", "cwd-pre-propose-base", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -2357,7 +2689,7 @@ dependencies = [ "cwd-interface", "cwd-macros", "cwd-voting", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -2368,7 +2700,7 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema 1.5.5", "cosmwasm-std 1.5.2", - "neutron-sdk 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neutron-sdk 0.10.0", "schemars", "serde", ] @@ -2451,6 +2783,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -2468,6 +2810,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2489,6 +2840,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "primeorder", + "sha2 0.10.8", +] + [[package]] name = "paste" version = "1.0.15" @@ -2527,6 +2890,15 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve 0.13.8", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -2676,6 +3048,26 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "rfc6979" version = "0.3.1" @@ -2697,6 +3089,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustversion" version = "1.0.17" @@ -2776,6 +3177,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-cw-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4" +dependencies = [ + "serde", +] + [[package]] name = "serde-json-wasm" version = "0.5.2" @@ -3140,6 +3550,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "version_check" version = "0.9.4" @@ -3433,8 +3849,42 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] diff --git a/Makefile b/Makefile index 7523cdbe..fc2cea35 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,6 @@ compile: --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 + cosmwasm/workspace-optimizer:0.16.0 build: schema clippy fmt test compile check_contracts diff --git a/contracts/dao/neutron-chain-manager/Cargo.toml b/contracts/dao/neutron-chain-manager/Cargo.toml index c1a94de6..249e8680 100644 --- a/contracts/dao/neutron-chain-manager/Cargo.toml +++ b/contracts/dao/neutron-chain-manager/Cargo.toml @@ -14,7 +14,7 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -cosmwasm-schema = { version = "2.0.4" } +cosmwasm-schema = { version = "2.1.4" } cosmwasm-std = { version = "2.0.4" } cosmwasm-storage = { version = "1.5.2" } cw-controllers = "1.1.0" @@ -28,7 +28,8 @@ schemars = "0.8.8" serde = { version = "1.0.175", default-features = false, features = ["derive"] } serde_with = { version = "3.7.0", features = ["json"] } thiserror = { version = "1.0" } -neutron-sdk = { git = "https://github.com/neutron-org/neutron-sdk.git", branch = "main" } +neutron-std = { git = "https://github.com/neutron-org/neutron-std.git", branch = "feat/add-interchain-security-protobuf" } +neutron-sdk = { git = "https://github.com/neutron-org/neutron-sdk.git", branch = "main" } serde-json-wasm = "1.0.1" prost = "0.9.0" diff --git a/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json b/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json index f681c60f..f818af9e 100644 --- a/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json +++ b/contracts/dao/neutron-chain-manager/schema/neutron-chain-manager.json @@ -1,6 +1,6 @@ { "contract_name": "neutron-chain-manager", - "contract_version": "0.3.0", + "contract_version": "0.4.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -124,7 +124,7 @@ "additionalProperties": false }, { - "description": "Depreacteed Proposal to upgrade IBC client", + "description": "Deprecated. Proposal to upgrade IBC client", "deprecated": true, "type": "object", "required": [ @@ -264,6 +264,23 @@ } ] }, + "AnyMsg": { + "description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, "BankMsg": { "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", "oneOf": [ @@ -290,7 +307,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -314,7 +332,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -325,6 +344,62 @@ "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, + "CCVUpdateParamsPermission": { + "type": "object", + "required": [ + "blocks_per_distribution_transmission", + "ccv_timeout_period", + "consumer_redistribution_fraction", + "distribution_transmission_channel", + "historical_entries", + "provider_fee_pool_addr_str", + "provider_reward_denoms", + "retry_delay_period", + "reward_denoms", + "soft_opt_out_threshold", + "transfer_timeout_period", + "unbonding_period" + ], + "properties": { + "blocks_per_distribution_transmission": { + "type": "boolean" + }, + "ccv_timeout_period": { + "type": "boolean" + }, + "consumer_redistribution_fraction": { + "type": "boolean" + }, + "distribution_transmission_channel": { + "type": "boolean" + }, + "historical_entries": { + "type": "boolean" + }, + "provider_fee_pool_addr_str": { + "type": "boolean" + }, + "provider_reward_denoms": { + "type": "boolean" + }, + "retry_delay_period": { + "type": "boolean" + }, + "reward_denoms": { + "type": "boolean" + }, + "soft_opt_out_threshold": { + "type": "boolean" + }, + "transfer_timeout_period": { + "type": "boolean" + }, + "unbonding_period": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "CancelSoftwareUpgradeProposal": { "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", "deprecated": true, @@ -342,7 +417,15 @@ "description": "*title** is a text title of proposal. Non unique.", "type": "string" } - } + }, + "additionalProperties": false + }, + "ChannelOrdering": { + "type": "string", + "enum": [ + "ORDER_ORDERED", + "ORDER_UNORDERED" + ] }, "ClearAdminProposal": { "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", @@ -366,7 +449,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "ClientUpdateProposal": { "description": "ClientUpdateProposal defines the struct for client update proposal.", @@ -395,7 +479,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "Coin": { "type": "object", @@ -410,7 +495,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_NeutronMsg": { "oneOf": [ @@ -439,39 +525,14 @@ "additionalProperties": false }, { - "description": "This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", - "deprecated": true, + "description": "`CosmosMsg::Any` is the replaces the \"stargate message\" – a message wrapped in a [protobuf Any](https://protobuf.dev/programming-guides/proto3/#any) that is suppored by the chain. It behaves the same as `CosmosMsg::Stargate` but has a better name and slightly improved syntax.\n\nThis is feature-gated at compile time with `cosmwasm_2_0` because a chain running CosmWasm < 2.0 cannot process this.", "type": "object", "required": [ - "stargate" + "any" ], "properties": { - "stargate": { - "type": "object", - "required": [ - "type_url", - "value" - ], - "properties": { - "type_url": { - "type": "string" - }, - "value": { - "$ref": "#/definitions/Binary" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "ibc" - ], - "properties": { - "ibc": { - "$ref": "#/definitions/IbcMsg" + "any": { + "$ref": "#/definitions/AnyMsg" } }, "additionalProperties": false @@ -487,18 +548,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "gov" - ], - "properties": { - "gov": { - "$ref": "#/definitions/GovMsg" - } - }, - "additionalProperties": false } ] }, @@ -557,18 +606,26 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false }, - "DepositOption": { + "DepositOptions": { "type": "object", - "required": [ - "disable_swap" - ], "properties": { - "disable_swap": { - "type": "boolean" + "disable_autoswap": { + "type": [ + "boolean", + "null" + ] + }, + "fail_tx_on_bel": { + "type": [ + "boolean", + "null" + ] } - } + }, + "additionalProperties": false }, "DexMsg": { "oneOf": [ @@ -619,7 +676,7 @@ "description": "Additional deposit options", "type": "array", "items": { - "$ref": "#/definitions/DepositOption" + "$ref": "#/definitions/DepositOptions" } }, "receiver": { @@ -642,7 +699,8 @@ "description": "Denom for the opposing side of the deposit", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -701,7 +759,8 @@ "description": "Denom for the opposing side of the deposit", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -782,7 +841,8 @@ "description": "Token being “bought”", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -804,7 +864,8 @@ "description": "TrancheKey for the target limit order", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -826,7 +887,8 @@ "description": "TrancheKey for the target limit order", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -879,7 +941,8 @@ "$ref": "#/definitions/MultiHopRoute" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -910,42 +973,37 @@ }, "additionalProperties": false }, - "GovMsg": { - "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", - "oneOf": [ - { - "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", - "type": "object", - "required": [ - "vote" - ], - "properties": { - "vote": { - "type": "object", - "required": [ - "option", - "proposal_id" - ], - "properties": { - "option": { - "description": "The vote option.\n\nThis used to be called \"vote\", but was changed for consistency with Cosmos SDK.", - "allOf": [ - { - "$ref": "#/definitions/VoteOption" - } - ] - }, - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false + "DynamicFeesUpdateParamsPermission": { + "type": "object", + "required": [ + "ntrn_prices" + ], + "properties": { + "ntrn_prices": { + "type": "boolean" } - ] + }, + "additionalProperties": false + }, + "GlobalfeeUpdateParamsPermission": { + "type": "object", + "required": [ + "bypass_min_fee_msg_types", + "max_total_bypass_min_fee_msg_gas_usage", + "minimum_gas_prices" + ], + "properties": { + "bypass_min_fee_msg_types": { + "type": "boolean" + }, + "max_total_bypass_min_fee_msg_gas_usage": { + "type": "boolean" + }, + "minimum_gas_prices": { + "type": "boolean" + } + }, + "additionalProperties": false }, "IbcFee": { "description": "IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. Unused fee kind will be returned back to message sender. Please refer to these links for more information: IBC transaction structure - General mechanics of fee payments - ", @@ -977,167 +1035,8 @@ "$ref": "#/definitions/Coin" } } - } - }, - "IbcMsg": { - "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", - "oneOf": [ - { - "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", - "type": "object", - "required": [ - "transfer" - ], - "properties": { - "transfer": { - "type": "object", - "required": [ - "amount", - "channel_id", - "timeout", - "to_address" - ], - "properties": { - "amount": { - "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", - "allOf": [ - { - "$ref": "#/definitions/Coin" - } - ] - }, - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "memo": { - "description": "An optional memo. See the blog post [\"Moving Beyond Simple Token Transfers\"](https://medium.com/the-interchain-foundation/moving-beyond-simple-token-transfers-d42b2b1dc29b) for more information.\n\nThere is no difference between setting this to `None` or an empty string.\n\nThis field is only supported on chains with CosmWasm >= 2.0 and silently ignored on older chains. If you need support for both 1.x and 2.x chain with the same codebase, it is recommended to use `CosmosMsg::Stargate` with a custom MsgTransfer protobuf encoder instead.", - "type": [ - "string", - "null" - ] - }, - "timeout": { - "description": "when packet times out, measured on remote chain", - "allOf": [ - { - "$ref": "#/definitions/IbcTimeout" - } - ] - }, - "to_address": { - "description": "address on the remote chain to receive these tokens", - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "data", - "timeout" - ], - "properties": { - "channel_id": { - "type": "string" - }, - "data": { - "$ref": "#/definitions/Binary" - }, - "timeout": { - "description": "when packet times out, measured on remote chain", - "allOf": [ - { - "$ref": "#/definitions/IbcTimeout" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", - "type": "object", - "required": [ - "close_channel" - ], - "properties": { - "close_channel": { - "type": "object", - "required": [ - "channel_id" - ], - "properties": { - "channel_id": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - }, - "IbcTimeout": { - "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", - "type": "object", - "properties": { - "block": { - "anyOf": [ - { - "$ref": "#/definitions/IbcTimeoutBlock" - }, - { - "type": "null" - } - ] - }, - "timestamp": { - "anyOf": [ - { - "$ref": "#/definitions/Timestamp" - }, - { - "type": "null" - } - ] - } - } - }, - "IbcTimeoutBlock": { - "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", - "type": "object", - "required": [ - "height", - "revision" - ], - "properties": { - "height": { - "description": "block height after which the packet times out. the height within the given revision", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "revision": { - "description": "the version that the client is currently on (e.g. after resetting the chain this could increment 1 as height drops to 0)", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } + }, + "additionalProperties": false }, "KVKey": { "description": "Describes a KV key for which you want to get value from the storage on remote chain", @@ -1159,7 +1058,8 @@ "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", "type": "string" } - } + }, + "additionalProperties": false }, "LimitOrderType": { "oneOf": [ @@ -1171,7 +1071,7 @@ ] }, { - "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` (https://github.com/neutron-org/neutron/blob/main/x/dex/types/errors.go#L107 ErrGoodTilOrderWithoutExpiration).", + "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` ( ErrGoodTilOrderWithoutExpiration).", "type": "string", "enum": [ "FILL_OR_KILL" @@ -1216,7 +1116,8 @@ "description": "*msg** is a contract call message", "type": "string" } - } + }, + "additionalProperties": false }, "MultiHopRoute": { "type": "object", @@ -1230,7 +1131,8 @@ "type": "string" } } - } + }, + "additionalProperties": false }, "NeutronMsg": { "description": "A number of Custom messages that can call into the Neutron bindings.", @@ -1257,6 +1159,17 @@ "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" }, + "ordering": { + "description": "**ordering** is an order of channel. Can be ordered or unordered. Set to ordered if not specified.", + "anyOf": [ + { + "$ref": "#/definitions/ChannelOrdering" + }, + { + "type": "null" + } + ] + }, "register_fee": { "description": "*register_fee** is a fees required to be payed to register interchain account", "type": [ @@ -1267,7 +1180,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1323,7 +1237,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1370,7 +1285,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1389,7 +1305,7 @@ ], "properties": { "new_keys": { - "description": "*new_keys** is the new query keys to retrive.", + "description": "*new_keys** is the new query keys to retrieve.", "type": [ "array", "null" @@ -1420,7 +1336,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1444,7 +1361,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1499,7 +1417,8 @@ "token": { "$ref": "#/definitions/Coin" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1520,7 +1439,8 @@ "admin_proposal": { "$ref": "#/definitions/AdminProposal" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1541,7 +1461,8 @@ "subdenom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1566,7 +1487,8 @@ "new_admin_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1595,7 +1517,8 @@ "mint_to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1625,7 +1548,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1650,7 +1574,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1683,7 +1608,8 @@ "transfer_to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1743,7 +1669,8 @@ "description": "**uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that the document didn't change. Optional.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1758,11 +1685,16 @@ "add_schedule": { "type": "object", "required": [ + "execution_stage", "msgs", "name", "period" ], "properties": { + "execution_stage": { + "description": "execution stage where schedule will be executed", + "type": "string" + }, "msgs": { "description": "list of cosmwasm messages to be executed", "type": "array", @@ -1780,7 +1712,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1801,7 +1734,8 @@ "name": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1824,7 +1758,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1865,7 +1800,8 @@ "description": "*value** is a new value for given parameter. Non unique.", "type": "string" } - } + }, + "additionalProperties": false }, "ParamChangePermission": { "type": "object", @@ -1906,7 +1842,8 @@ "description": "*title** is a text title of proposal. Non unique.", "type": "string" } - } + }, + "additionalProperties": false }, "ParamPermission": { "type": "object", @@ -1974,6 +1911,42 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "update_dynamicfees_params_permission" + ], + "properties": { + "update_dynamicfees_params_permission": { + "$ref": "#/definitions/DynamicFeesUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_globalfee_params_permission" + ], + "properties": { + "update_globalfee_params_permission": { + "$ref": "#/definitions/GlobalfeeUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_c_c_v_params_permission" + ], + "properties": { + "update_c_c_v_params_permission": { + "$ref": "#/definitions/CCVUpdateParamsPermission" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -1985,6 +1958,18 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "software_upgrade_permission" + ], + "properties": { + "software_upgrade_permission": { + "$ref": "#/definitions/SoftwareUpgradePermission" + } + }, + "additionalProperties": false } ] }, @@ -2015,7 +2000,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "Plan": { "description": "Plan defines the struct for planned upgrade.", @@ -2039,7 +2025,8 @@ "description": "*name** is a name for the upgrade", "type": "string" } - } + }, + "additionalProperties": false }, "PrecDec": { "type": "object", @@ -2050,7 +2037,8 @@ "i": { "type": "string" } - } + }, + "additionalProperties": false }, "ProposalExecuteMessage": { "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", @@ -2063,7 +2051,8 @@ "description": "*message** is a json representing an sdk message passed to admin module to execute.", "type": "string" } - } + }, + "additionalProperties": false }, "ProtobufAny": { "description": "Type for wrapping any protobuf message", @@ -2085,7 +2074,8 @@ } ] } - } + }, + "additionalProperties": false }, "RequestPacketTimeoutHeight": { "type": "object", @@ -2106,7 +2096,24 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false + }, + "SoftwareUpgradePermission": { + "type": "object", + "required": [ + "cancel_upgrade", + "upgrade" + ], + "properties": { + "cancel_upgrade": { + "type": "boolean" + }, + "upgrade": { + "type": "boolean" + } + }, + "additionalProperties": false }, "SoftwareUpgradeProposal": { "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", @@ -2134,7 +2141,8 @@ "description": "*title** is a text title of proposal. Non unique.", "type": "string" } - } + }, + "additionalProperties": false }, "StrategyMsg": { "oneOf": [ @@ -2192,15 +2200,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } - }, - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", - "allOf": [ - { - "$ref": "#/definitions/Uint64" - } - ] + }, + "additionalProperties": false }, "TokenfactoryUpdateParamsPermission": { "type": "object", @@ -2230,10 +2231,6 @@ "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", "type": "string" }, - "Uint64": { - "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", - "type": "string" - }, "UnpinCodesProposal": { "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", "deprecated": true, @@ -2261,7 +2258,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "UpdateAdminProposal": { "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", @@ -2290,7 +2288,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "UpgradeProposal": { "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", @@ -2327,16 +2326,8 @@ } ] } - } - }, - "VoteOption": { - "type": "string", - "enum": [ - "yes", - "no", - "abstain", - "no_with_veto" - ] + }, + "additionalProperties": false }, "WasmMsg": { "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", @@ -2373,7 +2364,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2423,7 +2415,63 @@ } ] } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code using a predictable address derivation algorithm implemented in [`cosmwasm_std::instantiate2_address`].\n\nThis is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96). `sender` is automatically filled with the current contract's address. `fix_msg` is automatically set to false.", + "type": "object", + "required": [ + "instantiate2" + ], + "properties": { + "instantiate2": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg", + "salt" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "salt": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2460,7 +2508,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2485,7 +2534,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2506,7 +2556,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2550,6 +2601,62 @@ "$ref": "#/definitions/StrategyMsg" }, "definitions": { + "CCVUpdateParamsPermission": { + "type": "object", + "required": [ + "blocks_per_distribution_transmission", + "ccv_timeout_period", + "consumer_redistribution_fraction", + "distribution_transmission_channel", + "historical_entries", + "provider_fee_pool_addr_str", + "provider_reward_denoms", + "retry_delay_period", + "reward_denoms", + "soft_opt_out_threshold", + "transfer_timeout_period", + "unbonding_period" + ], + "properties": { + "blocks_per_distribution_transmission": { + "type": "boolean" + }, + "ccv_timeout_period": { + "type": "boolean" + }, + "consumer_redistribution_fraction": { + "type": "boolean" + }, + "distribution_transmission_channel": { + "type": "boolean" + }, + "historical_entries": { + "type": "boolean" + }, + "provider_fee_pool_addr_str": { + "type": "boolean" + }, + "provider_reward_denoms": { + "type": "boolean" + }, + "retry_delay_period": { + "type": "boolean" + }, + "reward_denoms": { + "type": "boolean" + }, + "soft_opt_out_threshold": { + "type": "boolean" + }, + "transfer_timeout_period": { + "type": "boolean" + }, + "unbonding_period": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "CronPermission": { "type": "object", "required": [ @@ -2606,6 +2713,38 @@ }, "additionalProperties": false }, + "DynamicFeesUpdateParamsPermission": { + "type": "object", + "required": [ + "ntrn_prices" + ], + "properties": { + "ntrn_prices": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "GlobalfeeUpdateParamsPermission": { + "type": "object", + "required": [ + "bypass_min_fee_msg_types", + "max_total_bypass_min_fee_msg_gas_usage", + "minimum_gas_prices" + ], + "properties": { + "bypass_min_fee_msg_types": { + "type": "boolean" + }, + "max_total_bypass_min_fee_msg_gas_usage": { + "type": "boolean" + }, + "minimum_gas_prices": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "ParamChangePermission": { "type": "object", "required": [ @@ -2687,6 +2826,42 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "update_dynamicfees_params_permission" + ], + "properties": { + "update_dynamicfees_params_permission": { + "$ref": "#/definitions/DynamicFeesUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_globalfee_params_permission" + ], + "properties": { + "update_globalfee_params_permission": { + "$ref": "#/definitions/GlobalfeeUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_c_c_v_params_permission" + ], + "properties": { + "update_c_c_v_params_permission": { + "$ref": "#/definitions/CCVUpdateParamsPermission" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -2698,9 +2873,37 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "software_upgrade_permission" + ], + "properties": { + "software_upgrade_permission": { + "$ref": "#/definitions/SoftwareUpgradePermission" + } + }, + "additionalProperties": false } ] }, + "SoftwareUpgradePermission": { + "type": "object", + "required": [ + "cancel_upgrade", + "upgrade" + ], + "properties": { + "cancel_upgrade": { + "type": "boolean" + }, + "upgrade": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "StrategyMsg": { "oneOf": [ { diff --git a/contracts/dao/neutron-chain-manager/schema/raw/execute.json b/contracts/dao/neutron-chain-manager/schema/raw/execute.json index d12f6cf5..da3af87c 100644 --- a/contracts/dao/neutron-chain-manager/schema/raw/execute.json +++ b/contracts/dao/neutron-chain-manager/schema/raw/execute.json @@ -95,7 +95,7 @@ "additionalProperties": false }, { - "description": "Depreacteed Proposal to upgrade IBC client", + "description": "Deprecated. Proposal to upgrade IBC client", "deprecated": true, "type": "object", "required": [ @@ -235,6 +235,23 @@ } ] }, + "AnyMsg": { + "description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, "BankMsg": { "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", "oneOf": [ @@ -261,7 +278,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -285,7 +303,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -296,6 +315,62 @@ "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, + "CCVUpdateParamsPermission": { + "type": "object", + "required": [ + "blocks_per_distribution_transmission", + "ccv_timeout_period", + "consumer_redistribution_fraction", + "distribution_transmission_channel", + "historical_entries", + "provider_fee_pool_addr_str", + "provider_reward_denoms", + "retry_delay_period", + "reward_denoms", + "soft_opt_out_threshold", + "transfer_timeout_period", + "unbonding_period" + ], + "properties": { + "blocks_per_distribution_transmission": { + "type": "boolean" + }, + "ccv_timeout_period": { + "type": "boolean" + }, + "consumer_redistribution_fraction": { + "type": "boolean" + }, + "distribution_transmission_channel": { + "type": "boolean" + }, + "historical_entries": { + "type": "boolean" + }, + "provider_fee_pool_addr_str": { + "type": "boolean" + }, + "provider_reward_denoms": { + "type": "boolean" + }, + "retry_delay_period": { + "type": "boolean" + }, + "reward_denoms": { + "type": "boolean" + }, + "soft_opt_out_threshold": { + "type": "boolean" + }, + "transfer_timeout_period": { + "type": "boolean" + }, + "unbonding_period": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "CancelSoftwareUpgradeProposal": { "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", "deprecated": true, @@ -313,7 +388,15 @@ "description": "*title** is a text title of proposal. Non unique.", "type": "string" } - } + }, + "additionalProperties": false + }, + "ChannelOrdering": { + "type": "string", + "enum": [ + "ORDER_ORDERED", + "ORDER_UNORDERED" + ] }, "ClearAdminProposal": { "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", @@ -337,7 +420,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "ClientUpdateProposal": { "description": "ClientUpdateProposal defines the struct for client update proposal.", @@ -366,7 +450,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "Coin": { "type": "object", @@ -381,7 +466,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_NeutronMsg": { "oneOf": [ @@ -410,39 +496,14 @@ "additionalProperties": false }, { - "description": "This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", - "deprecated": true, + "description": "`CosmosMsg::Any` is the replaces the \"stargate message\" – a message wrapped in a [protobuf Any](https://protobuf.dev/programming-guides/proto3/#any) that is suppored by the chain. It behaves the same as `CosmosMsg::Stargate` but has a better name and slightly improved syntax.\n\nThis is feature-gated at compile time with `cosmwasm_2_0` because a chain running CosmWasm < 2.0 cannot process this.", "type": "object", "required": [ - "stargate" + "any" ], "properties": { - "stargate": { - "type": "object", - "required": [ - "type_url", - "value" - ], - "properties": { - "type_url": { - "type": "string" - }, - "value": { - "$ref": "#/definitions/Binary" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "ibc" - ], - "properties": { - "ibc": { - "$ref": "#/definitions/IbcMsg" + "any": { + "$ref": "#/definitions/AnyMsg" } }, "additionalProperties": false @@ -458,18 +519,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "gov" - ], - "properties": { - "gov": { - "$ref": "#/definitions/GovMsg" - } - }, - "additionalProperties": false } ] }, @@ -528,18 +577,26 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false }, - "DepositOption": { + "DepositOptions": { "type": "object", - "required": [ - "disable_swap" - ], "properties": { - "disable_swap": { - "type": "boolean" + "disable_autoswap": { + "type": [ + "boolean", + "null" + ] + }, + "fail_tx_on_bel": { + "type": [ + "boolean", + "null" + ] } - } + }, + "additionalProperties": false }, "DexMsg": { "oneOf": [ @@ -590,7 +647,7 @@ "description": "Additional deposit options", "type": "array", "items": { - "$ref": "#/definitions/DepositOption" + "$ref": "#/definitions/DepositOptions" } }, "receiver": { @@ -613,7 +670,8 @@ "description": "Denom for the opposing side of the deposit", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -672,7 +730,8 @@ "description": "Denom for the opposing side of the deposit", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -753,7 +812,8 @@ "description": "Token being “bought”", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -775,7 +835,8 @@ "description": "TrancheKey for the target limit order", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -797,7 +858,8 @@ "description": "TrancheKey for the target limit order", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -850,7 +912,8 @@ "$ref": "#/definitions/MultiHopRoute" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -881,42 +944,37 @@ }, "additionalProperties": false }, - "GovMsg": { - "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", - "oneOf": [ - { - "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", - "type": "object", - "required": [ - "vote" - ], - "properties": { - "vote": { - "type": "object", - "required": [ - "option", - "proposal_id" - ], - "properties": { - "option": { - "description": "The vote option.\n\nThis used to be called \"vote\", but was changed for consistency with Cosmos SDK.", - "allOf": [ - { - "$ref": "#/definitions/VoteOption" - } - ] - }, - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false + "DynamicFeesUpdateParamsPermission": { + "type": "object", + "required": [ + "ntrn_prices" + ], + "properties": { + "ntrn_prices": { + "type": "boolean" } - ] + }, + "additionalProperties": false + }, + "GlobalfeeUpdateParamsPermission": { + "type": "object", + "required": [ + "bypass_min_fee_msg_types", + "max_total_bypass_min_fee_msg_gas_usage", + "minimum_gas_prices" + ], + "properties": { + "bypass_min_fee_msg_types": { + "type": "boolean" + }, + "max_total_bypass_min_fee_msg_gas_usage": { + "type": "boolean" + }, + "minimum_gas_prices": { + "type": "boolean" + } + }, + "additionalProperties": false }, "IbcFee": { "description": "IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. Unused fee kind will be returned back to message sender. Please refer to these links for more information: IBC transaction structure - General mechanics of fee payments - ", @@ -948,167 +1006,8 @@ "$ref": "#/definitions/Coin" } } - } - }, - "IbcMsg": { - "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", - "oneOf": [ - { - "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", - "type": "object", - "required": [ - "transfer" - ], - "properties": { - "transfer": { - "type": "object", - "required": [ - "amount", - "channel_id", - "timeout", - "to_address" - ], - "properties": { - "amount": { - "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", - "allOf": [ - { - "$ref": "#/definitions/Coin" - } - ] - }, - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "memo": { - "description": "An optional memo. See the blog post [\"Moving Beyond Simple Token Transfers\"](https://medium.com/the-interchain-foundation/moving-beyond-simple-token-transfers-d42b2b1dc29b) for more information.\n\nThere is no difference between setting this to `None` or an empty string.\n\nThis field is only supported on chains with CosmWasm >= 2.0 and silently ignored on older chains. If you need support for both 1.x and 2.x chain with the same codebase, it is recommended to use `CosmosMsg::Stargate` with a custom MsgTransfer protobuf encoder instead.", - "type": [ - "string", - "null" - ] - }, - "timeout": { - "description": "when packet times out, measured on remote chain", - "allOf": [ - { - "$ref": "#/definitions/IbcTimeout" - } - ] - }, - "to_address": { - "description": "address on the remote chain to receive these tokens", - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "data", - "timeout" - ], - "properties": { - "channel_id": { - "type": "string" - }, - "data": { - "$ref": "#/definitions/Binary" - }, - "timeout": { - "description": "when packet times out, measured on remote chain", - "allOf": [ - { - "$ref": "#/definitions/IbcTimeout" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", - "type": "object", - "required": [ - "close_channel" - ], - "properties": { - "close_channel": { - "type": "object", - "required": [ - "channel_id" - ], - "properties": { - "channel_id": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - }, - "IbcTimeout": { - "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", - "type": "object", - "properties": { - "block": { - "anyOf": [ - { - "$ref": "#/definitions/IbcTimeoutBlock" - }, - { - "type": "null" - } - ] - }, - "timestamp": { - "anyOf": [ - { - "$ref": "#/definitions/Timestamp" - }, - { - "type": "null" - } - ] - } - } - }, - "IbcTimeoutBlock": { - "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", - "type": "object", - "required": [ - "height", - "revision" - ], - "properties": { - "height": { - "description": "block height after which the packet times out. the height within the given revision", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "revision": { - "description": "the version that the client is currently on (e.g. after resetting the chain this could increment 1 as height drops to 0)", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } + }, + "additionalProperties": false }, "KVKey": { "description": "Describes a KV key for which you want to get value from the storage on remote chain", @@ -1130,7 +1029,8 @@ "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", "type": "string" } - } + }, + "additionalProperties": false }, "LimitOrderType": { "oneOf": [ @@ -1142,7 +1042,7 @@ ] }, { - "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` (https://github.com/neutron-org/neutron/blob/main/x/dex/types/errors.go#L107 ErrGoodTilOrderWithoutExpiration).", + "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` ( ErrGoodTilOrderWithoutExpiration).", "type": "string", "enum": [ "FILL_OR_KILL" @@ -1187,7 +1087,8 @@ "description": "*msg** is a contract call message", "type": "string" } - } + }, + "additionalProperties": false }, "MultiHopRoute": { "type": "object", @@ -1201,7 +1102,8 @@ "type": "string" } } - } + }, + "additionalProperties": false }, "NeutronMsg": { "description": "A number of Custom messages that can call into the Neutron bindings.", @@ -1228,6 +1130,17 @@ "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" }, + "ordering": { + "description": "**ordering** is an order of channel. Can be ordered or unordered. Set to ordered if not specified.", + "anyOf": [ + { + "$ref": "#/definitions/ChannelOrdering" + }, + { + "type": "null" + } + ] + }, "register_fee": { "description": "*register_fee** is a fees required to be payed to register interchain account", "type": [ @@ -1238,7 +1151,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1294,7 +1208,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1341,7 +1256,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1360,7 +1276,7 @@ ], "properties": { "new_keys": { - "description": "*new_keys** is the new query keys to retrive.", + "description": "*new_keys** is the new query keys to retrieve.", "type": [ "array", "null" @@ -1391,7 +1307,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1415,7 +1332,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1470,7 +1388,8 @@ "token": { "$ref": "#/definitions/Coin" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1491,7 +1410,8 @@ "admin_proposal": { "$ref": "#/definitions/AdminProposal" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1512,7 +1432,8 @@ "subdenom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1537,7 +1458,8 @@ "new_admin_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1566,7 +1488,8 @@ "mint_to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1596,7 +1519,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1621,7 +1545,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1654,7 +1579,8 @@ "transfer_to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1714,7 +1640,8 @@ "description": "**uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that the document didn't change. Optional.", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1729,11 +1656,16 @@ "add_schedule": { "type": "object", "required": [ + "execution_stage", "msgs", "name", "period" ], "properties": { + "execution_stage": { + "description": "execution stage where schedule will be executed", + "type": "string" + }, "msgs": { "description": "list of cosmwasm messages to be executed", "type": "array", @@ -1751,7 +1683,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1772,7 +1705,8 @@ "name": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1795,7 +1729,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1836,7 +1771,8 @@ "description": "*value** is a new value for given parameter. Non unique.", "type": "string" } - } + }, + "additionalProperties": false }, "ParamChangePermission": { "type": "object", @@ -1877,7 +1813,8 @@ "description": "*title** is a text title of proposal. Non unique.", "type": "string" } - } + }, + "additionalProperties": false }, "ParamPermission": { "type": "object", @@ -1945,6 +1882,42 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "update_dynamicfees_params_permission" + ], + "properties": { + "update_dynamicfees_params_permission": { + "$ref": "#/definitions/DynamicFeesUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_globalfee_params_permission" + ], + "properties": { + "update_globalfee_params_permission": { + "$ref": "#/definitions/GlobalfeeUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_c_c_v_params_permission" + ], + "properties": { + "update_c_c_v_params_permission": { + "$ref": "#/definitions/CCVUpdateParamsPermission" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -1956,6 +1929,18 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "software_upgrade_permission" + ], + "properties": { + "software_upgrade_permission": { + "$ref": "#/definitions/SoftwareUpgradePermission" + } + }, + "additionalProperties": false } ] }, @@ -1986,7 +1971,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "Plan": { "description": "Plan defines the struct for planned upgrade.", @@ -2010,7 +1996,8 @@ "description": "*name** is a name for the upgrade", "type": "string" } - } + }, + "additionalProperties": false }, "PrecDec": { "type": "object", @@ -2021,7 +2008,8 @@ "i": { "type": "string" } - } + }, + "additionalProperties": false }, "ProposalExecuteMessage": { "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", @@ -2034,7 +2022,8 @@ "description": "*message** is a json representing an sdk message passed to admin module to execute.", "type": "string" } - } + }, + "additionalProperties": false }, "ProtobufAny": { "description": "Type for wrapping any protobuf message", @@ -2056,7 +2045,8 @@ } ] } - } + }, + "additionalProperties": false }, "RequestPacketTimeoutHeight": { "type": "object", @@ -2077,7 +2067,24 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false + }, + "SoftwareUpgradePermission": { + "type": "object", + "required": [ + "cancel_upgrade", + "upgrade" + ], + "properties": { + "cancel_upgrade": { + "type": "boolean" + }, + "upgrade": { + "type": "boolean" + } + }, + "additionalProperties": false }, "SoftwareUpgradeProposal": { "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", @@ -2105,7 +2112,8 @@ "description": "*title** is a text title of proposal. Non unique.", "type": "string" } - } + }, + "additionalProperties": false }, "StrategyMsg": { "oneOf": [ @@ -2163,15 +2171,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } - }, - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", - "allOf": [ - { - "$ref": "#/definitions/Uint64" - } - ] + }, + "additionalProperties": false }, "TokenfactoryUpdateParamsPermission": { "type": "object", @@ -2201,10 +2202,6 @@ "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", "type": "string" }, - "Uint64": { - "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", - "type": "string" - }, "UnpinCodesProposal": { "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", "deprecated": true, @@ -2232,7 +2229,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "UpdateAdminProposal": { "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", @@ -2261,7 +2259,8 @@ "description": "*title** is a text title of proposal.", "type": "string" } - } + }, + "additionalProperties": false }, "UpgradeProposal": { "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", @@ -2298,16 +2297,8 @@ } ] } - } - }, - "VoteOption": { - "type": "string", - "enum": [ - "yes", - "no", - "abstain", - "no_with_veto" - ] + }, + "additionalProperties": false }, "WasmMsg": { "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", @@ -2344,7 +2335,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2394,7 +2386,63 @@ } ] } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code using a predictable address derivation algorithm implemented in [`cosmwasm_std::instantiate2_address`].\n\nThis is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96). `sender` is automatically filled with the current contract's address. `fix_msg` is automatically set to false.", + "type": "object", + "required": [ + "instantiate2" + ], + "properties": { + "instantiate2": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg", + "salt" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "salt": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2431,7 +2479,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2456,7 +2505,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2477,7 +2527,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json b/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json index ebba6232..66ce3847 100644 --- a/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json +++ b/contracts/dao/neutron-chain-manager/schema/raw/response_to_strategies.json @@ -6,6 +6,62 @@ "$ref": "#/definitions/StrategyMsg" }, "definitions": { + "CCVUpdateParamsPermission": { + "type": "object", + "required": [ + "blocks_per_distribution_transmission", + "ccv_timeout_period", + "consumer_redistribution_fraction", + "distribution_transmission_channel", + "historical_entries", + "provider_fee_pool_addr_str", + "provider_reward_denoms", + "retry_delay_period", + "reward_denoms", + "soft_opt_out_threshold", + "transfer_timeout_period", + "unbonding_period" + ], + "properties": { + "blocks_per_distribution_transmission": { + "type": "boolean" + }, + "ccv_timeout_period": { + "type": "boolean" + }, + "consumer_redistribution_fraction": { + "type": "boolean" + }, + "distribution_transmission_channel": { + "type": "boolean" + }, + "historical_entries": { + "type": "boolean" + }, + "provider_fee_pool_addr_str": { + "type": "boolean" + }, + "provider_reward_denoms": { + "type": "boolean" + }, + "retry_delay_period": { + "type": "boolean" + }, + "reward_denoms": { + "type": "boolean" + }, + "soft_opt_out_threshold": { + "type": "boolean" + }, + "transfer_timeout_period": { + "type": "boolean" + }, + "unbonding_period": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "CronPermission": { "type": "object", "required": [ @@ -62,6 +118,38 @@ }, "additionalProperties": false }, + "DynamicFeesUpdateParamsPermission": { + "type": "object", + "required": [ + "ntrn_prices" + ], + "properties": { + "ntrn_prices": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "GlobalfeeUpdateParamsPermission": { + "type": "object", + "required": [ + "bypass_min_fee_msg_types", + "max_total_bypass_min_fee_msg_gas_usage", + "minimum_gas_prices" + ], + "properties": { + "bypass_min_fee_msg_types": { + "type": "boolean" + }, + "max_total_bypass_min_fee_msg_gas_usage": { + "type": "boolean" + }, + "minimum_gas_prices": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "ParamChangePermission": { "type": "object", "required": [ @@ -143,6 +231,42 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "update_dynamicfees_params_permission" + ], + "properties": { + "update_dynamicfees_params_permission": { + "$ref": "#/definitions/DynamicFeesUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_globalfee_params_permission" + ], + "properties": { + "update_globalfee_params_permission": { + "$ref": "#/definitions/GlobalfeeUpdateParamsPermission" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_c_c_v_params_permission" + ], + "properties": { + "update_c_c_v_params_permission": { + "$ref": "#/definitions/CCVUpdateParamsPermission" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -154,9 +278,37 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "software_upgrade_permission" + ], + "properties": { + "software_upgrade_permission": { + "$ref": "#/definitions/SoftwareUpgradePermission" + } + }, + "additionalProperties": false } ] }, + "SoftwareUpgradePermission": { + "type": "object", + "required": [ + "cancel_upgrade", + "upgrade" + ], + "properties": { + "cancel_upgrade": { + "type": "boolean" + }, + "upgrade": { + "type": "boolean" + } + }, + "additionalProperties": false + }, "StrategyMsg": { "oneOf": [ { diff --git a/contracts/dao/neutron-chain-manager/src/adminmodule_module_types.rs b/contracts/dao/neutron-chain-manager/src/adminmodule_module_types.rs deleted file mode 100644 index b889aa32..00000000 --- a/contracts/dao/neutron-chain-manager/src/adminmodule_module_types.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub const MSG_TYPE_SOFTWARE_UPGRADE: &str = "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; -pub const MSG_TYPE_CANCEL_SOFTWARE_UPGRADE: &str = "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; diff --git a/contracts/dao/neutron-chain-manager/src/contract.rs b/contracts/dao/neutron-chain-manager/src/contract.rs index 496f6117..e6e8c308 100644 --- a/contracts/dao/neutron-chain-manager/src/contract.rs +++ b/contracts/dao/neutron-chain-manager/src/contract.rs @@ -1,18 +1,3 @@ -use crate::adminmodule_module_types::{ - MSG_TYPE_CANCEL_SOFTWARE_UPGRADE, MSG_TYPE_SOFTWARE_UPGRADE, -}; -use crate::cron_module_types::{ - MsgUpdateParamsCron, ParamsRequestCron, ParamsResponseCron, MSG_TYPE_ADD_SCHEDULE, - MSG_TYPE_REMOVE_SCHEDULE, MSG_TYPE_UPDATE_PARAMS_CRON, PARAMS_QUERY_PATH_CRON, -}; -use crate::dex_module_types::{ - MsgUpdateParamsDex, ParamsRequestDex, ParamsResponseDex, MSG_TYPE_UPDATE_PARAMS_DEX, - PARAMS_QUERY_PATH_DEX, -}; -use crate::tokenfactory_module_types::{ - MsgUpdateParamsTokenfactory, ParamsRequestTokenfactory, ParamsResponseTokenfactory, - MSG_TYPE_UPDATE_PARAMS_TOKENFACTORY, PARAMS_QUERY_PATH_TOKENFACTORY, -}; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ @@ -20,10 +5,13 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use neutron_sdk::bindings::msg::{AdminProposal, NeutronMsg, ProposalExecuteMessage}; -use neutron_sdk::proto_types::neutron::cron::QueryParamsRequest as QueryParamsRequestCron; -use neutron_sdk::proto_types::neutron::dex::QueryParamsRequest as QueryParamsRequestDex; -use neutron_sdk::proto_types::osmosis::tokenfactory::v1beta1::QueryParamsRequest as QueryParamsRequestTokenfactory; -use neutron_sdk::stargate::aux::make_stargate_query; +use neutron_std::types::cosmos::upgrade::v1beta1::{MsgCancelUpgrade, MsgSoftwareUpgrade}; +use neutron_std::types::gaia::globalfee; +use neutron_std::types::interchain_security::ccv::consumer; +use neutron_std::types::neutron::cron; +use neutron_std::types::neutron::dex; +use neutron_std::types::neutron::dynamicfees; +use neutron_std::types::osmosis::tokenfactory; use crate::error::ContractError; use crate::msg::{ @@ -238,38 +226,47 @@ fn check_proposal_execute_message( ) -> Result<(), ContractError> { let typed_proposal: ProposalExecuteMessageJSON = serde_json_wasm::from_str(proposal.message.as_str())?; - match typed_proposal.type_field.as_str() { - MSG_TYPE_UPDATE_PARAMS_CRON => { + cron::MsgUpdateParams::TYPE_URL => { check_cron_update_msg_params(deps, strategy, proposal)?; Ok(()) } - MSG_TYPE_UPDATE_PARAMS_TOKENFACTORY => { + tokenfactory::v1beta1::MsgUpdateParams::TYPE_URL => { check_tokenfactory_update_msg_params(deps, strategy, proposal)?; Ok(()) } - MSG_TYPE_UPDATE_PARAMS_DEX => { + dex::MsgUpdateParams::TYPE_URL => { check_dex_update_msg_params(deps, strategy, proposal)?; Ok(()) } - MSG_TYPE_ADD_SCHEDULE => match strategy.has_cron_add_schedule_permission() { + dynamicfees::v1::MsgUpdateParams::TYPE_URL => { + check_dynamicfees_update_msg_params(deps, strategy, proposal)?; + Ok(()) + } + globalfee::v1beta1::MsgUpdateParams::TYPE_URL => { + check_globalfee_update_msg_params(deps, strategy, proposal)?; + Ok(()) + } + consumer::v1::MsgUpdateParams::TYPE_URL => { + check_ccv_update_msg_params(deps, strategy, proposal)?; + Ok(()) + } + cron::MsgAddSchedule::TYPE_URL => match strategy.has_cron_add_schedule_permission() { true => Ok(()), false => Err(ContractError::Unauthorized {}), }, - MSG_TYPE_REMOVE_SCHEDULE => match strategy.has_cron_remove_schedule_permission() { + cron::MsgRemoveSchedule::TYPE_URL => match strategy.has_cron_remove_schedule_permission() { true => Ok(()), false => Err(ContractError::Unauthorized {}), }, - MSG_TYPE_SOFTWARE_UPGRADE => match strategy.has_software_upgrade_permission() { + MsgSoftwareUpgrade::TYPE_URL => match strategy.has_software_upgrade_permission() { + true => Ok(()), + false => Err(ContractError::Unauthorized {}), + }, + MsgCancelUpgrade::TYPE_URL => match strategy.has_cancel_software_upgrade_permission() { true => Ok(()), false => Err(ContractError::Unauthorized {}), }, - MSG_TYPE_CANCEL_SOFTWARE_UPGRADE => { - match strategy.has_cancel_software_upgrade_permission() { - true => Ok(()), - false => Err(ContractError::Unauthorized {}), - } - } _ => Err(ContractError::Unauthorized {}), } } @@ -282,21 +279,20 @@ fn check_cron_update_msg_params( strategy: Strategy, proposal: ProposalExecuteMessage, ) -> Result<(), ContractError> { - let msg_update_params: MsgUpdateParamsCron = - serde_json_wasm::from_str(proposal.message.as_str())?; - + let msg_update_params = + serde_json_wasm::from_str::(proposal.message.as_str())? + .params + .ok_or(ContractError::Unauthorized {})?; let cron_update_param_permission = strategy .get_cron_update_param_permission() .ok_or(ContractError::Unauthorized {})?; - let cron_params = get_cron_params(deps, ParamsRequestCron {})?; - if cron_params.params.limit != msg_update_params.params.limit - && !cron_update_param_permission.limit - { + let cron_params = get_cron_params(deps)?.params.unwrap_or_default(); + if cron_params.limit != msg_update_params.limit && !cron_update_param_permission.limit { return Err(ContractError::Unauthorized {}); } - if cron_params.params.security_address != msg_update_params.params.security_address + if cron_params.security_address != msg_update_params.security_address && !cron_update_param_permission.security_address { return Err(ContractError::Unauthorized {}); @@ -306,12 +302,9 @@ fn check_cron_update_msg_params( } /// Queries the parameters of the cron module. -pub fn get_cron_params(deps: Deps, req: ParamsRequestCron) -> StdResult { - make_stargate_query( - deps, - PARAMS_QUERY_PATH_CRON, - QueryParamsRequestCron::from(req), - ) +pub fn get_cron_params(deps: Deps) -> StdResult { + let cron_querier = cron::CronQuerier::new(&deps.querier); + cron_querier.params() } /// Checks that the strategy owner is authorised to change the parameters of the @@ -322,35 +315,36 @@ fn check_tokenfactory_update_msg_params( strategy: Strategy, proposal: ProposalExecuteMessage, ) -> Result<(), ContractError> { - let msg_update_params: MsgUpdateParamsTokenfactory = - serde_json_wasm::from_str(proposal.message.as_str())?; - + let msg_update_params = serde_json_wasm::from_str::( + proposal.message.as_str(), + )? + .params + .ok_or(ContractError::Unauthorized {})?; let tokenfactory_update_param_permission = strategy .get_tokenfactory_update_param_permission() .ok_or(ContractError::Unauthorized {})?; - let tokenfactory_params = get_tokenfactory_params(deps, ParamsRequestTokenfactory {})?; - if tokenfactory_params.params.denom_creation_fee != msg_update_params.params.denom_creation_fee + let tokenfactory_params = get_tokenfactory_params(deps)?.params.unwrap_or_default(); + if tokenfactory_params.denom_creation_fee != msg_update_params.denom_creation_fee && !tokenfactory_update_param_permission.denom_creation_fee { return Err(ContractError::Unauthorized {}); } - if tokenfactory_params.params.denom_creation_gas_consume - != msg_update_params.params.denom_creation_gas_consume + if tokenfactory_params.denom_creation_gas_consume + != msg_update_params.denom_creation_gas_consume && !tokenfactory_update_param_permission.denom_creation_gas_consume { return Err(ContractError::Unauthorized {}); } - if tokenfactory_params.params.fee_collector_address - != msg_update_params.params.fee_collector_address + if tokenfactory_params.fee_collector_address != msg_update_params.fee_collector_address && !tokenfactory_update_param_permission.fee_collector_address { return Err(ContractError::Unauthorized {}); } - if tokenfactory_params.params.whitelisted_hooks != msg_update_params.params.whitelisted_hooks + if tokenfactory_params.whitelisted_hooks != msg_update_params.whitelisted_hooks && !tokenfactory_update_param_permission.whitelisted_hooks { return Err(ContractError::Unauthorized {}); @@ -362,13 +356,9 @@ fn check_tokenfactory_update_msg_params( /// Queries the parameters of the tokenfactory module. pub fn get_tokenfactory_params( deps: Deps, - req: ParamsRequestTokenfactory, -) -> StdResult { - make_stargate_query( - deps, - PARAMS_QUERY_PATH_TOKENFACTORY, - QueryParamsRequestTokenfactory::from(req), - ) +) -> StdResult { + let factory_querier = tokenfactory::v1beta1::TokenfactoryQuerier::new(&deps.querier); + factory_querier.params() } /// Checks that the strategy owner is authorised to change the parameters of the @@ -379,32 +369,30 @@ fn check_dex_update_msg_params( strategy: Strategy, proposal: ProposalExecuteMessage, ) -> Result<(), ContractError> { - let msg_update_params: MsgUpdateParamsDex = - serde_json_wasm::from_str(proposal.message.as_str())?; + let msg_update_params = + serde_json_wasm::from_str::(proposal.message.as_str())? + .params + .ok_or(ContractError::Unauthorized {})?; let dex_update_param_permission = strategy .get_dex_update_param_permission() .ok_or(ContractError::Unauthorized {})?; - let dex_params = get_dex_params(deps, ParamsRequestDex {})?; + let dex_params = get_dex_params(deps)?.params.unwrap_or_default(); - if dex_params.params.fee_tiers != msg_update_params.params.fee_tiers - && !dex_update_param_permission.fee_tiers + if dex_params.fee_tiers != msg_update_params.fee_tiers && !dex_update_param_permission.fee_tiers { return Err(ContractError::Unauthorized {}); } - if dex_params.params.paused != msg_update_params.params.paused - && !dex_update_param_permission.paused - { + if dex_params.paused != msg_update_params.paused && !dex_update_param_permission.paused { return Err(ContractError::Unauthorized {}); } - if dex_params.params.max_jits_per_block != msg_update_params.params.max_jits_per_block + if dex_params.max_jits_per_block != msg_update_params.max_jits_per_block && !dex_update_param_permission.max_jits_per_block { return Err(ContractError::Unauthorized {}); } - if dex_params.params.good_til_purge_allowance - != msg_update_params.params.good_til_purge_allowance + if dex_params.good_til_purge_allowance != msg_update_params.good_til_purge_allowance && !dex_update_param_permission.good_til_purge_allowance { return Err(ContractError::Unauthorized {}); @@ -414,12 +402,190 @@ fn check_dex_update_msg_params( } /// Queries the parameters of the dex module. -pub fn get_dex_params(deps: Deps, req: ParamsRequestDex) -> StdResult { - make_stargate_query( - deps, - PARAMS_QUERY_PATH_DEX, - QueryParamsRequestDex::from(req), - ) +pub fn get_dex_params(deps: Deps) -> StdResult { + let dex_querier = dex::DexQuerier::new(&deps.querier); + dex_querier.params() +} + +/// Checks that the strategy owner is authorised to change the parameters of the +/// dynamicfees module. We query the current values for each parameter & compare them to +/// the values in the proposal; all modifications must be allowed by the strategy. +fn check_dynamicfees_update_msg_params( + deps: Deps, + strategy: Strategy, + proposal: ProposalExecuteMessage, +) -> Result<(), ContractError> { + let msg_update_params = + serde_json_wasm::from_str::(proposal.message.as_str())? + .params + .ok_or(ContractError::Unauthorized {})?; + + let dynamicfees_update_param_permission = strategy + .get_dynamicfees_update_param_permission() + .ok_or(ContractError::Unauthorized {})?; + + let dynamicfees_params = get_dynamicfees_params(deps)?.params.unwrap_or_default(); + + if dynamicfees_params.ntrn_prices != msg_update_params.ntrn_prices + && !dynamicfees_update_param_permission.ntrn_prices + { + return Err(ContractError::Unauthorized {}); + } + + Ok(()) +} + +/// Queries the parameters of the dynamicfees module. +pub fn get_dynamicfees_params(deps: Deps) -> StdResult { + let dynamicfees_querier = dynamicfees::v1::DynamicfeesQuerier::new(&deps.querier); + dynamicfees_querier.params() +} + +/// Checks that the strategy owner is authorised to change the parameters of the +/// globalfee module. We query the current values for each parameter & compare them to +/// the values in the proposal; all modifications must be allowed by the strategy. +fn check_globalfee_update_msg_params( + deps: Deps, + strategy: Strategy, + proposal: ProposalExecuteMessage, +) -> Result<(), ContractError> { + let msg_update_params = serde_json_wasm::from_str::( + proposal.message.as_str(), + )? + .params + .ok_or(ContractError::Unauthorized {})?; + + let globalfee_update_param_permission = strategy + .get_globalfee_update_param_permission() + .ok_or(ContractError::Unauthorized {})?; + + let globalfee_params = get_globalfee_params(deps)?.params.unwrap_or_default(); + + if globalfee_params.bypass_min_fee_msg_types != msg_update_params.bypass_min_fee_msg_types + && !globalfee_update_param_permission.bypass_min_fee_msg_types + { + return Err(ContractError::Unauthorized {}); + } + + if globalfee_params.max_total_bypass_min_fee_msg_gas_usage + != msg_update_params.max_total_bypass_min_fee_msg_gas_usage + && !globalfee_update_param_permission.max_total_bypass_min_fee_msg_gas_usage + { + return Err(ContractError::Unauthorized {}); + } + + if globalfee_params.minimum_gas_prices != msg_update_params.minimum_gas_prices + && !globalfee_update_param_permission.minimum_gas_prices + { + return Err(ContractError::Unauthorized {}); + } + + Ok(()) +} + +/// Queries the parameters of the globalfee module. +pub fn get_globalfee_params(deps: Deps) -> StdResult { + let globalfee_querier = globalfee::v1beta1::GlobalfeeQuerier::new(&deps.querier); + globalfee_querier.params() +} + +/// Checks that the strategy owner is authorised to change the parameters of the +/// ccv module. We query the current values for each parameter & compare them to +/// the values in the proposal; all modifications must be allowed by the strategy. +#[allow(deprecated)] +fn check_ccv_update_msg_params( + deps: Deps, + strategy: Strategy, + proposal: ProposalExecuteMessage, +) -> Result<(), ContractError> { + let msg_update_params = + serde_json_wasm::from_str::(proposal.message.as_str())? + .params + .ok_or(ContractError::Unauthorized {})?; + + let ccv_update_param_permission = strategy + .get_ccv_update_param_permission() + .ok_or(ContractError::Unauthorized {})?; + + let ccv_params = get_ccv_params(deps)?.params.unwrap_or_default(); + + // never allow to change 'enabled' + if ccv_params.enabled != msg_update_params.enabled { + return Err(ContractError::Unauthorized {}); + } + + if ccv_params.blocks_per_distribution_transmission + != msg_update_params.blocks_per_distribution_transmission + && !ccv_update_param_permission.blocks_per_distribution_transmission + { + return Err(ContractError::Unauthorized {}); + } + + if ccv_params.ccv_timeout_period != msg_update_params.ccv_timeout_period + && !ccv_update_param_permission.ccv_timeout_period + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.consumer_redistribution_fraction + != msg_update_params.consumer_redistribution_fraction + && !ccv_update_param_permission.consumer_redistribution_fraction + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.distribution_transmission_channel + != msg_update_params.distribution_transmission_channel + && !ccv_update_param_permission.distribution_transmission_channel + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.historical_entries != msg_update_params.historical_entries + && !ccv_update_param_permission.historical_entries + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.provider_fee_pool_addr_str != msg_update_params.provider_fee_pool_addr_str + && !ccv_update_param_permission.provider_fee_pool_addr_str + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.provider_reward_denoms != msg_update_params.provider_reward_denoms + && !ccv_update_param_permission.provider_reward_denoms + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.retry_delay_period != msg_update_params.retry_delay_period + && !ccv_update_param_permission.retry_delay_period + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.reward_denoms != msg_update_params.reward_denoms + && !ccv_update_param_permission.reward_denoms + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.soft_opt_out_threshold != msg_update_params.soft_opt_out_threshold + && !ccv_update_param_permission.soft_opt_out_threshold + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.transfer_timeout_period != msg_update_params.transfer_timeout_period + && !ccv_update_param_permission.transfer_timeout_period + { + return Err(ContractError::Unauthorized {}); + } + if ccv_params.unbonding_period != msg_update_params.unbonding_period + && !ccv_update_param_permission.unbonding_period + { + return Err(ContractError::Unauthorized {}); + } + + Ok(()) +} + +/// Queries the parameters of the ccv module. +pub fn get_ccv_params(deps: Deps) -> StdResult { + let ccv_querier = consumer::v1::ConsumerQuerier::new(&deps.querier); + ccv_querier.query_params() } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/dao/neutron-chain-manager/src/cron_module_types.rs b/contracts/dao/neutron-chain-manager/src/cron_module_types.rs deleted file mode 100644 index 99f508e3..00000000 --- a/contracts/dao/neutron-chain-manager/src/cron_module_types.rs +++ /dev/null @@ -1,41 +0,0 @@ -use crate::utils::deserialize_u64; -use neutron_sdk::proto_types::neutron::cron::QueryParamsRequest; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -pub const PARAMS_QUERY_PATH_CRON: &str = "/neutron.cron.Query/Params"; -pub const MSG_TYPE_UPDATE_PARAMS_CRON: &str = "/neutron.cron.MsgUpdateParams"; -pub const MSG_TYPE_ADD_SCHEDULE: &str = "/neutron.cron.MsgAddSchedule"; -pub const MSG_TYPE_REMOVE_SCHEDULE: &str = "/neutron.cron.MsgRemoveSchedule"; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgUpdateParamsCron { - pub params: ParamsCron, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ParamsCron { - pub security_address: String, - /// Unfortunately, stargate returns a string instead of a number for the - /// limit parameter, so we need to have a custom deserializer for this - /// field. - #[serde(deserialize_with = "deserialize_u64")] - pub limit: u64, -} - -/// The types below are used for querying cron module parameters via stargate. -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, ::prost::Message)] -pub struct ParamsRequestCron {} - -impl From for QueryParamsRequest { - fn from(_: ParamsRequestCron) -> QueryParamsRequest { - QueryParamsRequest {} - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct ParamsResponseCron { - pub params: ParamsCron, -} diff --git a/contracts/dao/neutron-chain-manager/src/dex_module_types.rs b/contracts/dao/neutron-chain-manager/src/dex_module_types.rs deleted file mode 100644 index 322f0ba8..00000000 --- a/contracts/dao/neutron-chain-manager/src/dex_module_types.rs +++ /dev/null @@ -1,42 +0,0 @@ -use crate::utils::{deserialize_u64, deserialize_u64_vec}; -use neutron_sdk::proto_types::neutron::dex::QueryParamsRequest; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -pub const PARAMS_QUERY_PATH_DEX: &str = "/neutron.dex.Query/Params"; -pub const MSG_TYPE_UPDATE_PARAMS_DEX: &str = "/neutron.dex.MsgUpdateParams"; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgUpdateParamsDex { - pub params: ParamsDex, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// Unfortunately, stargate returns a string instead of a number for the -/// u64 fields, so we need to have a custom deserializer. -pub struct ParamsDex { - #[serde(deserialize_with = "deserialize_u64_vec")] - pub fee_tiers: Vec, - pub paused: bool, - #[serde(deserialize_with = "deserialize_u64")] - pub max_jits_per_block: u64, - #[serde(deserialize_with = "deserialize_u64")] - pub good_til_purge_allowance: u64, -} - -/// The types below are used for querying dex module parameters via stargate. -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, ::prost::Message)] -pub struct ParamsRequestDex {} - -impl From for QueryParamsRequest { - fn from(_: ParamsRequestDex) -> QueryParamsRequest { - QueryParamsRequest {} - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct ParamsResponseDex { - pub params: ParamsDex, -} diff --git a/contracts/dao/neutron-chain-manager/src/lib.rs b/contracts/dao/neutron-chain-manager/src/lib.rs index 747c14ae..a2c08c95 100644 --- a/contracts/dao/neutron-chain-manager/src/lib.rs +++ b/contracts/dao/neutron-chain-manager/src/lib.rs @@ -1,11 +1,7 @@ -pub mod adminmodule_module_types; pub mod contract; -mod cron_module_types; -mod dex_module_types; mod error; pub mod msg; pub mod state; #[cfg(test)] mod testing; -mod tokenfactory_module_types; pub mod utils; diff --git a/contracts/dao/neutron-chain-manager/src/msg.rs b/contracts/dao/neutron-chain-manager/src/msg.rs index 9308fa55..e7b28374 100644 --- a/contracts/dao/neutron-chain-manager/src/msg.rs +++ b/contracts/dao/neutron-chain-manager/src/msg.rs @@ -172,6 +172,68 @@ impl Strategy { } } + pub fn get_dynamicfees_update_param_permission( + &self, + ) -> Option { + match self { + Strategy::AllowAll => Some(DynamicFeesUpdateParamsPermission { ntrn_prices: true }), + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::UpdateDynamicfeesParamsPermission) { + Some(Permission::UpdateDynamicfeesParamsPermission( + dynamicfees_update_params, + )) => Some(dynamicfees_update_params.clone()), + _ => None, + } + } + } + } + + pub fn get_globalfee_update_param_permission(&self) -> Option { + match self { + Strategy::AllowAll => Some(GlobalfeeUpdateParamsPermission { + minimum_gas_prices: true, + bypass_min_fee_msg_types: true, + max_total_bypass_min_fee_msg_gas_usage: true, + }), + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::UpdateGlobalfeeParamsPermission) { + Some(Permission::UpdateGlobalfeeParamsPermission(globalfee_update_params)) => { + Some(globalfee_update_params.clone()) + } + _ => None, + } + } + } + } + + pub fn get_ccv_update_param_permission(&self) -> Option { + match self { + Strategy::AllowAll => Some(CCVUpdateParamsPermission { + // enabled: true, + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + }), + Strategy::AllowOnly(permissions) => { + match permissions.get(&PermissionType::UpdateCCVParamsPermission) { + Some(Permission::UpdateCCVParamsPermission(ccv_update_params)) => { + Some(ccv_update_params.clone()) + } + _ => None, + } + } + } + } + pub fn has_software_upgrade_permission(&self) -> bool { match self { Strategy::AllowAll => true, @@ -210,6 +272,10 @@ pub enum Permission { UpdateCronParamsPermission(CronUpdateParamsPermission), UpdateTokenfactoryParamsPermission(TokenfactoryUpdateParamsPermission), UpdateDexParamsPermission(DexUpdateParamsPermission), + UpdateDynamicfeesParamsPermission(DynamicFeesUpdateParamsPermission), + UpdateGlobalfeeParamsPermission(GlobalfeeUpdateParamsPermission), + #[serde(rename = "update_ccv_params_permission")] + UpdateCCVParamsPermission(CCVUpdateParamsPermission), CronPermission(CronPermission), SoftwareUpgradePermission(SoftwareUpgradePermission), } @@ -225,6 +291,13 @@ impl From for PermissionType { Permission::UpdateDexParamsPermission(_) => PermissionType::UpdateDexParamsPermission, Permission::CronPermission(_) => PermissionType::CronPermission, Permission::SoftwareUpgradePermission(_) => PermissionType::SoftwareUpgradePermission, + Permission::UpdateDynamicfeesParamsPermission(_) => { + PermissionType::UpdateDynamicfeesParamsPermission + } + Permission::UpdateGlobalfeeParamsPermission(_) => { + PermissionType::UpdateGlobalfeeParamsPermission + } + Permission::UpdateCCVParamsPermission(_) => PermissionType::UpdateCCVParamsPermission, } } } @@ -236,6 +309,9 @@ pub enum PermissionType { UpdateCronParamsPermission, UpdateTokenfactoryParamsPermission, UpdateDexParamsPermission, + UpdateDynamicfeesParamsPermission, + UpdateGlobalfeeParamsPermission, + UpdateCCVParamsPermission, CronPermission, SoftwareUpgradePermission, } @@ -291,6 +367,43 @@ pub struct DexUpdateParamsPermission { pub good_til_purge_allowance: bool, } +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct DynamicFeesUpdateParamsPermission { + pub ntrn_prices: bool, +} + +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct GlobalfeeUpdateParamsPermission { + pub minimum_gas_prices: bool, + pub bypass_min_fee_msg_types: bool, + pub max_total_bypass_min_fee_msg_gas_usage: bool, +} + +#[cw_serde] +#[derive(Eq)] +#[serde(rename_all = "snake_case")] +pub struct CCVUpdateParamsPermission { + // TODO: do we need to manage the param + // pub enabled: bool, + pub blocks_per_distribution_transmission: bool, + pub distribution_transmission_channel: bool, + pub provider_fee_pool_addr_str: bool, + pub ccv_timeout_period: bool, + pub transfer_timeout_period: bool, + pub consumer_redistribution_fraction: bool, + pub historical_entries: bool, + pub unbonding_period: bool, + // !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md + pub soft_opt_out_threshold: bool, + pub reward_denoms: bool, + pub provider_reward_denoms: bool, + pub retry_delay_period: bool, +} + #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct SoftwareUpgradePermission { diff --git a/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs b/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs index 1f3baaa7..2299e222 100644 --- a/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs +++ b/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs @@ -1,11 +1,23 @@ -use crate::cron_module_types::{ParamsCron, ParamsResponseCron}; -use crate::dex_module_types::{ParamsDex, ParamsResponseDex}; -use crate::tokenfactory_module_types::{ParamsResponseTokenfactory, ParamsTokenfactory}; use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; use cosmwasm_std::{ - coin, from_json, to_json_binary, ContractResult, Empty, OwnedDeps, Querier, QuerierResult, + from_json, Binary, ContractResult, Empty, GrpcQuery, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, }; +use neutron_sdk::proto_types::cosmos::base::v1beta1::Coin; +use neutron_sdk::proto_types::neutron::cron::{ + Params as CronParams, QueryParamsResponse as ParamsResponseCron, +}; +use neutron_sdk::proto_types::neutron::dex::{ + Params as DexParams, QueryParamsResponse as QueryParamsDexResponse, +}; +use neutron_sdk::proto_types::osmosis::tokenfactory::{ + v1beta1::QueryParamsResponse as QueryParamsTokenFactoryResponse, Params as TokenFactoryParams, +}; +use neutron_std::shim::Duration; +use neutron_std::types::cosmos::base::v1beta1::DecCoin; +use neutron_std::types::gaia::globalfee; +use neutron_std::types::interchain_security::ccv::{self, consumer}; +use neutron_std::types::neutron::dynamicfees; use std::marker::PhantomData; pub fn mock_dependencies() -> OwnedDeps { @@ -43,37 +55,69 @@ impl WasmMockQuerier { pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { match &request { #[allow(deprecated)] - QueryRequest::Stargate { path, data: _ } => match path.as_str() { + QueryRequest::Grpc(GrpcQuery { data: _, path }) => match path.as_str() { "/neutron.cron.Query/Params" => { - let resp = to_json_binary(&ParamsResponseCron { - params: ParamsCron { + let resp = ParamsResponseCron { + params: Some(CronParams { security_address: "neutron_dao_address".to_string(), limit: 10, - }, - }); - SystemResult::Ok(ContractResult::from(resp)) + }), + } + .to_proto_bytes(); + SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } "/osmosis.tokenfactory.v1beta1.Query/Params" => { - let resp = to_json_binary(&ParamsResponseTokenfactory { - params: ParamsTokenfactory { - denom_creation_fee: vec![coin(1, "untrn")], + let resp = &QueryParamsTokenFactoryResponse { + params: Some(TokenFactoryParams { + denom_creation_fee: vec![Coin { + denom: "untrn".to_string(), + amount: "1".to_string(), + }], denom_creation_gas_consume: 0, fee_collector_address: "test_addr".to_string(), whitelisted_hooks: vec![], - }, - }); - SystemResult::Ok(ContractResult::from(resp)) + }), + } + .to_proto_bytes(); + SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } "/neutron.dex.Query/Params" => { - let resp = to_json_binary(&ParamsResponseDex { - params: ParamsDex { + let resp = &QueryParamsDexResponse { + params: Some(DexParams { fee_tiers: [1, 2, 99].to_vec(), paused: false, max_jits_per_block: 20, good_til_purge_allowance: 25000, - }, - }); - SystemResult::Ok(ContractResult::from(resp)) + }), + } + .to_proto_bytes(); + SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) + } + "/neutron.dynamicfees.v1.Query/Params" => { + let resp = &dynamicfees::v1::QueryParamsResponse { + params: Some(dynamicfees::v1::Params { + ntrn_prices: vec![DecCoin { + denom: "uatom".to_string(), + amount: "0.5".to_string(), + }], + }), + } + .to_proto_bytes(); + SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) + } + "/gaia.globalfee.v1beta1.Query/Params" => { + let resp = &globalfee::v1beta1::QueryParamsResponse { + params: Some(default_globalfee_params()), + } + .to_proto_bytes(); + SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) + } + "/interchain_security.ccv.consumer.v1.Query/QueryParams" => { + let resp = &consumer::v1::QueryParamsResponse { + params: Some(default_consumer_params()), + } + .to_proto_bytes(); + SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } _ => todo!(), }, @@ -87,3 +131,80 @@ impl WasmMockQuerier { WasmMockQuerier { base } } } + +pub fn default_consumer_params() -> ccv::v1::ConsumerParams { + ccv::v1::ConsumerParams { + enabled: true, + blocks_per_distribution_transmission: 10, + distribution_transmission_channel: "channel-1".to_string(), + provider_fee_pool_addr_str: "provider_fee_pool_addr_str".to_string(), + ccv_timeout_period: Some(Duration { + seconds: 1, + nanos: 0, + }), + transfer_timeout_period: Some(Duration { + seconds: 1, + nanos: 0, + }), + consumer_redistribution_fraction: "0.75".to_string(), + historical_entries: 100, + unbonding_period: Some(Duration { + seconds: 1, + nanos: 0, + }), + soft_opt_out_threshold: "10".to_string(), + reward_denoms: vec!["untrn".to_string()], + provider_reward_denoms: vec!["untrn".to_string()], + retry_delay_period: Some(Duration { + seconds: 1, + nanos: 0, + }), + } +} + +pub fn consumer_params_to_update() -> ccv::v1::ConsumerParams { + ccv::v1::ConsumerParams { + enabled: true, + blocks_per_distribution_transmission: 11, + distribution_transmission_channel: "channel-2".to_string(), + provider_fee_pool_addr_str: "new_provider_fee_pool_addr_str".to_string(), + ccv_timeout_period: Some(Duration { + seconds: 10, + nanos: 0, + }), + transfer_timeout_period: Some(Duration { + seconds: 10, + nanos: 0, + }), + consumer_redistribution_fraction: "1.75".to_string(), + historical_entries: 1000, + unbonding_period: Some(Duration { + seconds: 10, + nanos: 0, + }), + soft_opt_out_threshold: "100".to_string(), + reward_denoms: vec!["utia".to_string()], + provider_reward_denoms: vec!["utia".to_string()], + retry_delay_period: Some(Duration { + seconds: 10, + nanos: 0, + }), + } +} + +pub fn default_globalfee_params() -> globalfee::v1beta1::Params { + globalfee::v1beta1::Params { + minimum_gas_prices: vec![ + DecCoin { + denom: "untrn".to_string(), + amount: "0.025".to_string(), + }, + DecCoin { + denom: "uatom".to_string(), + amount: "0.0025".to_string(), + }, + ], + bypass_min_fee_msg_types: vec!["allowedMsgType".to_string()], + max_total_bypass_min_fee_msg_gas_usage: 10000, + } +} diff --git a/contracts/dao/neutron-chain-manager/src/testing/mod.rs b/contracts/dao/neutron-chain-manager/src/testing/mod.rs index a1e507b6..ce65fab0 100644 --- a/contracts/dao/neutron-chain-manager/src/testing/mod.rs +++ b/contracts/dao/neutron-chain-manager/src/testing/mod.rs @@ -1,2 +1,3 @@ +#[allow(deprecated)] mod mock_querier; mod tests; diff --git a/contracts/dao/neutron-chain-manager/src/testing/tests.rs b/contracts/dao/neutron-chain-manager/src/testing/tests.rs index f79c65e3..2fcaf54c 100644 --- a/contracts/dao/neutron-chain-manager/src/testing/tests.rs +++ b/contracts/dao/neutron-chain-manager/src/testing/tests.rs @@ -3,15 +3,19 @@ use crate::contract::{ }; use crate::error::ContractError::{InvalidDemotion, Unauthorized}; use crate::msg::Permission::{ - CronPermission, ParamChangePermission, UpdateCronParamsPermission, UpdateDexParamsPermission, + CronPermission, ParamChangePermission, UpdateCCVParamsPermission, UpdateCronParamsPermission, + UpdateDexParamsPermission, UpdateDynamicfeesParamsPermission, UpdateGlobalfeeParamsPermission, UpdateTokenfactoryParamsPermission, }; use crate::msg::{ - CronPermission as CronPermissionType, CronUpdateParamsPermission, DexUpdateParamsPermission, + CCVUpdateParamsPermission, CronPermission as CronPermissionType, CronUpdateParamsPermission, + DexUpdateParamsPermission, DynamicFeesUpdateParamsPermission, GlobalfeeUpdateParamsPermission, InstantiateMsg, ParamChangePermission as ParamChangePermissionType, ParamPermission, StrategyMsg, TokenfactoryUpdateParamsPermission, }; -use crate::testing::mock_querier::mock_dependencies; +use crate::testing::mock_querier::{ + consumer_params_to_update, default_consumer_params, mock_dependencies, +}; use cosmwasm_std::testing::{message_info, mock_env}; use cosmwasm_std::{Addr, BankMsg, Coin, CosmosMsg, Uint128}; use neutron_sdk::bindings::msg::{ @@ -923,6 +927,1144 @@ pub fn test_execute_execute_message_update_params_dex_unauthorized_good_til_purg assert_eq!(err, Unauthorized {}); } +/// Checks that if you have permissions, you can change all parameters of the dynamicfees +/// module (new style parameter changes). NOTE: this does not check that the +/// parameters have actually been changed. +#[test] +pub fn test_execute_execute_message_update_params_dynamicfees_authorized() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/neutron.dynamicfees.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"ntrn_prices":[{"denom":"utia","amount":"1.5"}]}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateDynamicfeesParamsPermission( + DynamicFeesUpdateParamsPermission { ntrn_prices: true }, + )]), + ) + .unwrap(); + + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap(); +} + +/// Checks that you can't change `ntrn_prices` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_dynamicfees_unauthorized() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/neutron.dynamicfees.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"ntrn_prices":[{"denom":"utia","amount":"1.5"}]}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateDynamicfeesParamsPermission( + DynamicFeesUpdateParamsPermission { ntrn_prices: false }, + )]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that if you have permissions, you can change all parameters of the globalfee +/// module (new style parameter changes). NOTE: this does not check that the +/// parameters have actually been changed. +#[test] +pub fn test_execute_execute_message_update_params_globalfee_authorized() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/gaia.globalfee.v1beta1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"minimum_gas_prices":[{"denom":"utia","amount":"2.5"}],"bypass_min_fee_msg_types":["allowedMsgType2"],"max_total_bypass_min_fee_msg_gas_usage":100000}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateGlobalfeeParamsPermission( + GlobalfeeUpdateParamsPermission { + minimum_gas_prices: true, + bypass_min_fee_msg_types: true, + max_total_bypass_min_fee_msg_gas_usage: true, + }, + )]), + ) + .unwrap(); + + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap(); +} + +/// Checks that you can't change `minimum_gas_prices` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_globalfee_minimum_gas_prices_unauthorized() { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/gaia.globalfee.v1beta1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"minimum_gas_prices":[{"denom":"utia","amount":"2.5"}],"bypass_min_fee_msg_types":["allowedMsgType2"],"max_total_bypass_min_fee_msg_gas_usage":100000}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateGlobalfeeParamsPermission( + GlobalfeeUpdateParamsPermission { + minimum_gas_prices: false, + bypass_min_fee_msg_types: true, + max_total_bypass_min_fee_msg_gas_usage: true, + }, + )]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `bypass_min_fee_msg_types` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_globalfee_bypass_min_fee_msg_types_unauthorized() +{ + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/gaia.globalfee.v1beta1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"minimum_gas_prices":[{"denom":"utia","amount":"2.5"}],"bypass_min_fee_msg_types":["allowedMsgType2"],"max_total_bypass_min_fee_msg_gas_usage":100000}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateGlobalfeeParamsPermission( + GlobalfeeUpdateParamsPermission { + minimum_gas_prices: true, + bypass_min_fee_msg_types: false, + max_total_bypass_min_fee_msg_gas_usage: true, + }, + )]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `max_total_bypass_min_fee_msg_gas_usage` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_globalfee_max_total_bypass_min_fee_msg_gas_usage_unauthorized( +) { + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: r#"{"@type":"/gaia.globalfee.v1beta1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {"minimum_gas_prices":[{"denom":"utia","amount":"2.5"}],"bypass_min_fee_msg_types":["allowedMsgType2"],"max_total_bypass_min_fee_msg_gas_usage":100000}}"# + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateGlobalfeeParamsPermission( + GlobalfeeUpdateParamsPermission { + minimum_gas_prices: true, + bypass_min_fee_msg_types: true, + max_total_bypass_min_fee_msg_gas_usage: false, + }, + )]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that if you have permissions, you can change all parameters of the consumer +/// module (new style parameter changes). NOTE: this does not check that the +/// parameters have actually been changed. +#[test] +pub fn test_execute_execute_message_update_params_consumer_authorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let err = execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg.clone()]) + .unwrap_err(); + assert_eq!(err, Unauthorized {}); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap(); +} + +/// Checks that you can't change `enabled`. It is not allowed to change `enabled` param. +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_disable_unauthorized() { + let mut params = default_consumer_params(); + params.enabled = false; + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `blocks_per_distribution_transmission` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_blocks_per_distribution_transmission_unauthorized( +) { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: false, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `distribution_transmission_channel` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_distribution_transmission_channel_unauthorized( +) { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: false, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `provider_fee_pool_addr_str` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_provider_fee_pool_addr_str_unauthorized() +{ + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: false, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `ccv_timeout_period` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_ccv_timeout_period_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: false, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `transfer_timeout_period` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_transfer_timeout_period_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: false, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `consumer_redistribution_fraction` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_consumer_redistribution_fraction_unauthorized( +) { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: false, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `historical_entries` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_historical_entries_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: false, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `unbonding_period` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_unbonding_period_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: false, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `soft_opt_out_threshold` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_soft_opt_out_threshold_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: false, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `reward_denoms` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_reward_denoms_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: false, + provider_reward_denoms: true, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `provider_reward_denoms` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_provider_reward_denoms_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: false, + retry_delay_period: true, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + +/// Checks that you can't change `retry_delay_period` if you don't have the permission to do so +/// (new style parameter changes). +#[test] +pub fn test_execute_execute_message_update_params_consumer_retry_delay_period_unauthorized() { + let params = consumer_params_to_update(); + let msg = CosmosMsg::Custom(NeutronMsg::SubmitAdminProposal { + admin_proposal: AdminProposal::ProposalExecuteMessage(ProposalExecuteMessage { + message: format!( + r#"{{"@type":"/interchain_security.ccv.consumer.v1.MsgUpdateParams", + "authority":"neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z", + "params": {}}}"#, + serde_json_wasm::to_string(¶ms).unwrap() + ) + .to_string(), + }), + }); + + let mut deps = mock_dependencies(); + let env = mock_env(); + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + let non_priv_info = message_info(&Addr::unchecked("addr1"), &[]); + + instantiate( + deps.as_mut(), + env.clone(), + info.clone(), + InstantiateMsg { + initial_strategy_address: Addr::unchecked("neutron_dao_address".to_string()), + }, + ) + .unwrap(); + + let info = message_info(&Addr::unchecked("neutron_dao_address"), &[]); + execute_add_strategy( + deps.as_mut(), + info.clone(), + Addr::unchecked("addr1".to_string()), + StrategyMsg::AllowOnly(vec![UpdateCCVParamsPermission(CCVUpdateParamsPermission { + blocks_per_distribution_transmission: true, + distribution_transmission_channel: true, + provider_fee_pool_addr_str: true, + ccv_timeout_period: true, + transfer_timeout_period: true, + consumer_redistribution_fraction: true, + historical_entries: true, + unbonding_period: true, + soft_opt_out_threshold: true, + reward_denoms: true, + provider_reward_denoms: true, + retry_delay_period: false, + })]), + ) + .unwrap(); + + let err = + execute_execute_messages(deps.as_mut(), non_priv_info.clone(), vec![msg]).unwrap_err(); + assert_eq!(err, Unauthorized {}); +} + /// Checks that you can update a legacy param if you have the necessary ALLOW_ONLY permission. #[test] pub fn test_execute_execute_message_param_change_success() { diff --git a/contracts/dao/neutron-chain-manager/src/tokenfactory_module_types.rs b/contracts/dao/neutron-chain-manager/src/tokenfactory_module_types.rs deleted file mode 100644 index 21298b15..00000000 --- a/contracts/dao/neutron-chain-manager/src/tokenfactory_module_types.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::utils::deserialize_u64; -use cosmwasm_std::Coin; -use neutron_sdk::proto_types::osmosis::tokenfactory::v1beta1::QueryParamsRequest; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -pub const PARAMS_QUERY_PATH_TOKENFACTORY: &str = "/osmosis.tokenfactory.v1beta1.Query/Params"; -pub const MSG_TYPE_UPDATE_PARAMS_TOKENFACTORY: &str = - "/osmosis.tokenfactory.v1beta1.MsgUpdateParams"; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgUpdateParamsTokenfactory { - pub params: ParamsTokenfactory, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct WhitelistedHook { - #[serde(deserialize_with = "deserialize_u64")] - pub code_id: u64, - pub denom_creator: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ParamsTokenfactory { - pub denom_creation_fee: Vec, - #[serde(deserialize_with = "deserialize_u64")] - pub denom_creation_gas_consume: u64, - pub fee_collector_address: String, - pub whitelisted_hooks: Vec, -} - -/// The types below are used for querying tokenfactory module parameters via stargate. -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, ::prost::Message)] -pub struct ParamsRequestTokenfactory {} - -impl From for QueryParamsRequest { - fn from(_: ParamsRequestTokenfactory) -> QueryParamsRequest { - QueryParamsRequest {} - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct ParamsResponseTokenfactory { - pub params: ParamsTokenfactory, -} diff --git a/packages/cw-paginate/src/lib.rs b/packages/cw-paginate/src/lib.rs index f4a86d4c..9962b84b 100644 --- a/packages/cw-paginate/src/lib.rs +++ b/packages/cw-paginate/src/lib.rs @@ -418,7 +418,7 @@ mod tests { map.save( &mut deps.storage, ctr, - &Uint128::new(ctr.try_into().unwrap()), + &Uint128::new(ctr.into()), env.block.height, ) .unwrap(); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 8142c301..51985806 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.73.0" +channel = "1.78.0" From 0112676bac38dcad42e07a1fbc15cbb21fcc67f3 Mon Sep 17 00:00:00 2001 From: swelf Date: Mon, 11 Nov 2024 23:00:01 +0300 Subject: [PATCH 2/9] clippy --- .../src/testing/mock_querier.rs | 2 +- .../cwd-subdao-timelock-single/src/testing/tests.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/testing/mock_querier.rs b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/testing/mock_querier.rs index a23ea179..0a3ffc71 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/testing/mock_querier.rs +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/testing/mock_querier.rs @@ -231,7 +231,7 @@ pub fn get_dao_with_impostor_timelock() -> HashMap HashMap> { let mut contracts: HashMap> = get_properly_initialized_dao(); // subdao becomes impostor if it is not in the dao's list, so let's just make it empty - contracts.remove(&MOCK_DAO_CORE.to_string()); + contracts.remove(MOCK_DAO_CORE); contracts.insert( MOCK_DAO_CORE.to_string(), Box::new(MockDaoQueries { diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index 1076025f..b8a05e65 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -579,7 +579,7 @@ fn test_query_proposals() { limit: None, }; let res = query(deps.as_ref(), mock_env(), query_msg).unwrap(); - let queried_props: ProposalListResponse = from_json(&res).unwrap(); + let queried_props: ProposalListResponse = from_json(res).unwrap(); for (p, i) in queried_props.proposals.iter().zip(1..) { let expected_prop = SingleChoiceProposal { id: i, @@ -595,7 +595,7 @@ fn test_query_proposals() { limit: Some(100), }; let res = query(deps.as_ref(), mock_env(), query_msg).unwrap(); - let queried_props: ProposalListResponse = from_json(&res).unwrap(); + let queried_props: ProposalListResponse = from_json(res).unwrap(); for (p, i) in queried_props.proposals.iter().zip(1..) { let expected_prop = SingleChoiceProposal { id: i, @@ -611,7 +611,7 @@ fn test_query_proposals() { limit: Some(10), }; let res = query(deps.as_ref(), mock_env(), query_msg).unwrap(); - let queried_props: ProposalListResponse = from_json(&res).unwrap(); + let queried_props: ProposalListResponse = from_json(res).unwrap(); for (p, i) in queried_props.proposals.iter().zip(1..) { let expected_prop = SingleChoiceProposal { id: i, @@ -627,7 +627,7 @@ fn test_query_proposals() { limit: None, }; let res = query(deps.as_ref(), mock_env(), query_msg).unwrap(); - let queried_props: ProposalListResponse = from_json(&res).unwrap(); + let queried_props: ProposalListResponse = from_json(res).unwrap(); for (p, i) in queried_props.proposals.iter().zip(51..) { let expected_prop = SingleChoiceProposal { id: i, @@ -643,7 +643,7 @@ fn test_query_proposals() { limit: None, }; let res = query(deps.as_ref(), mock_env(), query_msg).unwrap(); - let queried_props: ProposalListResponse = from_json(&res).unwrap(); + let queried_props: ProposalListResponse = from_json(res).unwrap(); for (p, i) in queried_props.proposals.iter().zip(91..) { let expected_prop = SingleChoiceProposal { id: i, From 82da2c944bc4479f72203728672177aa61e1d0b1 Mon Sep 17 00:00:00 2001 From: swelf Date: Mon, 11 Nov 2024 23:48:04 +0300 Subject: [PATCH 3/9] updated contracts verify command --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fc2cea35..4b8ebb45 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ fmt: check_contracts: @cargo install cosmwasm-check --version 2.0.4 --locked - @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron artifacts/*.wasm + @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0 artifacts/*.wasm compile: @docker run --rm -v "$(CURDIR)":/code \ From 7be8d9d4184e46a69ea2af307c614e9cf54d9b26 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 12 Nov 2024 15:22:20 +0300 Subject: [PATCH 4/9] downgraded rust version: cosmwasm-std 1.5.2 is incompatible with rust 1.78+ --- .github/workflows/build.yml | 4 ++-- .github/workflows/tests.yml | 6 +++--- Makefile | 2 +- rust-toolchain.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f39ff827..ae403a22 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: inputs: toolchain: description: 'Default Rust Toolchain' - default: "1.78.0" + default: "1.75.0" required: true type: string target: @@ -31,7 +31,7 @@ on: type: string env: - TOOLCHAIN: ${{ inputs.toolchain || '1.78.0' }} + TOOLCHAIN: ${{ inputs.toolchain || '1.75.0' }} TARGET: ${{ inputs.target || 'wasm32-unknown-unknown' }} REF: ${{ github.event_name == 'push' && github.ref || inputs.branch || 'main' }} ID: ${{ inputs.id || 'scheduled' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 12551263..3122bd04 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.78.0 + toolchain: 1.75.0 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.78.0 + toolchain: 1.75.0 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.78.0 + toolchain: 1.75.0 profile: minimal - run: cargo fetch --verbose - run: cargo build diff --git a/Makefile b/Makefile index 4b8ebb45..7c422ed8 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,6 @@ compile: --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.16.0 + cosmwasm/workspace-optimizer:0.15.1 build: schema clippy fmt test compile check_contracts diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 51985806..7897a24d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.78.0" +channel = "1.75.0" From 54ad32ae7816e5e71e58d2a781900e7795141c74 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 12 Nov 2024 20:10:17 +0300 Subject: [PATCH 5/9] updated neutron-std --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed3d412c..8a5a1193 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2602,8 +2602,8 @@ dependencies = [ [[package]] name = "neutron-std" -version = "4.2.2-rc" -source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#431b87f7f89797450f0ca2dd413b27e713335235" +version = "5.0.0" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#6881da40f6119f8c12a4ef5141bd462f7ec9033e" dependencies = [ "bech32 0.9.1", "chrono", @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "neutron-std-derive" version = "0.20.1" -source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#431b87f7f89797450f0ca2dd413b27e713335235" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#6881da40f6119f8c12a4ef5141bd462f7ec9033e" dependencies = [ "itertools 0.10.5", "proc-macro2", From b905d26387fb1679895e86ad7d3bacc8d6128bcf Mon Sep 17 00:00:00 2001 From: swelf Date: Wed, 13 Nov 2024 19:29:43 +0300 Subject: [PATCH 6/9] updated neutron-std --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a5a1193..0064751d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2603,7 +2603,7 @@ dependencies = [ [[package]] name = "neutron-std" version = "5.0.0" -source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#6881da40f6119f8c12a4ef5141bd462f7ec9033e" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#71829775961f37ec17dc38b9b68f77035919195a" dependencies = [ "bech32 0.9.1", "chrono", @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "neutron-std-derive" version = "0.20.1" -source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#6881da40f6119f8c12a4ef5141bd462f7ec9033e" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#71829775961f37ec17dc38b9b68f77035919195a" dependencies = [ "itertools 0.10.5", "proc-macro2", From c2d8fbd659cfbeab836e2c8c998fe613f8f5b618 Mon Sep 17 00:00:00 2001 From: swelf Date: Mon, 25 Nov 2024 22:59:43 +0300 Subject: [PATCH 7/9] review fixes: removed commented code --- contracts/dao/neutron-chain-manager/src/msg.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contracts/dao/neutron-chain-manager/src/msg.rs b/contracts/dao/neutron-chain-manager/src/msg.rs index e7b28374..ed555dc1 100644 --- a/contracts/dao/neutron-chain-manager/src/msg.rs +++ b/contracts/dao/neutron-chain-manager/src/msg.rs @@ -209,7 +209,6 @@ impl Strategy { pub fn get_ccv_update_param_permission(&self) -> Option { match self { Strategy::AllowAll => Some(CCVUpdateParamsPermission { - // enabled: true, blocks_per_distribution_transmission: true, distribution_transmission_channel: true, provider_fee_pool_addr_str: true, @@ -387,8 +386,6 @@ pub struct GlobalfeeUpdateParamsPermission { #[derive(Eq)] #[serde(rename_all = "snake_case")] pub struct CCVUpdateParamsPermission { - // TODO: do we need to manage the param - // pub enabled: bool, pub blocks_per_distribution_transmission: bool, pub distribution_transmission_channel: bool, pub provider_fee_pool_addr_str: bool, @@ -397,7 +394,8 @@ pub struct CCVUpdateParamsPermission { pub consumer_redistribution_fraction: bool, pub historical_entries: bool, pub unbonding_period: bool, - // !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see docs/docs/adrs/adr-015-partial-set-security.md + // !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. + // see https://github.com/cosmos/interchain-security/blob/main/docs/docs/adrs/adr-015-partial-set-security.md pub soft_opt_out_threshold: bool, pub reward_denoms: bool, pub provider_reward_denoms: bool, From 7965942a27ccb97a3de8a3357b893bb36b86e9c9 Mon Sep 17 00:00:00 2001 From: swelf Date: Mon, 25 Nov 2024 23:44:12 +0300 Subject: [PATCH 8/9] fmt --- contracts/dao/neutron-chain-manager/src/msg.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/dao/neutron-chain-manager/src/msg.rs b/contracts/dao/neutron-chain-manager/src/msg.rs index ed555dc1..e1531857 100644 --- a/contracts/dao/neutron-chain-manager/src/msg.rs +++ b/contracts/dao/neutron-chain-manager/src/msg.rs @@ -394,7 +394,7 @@ pub struct CCVUpdateParamsPermission { pub consumer_redistribution_fraction: bool, pub historical_entries: bool, pub unbonding_period: bool, - // !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. + // !!! DEPRECATED !!! soft_opt_out_threshold is deprecated. // see https://github.com/cosmos/interchain-security/blob/main/docs/docs/adrs/adr-015-partial-set-security.md pub soft_opt_out_threshold: bool, pub reward_denoms: bool, From bebc16e56e4cc35e24337e14c52ea20c3b6c82a1 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 26 Nov 2024 00:37:42 +0300 Subject: [PATCH 9/9] refectored code: replaced hardcoded strings with a type defined PATH fields. Updated imports. Updated neutron-std --- Cargo.lock | 4 +- .../src/testing/mock_querier.rs | 40 ++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0064751d..58425780 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2603,7 +2603,7 @@ dependencies = [ [[package]] name = "neutron-std" version = "5.0.0" -source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#71829775961f37ec17dc38b9b68f77035919195a" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#47e90841f1a971d69c0e1baedd4253a087237918" dependencies = [ "bech32 0.9.1", "chrono", @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "neutron-std-derive" version = "0.20.1" -source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#71829775961f37ec17dc38b9b68f77035919195a" +source = "git+https://github.com/neutron-org/neutron-std.git?branch=feat/add-interchain-security-protobuf#47e90841f1a971d69c0e1baedd4253a087237918" dependencies = [ "itertools 0.10.5", "proc-macro2", diff --git a/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs b/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs index 2299e222..60a668f1 100644 --- a/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs +++ b/contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs @@ -3,21 +3,13 @@ use cosmwasm_std::{ from_json, Binary, ContractResult, Empty, GrpcQuery, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, }; -use neutron_sdk::proto_types::cosmos::base::v1beta1::Coin; -use neutron_sdk::proto_types::neutron::cron::{ - Params as CronParams, QueryParamsResponse as ParamsResponseCron, -}; -use neutron_sdk::proto_types::neutron::dex::{ - Params as DexParams, QueryParamsResponse as QueryParamsDexResponse, -}; -use neutron_sdk::proto_types::osmosis::tokenfactory::{ - v1beta1::QueryParamsResponse as QueryParamsTokenFactoryResponse, Params as TokenFactoryParams, -}; use neutron_std::shim::Duration; +use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_std::types::cosmos::base::v1beta1::DecCoin; use neutron_std::types::gaia::globalfee; use neutron_std::types::interchain_security::ccv::{self, consumer}; -use neutron_std::types::neutron::dynamicfees; +use neutron_std::types::neutron::{cron, dex, dynamicfees}; +use neutron_std::types::osmosis::tokenfactory; use std::marker::PhantomData; pub fn mock_dependencies() -> OwnedDeps { @@ -56,9 +48,9 @@ impl WasmMockQuerier { match &request { #[allow(deprecated)] QueryRequest::Grpc(GrpcQuery { data: _, path }) => match path.as_str() { - "/neutron.cron.Query/Params" => { - let resp = ParamsResponseCron { - params: Some(CronParams { + cron::QueryParamsRequest::PATH => { + let resp = cron::QueryParamsResponse { + params: Some(cron::Params { security_address: "neutron_dao_address".to_string(), limit: 10, }), @@ -66,14 +58,14 @@ impl WasmMockQuerier { .to_proto_bytes(); SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } - "/osmosis.tokenfactory.v1beta1.Query/Params" => { - let resp = &QueryParamsTokenFactoryResponse { - params: Some(TokenFactoryParams { + tokenfactory::v1beta1::QueryParamsRequest::PATH => { + let resp = &tokenfactory::v1beta1::QueryParamsResponse { + params: Some(tokenfactory::Params { denom_creation_fee: vec![Coin { denom: "untrn".to_string(), amount: "1".to_string(), }], - denom_creation_gas_consume: 0, + denom_creation_gas_consume: None, fee_collector_address: "test_addr".to_string(), whitelisted_hooks: vec![], }), @@ -81,9 +73,9 @@ impl WasmMockQuerier { .to_proto_bytes(); SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } - "/neutron.dex.Query/Params" => { - let resp = &QueryParamsDexResponse { - params: Some(DexParams { + dex::QueryParamsRequest::PATH => { + let resp = &dex::QueryParamsResponse { + params: Some(dex::Params { fee_tiers: [1, 2, 99].to_vec(), paused: false, max_jits_per_block: 20, @@ -93,7 +85,7 @@ impl WasmMockQuerier { .to_proto_bytes(); SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } - "/neutron.dynamicfees.v1.Query/Params" => { + dynamicfees::v1::QueryParamsRequest::PATH => { let resp = &dynamicfees::v1::QueryParamsResponse { params: Some(dynamicfees::v1::Params { ntrn_prices: vec![DecCoin { @@ -105,14 +97,14 @@ impl WasmMockQuerier { .to_proto_bytes(); SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } - "/gaia.globalfee.v1beta1.Query/Params" => { + globalfee::v1beta1::QueryParamsRequest::PATH => { let resp = &globalfee::v1beta1::QueryParamsResponse { params: Some(default_globalfee_params()), } .to_proto_bytes(); SystemResult::Ok(ContractResult::Ok(Binary::new(resp.to_vec()))) } - "/interchain_security.ccv.consumer.v1.Query/QueryParams" => { + consumer::v1::QueryParamsRequest::PATH => { let resp = &consumer::v1::QueryParamsResponse { params: Some(default_consumer_params()), }