diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2bc01b0..fca0ead 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 18a4d9a..e683412 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.73.0 + toolchain: 1.78.0 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.73.0 + toolchain: 1.78.0 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 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 e7f4949..ea31203 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1131,7 +1131,7 @@ dependencies = [ [[package]] name = "neutron-sdk" version = "0.11.0" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#a11018a9152bb0065868145266f35e283ac36b8e" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#e0e697a5c8f2960da1c1e6f4a5fd42b1c0dfb5b7" dependencies = [ "bech32 0.9.1", "chrono", @@ -1155,7 +1155,7 @@ dependencies = [ [[package]] name = "neutron-std-derive" version = "0.20.1" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#a11018a9152bb0065868145266f35e283ac36b8e" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#e0e697a5c8f2960da1c1e6f4a5fd42b1c0dfb5b7" dependencies = [ "itertools 0.10.5", "proc-macro2", diff --git a/Makefile b/Makefile index 0942ee6..7f2ba67 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ 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 check_contracts: @cargo install cosmwasm-check --version 2.0.4 --locked diff --git a/contracts/neutron_interchain_queries/schema/execute_msg.json b/contracts/neutron_interchain_queries/schema/execute_msg.json index 2b7f86e..0faca5d 100644 --- a/contracts/neutron_interchain_queries/schema/execute_msg.json +++ b/contracts/neutron_interchain_queries/schema/execute_msg.json @@ -224,7 +224,7 @@ "type": "object", "required": [ "connection_id", - "recipient", + "recipients", "update_period" ], "properties": { @@ -239,8 +239,11 @@ "format": "uint64", "minimum": 0.0 }, - "recipient": { - "type": "string" + "recipients": { + "type": "array", + "items": { + "type": "string" + } }, "update_period": { "type": "integer", diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 169e321..ca7619a 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -35,6 +35,7 @@ use neutron_sdk::interchain_queries::get_registered_query; use neutron_sdk::interchain_queries::types::{ QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; +use neutron_sdk::interchain_queries::v045::types::HEIGHT_FIELD; use neutron_sdk::interchain_queries::v047::queries::{ query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, query_government_proposal_votes, query_government_proposals, query_staking_validators, @@ -45,7 +46,7 @@ use neutron_sdk::interchain_queries::v047::register_queries::{ new_register_delegator_delegations_query_msg, new_register_delegator_unbonding_delegations_query_msg, new_register_distribution_fee_pool_query_msg, new_register_gov_proposals_query_msg, - new_register_staking_validators_query_msg, new_register_transfers_query_msg, + new_register_staking_validators_query_msg, }; use neutron_sdk::interchain_queries::v047::register_queries::{ new_register_gov_proposals_voters_votes_query_msg, @@ -144,10 +145,10 @@ pub fn execute( } => register_validators_signing_infos_query(connection_id, validators, update_period), ExecuteMsg::RegisterTransfersQuery { connection_id, - recipient, + recipients, update_period, min_height, - } => register_transfers_query(connection_id, recipient, update_period, min_height), + } => register_transfers_query(connection_id, recipients, update_period, min_height), ExecuteMsg::UpdateInterchainQuery { query_id, new_keys, @@ -284,12 +285,32 @@ pub fn register_validators_signing_infos_query( pub fn register_transfers_query( connection_id: String, - recipient: String, + recipients: Vec, update_period: u64, min_height: Option, ) -> NeutronResult> { - let msg = - new_register_transfers_query_msg(connection_id, recipient, update_period, min_height)?; + let mut query_data: Vec = recipients + .into_iter() + .map(|r| TransactionFilterItem { + field: RECIPIENT_FIELD.to_string(), + op: TransactionFilterOp::Eq, + value: TransactionFilterValue::String(r), + }) + .collect(); + + if let Some(min_height) = min_height { + query_data.push(TransactionFilterItem { + field: HEIGHT_FIELD.to_string(), + op: TransactionFilterOp::Gte, + value: TransactionFilterValue::Int(min_height), + }) + } + + let msg = NeutronMsg::register_interchain_query( + QueryPayload::TX(query_data), + connection_id, + update_period, + )?; Ok(Response::new().add_message(msg)) } diff --git a/contracts/neutron_interchain_queries/src/msg.rs b/contracts/neutron_interchain_queries/src/msg.rs index ddc0971..311a181 100644 --- a/contracts/neutron_interchain_queries/src/msg.rs +++ b/contracts/neutron_interchain_queries/src/msg.rs @@ -43,7 +43,7 @@ pub enum ExecuteMsg { RegisterTransfersQuery { connection_id: String, update_period: u64, - recipient: String, + recipients: Vec, min_height: Option, }, RegisterDelegatorDelegationsQuery { diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 04b0902..d0ee479 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -1000,7 +1000,7 @@ fn test_sudo_tx_query_result_callback() { let msg = ExecuteMsg::RegisterTransfersQuery { connection_id: "connection".to_string(), update_period: 1u64, - recipient: watched_addr.clone(), + recipients: vec![watched_addr.clone()], min_height: None, }; execute( @@ -1104,7 +1104,7 @@ fn test_sudo_tx_query_result_min_height_callback() { let msg = ExecuteMsg::RegisterTransfersQuery { connection_id: "connection".to_string(), update_period: 1u64, - recipient: watched_addr.clone(), + recipients: vec![watched_addr.clone()], min_height: Some(100000), }; execute( diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 20ff287..efc4660 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -346,7 +346,7 @@ fn execute_undelegate( amount: amount.to_string(), }), }; - let mut buf = Vec::new(); + let mut buf = Vec::with_capacity(delegate_msg.encoded_len()); buf.reserve(delegate_msg.encoded_len()); if let Err(e) = delegate_msg.encode(&mut buf) { @@ -403,7 +403,7 @@ fn do_delegate( amount: info.amount.to_string(), }), }; - let mut buf = Vec::new(); + let mut buf = Vec::with_capacity(delegate_msg.encoded_len()); buf.reserve(delegate_msg.encoded_len()); if let Err(e) = delegate_msg.encode(&mut buf) { diff --git a/contracts/neutron_validator_test/src/contract.rs b/contracts/neutron_validator_test/src/contract.rs index 9288521..31ee097 100644 --- a/contracts/neutron_validator_test/src/contract.rs +++ b/contracts/neutron_validator_test/src/contract.rs @@ -350,7 +350,7 @@ fn execute_undelegate( amount: amount.to_string(), }), }; - let mut buf = Vec::new(); + let mut buf = Vec::with_capacity(delegate_msg.encoded_len()); buf.reserve(delegate_msg.encoded_len()); if let Err(e) = delegate_msg.encode(&mut buf) { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 8142c30..5198580 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.73.0" +channel = "1.78.0"