diff --git a/Cargo.lock b/Cargo.lock index e33964b..146f43b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,7 +124,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", ] @@ -559,7 +559,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (git+https://github.com/neutron-org/neutron-sdk?rev=bb2188561a30d0a7fb293ff05f73907724eb2020)", "protobuf", "schemars", "serde", @@ -608,7 +608,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.11.9", "prost-types", "protobuf", @@ -662,6 +662,26 @@ dependencies = [ "thiserror", ] +[[package]] +name = "neutron-sdk" +version = "0.6.1" +source = "git+https://github.com/neutron-org/neutron-sdk?rev=bb2188561a30d0a7fb293ff05f73907724eb2020#bb2188561a30d0a7fb293ff05f73907724eb2020" +dependencies = [ + "base64 0.21.2", + "bech32", + "cosmos-sdk-proto 0.16.0", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", + "prost 0.11.9", + "protobuf", + "schemars", + "serde", + "serde-json-wasm", + "serde_json", + "thiserror", +] + [[package]] name = "neutron_interchain_queries" version = "0.1.0" @@ -672,7 +692,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.11.9", "schemars", "serde", @@ -690,7 +710,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (git+https://github.com/neutron-org/neutron-sdk?rev=bb2188561a30d0a7fb293ff05f73907724eb2020)", "prost 0.11.9", "prost-types", "protobuf", @@ -711,7 +731,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.11.9", "prost-types", "protobuf", @@ -1027,7 +1047,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", ] @@ -1221,7 +1241,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "osmosis-std", "prost 0.11.9", "prost-types", @@ -1375,7 +1395,7 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "neutron-sdk", + "neutron-sdk 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", ] diff --git a/contracts/ibc_transfer/Cargo.toml b/contracts/ibc_transfer/Cargo.toml index b8ba945..f559091 100644 --- a/contracts/ibc_transfer/Cargo.toml +++ b/contracts/ibc_transfer/Cargo.toml @@ -39,7 +39,7 @@ schemars = "0.8.10" serde = { version = "1.0.180", default-features = false, features = ["derive"] } serde-json-wasm = { version = "0.5.1" } cw-storage-plus = { version = "1.1.0", features = ["iterator"]} -neutron-sdk = { package = "neutron-sdk", version = "0.6.1" } +neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", rev = "bb2188561a30d0a7fb293ff05f73907724eb2020" } protobuf = { version = "3.2.0", features = ["with-bytes"] } [dev-dependencies] diff --git a/contracts/ibc_transfer/schema/execute_msg.json b/contracts/ibc_transfer/schema/execute_msg.json index 910eb5d..cbbce3d 100644 --- a/contracts/ibc_transfer/schema/execute_msg.json +++ b/contracts/ibc_transfer/schema/execute_msg.json @@ -82,6 +82,28 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "resubmit_failure" + ], + "properties": { + "resubmit_failure": { + "type": "object", + "required": [ + "failure_id" + ], + "properties": { + "failure_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, { "description": "Used only in integration tests framework to simulate failures. After executing this message, contract will fail, all of this happening in sudo callback handler.", "type": "object", diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index df6a929..b43f7a5 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -58,6 +58,9 @@ pub enum ExecuteMsg { timeout_fee: u128, denom: String, }, + ResubmitFailure { + failure_id: u64, + }, /// Used only in integration tests framework to simulate failures. /// After executing this message, contract will fail, all of this happening /// in sudo callback handler. @@ -94,6 +97,9 @@ pub fn execute( timeout_fee, denom, } => execute_set_fees(deps, recv_fee, ack_fee, timeout_fee, denom), + + ExecuteMsg::ResubmitFailure { failure_id } => execute_resubmit_failure(deps, failure_id), + // Used only in integration tests framework to simulate failures. // After executing this message, contract fail, all of this happening // in sudo callback handler. @@ -258,6 +264,11 @@ fn execute_send( Ok(Response::default().add_submessages(vec![submsg1, submsg2])) } +fn execute_resubmit_failure(_: DepsMut, failure_id: u64) -> StdResult> { + let msg = NeutronMsg::submit_resubmit_failure(failure_id); + Ok(Response::default().add_message(msg)) +} + #[allow(unreachable_code)] #[entry_point] pub fn sudo(deps: DepsMut, _env: Env, msg: TransferSudoMsg) -> StdResult { diff --git a/contracts/neutron_interchain_txs/Cargo.toml b/contracts/neutron_interchain_txs/Cargo.toml index ef55f60..826c18d 100644 --- a/contracts/neutron_interchain_txs/Cargo.toml +++ b/contracts/neutron_interchain_txs/Cargo.toml @@ -39,7 +39,7 @@ serde = { version = "1.0.180", default-features = false, features = ["derive"] } serde-json-wasm = { version = "0.5.1" } cw-storage-plus = { version = "1.1.0", features = ["iterator"]} cosmos-sdk-proto = { version = "0.16.0", default-features = false } -neutron-sdk = { package = "neutron-sdk", version = "0.6.1" } +neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", rev = "bb2188561a30d0a7fb293ff05f73907724eb2020" } base64 = "0.21.2" protobuf = { version = "3.2.0", features = ["with-bytes"] } prost = "0.11" diff --git a/contracts/neutron_interchain_txs/schema/execute_msg.json b/contracts/neutron_interchain_txs/schema/execute_msg.json index ff07416..b6c3544 100644 --- a/contracts/neutron_interchain_txs/schema/execute_msg.json +++ b/contracts/neutron_interchain_txs/schema/execute_msg.json @@ -160,6 +160,28 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "resubmit_failure" + ], + "properties": { + "resubmit_failure": { + "type": "object", + "required": [ + "failure_id" + ], + "properties": { + "failure_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, { "description": "Used only in integration tests framework to simulate failures. After executing this message, any sudo call to the contract will result in an error.", "type": "object", diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 19727b6..9d46994 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -131,6 +131,7 @@ pub fn execute( timeout_fee, } => execute_set_fees(deps, denom, recv_fee, ack_fee, timeout_fee), ExecuteMsg::CleanAckResults {} => execute_clean_ack_results(deps), + ExecuteMsg::ResubmitFailure { failure_id } => execute_resubmit_failure(deps, failure_id), // The section below is used only in integration tests framework to simulate failures. ExecuteMsg::IntegrationTestsSetSudoFailureMock {} => set_sudo_failure_mock(deps), @@ -383,6 +384,11 @@ fn execute_clean_ack_results(deps: DepsMut) -> StdResult> { Ok(Response::default()) } +fn execute_resubmit_failure(_: DepsMut, failure_id: u64) -> StdResult> { + let msg = NeutronMsg::submit_resubmit_failure(failure_id); + Ok(Response::default().add_message(msg)) +} + fn integration_tests_sudo_submsg(deps: DepsMut) -> StdResult> { if let Some(IntegrationTestsSudoSubmsgFailureMock::Enabled {}) = INTEGRATION_TESTS_SUDO_SUBMSG_FAILURE_MOCK.may_load(deps.storage)? diff --git a/contracts/neutron_interchain_txs/src/msg.rs b/contracts/neutron_interchain_txs/src/msg.rs index 125aeee..a6ef987 100644 --- a/contracts/neutron_interchain_txs/src/msg.rs +++ b/contracts/neutron_interchain_txs/src/msg.rs @@ -59,6 +59,9 @@ pub enum ExecuteMsg { timeout: Option, }, CleanAckResults {}, + ResubmitFailure { + failure_id: u64, + }, /// Used only in integration tests framework to simulate failures. /// After executing this message, any sudo call to the contract will result in an error. IntegrationTestsSetSudoFailureMock {},