From 766672c1e7514860a896c94c56fb7b0a9631820d Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 17 Oct 2024 18:48:02 +0400 Subject: [PATCH] fix queries Height struct used in sudo calls --- Cargo.lock | 4 ++-- contracts/neutron_interchain_queries/src/contract.rs | 2 +- .../neutron_interchain_queries/src/testing/tests.rs | 5 +++-- contracts/neutron_interchain_txs/schema/sudo_msg.json | 9 +++------ contracts/neutron_validator_test/schema/sudo_msg.json | 9 +++------ contracts/neutron_validator_test/src/contract.rs | 2 +- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 858d0a9..e85c20b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1128,7 +1128,7 @@ dependencies = [ [[package]] name = "neutron-sdk" version = "0.11.0" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/clean-bindings#08b4e767a8147edf1f80d00d7d49067fae538103" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/clean-bindings#b3095f3719c05268ca796bdcf7b77d3589bab394" dependencies = [ "bech32 0.9.1", "chrono", @@ -1177,7 +1177,7 @@ dependencies = [ [[package]] name = "neutron-std-derive" version = "0.20.1" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/clean-bindings#08b4e767a8147edf1f80d00d7d49067fae538103" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/clean-bindings#b3095f3719c05268ca796bdcf7b77d3589bab394" dependencies = [ "itertools 0.10.5", "proc-macro2", diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 8c4656d..e9aac7c 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -34,6 +34,7 @@ use neutron_sdk::interchain_queries::helpers::{ remove_interchain_query as helpers_remove_interchain_query, update_interchain_query as helpers_update_interchain_query, }; +use neutron_sdk::interchain_queries::sudo::Height; use neutron_sdk::interchain_queries::types::{ QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; @@ -57,7 +58,6 @@ use neutron_sdk::interchain_queries::v047::register_queries::{ use neutron_sdk::interchain_queries::v047::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; use neutron_sdk::sudo::msg::SudoMsg; use neutron_sdk::{NeutronError, NeutronResult}; -use neutron_std::types::ibc::core::client::v1::Height; use neutron_std::types::neutron::interchainqueries::KvKey; use prost::Message as ProstMessage; diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index e4acd4e..504e8a7 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -33,6 +33,7 @@ use cosmwasm_std::{ }; use neutron_sdk::interchain_queries::helpers::{decode_and_convert, kv_key_from_string}; use neutron_sdk::interchain_queries::hex::decode_hex; +use neutron_sdk::interchain_queries::sudo::Height as QueriesHeight; use neutron_sdk::interchain_queries::types::{ QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; @@ -1032,7 +1033,7 @@ fn test_sudo_tx_query_result_callback() { let env = mock_env(); let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); let query_id: u64 = 1u64; - let height = Height { + let height = QueriesHeight { revision_number: 0u64, revision_height: 1u64, }; @@ -1136,7 +1137,7 @@ fn test_sudo_tx_query_result_min_height_callback() { let env = mock_env(); let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); let query_id: u64 = 1u64; - let height = Height { + let height = QueriesHeight { revision_number: 0u64, revision_height: 1u64, }; diff --git a/contracts/neutron_interchain_txs/schema/sudo_msg.json b/contracts/neutron_interchain_txs/schema/sudo_msg.json index da97da0..de8ad10 100644 --- a/contracts/neutron_interchain_txs/schema/sudo_msg.json +++ b/contracts/neutron_interchain_txs/schema/sudo_msg.json @@ -167,21 +167,18 @@ "type": "string" }, "Height": { - "description": "Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients\n\nNormally the RevisionHeight is incremented at each height while keeping RevisionNumber the same. However some consensus algorithms may choose to reset the height in certain conditions e.g. hard forks, state-machine breaking changes In these cases, the RevisionNumber is incremented so that height continues to be monitonically increasing even as the RevisionHeight gets reset", "type": "object", - "required": [ - "revision_height", - "revision_number" - ], "properties": { "revision_height": { - "description": "the height within the given revision", + "description": "*height** is a height of remote chain", + "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 }, "revision_number": { "description": "the revision that the client is currently on", + "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 diff --git a/contracts/neutron_validator_test/schema/sudo_msg.json b/contracts/neutron_validator_test/schema/sudo_msg.json index da97da0..de8ad10 100644 --- a/contracts/neutron_validator_test/schema/sudo_msg.json +++ b/contracts/neutron_validator_test/schema/sudo_msg.json @@ -167,21 +167,18 @@ "type": "string" }, "Height": { - "description": "Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients\n\nNormally the RevisionHeight is incremented at each height while keeping RevisionNumber the same. However some consensus algorithms may choose to reset the height in certain conditions e.g. hard forks, state-machine breaking changes In these cases, the RevisionNumber is incremented so that height continues to be monitonically increasing even as the RevisionHeight gets reset", "type": "object", - "required": [ - "revision_height", - "revision_number" - ], "properties": { "revision_height": { - "description": "the height within the given revision", + "description": "*height** is a height of remote chain", + "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 }, "revision_number": { "description": "the revision that the client is currently on", + "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 diff --git a/contracts/neutron_validator_test/src/contract.rs b/contracts/neutron_validator_test/src/contract.rs index 1924e24..ec5863f 100644 --- a/contracts/neutron_validator_test/src/contract.rs +++ b/contracts/neutron_validator_test/src/contract.rs @@ -36,6 +36,7 @@ use cosmwasm_std::{ use cw2::set_contract_version; use neutron_sdk::interchain_queries::helpers::remove_interchain_query as helpers_remove_interchain_query; use neutron_sdk::interchain_queries::queries::get_registered_query; +use neutron_sdk::interchain_queries::sudo::Height; use neutron_sdk::interchain_queries::types::{ TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; @@ -53,7 +54,6 @@ use neutron_sdk::{NeutronError, NeutronResult}; use neutron_std::shim::Any; use neutron_std::types::cosmos::base::v1beta1::Coin as CosmosCoin; use neutron_std::types::ibc::core::channel::v1::Order; -use neutron_std::types::ibc::core::client::v1::Height; use neutron_std::types::neutron::feerefunder::Fee; use neutron_std::types::neutron::interchainqueries::RegisteredQuery; use neutron_std::types::neutron::interchaintxs::v1::{InterchaintxsQuerier, MsgSubmitTxResponse};