Skip to content

Commit

Permalink
Merge branch 'main' into feat/choose-cron-blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 committed Sep 4, 2024
2 parents 6164ce8 + 8ef5964 commit 8198421
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 10 deletions.
17 changes: 10 additions & 7 deletions contracts/neutron_interchain_txs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use neutron_sdk::bindings::msg::IbcFee;
use crate::storage::{
add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload,
save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload,
ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID,
};
use neutron_sdk::bindings::msg::{ChannelOrdering, IbcFee};
use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse;
use neutron_sdk::{
bindings::{
Expand All @@ -27,12 +32,6 @@ use neutron_sdk::{
NeutronError, NeutronResult,
};

use crate::storage::{
add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload,
save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload,
ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID,
};

// Default timeout for SubmitTX is two weeks
const DEFAULT_TIMEOUT_SECONDS: u64 = 60 * 60 * 24 * 7 * 2;
const FEE_DENOM: &str = "untrn";
Expand Down Expand Up @@ -77,12 +76,14 @@ pub fn execute(
connection_id,
interchain_account_id,
register_fee,
ordering,
} => execute_register_ica(
deps,
env,
connection_id,
interchain_account_id,
register_fee,
ordering,
),
ExecuteMsg::Delegate {
validator,
Expand Down Expand Up @@ -198,11 +199,13 @@ fn execute_register_ica(
connection_id: String,
interchain_account_id: String,
register_fee: Vec<CoinSDK>,
ordering: Option<ChannelOrdering>,
) -> NeutronResult<Response<NeutronMsg>> {
let register = NeutronMsg::register_interchain_account(
connection_id,
interchain_account_id.clone(),
Some(register_fee),
ordering,
);
let key = get_port_id(env.contract.address.as_str(), &interchain_account_id);
// we are saving empty data here because we handle response of registering ICA in sudo_open_ack method
Expand Down
2 changes: 2 additions & 0 deletions contracts/neutron_interchain_txs/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use cosmwasm_std::Coin;
use neutron_sdk::bindings::msg::ChannelOrdering;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -36,6 +37,7 @@ pub enum ExecuteMsg {
connection_id: String,
interchain_account_id: String,
register_fee: Vec<Coin>,
ordering: Option<ChannelOrdering>,
},
Delegate {
interchain_account_id: String,
Expand Down
16 changes: 15 additions & 1 deletion packages/neutron-sdk/src/bindings/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ pub struct IbcFee {
pub timeout_fee: Vec<Coin>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum ChannelOrdering {
OrderOrdered,
OrderUnordered,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
/// A number of Custom messages that can call into the Neutron bindings.
Expand All @@ -43,6 +50,10 @@ pub enum NeutronMsg {

/// **register_fee** is a fees required to be payed to register interchain account
register_fee: Option<Vec<Coin>>,

/// **ordering** is an order of channel. Can be ordered or unordered.
/// Set to ordered if not specified.
ordering: Option<ChannelOrdering>,
},

/// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.
Expand Down Expand Up @@ -89,7 +100,7 @@ pub enum NeutronMsg {
/// **query_id** is the ID of the query we want to update.
query_id: u64,

/// **new_keys** is the new query keys to retrive.
/// **new_keys** is the new query keys to retrieve.
new_keys: Option<Vec<KVKey>>,

/// **new_update_period** is a new update period of the query.
Expand Down Expand Up @@ -240,15 +251,18 @@ impl NeutronMsg {
/// Basic helper to define a register interchain account message:
/// * **connection_id** is an IBC connection identifier between Neutron and remote chain;
/// * **interchain_account_id** is an identifier of your new interchain account. Can be any string.
/// * **ordering** is an ordering of ICA channel. Set to ORDERED if not specified
pub fn register_interchain_account(
connection_id: String,
interchain_account_id: String,
register_fee: Option<Vec<Coin>>,
ordering: Option<ChannelOrdering>,
) -> Self {
NeutronMsg::RegisterInterchainAccount {
connection_id,
interchain_account_id,
register_fee,
ordering,
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
403292ad198dd528fab93e2e0673ba261da99576
93ca90d30a0c4f75af0d30f52cd9abdf8018a715
14 changes: 14 additions & 0 deletions packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ pub struct Params {
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub tx_query_removal_limit: u64,
/// Maximum amount of keys in a registered key value query
#[prost(uint64, tag = "4")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub max_kv_query_keys_count: u64,
/// max_transactions_filters defines maximum allowed amount of tx filters in msgRegisterInterchainQuery
#[prost(uint64, tag = "5")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub max_transactions_filters: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ pub struct MsgRegisterInterchainAccount {
pub interchain_account_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub register_fee: ::prost::alloc::vec::Vec<super::super::super::cosmos::base::v1beta1::Coin>,
#[prost(
enumeration = "super::super::super::ibc::core::channel::v1::Order",
tag = "5"
)]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub ordering: i32,
}
/// MsgRegisterInterchainAccountResponse is the response type for
/// MsgRegisterInterchainAccount.
Expand Down
2 changes: 1 addition & 1 deletion proto-build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SLINKY_REPO: &str = "https://github.com/skip-mev/slinky.git";
const COSMOS_SDK_REV: &str = "v0.50.8-neutron";

/// The Neutron commit or tag to be cloned and used to build the proto files
const NEUTRON_REV: &str = "403292ad198dd528fab93e2e0673ba261da99576";
const NEUTRON_REV: &str = "93ca90d30a0c4f75af0d30f52cd9abdf8018a715";

/// The wasmd commit or tag to be cloned and used to build the proto files
const WASMD_REV: &str = "v0.51.0";
Expand Down

0 comments on commit 8198421

Please sign in to comment.