From 29785255db777fec917225ec866d1c4be1d5512c Mon Sep 17 00:00:00 2001 From: swelf Date: Thu, 1 Aug 2024 17:25:41 +0300 Subject: [PATCH] removed hardcoded TOO_MANY_FILTER error --- packages/neutron-sdk/src/bindings/msg.rs | 39 ++++++------------- packages/neutron-sdk/src/errors/error.rs | 3 -- .../src/interchain_queries/types.rs | 1 - 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 5b8daf9c..04129e8e 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,8 +1,8 @@ use crate::{ bindings::types::{KVKey, ProtobufAny}, - interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, MAX_TX_FILTERS}, + interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem}, sudo::msg::RequestPacketTimeoutHeight, - NeutronError, NeutronResult, + NeutronResult, }; use crate::bindings::dex::msg::DexMsg; @@ -295,22 +295,14 @@ impl NeutronMsg { connection_id, update_period, }, - QueryPayload::TX(transactions_filters) => { - if transactions_filters.len() > MAX_TX_FILTERS { - return Err(NeutronError::TooManyTransactionFilters { - max: MAX_TX_FILTERS, - }); - } else { - NeutronMsg::RegisterInterchainQuery { - query_type: QueryType::TX.into(), - keys: vec![], - transactions_filter: to_string(&transactions_filters) - .map_err(|e| StdError::generic_err(e.to_string()))?, - connection_id, - update_period, - } - } - } + QueryPayload::TX(transactions_filters) => NeutronMsg::RegisterInterchainQuery { + query_type: QueryType::TX.into(), + keys: vec![], + transactions_filter: to_string(&transactions_filters) + .map_err(|e| StdError::generic_err(e.to_string()))?, + connection_id, + update_period, + }, }) } @@ -330,16 +322,7 @@ impl NeutronMsg { new_update_period, new_transactions_filter: match new_transactions_filter { Some(filters) => { - if filters.len() > MAX_TX_FILTERS { - return Err(NeutronError::TooManyTransactionFilters { - max: MAX_TX_FILTERS, - }); - } else { - Some( - to_string(&filters) - .map_err(|e| StdError::generic_err(e.to_string()))?, - ) - } + Some(to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))?) } None => None, }, diff --git a/packages/neutron-sdk/src/errors/error.rs b/packages/neutron-sdk/src/errors/error.rs index 700f5224..c94ad5cb 100644 --- a/packages/neutron-sdk/src/errors/error.rs +++ b/packages/neutron-sdk/src/errors/error.rs @@ -48,9 +48,6 @@ pub enum NeutronError { #[error("Integration tests mock is active")] IntegrationTestsMock {}, - #[error("Too many transaction filters, max allowed: {max:?}")] - TooManyTransactionFilters { max: usize }, - #[error("Can't deconstruct account denom balance key: {0}")] AccountDenomBalanceKeyDeconstructionError(String), } diff --git a/packages/neutron-sdk/src/interchain_queries/types.rs b/packages/neutron-sdk/src/interchain_queries/types.rs index f3d164b2..4920ece6 100644 --- a/packages/neutron-sdk/src/interchain_queries/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/types.rs @@ -59,7 +59,6 @@ impl Serialize for TransactionFilterValue { } } -pub const MAX_TX_FILTERS: usize = 32; #[derive(Serialize, Deserialize, Debug)] pub struct TransactionFilterItem {