From 4a733f4a7358e5467e66c1fa95904c25fdb8d49c Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 28 Aug 2023 17:50:48 +0400 Subject: [PATCH 01/23] feat: save execution failure for proposal in timelock contract --- .../schema/cwd-subdao-timelock-single.json | 32 +++++++++++++++++++ .../schema/raw/query.json | 24 ++++++++++++++ ...se_to_proposal_failed_execution_error.json | 8 +++++ .../src/contract.rs | 18 +++++++++-- .../cwd-subdao-timelock-single/src/state.rs | 1 + .../neutron-subdao-timelock-single/src/msg.rs | 5 +++ 6 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index cddffffe..017b7af1 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -1918,6 +1918,30 @@ } }, "additionalProperties": false + }, + { + "description": "Returns an error of the failed proposal. Returns `Option`", + "type": "object", + "required": [ + "proposal_failed_execution_error" + ], + "properties": { + "proposal_failed_execution_error": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } ] }, @@ -5535,6 +5559,14 @@ ] } } + }, + "proposal_failed_execution_error": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_String", + "type": [ + "string", + "null" + ] } } } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json index cc0e1b2b..d6e5ef82 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json @@ -73,6 +73,30 @@ } }, "additionalProperties": false + }, + { + "description": "Returns an error of the failed proposal. Returns `Option`", + "type": "object", + "required": [ + "proposal_failed_execution_error" + ], + "properties": { + "proposal_failed_execution_error": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } ] } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json new file mode 100644 index 00000000..f4c601d9 --- /dev/null +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_String", + "type": [ + "string", + "null" + ] +} diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 6cbbba06..17677f72 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -24,7 +24,7 @@ use neutron_subdao_timelock_single::{ }; use crate::error::ContractError; -use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS}; +use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS, PROPOSAL_FAILED_EXECUTION_ERRORS}; pub(crate) const CONTRACT_NAME: &str = "crates.io:cwd-subdao-timelock-single"; pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -248,6 +248,9 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { QueryMsg::ListProposals { start_after, limit } => { query_list_proposals(deps, start_after, limit) } + QueryMsg::ProposalFailedExecutionError { proposal_id } => { + query_proposal_failed_execution_error(deps, proposal_id) + } } } @@ -274,6 +277,11 @@ pub fn query_list_proposals( to_binary(&ProposalListResponse { proposals: props }) } +fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { + let proposal_error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; + to_binary(&proposal_error) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { // Set contract to version to latest @@ -315,12 +323,18 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { prop.status = ProposalStatus::ExecutionFailed; - Ok(prop) } None => Err(ContractError::NoSuchProposal { id: proposal_id }), })?; + let err = msg + .result + .into_result() + .err() + .unwrap_or_else(|| "result is not error".to_string()); + PROPOSAL_FAILED_EXECUTION_ERRORS.save(deps.storage, proposal_id, &err)?; + Ok(Response::new().add_attribute( "timelocked_proposal_execution_failed", proposal_id.to_string(), diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index c1fde550..7fef95c6 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -6,3 +6,4 @@ pub const DEFAULT_LIMIT: u64 = 30; pub const CONFIG: Item = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index 011d8a81..8d46fee7 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -54,6 +54,11 @@ pub enum QueryMsg { /// returned. limit: Option, }, + + /// Returns an error of the failed proposal. + /// Returns `Option` + #[returns(Option)] + ProposalFailedExecutionError { proposal_id: u64 }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] From e3f7b166667afc8e50547f76e16d6c4d45c98926 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 1 Sep 2023 18:39:17 +0400 Subject: [PATCH 02/23] add comment for expected format of returned error --- .../schema/cwd-subdao-timelock-single.json | 2 +- .../subdaos/cwd-subdao-timelock-single/schema/raw/query.json | 2 +- contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs | 1 + packages/neutron-subdao-timelock-single/src/msg.rs | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index 017b7af1..75348f46 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -1920,7 +1920,7 @@ "additionalProperties": false }, { - "description": "Returns an error of the failed proposal. Returns `Option`", + "description": "Returns an error of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ "proposal_failed_execution_error" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json index d6e5ef82..34a7fd6b 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json @@ -75,7 +75,7 @@ "additionalProperties": false }, { - "description": "Returns an error of the failed proposal. Returns `Option`", + "description": "Returns an error of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ "proposal_failed_execution_error" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 17677f72..15fac369 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -333,6 +333,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result` #[returns(Option)] ProposalFailedExecutionError { proposal_id: u64 }, From ef65e8b4eee2b85ddde35ce1a330a251a74bbaab Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 5 Sep 2023 15:45:34 +0400 Subject: [PATCH 03/23] feat: save lists of failures instead of one and block height with it --- .../schema/cwd-subdao-timelock-single.json | 43 ++++++++++++++++--- .../schema/raw/query.json | 2 +- ...se_to_proposal_failed_execution_error.json | 41 +++++++++++++++--- .../src/contract.rs | 35 +++++++++++---- .../cwd-subdao-timelock-single/src/state.rs | 5 ++- .../neutron-subdao-timelock-single/src/msg.rs | 8 ++-- .../src/types.rs | 15 +++++++ 7 files changed, 122 insertions(+), 27 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index 75348f46..9367d378 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -1920,7 +1920,7 @@ "additionalProperties": false }, { - "description": "Returns an error of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", "type": "object", "required": [ "proposal_failed_execution_error" @@ -5562,11 +5562,42 @@ }, "proposal_failed_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Nullable_String", - "type": [ - "string", - "null" - ] + "title": "FailedProposalErrors", + "description": "A list of proposals returned by `ListProposals`.", + "type": "object", + "properties": { + "errors": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/FailedExecutionError" + } + } + }, + "definitions": { + "FailedExecutionError": { + "description": "Proposal failed execution error", + "type": "object", + "required": [ + "error", + "height" + ], + "properties": { + "error": { + "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", + "type": "string" + }, + "height": { + "description": "Block height of execution error", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } } } } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json index 34a7fd6b..04c9b744 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json @@ -75,7 +75,7 @@ "additionalProperties": false }, { - "description": "Returns an error of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", "type": "object", "required": [ "proposal_failed_execution_error" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json index f4c601d9..c6aaf984 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -1,8 +1,39 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Nullable_String", - "type": [ - "string", - "null" - ] + "title": "FailedProposalErrors", + "description": "A list of proposals returned by `ListProposals`.", + "type": "object", + "properties": { + "errors": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/FailedExecutionError" + } + } + }, + "definitions": { + "FailedExecutionError": { + "description": "Proposal failed execution error", + "type": "object", + "required": [ + "error", + "height" + ], + "properties": { + "error": { + "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", + "type": "string" + }, + "height": { + "description": "Block height of execution error", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 15fac369..2798d537 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -18,6 +18,7 @@ use neutron_dao_pre_propose_overrule::msg::{ use neutron_sdk::bindings::msg::NeutronMsg; use neutron_subdao_core::msg::QueryMsg as SubdaoQuery; use neutron_subdao_pre_propose_single::msg::QueryMsg as PreProposeQuery; +use neutron_subdao_timelock_single::types::{FailedExecutionError, FailedProposalErrors}; use neutron_subdao_timelock_single::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, types::{Config, ProposalListResponse, ProposalStatus, SingleChoiceProposal}, @@ -278,8 +279,8 @@ pub fn query_list_proposals( } fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let proposal_error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; - to_binary(&proposal_error) + let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; + to_binary(&FailedProposalErrors { errors }) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -317,7 +318,7 @@ fn is_overrule_proposal_rejected( } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { +pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { let proposal_id = msg.id; PROPOSALS.update(deps.storage, proposal_id, |prop| match prop { @@ -328,13 +329,29 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Err(ContractError::NoSuchProposal { id: proposal_id }), })?; - let err = msg - .result - .into_result() - .err() - .unwrap_or_else(|| "result is not error".to_string()); // Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" - PROPOSAL_FAILED_EXECUTION_ERRORS.save(deps.storage, proposal_id, &err)?; + PROPOSAL_FAILED_EXECUTION_ERRORS.update::<_, ContractError>( + deps.storage, + proposal_id, + |maybe| { + let error = msg + .result + .into_result() + .err() + .unwrap_or_else(|| "result is not error".to_string()); + let value = FailedExecutionError { + height: env.block.height, + error: error.to_string(), + }; + match maybe { + Some(mut xs) => { + xs.push(value); + Ok(xs) + } + None => Ok(vec![value]), + } + }, + )?; Ok(Response::new().add_attribute( "timelocked_proposal_execution_failed", diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index 7fef95c6..5f6b4933 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -1,9 +1,10 @@ use cw_storage_plus::{Item, Map}; -use neutron_subdao_timelock_single::types::{Config, SingleChoiceProposal}; +use neutron_subdao_timelock_single::types::{Config, FailedExecutionError, SingleChoiceProposal}; /// Default limit for proposal pagination. pub const DEFAULT_LIMIT: u64 = 30; pub const CONFIG: Item = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = + Map::new("failed_proposal_errors"); diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index cc0fc33e..5b398ce7 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -55,10 +55,10 @@ pub enum QueryMsg { limit: Option, }, - /// Returns an error of the failed proposal. - /// Expected in the form of "codespace=? code=?". - /// Returns `Option` - #[returns(Option)] + /// Returns errors of the failed proposal. + /// Expected in the form of [execution_height, "codespace=? code=?"]. + /// Returns `types::FailedProposalErrors` + #[returns(crate::types::FailedProposalErrors)] ProposalFailedExecutionError { proposal_id: u64 }, } diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index d966c0ce..2c0c4732 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -53,3 +53,18 @@ impl std::fmt::Display for ProposalStatus { pub struct ProposalListResponse { pub proposals: Vec, } + +/// A list of proposals returned by `ListProposals`. +#[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] +pub struct FailedProposalErrors { + pub errors: Option>, +} + +/// Proposal failed execution error +#[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] +pub struct FailedExecutionError { + /// Block height of execution error + pub height: u64, + /// Error text. Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" + pub error: String, +} From 0c7b84924a9d97f7dd35ba484cea57c852d21d9a Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 5 Sep 2023 17:00:26 +0400 Subject: [PATCH 04/23] fix lint --- contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 2798d537..c4bbc22a 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -341,7 +341,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { From 56765ceb31befdc87d822c9d30be6397dfc82752 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 7 Sep 2023 16:33:14 +0400 Subject: [PATCH 05/23] review fixes --- .../src/contract.rs | 28 +++++++++++-------- .../src/types.rs | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index c4bbc22a..454141aa 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, + to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -280,7 +280,10 @@ pub fn query_list_proposals( fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; - to_binary(&FailedProposalErrors { errors }) + let res = FailedProposalErrors { + errors: errors.unwrap_or_default(), + }; + to_binary(&res) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -333,20 +336,21 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result( deps.storage, proposal_id, - |maybe| { - let error = msg - .result - .into_result() - .err() - .unwrap_or_else(|| "result is not error".to_string()); + |maybe_errors| { + let error = msg.result.into_result().err().ok_or_else(|| { + // should never happen since we reply only on failure + ContractError::Std(StdError::generic_err( + "must be an error in the failed result", + )) + })?; let value = FailedExecutionError { height: env.block.height, error, }; - match maybe { - Some(mut xs) => { - xs.push(value); - Ok(xs) + match maybe_errors { + Some(mut errors) => { + errors.push(value); + Ok(errors) } None => Ok(vec![value]), } diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index 2c0c4732..07d220bc 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -57,7 +57,7 @@ pub struct ProposalListResponse { /// A list of proposals returned by `ListProposals`. #[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] pub struct FailedProposalErrors { - pub errors: Option>, + pub errors: Vec, } /// Proposal failed execution error From e1e145d1ea38e8ae3fcbea3a4d86e05d42d83d35 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 7 Sep 2023 18:15:01 +0400 Subject: [PATCH 06/23] fix schema --- .../schema/cwd-subdao-timelock-single.json | 8 ++++---- .../raw/response_to_proposal_failed_execution_error.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index 9367d378..3d9cb529 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -5565,12 +5565,12 @@ "title": "FailedProposalErrors", "description": "A list of proposals returned by `ListProposals`.", "type": "object", + "required": [ + "errors" + ], "properties": { "errors": { - "type": [ - "array", - "null" - ], + "type": "array", "items": { "$ref": "#/definitions/FailedExecutionError" } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json index c6aaf984..dcf1c51e 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -3,12 +3,12 @@ "title": "FailedProposalErrors", "description": "A list of proposals returned by `ListProposals`.", "type": "object", + "required": [ + "errors" + ], "properties": { "errors": { - "type": [ - "array", - "null" - ], + "type": "array", "items": { "$ref": "#/definitions/FailedExecutionError" } From 5ec3ca1e34c0ee5f58fe4e69565b87e0510f45bb Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 7 Sep 2023 19:01:27 +0400 Subject: [PATCH 07/23] add test for new code --- .../src/contract.rs | 2 +- .../src/testing/tests.rs | 33 ++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 454141aa..f7d3bad9 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -278,7 +278,7 @@ pub fn query_list_proposals( to_binary(&ProposalListResponse { proposals: props }) } -fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { +pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; let res = FailedProposalErrors { errors: errors.unwrap_or_default(), diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index 252aff63..f864b759 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -14,6 +14,7 @@ use neutron_subdao_timelock_single::{ use std::cell::RefCell; use std::rc::Rc; +use crate::contract::query_proposal_failed_execution_error; use crate::testing::mock_querier::{MOCK_MAIN_DAO_ADDR, MOCK_OVERRULE_PREPROPOSAL}; use crate::{ contract::{execute, instantiate, query, reply}, @@ -23,6 +24,7 @@ use crate::{ use neutron_dao_pre_propose_overrule::msg::{ ExecuteMsg as OverruleExecuteMsg, ProposeMessage as OverruleProposeMessage, }; +use neutron_subdao_timelock_single::types::FailedProposalErrors; use super::mock_querier::{mock_dependencies, MOCK_SUBDAO_CORE_ADDR}; @@ -519,9 +521,38 @@ fn test_reply() { msgs: vec![NeutronMsg::remove_interchain_query(1).into()], status: ProposalStatus::Timelocked, }; + let env = mock_env(); PROPOSALS.save(deps.as_mut().storage, 10, &prop).unwrap(); - let res_ok = reply(deps.as_mut(), mock_env(), msg).unwrap(); + let res_ok = reply(deps.as_mut(), env.clone(), msg).unwrap(); assert_eq!(0, res_ok.messages.len()); let expected_attributes = vec![Attribute::new("timelocked_proposal_execution_failed", "10")]; assert_eq!(expected_attributes, res_ok.attributes); + + // reply writes the failed proposal error + let query_res = query_proposal_failed_execution_error(deps.as_ref(), 10).unwrap(); + let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); + assert_eq!(query_errs.errors.len(), 1); + let error = query_errs.errors.first().unwrap(); + assert_eq!(error.error, "error".to_string()); + assert_eq!(error.height, env.block.height); + + // reply second time appends new error + let env2 = { + let mut e = env; + e.block.height += 10; + e + }; + let msg2 = Reply { + id: 10, + result: SubMsgResult::Err("error2".to_string()), + }; + let res_ok = reply(deps.as_mut(), env2.clone(), msg2).unwrap(); + assert_eq!(0, res_ok.messages.len()); + + let query_res = query_proposal_failed_execution_error(deps.as_ref(), 10).unwrap(); + let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); + assert_eq!(query_errs.errors.len(), 2); + let error2 = query_errs.errors.last().unwrap(); + assert_eq!(error2.error, "error2".to_string()); + assert_eq!(error2.height, env2.block.height); } From 84e11236bd4c58fa589d7979873221cdb4a0850a Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 13 Sep 2023 15:54:22 +0400 Subject: [PATCH 08/23] add failed proposal errors query to single and multiple proposals --- .../cwd-proposal-multiple/src/contract.rs | 45 ++++++++++++++++-- .../proposal/cwd-proposal-multiple/src/msg.rs | 5 ++ .../cwd-proposal-multiple/src/query.rs | 7 +++ .../cwd-proposal-multiple/src/state.rs | 12 +++++ .../cwd-proposal-single/src/contract.rs | 46 +++++++++++++++++-- .../proposal/cwd-proposal-single/src/msg.rs | 5 ++ .../proposal/cwd-proposal-single/src/query.rs | 7 +++ .../proposal/cwd-proposal-single/src/state.rs | 12 +++++ .../cwd-subdao-timelock-single/src/state.rs | 1 + .../src/types.rs | 2 +- 10 files changed, 135 insertions(+), 7 deletions(-) diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs index 74d1f3f7..0717c1f9 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdResult, - Storage, SubMsg, WasmMsg, + to_binary, Addr, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Reply, Response, StdError, + StdResult, Storage, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -26,6 +26,8 @@ use cwd_voting::{ voting::{get_total_power, get_voting_power, validate_voting_period}, }; +use crate::query::FailedProposalErrors; +use crate::state::{FailedExecutionError, PROPOSAL_FAILED_EXECUTION_ERRORS}; use crate::{msg::MigrateMsg, state::CREATION_POLICY}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, QueryMsg}, @@ -730,6 +732,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), QueryMsg::Dao {} => query_dao(deps), + QueryMsg::ProposalFailedExecutionError { proposal_id } => { + query_proposal_failed_execution_error(deps, proposal_id) + } } } @@ -841,8 +846,16 @@ pub fn query_info(deps: Deps) -> StdResult { to_binary(&cwd_interface::voting::InfoResponse { info }) } +pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { + let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; + let res = FailedProposalErrors { + errors: errors.unwrap_or_default(), + }; + to_binary(&res) +} + #[cfg_attr(not(feature = "library"), entry_point)] -pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { +pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { let repl = TaggedReplyId::new(msg.id)?; match repl { TaggedReplyId::FailedProposalExecution(proposal_id) => { @@ -853,6 +866,32 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Err(ContractError::NoSuchProposal { id: proposal_id }), })?; + + // Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" + PROPOSAL_FAILED_EXECUTION_ERRORS.update::<_, ContractError>( + deps.storage, + proposal_id, + |maybe_errors| { + let error = msg.result.into_result().err().ok_or_else(|| { + // should never happen since we reply only on failure + ContractError::Std(StdError::generic_err( + "must be an error in the failed result", + )) + })?; + let value = FailedExecutionError { + height: env.block.height, + error, + }; + match maybe_errors { + Some(mut errors) => { + errors.push(value); + Ok(errors) + } + None => Ok(vec![value]), + } + }, + )?; + Ok(Response::new().add_attribute("proposal execution failed", proposal_id.to_string())) } TaggedReplyId::FailedProposalHook(idx) => { diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs index e8496408..049ed1ef 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs @@ -186,6 +186,11 @@ pub enum QueryMsg { /// module. #[returns(HooksResponse)] VoteHooks {}, + /// Returns errors of the failed proposal. + /// Expected in the form of [execution_height, "codespace=? code=?"]. + /// Returns `types::FailedProposalErrors` + #[returns(crate::query::FailedProposalErrors)] + ProposalFailedExecutionError { proposal_id: u64 }, } #[cw_serde] diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs index dd1f87f1..1778597a 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs @@ -2,6 +2,7 @@ use crate::{proposal::MultipleChoiceProposal, state::Config}; use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Uint128}; +use crate::state::FailedExecutionError; use cwd_voting::multiple_choice::MultipleChoiceVote; #[cw_serde] @@ -41,3 +42,9 @@ pub struct VoteListResponse { pub struct ConfigResponse { pub config: Config, } + +/// A list of proposals returned by `ProposalFailedExecutionError`. +#[cw_serde] +pub struct FailedProposalErrors { + pub errors: Vec, +} diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs index e676a25e..d7100055 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs @@ -45,6 +45,15 @@ pub struct Config { pub close_proposal_on_execution_failure: bool, } +/// Proposal failed execution error +#[cw_serde] +pub struct FailedExecutionError { + /// Block height of execution error + pub height: u64, + /// Error text. Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" + pub error: String, +} + // we cast a ballot with our chosen vote and a given weight // stored under the key that voted #[cw_serde] @@ -67,3 +76,6 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// The address of the pre-propose module associated with this /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); +// Execution errors for proposals that do execute only once +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = + Map::new("failed_proposal_errors"); diff --git a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs index 96ac1f6e..a3cdd6a2 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs @@ -1,7 +1,7 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, + to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, Storage, SubMsg, WasmMsg, }; use cw2::set_contract_version; @@ -23,8 +23,11 @@ use neutron_sdk::bindings::msg::NeutronMsg; use crate::msg::MigrateMsg; use crate::proposal::SingleChoiceProposal; -use crate::state::{Config, CREATION_POLICY}; +use crate::state::{ + Config, FailedExecutionError, CREATION_POLICY, PROPOSAL_FAILED_EXECUTION_ERRORS, +}; +use crate::query::FailedProposalErrors; use crate::{ error::ContractError, msg::{ExecuteMsg, InstantiateMsg, QueryMsg}, @@ -667,6 +670,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::ProposalCreationPolicy {} => query_creation_policy(deps), QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), + QueryMsg::ProposalFailedExecutionError { proposal_id } => { + query_proposal_failed_execution_error(deps, proposal_id) + } } } @@ -778,25 +784,59 @@ pub fn query_info(deps: Deps) -> StdResult { to_binary(&cwd_interface::voting::InfoResponse { info }) } +pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { + let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; + let res = FailedProposalErrors { + errors: errors.unwrap_or_default(), + }; + to_binary(&res) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { Ok(Response::default()) } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { +pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { let repl = TaggedReplyId::new(msg.id)?; match repl { TaggedReplyId::FailedProposalExecution(proposal_id) => { PROPOSALS.update(deps.storage, proposal_id, |prop| match prop { Some(mut prop) => { prop.status = Status::ExecutionFailed; + // here\ Ok(prop) } None => Err(ContractError::NoSuchProposal { id: proposal_id }), })?; + // Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" + PROPOSAL_FAILED_EXECUTION_ERRORS.update::<_, ContractError>( + deps.storage, + proposal_id, + |maybe_errors| { + let error = msg.result.into_result().err().ok_or_else(|| { + // should never happen since we reply only on failure + ContractError::Std(StdError::generic_err( + "must be an error in the failed result", + )) + })?; + let value = FailedExecutionError { + height: env.block.height, + error, + }; + match maybe_errors { + Some(mut errors) => { + errors.push(value); + Ok(errors) + } + None => Ok(vec![value]), + } + }, + )?; + Ok(Response::new().add_attribute("proposal_execution_failed", proposal_id.to_string())) } TaggedReplyId::FailedProposalHook(idx) => { diff --git a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs index e13a49b9..97f9e912 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs @@ -202,6 +202,11 @@ pub enum QueryMsg { /// module. Returns cwd_hooks::HooksResponse. #[returns(cwd_hooks::HooksResponse)] VoteHooks {}, + /// Returns errors of the failed proposal. + /// Expected in the form of [execution_height, "codespace=? code=?"]. + /// Returns `types::FailedProposalErrors` + #[returns(crate::query::FailedProposalErrors)] + ProposalFailedExecutionError { proposal_id: u64 }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] diff --git a/contracts/dao/proposal/cwd-proposal-single/src/query.rs b/contracts/dao/proposal/cwd-proposal-single/src/query.rs index 91aecbee..55fed1d2 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/query.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/query.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; use cwd_voting::voting::Vote; use crate::proposal::SingleChoiceProposal; +use crate::state::FailedExecutionError; /// Information about a proposal returned by proposal queries. #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] @@ -44,3 +45,9 @@ pub struct VoteListResponse { pub struct ProposalListResponse { pub proposals: Vec, } + +/// A list of proposals returned by `ProposalFailedExecutionError`. +#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] +pub struct FailedProposalErrors { + pub errors: Vec, +} diff --git a/contracts/dao/proposal/cwd-proposal-single/src/state.rs b/contracts/dao/proposal/cwd-proposal-single/src/state.rs index e7086863..b5ce0282 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/state.rs @@ -50,6 +50,15 @@ pub struct Config { pub close_proposal_on_execution_failure: bool, } +/// Proposal failed execution error +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct FailedExecutionError { + /// Block height of execution error + pub height: u64, + /// Error text. Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" + pub error: String, +} + /// The current top level config for the module. The "config" key was /// previously used to store configs for v1 DAOs. pub const CONFIG: Item = Item::new("config_v2"); @@ -64,3 +73,6 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// The address of the pre-propose module associated with this /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); +// Execution errors for proposals that do execute only once +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = + Map::new("failed_proposal_errors"); diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index 5f6b4933..ef0392b3 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -6,5 +6,6 @@ pub const DEFAULT_LIMIT: u64 = 30; pub const CONFIG: Item = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); +// Execution errors for proposals that do execute only once pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = Map::new("failed_proposal_errors"); diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index 07d220bc..503a107b 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -54,7 +54,7 @@ pub struct ProposalListResponse { pub proposals: Vec, } -/// A list of proposals returned by `ListProposals`. +/// A list of proposals returned by `ProposalFailedExecutionError`. #[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] pub struct FailedProposalErrors { pub errors: Vec, From 0f08386980f4ff91ac93f9f7432bf8ccfd8766b8 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 13 Sep 2023 17:44:27 +0400 Subject: [PATCH 09/23] feat: add close_proposal_on_execution_failure logic to timelocked contract --- Cargo.lock | 1 + .../cwd-subdao-timelock-single/Cargo.toml | 1 + .../src/contract.rs | 32 ++++++++++++++----- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9f61fd2..9caed47a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1215,6 +1215,7 @@ dependencies = [ "neutron-sdk", "neutron-subdao-core", "neutron-subdao-pre-propose-single", + "neutron-subdao-proposal-single", "neutron-subdao-timelock-single", "schemars", "serde", diff --git a/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml b/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml index 71267b07..16397e40 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml +++ b/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml @@ -27,6 +27,7 @@ serde = { version = "1.0.175", default-features = false, features = ["derive"] } thiserror = { version = "1.0" } cwd-interface = { path = "../../../packages/cwd-interface" } cwd-macros = { path = "../../../packages/cwd-macros" } +neutron-subdao-proposal-single = { path = "../../../packages/neutron-subdao-proposal-single" } neutron-subdao-pre-propose-single = { path = "../../../packages/neutron-subdao-pre-propose-single" } neutron-subdao-timelock-single = { path = "../../../packages/neutron-subdao-timelock-single" } cwd-pre-propose-base = { path = "../../../packages/cwd-pre-propose-base" } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index f7d3bad9..57f26fdc 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -18,6 +18,8 @@ use neutron_dao_pre_propose_overrule::msg::{ use neutron_sdk::bindings::msg::NeutronMsg; use neutron_subdao_core::msg::QueryMsg as SubdaoQuery; use neutron_subdao_pre_propose_single::msg::QueryMsg as PreProposeQuery; +use neutron_subdao_proposal_single::msg::QueryMsg as ProposalQueryMsg; +use neutron_subdao_proposal_single::types::Config as ProposalConfig; use neutron_subdao_timelock_single::types::{FailedExecutionError, FailedProposalErrors}; use neutron_subdao_timelock_single::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, @@ -144,7 +146,6 @@ pub fn execute_execute_proposal( proposal_id: u64, ) -> Result, ContractError> { let config = CONFIG.load(deps.storage)?; - let mut proposal = PROPOSALS.load(deps.storage, proposal_id)?; // Check if proposal is timelocked @@ -162,16 +163,31 @@ pub fn execute_execute_proposal( proposal.status = ProposalStatus::Executed; PROPOSALS.save(deps.storage, proposal_id, &proposal)?; - let msgs: Vec> = proposal - .msgs - .iter() - .map(|msg| SubMsg::reply_on_error(msg.clone(), proposal_id)) - .collect(); + let response: Response = { + let proposal_module: Addr = deps + .querier + .query_wasm_smart(config.subdao, &PreProposeQuery::ProposalModule {})?; + let proposal_config: ProposalConfig = deps + .querier + .query_wasm_smart(proposal_module, &ProposalQueryMsg::Config {})?; + + match proposal_config.close_proposal_on_execution_failure { + true => { + let msgs: Vec> = proposal + .msgs + .iter() + .map(|msg| SubMsg::reply_on_error(msg.clone(), proposal_id)) + .collect(); + + Response::default().add_submessages(msgs) + } + false => Response::default().add_messages(proposal.msgs), + } + }; // Note: we add the proposal messages as submessages to change the status to ExecutionFailed // in the reply handler if any of the submessages fail. - Ok(Response::new() - .add_submessages(msgs) + Ok(response .add_attribute("action", "execute_proposal") .add_attribute("sender", info.sender) .add_attribute("proposal_id", proposal_id.to_string())) From 12b92f049402934a082dcb811f7a10cad0f209bb Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 14 Sep 2023 15:03:20 +0400 Subject: [PATCH 10/23] add query for timelock proposal module to subdao core and use it --- .../subdaos/cwd-subdao-core/src/contract.rs | 25 +++++++- .../src/contract.rs | 9 ++- .../src/testing/mock_querier.rs | 57 ++++++++++++++----- packages/neutron-subdao-core/src/msg.rs | 3 + 4 files changed, 73 insertions(+), 21 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-core/src/contract.rs b/contracts/subdaos/cwd-subdao-core/src/contract.rs index 0635f494..79bf3141 100644 --- a/contracts/subdaos/cwd-subdao-core/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-core/src/contract.rs @@ -401,6 +401,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::DaoURI {} => query_dao_uri(deps), QueryMsg::MainDao {} => query_main_dao(deps), QueryMsg::VerifyTimelock { timelock } => query_verify_timelock(deps, timelock), + QueryMsg::TimelockProposalModuleAddress { timelock } => { + query_timelock_proposal_module_address(deps, timelock) + } } } @@ -600,6 +603,13 @@ pub fn query_verify_timelock(deps: Deps, timelock: String) -> StdResult to_binary(&(execution_access_check(deps, deps.api.addr_validate(&timelock)?).is_ok())) } +pub fn query_timelock_proposal_module_address(deps: Deps, timelock: String) -> StdResult { + let maybe_proposal = proposal_from_timelock(deps, timelock)?; + let proposal = + maybe_proposal.ok_or_else(|| StdError::generic_err("incorrect timelock addr provided"))?; + to_binary(&proposal.address) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result { Ok(Response::default()) @@ -660,11 +670,20 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result<(), ContractError> { + let res = proposal_from_timelock(deps, sender.to_string())?; + match res { + Some(_) => Ok(()), + None => Err(ContractError::Unauthorized {}), + } +} + +// returns Unauthorized if not found +fn proposal_from_timelock(deps: Deps, sender: String) -> Result, StdError> { let proposal_modules = PROPOSAL_MODULES .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) .map(|kv| Ok(kv?.1)) .collect::>>()?; - for proposal_module in proposal_modules.iter() { + for proposal_module in proposal_modules.into_iter() { let policy: ProposalCreationPolicy = deps.querier.query_wasm_smart( &proposal_module.address, &ProposeQueryMsg::ProposalCreationPolicy {}, @@ -677,12 +696,12 @@ pub(crate) fn execution_access_check(deps: Deps, sender: Addr) -> Result<(), Con }, ) { if sender == timelock_contract { - return Ok(()); + return Ok(Some(proposal_module)); } } }; } - Err(ContractError::Unauthorized {}) + Ok(None) } pub(crate) fn derive_proposal_module_prefix(mut dividend: usize) -> StdResult { diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 57f26fdc..3913dcd4 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -164,9 +164,12 @@ pub fn execute_execute_proposal( PROPOSALS.save(deps.storage, proposal_id, &proposal)?; let response: Response = { - let proposal_module: Addr = deps - .querier - .query_wasm_smart(config.subdao, &PreProposeQuery::ProposalModule {})?; + let proposal_module: Addr = deps.querier.query_wasm_smart( + config.subdao, + &SubdaoQuery::TimelockProposalModuleAddress { + timelock: env.contract.address.to_string(), + }, + )?; let proposal_config: ProposalConfig = deps .querier .query_wasm_smart(proposal_module, &ProposalQueryMsg::Config {})?; diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs index a54dd8e3..975c38ed 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs @@ -10,20 +10,21 @@ use cosmwasm_std::{ }; use cw_utils::Duration; use cwd_proposal_single::{ - msg::{QueryMsg as ProposeQuery, QueryMsg}, - proposal::SingleChoiceProposal as MainDaoSingleChoiceProposal, - query::ProposalResponse as MainDaoProposalResponse, - state::Config as OverrulProposalConfig, + msg::QueryMsg as ProposeQuery, proposal::SingleChoiceProposal as MainDaoSingleChoiceProposal, + query::ProposalResponse as MainDaoProposalResponse, state::Config as OverruleProposalConfig, }; use cwd_voting::status::Status; +use cwd_voting::threshold::PercentageThreshold::Majority; use cwd_voting::threshold::Threshold; use cwd_voting::voting::Votes; use neutron_dao_pre_propose_overrule::msg::{ QueryExt as PreProposeOverruleQueryExt, QueryMsg as PreProposeOverruleQuery, }; +use neutron_subdao_core::msg::QueryMsg as CoreSubdaoQuery; use neutron_subdao_pre_propose_single::msg::{ QueryExt as PreProposeQueryExt, QueryMsg as PreProposeQuery, }; +use neutron_subdao_proposal_single::types::Config as ProposalConfig; pub const MOCK_SUBDAO_CORE_ADDR: &str = "neutron1subdao_core_contract"; pub const MOCK_TIMELOCK_INITIALIZER: &str = "neutron1timelock_initializer"; @@ -31,6 +32,8 @@ pub const MOCK_MAIN_DAO_ADDR: &str = "neutron1main_dao_core_contract"; pub const MOCK_OVERRULE_PROPOSAL: &str = "neutron1main_dao_overrule_proposal"; pub const MOCK_OVERRULE_PREPROPOSAL: &str = "neutron1main_dao_overrule_preproposal"; +pub const MOCK_PROPOSAL_ADDR: &str = "neutron1subdao_proposal_contract"; + pub fn mock_dependencies( x: Rc>, ) -> OwnedDeps { @@ -85,7 +88,14 @@ impl WasmMockQuerier { return SystemResult::Ok(ContractResult::from(to_binary(addr))); } if contract_addr == MOCK_SUBDAO_CORE_ADDR { - let addr = { MOCK_MAIN_DAO_ADDR }; + let q: CoreSubdaoQuery = from_binary(msg).unwrap(); + let addr = match q { + CoreSubdaoQuery::MainDao {} => MOCK_MAIN_DAO_ADDR, + CoreSubdaoQuery::TimelockProposalModuleAddress { timelock: _ } => { + MOCK_PROPOSAL_ADDR + } + _ => todo!(), + }; return SystemResult::Ok(ContractResult::from(to_binary(addr))); } if contract_addr == MOCK_OVERRULE_PREPROPOSAL { @@ -108,7 +118,7 @@ impl WasmMockQuerier { if contract_addr == MOCK_OVERRULE_PROPOSAL { let q: ProposeQuery = from_binary(msg).unwrap(); let reply = match q { - QueryMsg::Config {} => to_binary(&OverrulProposalConfig { + ProposeQuery::Config {} => to_binary(&OverruleProposalConfig { threshold: Threshold::AbsoluteCount { threshold: Default::default(), }, @@ -118,7 +128,7 @@ impl WasmMockQuerier { dao: Addr::unchecked(MOCK_MAIN_DAO_ADDR), close_proposal_on_execution_failure: false, }), - QueryMsg::Proposal { .. } => to_binary(&MainDaoProposalResponse { + ProposeQuery::Proposal { .. } => to_binary(&MainDaoProposalResponse { id: 1, proposal: MainDaoSingleChoiceProposal { title: "".to_string(), @@ -142,14 +152,31 @@ impl WasmMockQuerier { allow_revoting: false, }, }), - QueryMsg::ListProposals { .. } => todo!(), - QueryMsg::ReverseProposals { .. } => todo!(), - QueryMsg::ProposalCount { .. } => todo!(), - QueryMsg::GetVote { .. } => todo!(), - QueryMsg::ListVotes { .. } => todo!(), - QueryMsg::ProposalCreationPolicy { .. } => todo!(), - QueryMsg::ProposalHooks { .. } => todo!(), - QueryMsg::VoteHooks { .. } => todo!(), + ProposeQuery::ListProposals { .. } => todo!(), + ProposeQuery::ReverseProposals { .. } => todo!(), + ProposeQuery::ProposalCount { .. } => todo!(), + ProposeQuery::GetVote { .. } => todo!(), + ProposeQuery::ListVotes { .. } => todo!(), + ProposeQuery::ProposalCreationPolicy { .. } => todo!(), + ProposeQuery::ProposalHooks { .. } => todo!(), + ProposeQuery::VoteHooks { .. } => todo!(), + _ => todo!(), + }; + return SystemResult::Ok(ContractResult::from(reply)); + } + if contract_addr == MOCK_PROPOSAL_ADDR { + let q: ProposeQuery = from_binary(msg).unwrap(); + let reply = match q { + ProposeQuery::Config {} => to_binary(&ProposalConfig { + threshold: Threshold::AbsolutePercentage { + percentage: Majority {}, + }, + max_voting_period: Duration::Time(1), + min_voting_period: None, + allow_revoting: false, + dao: Addr::unchecked(""), + close_proposal_on_execution_failure: true, + }), _ => todo!(), }; return SystemResult::Ok(ContractResult::from(reply)); diff --git a/packages/neutron-subdao-core/src/msg.rs b/packages/neutron-subdao-core/src/msg.rs index 2fcbd3a6..b9116ce8 100644 --- a/packages/neutron-subdao-core/src/msg.rs +++ b/packages/neutron-subdao-core/src/msg.rs @@ -155,6 +155,9 @@ pub enum QueryMsg { /// Verify timelock. Returns bool. #[returns(bool)] VerifyTimelock { timelock: String }, + /// Returns proposal module address for timelock contract if it's correct + #[returns(Addr)] + TimelockProposalModuleAddress { timelock: String }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] From f9fec92de4ac4bf637aa0615a9c8081dcf11ff3f Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 14 Sep 2023 16:54:33 +0400 Subject: [PATCH 11/23] check with close_proposal_on_execution_failure = false --- .../src/testing/mock_querier.rs | 8 ++++- .../src/testing/tests.rs | 33 +++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs index 975c38ed..9f695504 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs @@ -51,6 +51,7 @@ pub fn mock_dependencies( pub struct WasmMockQuerier { base: MockQuerier, overrule_proposal_status: Rc>, + close_proposal_on_execution_failure: bool, } impl Querier for WasmMockQuerier { @@ -175,7 +176,7 @@ impl WasmMockQuerier { min_voting_period: None, allow_revoting: false, dao: Addr::unchecked(""), - close_proposal_on_execution_failure: true, + close_proposal_on_execution_failure: self.close_proposal_on_execution_failure, }), _ => todo!(), }; @@ -188,6 +189,10 @@ impl WasmMockQuerier { _ => self.base.handle_query(request), } } + + pub fn set_close_proposal_on_execution_failure(self: &mut Self, v: bool) { + self.close_proposal_on_execution_failure = v + } } impl WasmMockQuerier { @@ -195,6 +200,7 @@ impl WasmMockQuerier { WasmMockQuerier { base, overrule_proposal_status: x, + close_proposal_on_execution_failure: true, } } } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index f864b759..836f860a 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -194,6 +194,8 @@ fn test_execute_proposal() { ) } + // check execution with close_proposal_on_execution_failure = true + deps.querier.set_close_proposal_on_execution_failure(true); let proposal = SingleChoiceProposal { id: 10, msgs: vec![NeutronMsg::remove_interchain_query(1).into()], @@ -208,7 +210,7 @@ fn test_execute_proposal() { let mut data_mut_ref = overrule_proposal_status.borrow_mut(); *data_mut_ref = Status::Rejected; } - let res = execute(deps.as_mut(), env, info, msg).unwrap(); + let res = execute(deps.as_mut(), env.clone(), info.clone(), msg.clone()).unwrap(); let expected_attributes = vec![ Attribute::new("action", "execute_proposal"), Attribute::new("sender", "neutron1unknownsender"), @@ -224,7 +226,34 @@ fn test_execute_proposal() { res.messages ); let updated_prop = PROPOSALS.load(deps.as_mut().storage, 10).unwrap(); - assert_eq!(ProposalStatus::Executed, updated_prop.status) + assert_eq!(ProposalStatus::Executed, updated_prop.status); + + // check proposal execution close_proposal_on_execution_failure = false + deps.querier.set_close_proposal_on_execution_failure(false); + let proposal = SingleChoiceProposal { + id: 10, + msgs: vec![NeutronMsg::remove_interchain_query(1).into()], + status: ProposalStatus::Timelocked, + }; + PROPOSALS + .save(deps.as_mut().storage, proposal.id, &proposal) + .unwrap(); + let res = execute(deps.as_mut(), env, info, msg).unwrap(); + let expected_attributes = vec![ + Attribute::new("action", "execute_proposal"), + Attribute::new("sender", "neutron1unknownsender"), + Attribute::new("proposal_id", "10"), + ]; + assert_eq!(expected_attributes, res.attributes); + // added as messages without reply + let expected_msgs = proposal + .msgs + .iter() + .map(|msg| SubMsg::new(msg.clone())) + .collect::>>(); + assert_eq!(expected_msgs, res.messages); + let updated_prop = PROPOSALS.load(deps.as_mut().storage, 10).unwrap(); + assert_eq!(ProposalStatus::Executed, updated_prop.status); } #[test] From 6ca23e0c5d49ac684fe626c97e774a8a0575ef86 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 14 Sep 2023 20:09:11 +0400 Subject: [PATCH 12/23] cargo fmt and cargo schema --- .../schema/cwd-proposal-multiple.json | 65 +++++++++++++++++++ .../schema/raw/query.json | 24 +++++++ ...se_to_proposal_failed_execution_error.json | 41 ++++++++++++ .../schema/cwd-proposal-single.json | 63 ++++++++++++++++++ .../cwd-proposal-single/schema/raw/query.json | 24 +++++++ ...se_to_proposal_failed_execution_error.json | 39 +++++++++++ .../schema/cwd-subdao-core.json | 28 ++++++++ .../cwd-subdao-core/schema/raw/query.json | 22 +++++++ ...e_to_timelock_proposal_module_address.json | 6 ++ .../schema/cwd-subdao-timelock-single.json | 2 +- ...se_to_proposal_failed_execution_error.json | 2 +- .../src/testing/mock_querier.rs | 7 +- 12 files changed, 318 insertions(+), 5 deletions(-) create mode 100644 contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json create mode 100644 contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json create mode 100644 contracts/subdaos/cwd-subdao-core/schema/raw/response_to_timelock_proposal_module_address.json diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json index f952305e..18066f5a 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json @@ -2801,6 +2801,30 @@ }, "additionalProperties": false }, + { + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "type": "object", + "required": [ + "proposal_failed_execution_error" + ], + "properties": { + "proposal_failed_execution_error": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -7568,6 +7592,47 @@ } } }, + "proposal_failed_execution_error": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FailedProposalErrors", + "description": "A list of proposals returned by `ProposalFailedExecutionError`.", + "type": "object", + "required": [ + "errors" + ], + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/FailedExecutionError" + } + } + }, + "additionalProperties": false, + "definitions": { + "FailedExecutionError": { + "description": "Proposal failed execution error", + "type": "object", + "required": [ + "error", + "height" + ], + "properties": { + "error": { + "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", + "type": "string" + }, + "height": { + "description": "Block height of execution error", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, "proposal_hooks": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "HooksResponse", diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json index 97177e3c..41cdda2d 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json @@ -226,6 +226,30 @@ }, "additionalProperties": false }, + { + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "type": "object", + "required": [ + "proposal_failed_execution_error" + ], + "properties": { + "proposal_failed_execution_error": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json new file mode 100644 index 00000000..130feb40 --- /dev/null +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FailedProposalErrors", + "description": "A list of proposals returned by `ProposalFailedExecutionError`.", + "type": "object", + "required": [ + "errors" + ], + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/FailedExecutionError" + } + } + }, + "additionalProperties": false, + "definitions": { + "FailedExecutionError": { + "description": "Proposal failed execution error", + "type": "object", + "required": [ + "error", + "height" + ], + "properties": { + "error": { + "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", + "type": "string" + }, + "height": { + "description": "Block height of execution error", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json b/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json index cf942ae3..46c6b3e2 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json @@ -2863,6 +2863,30 @@ }, "additionalProperties": false }, + { + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "type": "object", + "required": [ + "proposal_failed_execution_error" + ], + "properties": { + "proposal_failed_execution_error": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -7502,6 +7526,45 @@ } } }, + "proposal_failed_execution_error": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FailedProposalErrors", + "description": "A list of proposals returned by `ProposalFailedExecutionError`.", + "type": "object", + "required": [ + "errors" + ], + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/FailedExecutionError" + } + } + }, + "definitions": { + "FailedExecutionError": { + "description": "Proposal failed execution error", + "type": "object", + "required": [ + "error", + "height" + ], + "properties": { + "error": { + "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", + "type": "string" + }, + "height": { + "description": "Block height of execution error", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, "proposal_hooks": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "HooksResponse", diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json index fc1c8ec9..9747b6cc 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json @@ -233,6 +233,30 @@ }, "additionalProperties": false }, + { + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "type": "object", + "required": [ + "proposal_failed_execution_error" + ], + "properties": { + "proposal_failed_execution_error": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json new file mode 100644 index 00000000..f5e61b0f --- /dev/null +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FailedProposalErrors", + "description": "A list of proposals returned by `ProposalFailedExecutionError`.", + "type": "object", + "required": [ + "errors" + ], + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/FailedExecutionError" + } + } + }, + "definitions": { + "FailedExecutionError": { + "description": "Proposal failed execution error", + "type": "object", + "required": [ + "error", + "height" + ], + "properties": { + "error": { + "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", + "type": "string" + }, + "height": { + "description": "Block height of execution error", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } +} diff --git a/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json b/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json index 6b3de7b4..6ef7f833 100644 --- a/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json +++ b/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json @@ -2477,6 +2477,28 @@ }, "additionalProperties": false }, + { + "description": "Returns proposal module address for timelock contract if it's correct", + "type": "object", + "required": [ + "timelock_proposal_module_address" + ], + "properties": { + "timelock_proposal_module_address": { + "type": "object", + "required": [ + "timelock" + ], + "properties": { + "timelock": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -3114,6 +3136,12 @@ } } }, + "timelock_proposal_module_address": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Addr", + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, "total_power_at_height": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "TotalPowerAtHeightResponse", diff --git a/contracts/subdaos/cwd-subdao-core/schema/raw/query.json b/contracts/subdaos/cwd-subdao-core/schema/raw/query.json index 54abace9..aba08d24 100644 --- a/contracts/subdaos/cwd-subdao-core/schema/raw/query.json +++ b/contracts/subdaos/cwd-subdao-core/schema/raw/query.json @@ -236,6 +236,28 @@ }, "additionalProperties": false }, + { + "description": "Returns proposal module address for timelock contract if it's correct", + "type": "object", + "required": [ + "timelock_proposal_module_address" + ], + "properties": { + "timelock_proposal_module_address": { + "type": "object", + "required": [ + "timelock" + ], + "properties": { + "timelock": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/contracts/subdaos/cwd-subdao-core/schema/raw/response_to_timelock_proposal_module_address.json b/contracts/subdaos/cwd-subdao-core/schema/raw/response_to_timelock_proposal_module_address.json new file mode 100644 index 00000000..4c7f1934 --- /dev/null +++ b/contracts/subdaos/cwd-subdao-core/schema/raw/response_to_timelock_proposal_module_address.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Addr", + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" +} diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index 3d9cb529..75135f69 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -5563,7 +5563,7 @@ "proposal_failed_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ListProposals`.", + "description": "A list of proposals returned by `ProposalFailedExecutionError`.", "type": "object", "required": [ "errors" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json index dcf1c51e..f5e61b0f 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ListProposals`.", + "description": "A list of proposals returned by `ProposalFailedExecutionError`.", "type": "object", "required": [ "errors" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs index 9f695504..b7625eaf 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/mock_querier.rs @@ -176,7 +176,8 @@ impl WasmMockQuerier { min_voting_period: None, allow_revoting: false, dao: Addr::unchecked(""), - close_proposal_on_execution_failure: self.close_proposal_on_execution_failure, + close_proposal_on_execution_failure: self + .close_proposal_on_execution_failure, }), _ => todo!(), }; @@ -190,8 +191,8 @@ impl WasmMockQuerier { } } - pub fn set_close_proposal_on_execution_failure(self: &mut Self, v: bool) { - self.close_proposal_on_execution_failure = v + pub fn set_close_proposal_on_execution_failure(&mut self, v: bool) { + self.close_proposal_on_execution_failure = v } } From 5f767f78dafce6fcfc1671d31b50a58eb3ac078d Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 15 Sep 2023 00:13:21 +0400 Subject: [PATCH 13/23] fix build --- .../cwd-proposal-single/src/testing/tests.rs | 14 +++++++------- packages/cw-denom/src/lib.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs index 939908b3..b2450435 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs @@ -164,7 +164,7 @@ fn test_proposal_close_after_expiry() { assert!(matches!(err, ContractError::WrongCloseStatus {})); // Expire the proposal. Now it should be closable. - app.update_block(|mut b| b.time = b.time.plus_seconds(604800)); + app.update_block(|b| b.time = b.time.plus_seconds(604800)); close_proposal(&mut app, &proposal_module, CREATOR_ADDR, proposal_id); let proposal = query_proposal(&app, &proposal_module, proposal_id); assert_eq!(proposal.proposal.status, Status::Closed); @@ -207,7 +207,7 @@ fn test_proposal_cant_close_after_expiry_is_passed() { assert_eq!(proposal.proposal.status, Status::Open); // Expire the proposal. This should pass it. - app.update_block(|mut b| b.time = b.time.plus_seconds(604800)); + app.update_block(|b| b.time = b.time.plus_seconds(604800)); let proposal = query_proposal(&app, &proposal_module, proposal_id); assert_eq!(proposal.proposal.status, Status::Passed); @@ -243,7 +243,7 @@ fn test_execute_no_non_passed_execution() { assert!(matches!(err, ContractError::NotPassed {})); // Expire the proposal. - app.update_block(|mut b| b.time = b.time.plus_seconds(604800)); + app.update_block(|b| b.time = b.time.plus_seconds(604800)); let err = execute_proposal_should_fail(&mut app, &proposal_module, CREATOR_ADDR, proposal_id); assert!(matches!(err, ContractError::NotPassed {})); @@ -585,7 +585,7 @@ fn test_min_voting_period_no_early_pass() { let proposal_response = query_proposal(&app, &proposal_module, proposal_id); assert_eq!(proposal_response.proposal.status, Status::Open); - app.update_block(|mut block| block.height += 10); + app.update_block(|block| block.height += 10); let proposal_response = query_proposal(&app, &proposal_module, proposal_id); assert_eq!(proposal_response.proposal.status, Status::Passed); } @@ -622,7 +622,7 @@ fn test_min_duration_same_as_proposal_duration() { vote_on_proposal(&mut app, &proposal_module, "whale", proposal_id, Vote::Yes); vote_on_proposal(&mut app, &proposal_module, "ekez", proposal_id, Vote::No); - app.update_block(|mut b| b.height += 100); + app.update_block(|b| b.height += 100); let proposal_response = query_proposal(&app, &proposal_module, proposal_id); assert_eq!(proposal_response.proposal.status, Status::Passed); } @@ -681,7 +681,7 @@ fn test_min_duration_same_as_proposal_duration() { // assert!(matches!(err, ContractError::AlreadyCast {})); // // // Expire the proposal allowing the votes to be tallied. -// app.update_block(|mut b| b.time = b.time.plus_seconds(604800)); +// app.update_block(|b| b.time = b.time.plus_seconds(604800)); // let proposal_response = query_proposal(&app, &proposal_module, proposal_id); // assert_eq!(proposal_response.proposal.status, Status::Passed); // execute_proposal(&mut app, &proposal_module, CREATOR_ADDR, proposal_id); @@ -779,7 +779,7 @@ fn test_min_duration_same_as_proposal_duration() { // Vote::No, // ); // // Expire the revoting proposal and close it. -// app.update_block(|mut b| b.time = b.time.plus_seconds(604800)); +// app.update_block(|b| b.time = b.time.plus_seconds(604800)); // close_proposal(&mut app, &proposal_module, CREATOR_ADDR, revoting_proposal); // } // diff --git a/packages/cw-denom/src/lib.rs b/packages/cw-denom/src/lib.rs index e8103afc..e58adbcf 100644 --- a/packages/cw-denom/src/lib.rs +++ b/packages/cw-denom/src/lib.rs @@ -275,8 +275,8 @@ mod tests { "1abc".to_string(), // Starts with non alphabetic character. "abc~d".to_string(), // Contains invalid character. "".to_string(), // Too short, also empty. - "🥵abc".to_string(), // Weird unicode start. - "ab:12🥵a".to_string(), // Weird unocide in non-head position. + "🥵abc".to_string(), // Weird unicode start. + "ab:12🥵a".to_string(), // Weird unocide in non-head position. "ab,cd".to_string(), // Comma is not a valid seperator. ]; From f276009c7793d590b7846b068ef0e410f788787d Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 15 Sep 2023 18:55:21 +0400 Subject: [PATCH 14/23] add tests for reply errors in single/multiple --- .../cwd-proposal-multiple/src/contract.rs | 2 +- .../src/testing/tests.rs | 88 ++++++++++++++++++- .../cwd-proposal-single/src/testing/tests.rs | 38 +++++++- 3 files changed, 121 insertions(+), 7 deletions(-) diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs index 0717c1f9..8be31728 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs @@ -892,7 +892,7 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { let addr = PROPOSAL_HOOKS.remove_hook_by_index(deps.storage, idx)?; diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs index 7017d6c1..20339672 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs @@ -1,6 +1,7 @@ +use cosmwasm_std::testing::{mock_dependencies, mock_env}; use cosmwasm_std::{ - coins, to_binary, Addr, Api, Coin, CosmosMsg, Decimal, Empty, Storage, Timestamp, Uint128, - WasmMsg, + coins, from_binary, to_binary, Addr, Api, Attribute, Coin, CosmosMsg, Decimal, Empty, Reply, + Storage, SubMsgResult, Timestamp, Uint128, WasmMsg, }; use cw20::Cw20Coin; use cw_denom::{CheckedDenom, UncheckedDenom}; @@ -44,8 +45,11 @@ use crate::{ }; use cwd_pre_propose_multiple as cppm; +use crate::contract::query_proposal_failed_execution_error; +use crate::query::FailedProposalErrors; use crate::testing::execute::mint_natives; use cwd_testing::ShouldExecute; +use cwd_voting::reply::mask_proposal_execution_proposal_id; pub const CREATOR_ADDR: &str = "creator"; @@ -2128,3 +2132,83 @@ fn test_close_failed_proposal() { // not reverted assert_eq!(updated.proposal.status, Status::Passed); } + +#[test] +fn test_reply_proposal_mock() { + use crate::contract::reply; + use crate::state::PROPOSALS; + + let mut deps = mock_dependencies(); + let env = mock_env(); + + let m_proposal_id = mask_proposal_execution_proposal_id(1); + PROPOSALS + .save( + deps.as_mut().storage, + 1, + &MultipleChoiceProposal { + title: "A simple text proposal".to_string(), + description: "This is a simple text proposal".to_string(), + proposer: Addr::unchecked(CREATOR_ADDR), + start_height: env.block.height, + expiration: Duration::Height(6).after(&env.block), + min_voting_period: None, + allow_revoting: false, + total_power: Uint128::new(100_000_000), + status: Status::Open, + votes: MultipleChoiceVotes { + vote_weights: vec![Uint128::zero(); 3], + }, + choices: vec![], + voting_strategy: VotingStrategy::SingleChoice { + quorum: PercentageThreshold::Majority {}, + }, + }, + ) + .unwrap(); + + // PROPOSALS + let reply_msg = Reply { + id: m_proposal_id, + result: SubMsgResult::Err("error".to_string()), + }; + let res = reply(deps.as_mut(), env.clone(), reply_msg).unwrap(); + assert_eq!( + res.attributes[0], + Attribute { + key: "proposal_execution_failed".to_string(), + value: 1.to_string() + } + ); + + let prop = PROPOSALS.load(deps.as_mut().storage, 1).unwrap(); + assert_eq!(prop.status, Status::ExecutionFailed); + + // reply writes the failed proposal error + let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); + let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); + assert_eq!(query_errs.errors.len(), 1); + let error = query_errs.errors.first().unwrap(); + assert_eq!(error.error, "error".to_string()); + assert_eq!(error.height, env.block.height); + + // reply second time appends new error + let env2 = { + let mut e = env; + e.block.height += 10; + e + }; + let msg2 = Reply { + id: m_proposal_id, + result: SubMsgResult::Err("error2".to_string()), + }; + let res_ok = reply(deps.as_mut(), env2.clone(), msg2).unwrap(); + assert_eq!(0, res_ok.messages.len()); + + let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); + let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); + assert_eq!(query_errs.errors.len(), 2); + let error2 = query_errs.errors.last().unwrap(); + assert_eq!(error2.error, "error2".to_string()); + assert_eq!(error2.height, env2.block.height); +} diff --git a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs index b2450435..92bab62c 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs @@ -1,5 +1,5 @@ use cosmwasm_std::{ - coins, + coins, from_binary, testing::{mock_dependencies, mock_env}, to_binary, Addr, Attribute, BankMsg, ContractInfoResponse, CosmosMsg, Decimal, Empty, Reply, StdError, StdResult, SubMsgResult, Uint128, WasmMsg, WasmQuery, @@ -26,6 +26,8 @@ use cwd_voting::{ }; use neutron_sdk::bindings::msg::NeutronMsg; +use crate::contract::query_proposal_failed_execution_error; +use crate::query::FailedProposalErrors; use crate::testing::execute::{execute_proposal, execute_proposal_should_fail}; use crate::{ contract::{CONTRACT_NAME, CONTRACT_VERSION}, @@ -948,7 +950,7 @@ fn test_reply_proposal_mock() { description: "This is a simple text proposal".to_string(), proposer: Addr::unchecked(CREATOR_ADDR), start_height: env.block.height, - expiration: cw_utils::Duration::Height(6).after(&env.block), + expiration: Duration::Height(6).after(&env.block), min_voting_period: None, threshold: Threshold::AbsolutePercentage { percentage: PercentageThreshold::Majority {}, @@ -965,9 +967,9 @@ fn test_reply_proposal_mock() { // PROPOSALS let reply_msg = Reply { id: m_proposal_id, - result: SubMsgResult::Err("error_msg".to_string()), + result: SubMsgResult::Err("error".to_string()), }; - let res = reply(deps.as_mut(), env, reply_msg).unwrap(); + let res = reply(deps.as_mut(), env.clone(), reply_msg).unwrap(); assert_eq!( res.attributes[0], Attribute { @@ -978,6 +980,34 @@ fn test_reply_proposal_mock() { let prop = PROPOSALS.load(deps.as_mut().storage, 1).unwrap(); assert_eq!(prop.status, Status::ExecutionFailed); + + // reply writes the failed proposal error + let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); + let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); + assert_eq!(query_errs.errors.len(), 1); + let error = query_errs.errors.first().unwrap(); + assert_eq!(error.error, "error".to_string()); + assert_eq!(error.height, env.block.height); + + // reply second time appends new error + let env2 = { + let mut e = env; + e.block.height += 10; + e + }; + let msg2 = Reply { + id: m_proposal_id, + result: SubMsgResult::Err("error2".to_string()), + }; + let res_ok = reply(deps.as_mut(), env2.clone(), msg2).unwrap(); + assert_eq!(0, res_ok.messages.len()); + + let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); + let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); + assert_eq!(query_errs.errors.len(), 2); + let error2 = query_errs.errors.last().unwrap(); + assert_eq!(error2.error, "error2".to_string()); + assert_eq!(error2.height, env2.block.height); } #[test] From f316f07af4657278a7d9b7c7318bd1f37dd8518a Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 15 Sep 2023 19:07:24 +0400 Subject: [PATCH 15/23] fix lint on old rust version --- packages/cw-denom/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cw-denom/src/lib.rs b/packages/cw-denom/src/lib.rs index e58adbcf..0664c299 100644 --- a/packages/cw-denom/src/lib.rs +++ b/packages/cw-denom/src/lib.rs @@ -275,8 +275,8 @@ mod tests { "1abc".to_string(), // Starts with non alphabetic character. "abc~d".to_string(), // Contains invalid character. "".to_string(), // Too short, also empty. - "🥵abc".to_string(), // Weird unicode start. - "ab:12🥵a".to_string(), // Weird unocide in non-head position. + "🥵abc".to_string(), // Weird unicode start. + "ab:12🥵a".to_string(), // Weird unicode in non-head position. "ab,cd".to_string(), // Comma is not a valid seperator. ]; From 03a52d1f735646117337208e34aafa24d118d1ba Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 29 Sep 2023 17:31:19 +0400 Subject: [PATCH 16/23] Use just string for errors since there is only one value possible. Fix review issues --- .../cwd-proposal-multiple/src/contract.rs | 42 +++++------------ .../proposal/cwd-proposal-multiple/src/msg.rs | 2 +- .../cwd-proposal-multiple/src/query.rs | 7 --- .../cwd-proposal-multiple/src/state.rs | 12 +---- .../src/testing/tests.rs | 30 ++----------- .../cwd-proposal-single/src/contract.rs | 45 +++++-------------- .../proposal/cwd-proposal-single/src/msg.rs | 2 +- .../proposal/cwd-proposal-single/src/query.rs | 7 --- .../proposal/cwd-proposal-single/src/state.rs | 12 +---- .../cwd-proposal-single/src/testing/tests.rs | 30 ++----------- .../subdaos/cwd-subdao-core/src/contract.rs | 3 +- .../src/contract.rs | 42 +++++------------ .../cwd-subdao-timelock-single/src/state.rs | 5 +-- .../src/testing/tests.rs | 30 ++----------- .../neutron-subdao-timelock-single/src/msg.rs | 2 +- .../src/types.rs | 13 +----- 16 files changed, 54 insertions(+), 230 deletions(-) diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs index 8be31728..99b490d2 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs @@ -26,8 +26,7 @@ use cwd_voting::{ voting::{get_total_power, get_voting_power, validate_voting_period}, }; -use crate::query::FailedProposalErrors; -use crate::state::{FailedExecutionError, PROPOSAL_FAILED_EXECUTION_ERRORS}; +use crate::state::PROPOSAL_FAILED_EXECUTION_ERRORS; use crate::{msg::MigrateMsg, state::CREATION_POLICY}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, QueryMsg}, @@ -847,15 +846,12 @@ pub fn query_info(deps: Deps) -> StdResult { } pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; - let res = FailedProposalErrors { - errors: errors.unwrap_or_default(), - }; - to_binary(&res) + let error = PROPOSAL_FAILED_EXECUTION_ERRORS.load(deps.storage, proposal_id)?; + to_binary(&error) } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { +pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { let repl = TaggedReplyId::new(msg.id)?; match repl { TaggedReplyId::FailedProposalExecution(proposal_id) => { @@ -868,29 +864,13 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result( - deps.storage, - proposal_id, - |maybe_errors| { - let error = msg.result.into_result().err().ok_or_else(|| { - // should never happen since we reply only on failure - ContractError::Std(StdError::generic_err( - "must be an error in the failed result", - )) - })?; - let value = FailedExecutionError { - height: env.block.height, - error, - }; - match maybe_errors { - Some(mut errors) => { - errors.push(value); - Ok(errors) - } - None => Ok(vec![value]), - } - }, - )?; + let error = msg.result.into_result().err().ok_or_else(|| { + // should never happen since we reply only on failure + ContractError::Std(StdError::generic_err( + "must be an error in the failed result", + )) + })?; + PROPOSAL_FAILED_EXECUTION_ERRORS.save(deps.storage, proposal_id, &error)?; Ok(Response::new().add_attribute("proposal_execution_failed", proposal_id.to_string())) } diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs index 049ed1ef..61d944d2 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs @@ -189,7 +189,7 @@ pub enum QueryMsg { /// Returns errors of the failed proposal. /// Expected in the form of [execution_height, "codespace=? code=?"]. /// Returns `types::FailedProposalErrors` - #[returns(crate::query::FailedProposalErrors)] + #[returns(String)] ProposalFailedExecutionError { proposal_id: u64 }, } diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs index 1778597a..dd1f87f1 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/query.rs @@ -2,7 +2,6 @@ use crate::{proposal::MultipleChoiceProposal, state::Config}; use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Uint128}; -use crate::state::FailedExecutionError; use cwd_voting::multiple_choice::MultipleChoiceVote; #[cw_serde] @@ -42,9 +41,3 @@ pub struct VoteListResponse { pub struct ConfigResponse { pub config: Config, } - -/// A list of proposals returned by `ProposalFailedExecutionError`. -#[cw_serde] -pub struct FailedProposalErrors { - pub errors: Vec, -} diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs index d7100055..85efbdb7 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs @@ -45,15 +45,6 @@ pub struct Config { pub close_proposal_on_execution_failure: bool, } -/// Proposal failed execution error -#[cw_serde] -pub struct FailedExecutionError { - /// Block height of execution error - pub height: u64, - /// Error text. Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" - pub error: String, -} - // we cast a ballot with our chosen vote and a given weight // stored under the key that voted #[cw_serde] @@ -77,5 +68,4 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); // Execution errors for proposals that do execute only once -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = - Map::new("failed_proposal_errors"); +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs index 20339672..ccd82967 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs @@ -46,7 +46,6 @@ use crate::{ use cwd_pre_propose_multiple as cppm; use crate::contract::query_proposal_failed_execution_error; -use crate::query::FailedProposalErrors; use crate::testing::execute::mint_natives; use cwd_testing::ShouldExecute; use cwd_voting::reply::mask_proposal_execution_proposal_id; @@ -2172,7 +2171,7 @@ fn test_reply_proposal_mock() { id: m_proposal_id, result: SubMsgResult::Err("error".to_string()), }; - let res = reply(deps.as_mut(), env.clone(), reply_msg).unwrap(); + let res = reply(deps.as_mut(), env, reply_msg).unwrap(); assert_eq!( res.attributes[0], Attribute { @@ -2186,29 +2185,6 @@ fn test_reply_proposal_mock() { // reply writes the failed proposal error let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); - let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); - assert_eq!(query_errs.errors.len(), 1); - let error = query_errs.errors.first().unwrap(); - assert_eq!(error.error, "error".to_string()); - assert_eq!(error.height, env.block.height); - - // reply second time appends new error - let env2 = { - let mut e = env; - e.block.height += 10; - e - }; - let msg2 = Reply { - id: m_proposal_id, - result: SubMsgResult::Err("error2".to_string()), - }; - let res_ok = reply(deps.as_mut(), env2.clone(), msg2).unwrap(); - assert_eq!(0, res_ok.messages.len()); - - let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); - let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); - assert_eq!(query_errs.errors.len(), 2); - let error2 = query_errs.errors.last().unwrap(); - assert_eq!(error2.error, "error2".to_string()); - assert_eq!(error2.height, env2.block.height); + let error: String = from_binary(&query_res).unwrap(); + assert_eq!(error, "error".to_string()); } diff --git a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs index a3cdd6a2..de83e57f 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs @@ -23,11 +23,8 @@ use neutron_sdk::bindings::msg::NeutronMsg; use crate::msg::MigrateMsg; use crate::proposal::SingleChoiceProposal; -use crate::state::{ - Config, FailedExecutionError, CREATION_POLICY, PROPOSAL_FAILED_EXECUTION_ERRORS, -}; +use crate::state::{Config, CREATION_POLICY, PROPOSAL_FAILED_EXECUTION_ERRORS}; -use crate::query::FailedProposalErrors; use crate::{ error::ContractError, msg::{ExecuteMsg, InstantiateMsg, QueryMsg}, @@ -785,11 +782,8 @@ pub fn query_info(deps: Deps) -> StdResult { } pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; - let res = FailedProposalErrors { - errors: errors.unwrap_or_default(), - }; - to_binary(&res) + let error = PROPOSAL_FAILED_EXECUTION_ERRORS.load(deps.storage, proposal_id)?; + to_binary(&error) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -798,14 +792,13 @@ pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result Result { +pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { let repl = TaggedReplyId::new(msg.id)?; match repl { TaggedReplyId::FailedProposalExecution(proposal_id) => { PROPOSALS.update(deps.storage, proposal_id, |prop| match prop { Some(mut prop) => { prop.status = Status::ExecutionFailed; - // here\ Ok(prop) } @@ -813,29 +806,13 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result( - deps.storage, - proposal_id, - |maybe_errors| { - let error = msg.result.into_result().err().ok_or_else(|| { - // should never happen since we reply only on failure - ContractError::Std(StdError::generic_err( - "must be an error in the failed result", - )) - })?; - let value = FailedExecutionError { - height: env.block.height, - error, - }; - match maybe_errors { - Some(mut errors) => { - errors.push(value); - Ok(errors) - } - None => Ok(vec![value]), - } - }, - )?; + let error = msg.result.into_result().err().ok_or_else(|| { + // should never happen since we reply only on failure + ContractError::Std(StdError::generic_err( + "must be an error in the failed result", + )) + })?; + PROPOSAL_FAILED_EXECUTION_ERRORS.save(deps.storage, proposal_id, &error)?; Ok(Response::new().add_attribute("proposal_execution_failed", proposal_id.to_string())) } diff --git a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs index 97f9e912..fa885618 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs @@ -205,7 +205,7 @@ pub enum QueryMsg { /// Returns errors of the failed proposal. /// Expected in the form of [execution_height, "codespace=? code=?"]. /// Returns `types::FailedProposalErrors` - #[returns(crate::query::FailedProposalErrors)] + #[returns(String)] ProposalFailedExecutionError { proposal_id: u64 }, } diff --git a/contracts/dao/proposal/cwd-proposal-single/src/query.rs b/contracts/dao/proposal/cwd-proposal-single/src/query.rs index 55fed1d2..91aecbee 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/query.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/query.rs @@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize}; use cwd_voting::voting::Vote; use crate::proposal::SingleChoiceProposal; -use crate::state::FailedExecutionError; /// Information about a proposal returned by proposal queries. #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] @@ -45,9 +44,3 @@ pub struct VoteListResponse { pub struct ProposalListResponse { pub proposals: Vec, } - -/// A list of proposals returned by `ProposalFailedExecutionError`. -#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] -pub struct FailedProposalErrors { - pub errors: Vec, -} diff --git a/contracts/dao/proposal/cwd-proposal-single/src/state.rs b/contracts/dao/proposal/cwd-proposal-single/src/state.rs index b5ce0282..49a0da9d 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/state.rs @@ -50,15 +50,6 @@ pub struct Config { pub close_proposal_on_execution_failure: bool, } -/// Proposal failed execution error -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct FailedExecutionError { - /// Block height of execution error - pub height: u64, - /// Error text. Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" - pub error: String, -} - /// The current top level config for the module. The "config" key was /// previously used to store configs for v1 DAOs. pub const CONFIG: Item = Item::new("config_v2"); @@ -74,5 +65,4 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); // Execution errors for proposals that do execute only once -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = - Map::new("failed_proposal_errors"); +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs index 92bab62c..aa4ee2bc 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs @@ -27,7 +27,6 @@ use cwd_voting::{ use neutron_sdk::bindings::msg::NeutronMsg; use crate::contract::query_proposal_failed_execution_error; -use crate::query::FailedProposalErrors; use crate::testing::execute::{execute_proposal, execute_proposal_should_fail}; use crate::{ contract::{CONTRACT_NAME, CONTRACT_VERSION}, @@ -969,7 +968,7 @@ fn test_reply_proposal_mock() { id: m_proposal_id, result: SubMsgResult::Err("error".to_string()), }; - let res = reply(deps.as_mut(), env.clone(), reply_msg).unwrap(); + let res = reply(deps.as_mut(), env, reply_msg).unwrap(); assert_eq!( res.attributes[0], Attribute { @@ -983,31 +982,8 @@ fn test_reply_proposal_mock() { // reply writes the failed proposal error let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); - let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); - assert_eq!(query_errs.errors.len(), 1); - let error = query_errs.errors.first().unwrap(); - assert_eq!(error.error, "error".to_string()); - assert_eq!(error.height, env.block.height); - - // reply second time appends new error - let env2 = { - let mut e = env; - e.block.height += 10; - e - }; - let msg2 = Reply { - id: m_proposal_id, - result: SubMsgResult::Err("error2".to_string()), - }; - let res_ok = reply(deps.as_mut(), env2.clone(), msg2).unwrap(); - assert_eq!(0, res_ok.messages.len()); - - let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); - let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); - assert_eq!(query_errs.errors.len(), 2); - let error2 = query_errs.errors.last().unwrap(); - assert_eq!(error2.error, "error2".to_string()); - assert_eq!(error2.height, env2.block.height); + let error: String = from_binary(&query_res).unwrap(); + assert_eq!(error, "error".to_string()); } #[test] diff --git a/contracts/subdaos/cwd-subdao-core/src/contract.rs b/contracts/subdaos/cwd-subdao-core/src/contract.rs index 79bf3141..0a2ef632 100644 --- a/contracts/subdaos/cwd-subdao-core/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-core/src/contract.rs @@ -677,7 +677,8 @@ pub(crate) fn execution_access_check(deps: Deps, sender: Addr) -> Result<(), Con } } -// returns Unauthorized if not found +/// Tries to find proposal module for a given timelock address (`sender`). +/// Returns Ok(None) if not found fn proposal_from_timelock(deps: Deps, sender: String) -> Result, StdError> { let proposal_modules = PROPOSAL_MODULES .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 3913dcd4..1e4cbf98 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -20,7 +20,6 @@ use neutron_subdao_core::msg::QueryMsg as SubdaoQuery; use neutron_subdao_pre_propose_single::msg::QueryMsg as PreProposeQuery; use neutron_subdao_proposal_single::msg::QueryMsg as ProposalQueryMsg; use neutron_subdao_proposal_single::types::Config as ProposalConfig; -use neutron_subdao_timelock_single::types::{FailedExecutionError, FailedProposalErrors}; use neutron_subdao_timelock_single::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, types::{Config, ProposalListResponse, ProposalStatus, SingleChoiceProposal}, @@ -164,6 +163,8 @@ pub fn execute_execute_proposal( PROPOSALS.save(deps.storage, proposal_id, &proposal)?; let response: Response = { + // In order to get config.close_proposal_on_execution_failure on proposal module, + // we have to query subdao to get proposal module address and then it's config let proposal_module: Addr = deps.querier.query_wasm_smart( config.subdao, &SubdaoQuery::TimelockProposalModuleAddress { @@ -298,11 +299,8 @@ pub fn query_list_proposals( } pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let errors = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; - let res = FailedProposalErrors { - errors: errors.unwrap_or_default(), - }; - to_binary(&res) + let error = PROPOSAL_FAILED_EXECUTION_ERRORS.load(deps.storage, proposal_id)?; + to_binary(&error) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -340,7 +338,7 @@ fn is_overrule_proposal_rejected( } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result { +pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result { let proposal_id = msg.id; PROPOSALS.update(deps.storage, proposal_id, |prop| match prop { @@ -352,29 +350,13 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> Result( - deps.storage, - proposal_id, - |maybe_errors| { - let error = msg.result.into_result().err().ok_or_else(|| { - // should never happen since we reply only on failure - ContractError::Std(StdError::generic_err( - "must be an error in the failed result", - )) - })?; - let value = FailedExecutionError { - height: env.block.height, - error, - }; - match maybe_errors { - Some(mut errors) => { - errors.push(value); - Ok(errors) - } - None => Ok(vec![value]), - } - }, - )?; + let error = msg.result.into_result().err().ok_or_else(|| { + // should never happen since we reply only on failure + ContractError::Std(StdError::generic_err( + "must be an error in the failed result", + )) + })?; + PROPOSAL_FAILED_EXECUTION_ERRORS.save(deps.storage, proposal_id, &error)?; Ok(Response::new().add_attribute( "timelocked_proposal_execution_failed", diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index ef0392b3..b3ce43e7 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -1,5 +1,5 @@ use cw_storage_plus::{Item, Map}; -use neutron_subdao_timelock_single::types::{Config, FailedExecutionError, SingleChoiceProposal}; +use neutron_subdao_timelock_single::types::{Config, SingleChoiceProposal}; /// Default limit for proposal pagination. pub const DEFAULT_LIMIT: u64 = 30; @@ -7,5 +7,4 @@ pub const DEFAULT_LIMIT: u64 = 30; pub const CONFIG: Item = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); // Execution errors for proposals that do execute only once -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map> = - Map::new("failed_proposal_errors"); +pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index 836f860a..cb2c99c3 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -24,7 +24,6 @@ use crate::{ use neutron_dao_pre_propose_overrule::msg::{ ExecuteMsg as OverruleExecuteMsg, ProposeMessage as OverruleProposeMessage, }; -use neutron_subdao_timelock_single::types::FailedProposalErrors; use super::mock_querier::{mock_dependencies, MOCK_SUBDAO_CORE_ADDR}; @@ -552,36 +551,13 @@ fn test_reply() { }; let env = mock_env(); PROPOSALS.save(deps.as_mut().storage, 10, &prop).unwrap(); - let res_ok = reply(deps.as_mut(), env.clone(), msg).unwrap(); + let res_ok = reply(deps.as_mut(), env, msg).unwrap(); assert_eq!(0, res_ok.messages.len()); let expected_attributes = vec![Attribute::new("timelocked_proposal_execution_failed", "10")]; assert_eq!(expected_attributes, res_ok.attributes); // reply writes the failed proposal error let query_res = query_proposal_failed_execution_error(deps.as_ref(), 10).unwrap(); - let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); - assert_eq!(query_errs.errors.len(), 1); - let error = query_errs.errors.first().unwrap(); - assert_eq!(error.error, "error".to_string()); - assert_eq!(error.height, env.block.height); - - // reply second time appends new error - let env2 = { - let mut e = env; - e.block.height += 10; - e - }; - let msg2 = Reply { - id: 10, - result: SubMsgResult::Err("error2".to_string()), - }; - let res_ok = reply(deps.as_mut(), env2.clone(), msg2).unwrap(); - assert_eq!(0, res_ok.messages.len()); - - let query_res = query_proposal_failed_execution_error(deps.as_ref(), 10).unwrap(); - let query_errs: FailedProposalErrors = from_binary(&query_res).unwrap(); - assert_eq!(query_errs.errors.len(), 2); - let error2 = query_errs.errors.last().unwrap(); - assert_eq!(error2.error, "error2".to_string()); - assert_eq!(error2.height, env2.block.height); + let error: String = from_binary(&query_res).unwrap(); + assert_eq!(error, "error".to_string()); } diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index 5b398ce7..7a28d097 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -58,7 +58,7 @@ pub enum QueryMsg { /// Returns errors of the failed proposal. /// Expected in the form of [execution_height, "codespace=? code=?"]. /// Returns `types::FailedProposalErrors` - #[returns(crate::types::FailedProposalErrors)] + #[returns(String)] ProposalFailedExecutionError { proposal_id: u64 }, } diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index 503a107b..340b95e9 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -54,17 +54,8 @@ pub struct ProposalListResponse { pub proposals: Vec, } -/// A list of proposals returned by `ProposalFailedExecutionError`. +/// A proposal error returned by `ProposalFailedExecutionError`. #[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] -pub struct FailedProposalErrors { - pub errors: Vec, -} - -/// Proposal failed execution error -#[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] -pub struct FailedExecutionError { - /// Block height of execution error - pub height: u64, - /// Error text. Error is reduced before cosmwasm reply and is expected in form of "codespace=? code=?" +pub struct FailedProposalError { pub error: String, } From 059fdfcc2c17008f2eae0812a6baeaf78301f0ff Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 6 Oct 2023 14:32:14 +0300 Subject: [PATCH 17/23] fix --- Cargo.lock | 2 +- contracts/dao/cwd-core/Cargo.toml | 2 +- contracts/dao/cwd-core/schema/cwd-core.json | 63 +++- .../dao/cwd-core/schema/raw/execute.json | 63 +++- .../cwd-pre-propose-multiple/Cargo.toml | 2 +- .../schema/cwd-pre-propose-multiple.json | 63 +++- .../schema/raw/execute.json | 63 +++- .../Cargo.toml | 2 +- .../src/contract.rs | 2 +- .../cwd-pre-propose-single/Cargo.toml | 2 +- .../schema/cwd-pre-propose-single.json | 63 +++- .../schema/raw/execute.json | 63 +++- .../proposal/cwd-proposal-multiple/Cargo.toml | 2 +- .../schema/cwd-proposal-multiple.json | 297 +++++++++++++++--- .../schema/raw/execute.json | 63 +++- .../schema/raw/query.json | 2 +- .../raw/response_to_list_proposals.json | 63 +++- .../schema/raw/response_to_proposal.json | 63 +++- ...se_to_proposal_failed_execution_error.json | 43 +-- .../raw/response_to_reverse_proposals.json | 63 +++- .../cwd-proposal-multiple/src/contract.rs | 2 +- .../proposal/cwd-proposal-multiple/src/msg.rs | 4 +- .../src/testing/tests.rs | 4 +- .../proposal/cwd-proposal-single/Cargo.toml | 2 +- .../schema/cwd-proposal-single.json | 295 ++++++++++++++--- .../schema/raw/execute.json | 63 +++- .../cwd-proposal-single/schema/raw/query.json | 2 +- .../raw/response_to_list_proposals.json | 63 +++- .../schema/raw/response_to_proposal.json | 63 +++- ...se_to_proposal_failed_execution_error.json | 41 +-- .../raw/response_to_reverse_proposals.json | 63 +++- .../cwd-proposal-single/src/contract.rs | 2 +- .../proposal/cwd-proposal-single/src/msg.rs | 4 +- .../cwd-proposal-single/src/testing/tests.rs | 4 +- contracts/subdaos/cwd-subdao-core/Cargo.toml | 2 +- .../schema/cwd-subdao-core.json | 63 +++- .../cwd-subdao-core/schema/raw/execute.json | 63 +++- .../cwd-subdao-timelock-single/Cargo.toml | 2 +- .../schema/cwd-subdao-timelock-single.json | 232 +++++++++++--- .../schema/raw/execute.json | 63 +++- .../schema/raw/query.json | 2 +- .../raw/response_to_list_proposals.json | 63 +++- .../schema/raw/response_to_proposal.json | 63 +++- ...se_to_proposal_failed_execution_error.json | 41 +-- .../src/contract.rs | 2 +- .../src/testing/tests.rs | 4 +- .../Cargo.toml | 2 +- ...subdao-pre-propose-single-no-timelock.json | 63 +++- .../schema/raw/execute.json | 63 +++- .../cwd-subdao-pre-propose-single/Cargo.toml | 2 +- .../schema/cwd-subdao-pre-propose-single.json | 63 +++- .../schema/raw/execute.json | 63 +++- .../cwd-subdao-proposal-single/Cargo.toml | 2 +- .../schema/cwd-subdao-proposal-single.json | 252 ++++++++++++++- .../schema/raw/execute.json | 63 +++- .../raw/response_to_list_proposals.json | 63 +++- .../schema/raw/response_to_proposal.json | 63 +++- .../raw/response_to_reverse_proposals.json | 63 +++- contracts/tokenomics/reserve/Cargo.toml | 2 +- packages/cwd-voting/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/neutron-subdao-core/Cargo.toml | 2 +- .../Cargo.toml | 2 +- .../neutron-subdao-proposal-single/Cargo.toml | 2 +- .../neutron-subdao-timelock-single/Cargo.toml | 2 +- .../neutron-subdao-timelock-single/src/msg.rs | 4 +- 66 files changed, 2591 insertions(+), 387 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6478d18c..b54f75cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1631,7 +1631,7 @@ dependencies = [ [[package]] name = "neutron-sdk" version = "0.6.1" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/sdk47#cfb3c83b56979f0592d8c4fd5be98031cfe8ec3e" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=sdk/47#9626f3086418a04b61b6ef0af8f1721810cf5eba" dependencies = [ "base64 0.21.2", "bech32", diff --git a/contracts/dao/cwd-core/Cargo.toml b/contracts/dao/cwd-core/Cargo.toml index 70e28588..64b0e640 100644 --- a/contracts/dao/cwd-core/Cargo.toml +++ b/contracts/dao/cwd-core/Cargo.toml @@ -28,7 +28,7 @@ cw20 = "1.1.0" cw721 = "0.18.0" cwd-interface = {path = "../../../packages/cwd-interface"} cwd-macros = {path = "../../../packages/cwd-macros"} -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" serde = {version = "1.0.175", default-features = false, features = ["derive"]} thiserror = {version = "1.0"} diff --git a/contracts/dao/cwd-core/schema/cwd-core.json b/contracts/dao/cwd-core/schema/cwd-core.json index 8ddbe510..c2fe891f 100644 --- a/contracts/dao/cwd-core/schema/cwd-core.json +++ b/contracts/dao/cwd-core/schema/cwd-core.json @@ -1092,7 +1092,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1102,6 +1103,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1466,6 +1474,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1523,6 +1556,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1600,14 +1656,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/cwd-core/schema/raw/execute.json b/contracts/dao/cwd-core/schema/raw/execute.json index 4e505838..140ed60a 100644 --- a/contracts/dao/cwd-core/schema/raw/execute.json +++ b/contracts/dao/cwd-core/schema/raw/execute.json @@ -932,7 +932,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -942,6 +943,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1306,6 +1314,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1363,6 +1396,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1440,14 +1496,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/pre-propose/cwd-pre-propose-multiple/Cargo.toml b/contracts/dao/pre-propose/cwd-pre-propose-multiple/Cargo.toml index 2ca883e4..636b503e 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-multiple/Cargo.toml +++ b/contracts/dao/pre-propose/cwd-pre-propose-multiple/Cargo.toml @@ -21,7 +21,7 @@ cw2 = "1.1.0" serde = { version = "1.0.175", default-features = false, features = ["derive"] } cwd-pre-propose-base = { version = "*", path = "../../../../packages/cwd-pre-propose-base" } cwd-voting = { path = "../../../../packages/cwd-voting" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" cosmwasm-schema = "1.3.0" diff --git a/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/cwd-pre-propose-multiple.json b/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/cwd-pre-propose-multiple.json index 77548d81..ecf6e9a3 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/cwd-pre-propose-multiple.json +++ b/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/cwd-pre-propose-multiple.json @@ -996,7 +996,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1006,6 +1007,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1370,6 +1378,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1427,6 +1460,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1504,14 +1560,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/raw/execute.json b/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/raw/execute.json index 49389814..33d2dffb 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/raw/execute.json +++ b/contracts/dao/pre-propose/cwd-pre-propose-multiple/schema/raw/execute.json @@ -831,7 +831,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -841,6 +842,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1205,6 +1213,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1262,6 +1295,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1339,14 +1395,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/Cargo.toml b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/Cargo.toml index 6043b649..a53bec32 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/Cargo.toml +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/Cargo.toml @@ -22,7 +22,7 @@ cw-storage-plus = "1.1.0" serde = { version = "1.0.175", default-features = false, features = ["derive"] } cwd-pre-propose-base = { version = "*", path = "../../../../packages/cwd-pre-propose-base" } cwd-voting = { path = "../../../../packages/cwd-voting" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" thiserror = { version = "1.0.31" } neutron-subdao-core = { version = "*", path = "../../../../packages/neutron-subdao-core" } diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs index aa3d8318..b523161d 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs @@ -198,7 +198,7 @@ fn is_subdao_legit(deps: &DepsMut, subdao_core: &Addr) -> Result Ok(subdao.addr == *subdao_core), + Ok(_) => Ok(true), Err(_) => Ok(false), } } diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single/Cargo.toml b/contracts/dao/pre-propose/cwd-pre-propose-single/Cargo.toml index 0abb50b4..bca86aea 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single/Cargo.toml +++ b/contracts/dao/pre-propose/cwd-pre-propose-single/Cargo.toml @@ -20,7 +20,7 @@ cosmwasm-std = { version = "1.3.0" } cw2 = "1.1.0" serde = { version = "1.0.175", default-features = false, features = ["derive"] } cwd-pre-propose-base = { version = "*", path = "../../../../packages/cwd-pre-propose-base" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" [dev-dependencies] diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single/schema/cwd-pre-propose-single.json b/contracts/dao/pre-propose/cwd-pre-propose-single/schema/cwd-pre-propose-single.json index f938a78b..2676b55c 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single/schema/cwd-pre-propose-single.json +++ b/contracts/dao/pre-propose/cwd-pre-propose-single/schema/cwd-pre-propose-single.json @@ -960,7 +960,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -970,6 +971,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1334,6 +1342,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1391,6 +1424,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1468,14 +1524,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single/schema/raw/execute.json b/contracts/dao/pre-propose/cwd-pre-propose-single/schema/raw/execute.json index 28db8930..a1088868 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single/schema/raw/execute.json +++ b/contracts/dao/pre-propose/cwd-pre-propose-single/schema/raw/execute.json @@ -795,7 +795,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -805,6 +806,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1169,6 +1177,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1226,6 +1259,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1303,14 +1359,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-multiple/Cargo.toml b/contracts/dao/proposal/cwd-proposal-multiple/Cargo.toml index 8188e13a..8df118af 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/Cargo.toml +++ b/contracts/dao/proposal/cwd-proposal-multiple/Cargo.toml @@ -17,7 +17,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cosmwasm-std = { version = "1.3.0", features = ["ibc3"] } cosmwasm-storage = { version = "1.3.0" } cw-storage-plus = "1.1.0" diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json index 00e16e12..f54b8b28 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json @@ -1351,7 +1351,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1361,6 +1362,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1725,6 +1733,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1782,6 +1815,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1928,14 +1984,15 @@ ] }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -2558,7 +2615,7 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", "type": "object", "required": [ "proposal_failed_execution_error" @@ -3900,7 +3957,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -3910,6 +3968,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -4274,6 +4339,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -4331,6 +4421,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -4439,14 +4552,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -5821,7 +5935,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -5831,6 +5946,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -6195,6 +6317,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -6252,6 +6399,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -6360,14 +6530,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -6862,44 +7033,11 @@ }, "proposal_failed_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ProposalFailedExecutionError`.", - "type": "object", - "required": [ - "errors" - ], - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedExecutionError" - } - } - }, - "additionalProperties": false, - "definitions": { - "FailedExecutionError": { - "description": "Proposal failed execution error", - "type": "object", - "required": [ - "error", - "height" - ], - "properties": { - "error": { - "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", - "type": "string" - }, - "height": { - "description": "Block height of execution error", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - } + "title": "Nullable_String", + "type": [ + "string", + "null" + ] }, "proposal_hooks": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -7752,7 +7890,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -7762,6 +7901,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -8126,6 +8272,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -8183,6 +8354,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -8291,14 +8485,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/execute.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/execute.json index c0629a6e..2bbe62f3 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/execute.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/execute.json @@ -1067,7 +1067,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1077,6 +1078,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1441,6 +1449,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1498,6 +1531,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1644,14 +1700,15 @@ ] }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json index 41cdda2d..d9665ba3 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json @@ -227,7 +227,7 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", "type": "object", "required": [ "proposal_failed_execution_error" diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_list_proposals.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_list_proposals.json index 1cfe64bf..a5d92887 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_list_proposals.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_list_proposals.json @@ -833,7 +833,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -843,6 +844,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1207,6 +1215,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1264,6 +1297,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1372,14 +1428,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal.json index 2438192c..880be015 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal.json @@ -837,7 +837,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -847,6 +848,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1211,6 +1219,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1268,6 +1301,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1376,14 +1432,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json index 130feb40..f4c601d9 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_failed_execution_error.json @@ -1,41 +1,8 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ProposalFailedExecutionError`.", - "type": "object", - "required": [ - "errors" - ], - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedExecutionError" - } - } - }, - "additionalProperties": false, - "definitions": { - "FailedExecutionError": { - "description": "Proposal failed execution error", - "type": "object", - "required": [ - "error", - "height" - ], - "properties": { - "error": { - "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", - "type": "string" - }, - "height": { - "description": "Block height of execution error", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - } + "title": "Nullable_String", + "type": [ + "string", + "null" + ] } diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_reverse_proposals.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_reverse_proposals.json index 1cfe64bf..a5d92887 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_reverse_proposals.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_reverse_proposals.json @@ -833,7 +833,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -843,6 +844,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1207,6 +1215,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1264,6 +1297,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1372,14 +1428,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs index 99b490d2..33a3b691 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs @@ -846,7 +846,7 @@ pub fn query_info(deps: Deps) -> StdResult { } pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let error = PROPOSAL_FAILED_EXECUTION_ERRORS.load(deps.storage, proposal_id)?; + let error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; to_binary(&error) } diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs index 61d944d2..771f7568 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/msg.rs @@ -188,8 +188,8 @@ pub enum QueryMsg { VoteHooks {}, /// Returns errors of the failed proposal. /// Expected in the form of [execution_height, "codespace=? code=?"]. - /// Returns `types::FailedProposalErrors` - #[returns(String)] + /// Returns `Option` + #[returns(Option)] ProposalFailedExecutionError { proposal_id: u64 }, } diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs index ccd82967..fd730690 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs @@ -2185,6 +2185,6 @@ fn test_reply_proposal_mock() { // reply writes the failed proposal error let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); - let error: String = from_binary(&query_res).unwrap(); - assert_eq!(error, "error".to_string()); + let error: Option = from_binary(&query_res).unwrap(); + assert_eq!(error, Some("error".to_string())); } diff --git a/contracts/dao/proposal/cwd-proposal-single/Cargo.toml b/contracts/dao/proposal/cwd-proposal-single/Cargo.toml index 6dcf9909..ce05a600 100644 --- a/contracts/dao/proposal/cwd-proposal-single/Cargo.toml +++ b/contracts/dao/proposal/cwd-proposal-single/Cargo.toml @@ -24,7 +24,7 @@ cw-utils = {version = "1.0.1"} cw2 = "1.1.0" cw20 = "1.1.0" cw3 = "1.1.0" -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" serde = {version = "1.0.175", default-features = false, features = ["derive"]} thiserror = {version = "1.0"} diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json b/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json index 5834c499..6afd36b5 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json @@ -1334,7 +1334,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1344,6 +1345,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1708,6 +1716,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1765,6 +1798,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1911,14 +1967,15 @@ ] }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -2620,7 +2677,7 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", "type": "object", "required": [ "proposal_failed_execution_error" @@ -3682,7 +3739,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -3692,6 +3750,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -4056,6 +4121,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -4113,6 +4203,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -4221,14 +4334,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -5600,7 +5714,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -5610,6 +5725,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -5974,6 +6096,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -6031,6 +6178,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -6139,14 +6309,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -6796,42 +6967,11 @@ }, "proposal_failed_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ProposalFailedExecutionError`.", - "type": "object", - "required": [ - "errors" - ], - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedExecutionError" - } - } - }, - "definitions": { - "FailedExecutionError": { - "description": "Proposal failed execution error", - "type": "object", - "required": [ - "error", - "height" - ], - "properties": { - "error": { - "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", - "type": "string" - }, - "height": { - "description": "Block height of execution error", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - } + "title": "Nullable_String", + "type": [ + "string", + "null" + ] }, "proposal_hooks": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -7516,7 +7656,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -7526,6 +7667,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -7890,6 +8038,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -7947,6 +8120,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -8055,14 +8251,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/execute.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/execute.json index 9eb192c8..5c44a79d 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/execute.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/execute.json @@ -1005,7 +1005,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1015,6 +1016,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1379,6 +1387,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1436,6 +1469,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1582,14 +1638,15 @@ ] }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json index 9747b6cc..018232d2 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json @@ -234,7 +234,7 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", "type": "object", "required": [ "proposal_failed_execution_error" diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_list_proposals.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_list_proposals.json index 9b660dd8..db905e68 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_list_proposals.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_list_proposals.json @@ -665,7 +665,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -675,6 +676,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1039,6 +1047,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1096,6 +1129,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1204,14 +1260,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal.json index 32da68ce..5370f6cb 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal.json @@ -669,7 +669,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -679,6 +680,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1043,6 +1051,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1100,6 +1133,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1208,14 +1264,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json index f5e61b0f..f4c601d9 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -1,39 +1,8 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ProposalFailedExecutionError`.", - "type": "object", - "required": [ - "errors" - ], - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedExecutionError" - } - } - }, - "definitions": { - "FailedExecutionError": { - "description": "Proposal failed execution error", - "type": "object", - "required": [ - "error", - "height" - ], - "properties": { - "error": { - "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", - "type": "string" - }, - "height": { - "description": "Block height of execution error", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - } + "title": "Nullable_String", + "type": [ + "string", + "null" + ] } diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_reverse_proposals.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_reverse_proposals.json index 9b660dd8..db905e68 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_reverse_proposals.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_reverse_proposals.json @@ -665,7 +665,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -675,6 +676,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1039,6 +1047,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1096,6 +1129,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1204,14 +1260,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs index de83e57f..944365c2 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs @@ -782,7 +782,7 @@ pub fn query_info(deps: Deps) -> StdResult { } pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let error = PROPOSAL_FAILED_EXECUTION_ERRORS.load(deps.storage, proposal_id)?; + let error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; to_binary(&error) } diff --git a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs index fa885618..b2541c3b 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/msg.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/msg.rs @@ -204,8 +204,8 @@ pub enum QueryMsg { VoteHooks {}, /// Returns errors of the failed proposal. /// Expected in the form of [execution_height, "codespace=? code=?"]. - /// Returns `types::FailedProposalErrors` - #[returns(String)] + /// Returns `Option` + #[returns(Option)] ProposalFailedExecutionError { proposal_id: u64 }, } diff --git a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs index aa4ee2bc..8b0f4aed 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs @@ -982,8 +982,8 @@ fn test_reply_proposal_mock() { // reply writes the failed proposal error let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); - let error: String = from_binary(&query_res).unwrap(); - assert_eq!(error, "error".to_string()); + let error: Option = from_binary(&query_res).unwrap(); + assert_eq!(error, Some("error".to_string())); } #[test] diff --git a/contracts/subdaos/cwd-subdao-core/Cargo.toml b/contracts/subdaos/cwd-subdao-core/Cargo.toml index 0ce74ccc..d938e5e3 100644 --- a/contracts/subdaos/cwd-subdao-core/Cargo.toml +++ b/contracts/subdaos/cwd-subdao-core/Cargo.toml @@ -16,7 +16,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cosmwasm-std = { version = "1.3.0", features = ["ibc3"] } cosmwasm-storage = { version = "1.3.0" } cw-storage-plus = "1.1.0" diff --git a/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json b/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json index f78c6c4d..376cc0d2 100644 --- a/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json +++ b/contracts/subdaos/cwd-subdao-core/schema/cwd-subdao-core.json @@ -1092,7 +1092,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1102,6 +1103,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1466,6 +1474,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1523,6 +1556,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1600,14 +1656,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/cwd-subdao-core/schema/raw/execute.json b/contracts/subdaos/cwd-subdao-core/schema/raw/execute.json index 0859538c..d299da1f 100644 --- a/contracts/subdaos/cwd-subdao-core/schema/raw/execute.json +++ b/contracts/subdaos/cwd-subdao-core/schema/raw/execute.json @@ -922,7 +922,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -932,6 +933,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1296,6 +1304,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1353,6 +1386,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1430,14 +1486,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml b/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml index 3d60594c..aecd6d19 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml +++ b/contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml @@ -16,7 +16,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cosmwasm-std = { version = "1.3.0" } cosmwasm-storage = { version = "1.3.0" } cw-storage-plus = "1.1.0" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index 4e730f0b..9206f0ff 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -715,7 +715,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -725,6 +726,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1089,6 +1097,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1146,6 +1179,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1223,14 +1279,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -1676,7 +1733,7 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option)`", "type": "object", "required": [ "proposal_failed_execution_error" @@ -2347,7 +2404,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -2357,6 +2415,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -2721,6 +2786,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -2778,6 +2868,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -2855,14 +2968,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -3912,7 +4026,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -3922,6 +4037,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -4286,6 +4408,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -4343,6 +4490,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -4420,14 +4590,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -4830,42 +5001,11 @@ }, "proposal_failed_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ProposalFailedExecutionError`.", - "type": "object", - "required": [ - "errors" - ], - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedExecutionError" - } - } - }, - "definitions": { - "FailedExecutionError": { - "description": "Proposal failed execution error", - "type": "object", - "required": [ - "error", - "height" - ], - "properties": { - "error": { - "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", - "type": "string" - }, - "height": { - "description": "Block height of execution error", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - } + "title": "Nullable_String", + "type": [ + "string", + "null" + ] } } } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/execute.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/execute.json index 1d4825a5..56c1ab20 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/execute.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/execute.json @@ -698,7 +698,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -708,6 +709,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1072,6 +1080,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1129,6 +1162,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1206,14 +1262,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json index 04c9b744..c83117f7 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json @@ -75,7 +75,7 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `types::FailedProposalErrors`", + "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option)`", "type": "object", "required": [ "proposal_failed_execution_error" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_list_proposals.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_list_proposals.json index e18eea19..235d1362 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_list_proposals.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_list_proposals.json @@ -610,7 +610,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -620,6 +621,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -984,6 +992,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1041,6 +1074,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1118,14 +1174,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal.json index 65b627ce..2b90f32f 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal.json @@ -621,7 +621,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -631,6 +632,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -995,6 +1003,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1052,6 +1085,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1129,14 +1185,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json index f5e61b0f..f4c601d9 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_failed_execution_error.json @@ -1,39 +1,8 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "FailedProposalErrors", - "description": "A list of proposals returned by `ProposalFailedExecutionError`.", - "type": "object", - "required": [ - "errors" - ], - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedExecutionError" - } - } - }, - "definitions": { - "FailedExecutionError": { - "description": "Proposal failed execution error", - "type": "object", - "required": [ - "error", - "height" - ], - "properties": { - "error": { - "description": "Error text. Error is reduced before cosmwasm reply and is expected in form of \"codespace=? code=?\"", - "type": "string" - }, - "height": { - "description": "Block height of execution error", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - } + "title": "Nullable_String", + "type": [ + "string", + "null" + ] } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index 1e4cbf98..a90288a9 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -299,7 +299,7 @@ pub fn query_list_proposals( } pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let error = PROPOSAL_FAILED_EXECUTION_ERRORS.load(deps.storage, proposal_id)?; + let error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; to_binary(&error) } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index cb2c99c3..1d4cee05 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -558,6 +558,6 @@ fn test_reply() { // reply writes the failed proposal error let query_res = query_proposal_failed_execution_error(deps.as_ref(), 10).unwrap(); - let error: String = from_binary(&query_res).unwrap(); - assert_eq!(error, "error".to_string()); + let error: Option = from_binary(&query_res).unwrap(); + assert_eq!(error, Some("error".to_string())); } diff --git a/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/Cargo.toml b/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/Cargo.toml index 9071daf7..2363111b 100644 --- a/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/Cargo.toml +++ b/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/Cargo.toml @@ -23,7 +23,7 @@ cw-utils = { version = "1.0.1" } serde = { version = "1.0.175", default-features = false, features = ["derive"] } cwd-pre-propose-base = { version = "*", path = "../../../../packages/cwd-pre-propose-base" } cwd-voting = { path = "../../../../packages/cwd-voting" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} neutron-subdao-core = { path = "../../../../packages/neutron-subdao-core" } neutron-subdao-timelock-single = { path = "../../../../packages/neutron-subdao-timelock-single" } neutron-subdao-proposal-single = { path = "../../../../packages/neutron-subdao-proposal-single" } diff --git a/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/cwd-subdao-pre-propose-single-no-timelock.json b/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/cwd-subdao-pre-propose-single-no-timelock.json index d6b27cde..4cd0e3d0 100644 --- a/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/cwd-subdao-pre-propose-single-no-timelock.json +++ b/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/cwd-subdao-pre-propose-single-no-timelock.json @@ -960,7 +960,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -970,6 +971,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1334,6 +1342,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1391,6 +1424,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1468,14 +1524,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/raw/execute.json b/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/raw/execute.json index 28db8930..a1088868 100644 --- a/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/raw/execute.json +++ b/contracts/subdaos/pre-propose/cwd-security-subdao-pre-propose/schema/raw/execute.json @@ -795,7 +795,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -805,6 +806,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1169,6 +1177,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1226,6 +1259,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1303,14 +1359,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/Cargo.toml b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/Cargo.toml index abfe0b35..15e7364f 100644 --- a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/Cargo.toml +++ b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/Cargo.toml @@ -23,7 +23,7 @@ cw-utils = { version = "1.0.1" } serde = { version = "1.0.175", default-features = false, features = ["derive"] } cwd-pre-propose-base = { version = "*", path = "../../../../packages/cwd-pre-propose-base" } cwd-voting = { path = "../../../../packages/cwd-voting" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} neutron-subdao-core = { path = "../../../../packages/neutron-subdao-core" } neutron-subdao-timelock-single = { path = "../../../../packages/neutron-subdao-timelock-single" } neutron-subdao-proposal-single = { path = "../../../../packages/neutron-subdao-proposal-single" } diff --git a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/cwd-subdao-pre-propose-single.json b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/cwd-subdao-pre-propose-single.json index c452e227..4efde520 100644 --- a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/cwd-subdao-pre-propose-single.json +++ b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/cwd-subdao-pre-propose-single.json @@ -960,7 +960,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -970,6 +971,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1334,6 +1342,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1391,6 +1424,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1468,14 +1524,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/raw/execute.json b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/raw/execute.json index 28db8930..a1088868 100644 --- a/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/raw/execute.json +++ b/contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/schema/raw/execute.json @@ -795,7 +795,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -805,6 +806,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1169,6 +1177,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1226,6 +1259,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1303,14 +1359,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/proposal/cwd-subdao-proposal-single/Cargo.toml b/contracts/subdaos/proposal/cwd-subdao-proposal-single/Cargo.toml index 07bf3c9f..b4a1e175 100644 --- a/contracts/subdaos/proposal/cwd-subdao-proposal-single/Cargo.toml +++ b/contracts/subdaos/proposal/cwd-subdao-proposal-single/Cargo.toml @@ -16,7 +16,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cosmwasm-std = { version = "1.3.0", features = ["ibc3"] } cosmwasm-storage = { version = "1.3.0" } cw-storage-plus = "1.1.0" diff --git a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/cwd-subdao-proposal-single.json b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/cwd-subdao-proposal-single.json index 6316c2dc..559493ae 100644 --- a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/cwd-subdao-proposal-single.json +++ b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/cwd-subdao-proposal-single.json @@ -1334,7 +1334,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1344,6 +1345,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1708,6 +1716,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1765,6 +1798,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1911,14 +1967,15 @@ ] }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -3659,7 +3716,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -3669,6 +3727,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -4033,6 +4098,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -4090,6 +4180,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -4198,14 +4311,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -5577,7 +5691,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -5587,6 +5702,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -5951,6 +6073,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -6008,6 +6155,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -6116,14 +6286,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, @@ -7454,7 +7625,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -7464,6 +7636,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -7828,6 +8007,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -7885,6 +8089,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -7993,14 +8220,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/execute.json b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/execute.json index 3adf2ecd..7ebca31f 100644 --- a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/execute.json +++ b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/execute.json @@ -1005,7 +1005,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -1015,6 +1016,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1379,6 +1387,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1436,6 +1469,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1582,14 +1638,15 @@ ] }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_list_proposals.json b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_list_proposals.json index 9b660dd8..db905e68 100644 --- a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_list_proposals.json +++ b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_list_proposals.json @@ -665,7 +665,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -675,6 +676,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1039,6 +1047,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1096,6 +1129,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1204,14 +1260,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_proposal.json b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_proposal.json index 32da68ce..5370f6cb 100644 --- a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_proposal.json +++ b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_proposal.json @@ -669,7 +669,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -679,6 +680,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1043,6 +1051,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1100,6 +1133,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1208,14 +1264,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_reverse_proposals.json b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_reverse_proposals.json index 9b660dd8..db905e68 100644 --- a/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_reverse_proposals.json +++ b/contracts/subdaos/proposal/cwd-subdao-proposal-single/schema/raw/response_to_reverse_proposals.json @@ -665,7 +665,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -675,6 +676,13 @@ "interchain_account_id": { "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", "type": "string" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -1039,6 +1047,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", "type": "object", @@ -1096,6 +1129,29 @@ } }, "additionalProperties": false + }, + { + "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", + "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 } ] }, @@ -1204,14 +1260,15 @@ } }, "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible update params admin proposal.", + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", "type": "object", "required": [ "message" ], "properties": { "message": { - "description": "*message** is a json representing a sdk message passed to admin module to execute." + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" } } }, diff --git a/contracts/tokenomics/reserve/Cargo.toml b/contracts/tokenomics/reserve/Cargo.toml index 3fb9eb4a..0f418705 100644 --- a/contracts/tokenomics/reserve/Cargo.toml +++ b/contracts/tokenomics/reserve/Cargo.toml @@ -18,7 +18,7 @@ cosmwasm-std = {version = "1.3.0"} cw-storage-plus = "1.1.0" cwd-macros = {path = "../../../packages/cwd-macros"} exec-control = {path = "../../../packages/exec-control"} -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" serde = {version = "1.0.103", default-features = false, features = ["derive"]} thiserror = {version = "1.0"} diff --git a/packages/cwd-voting/Cargo.toml b/packages/cwd-voting/Cargo.toml index cbd6e876..427e2120 100644 --- a/packages/cwd-voting/Cargo.toml +++ b/packages/cwd-voting/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/DA0-DA0/dao-contracts" description = "Types and methods for CosmWasm DAO voting." [dependencies] -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cosmwasm-std = { version = "1.3.0" } schemars = "0.8.8" serde = { version = "1.0.175", default-features = false, features = ["derive"] } diff --git a/packages/neutron-security-subdao-pre-propose/Cargo.toml b/packages/neutron-security-subdao-pre-propose/Cargo.toml index 4cd54aee..4aa16195 100644 --- a/packages/neutron-security-subdao-pre-propose/Cargo.toml +++ b/packages/neutron-security-subdao-pre-propose/Cargo.toml @@ -14,6 +14,6 @@ cw-utils = { version = "1.0.1" } schemars = "0.8.8" serde = { version = "1.0.175", default-features = false, features = ["derive"] } cosmwasm-std = { version = "1.3.0" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cwd-voting = { path = "../cwd-voting" } cwd-interface = { path = "../cwd-interface" } diff --git a/packages/neutron-subdao-core/Cargo.toml b/packages/neutron-subdao-core/Cargo.toml index aaaa411f..f7816790 100644 --- a/packages/neutron-subdao-core/Cargo.toml +++ b/packages/neutron-subdao-core/Cargo.toml @@ -17,7 +17,7 @@ cwd-interface = {path = "../cwd-interface"} cwd-macros = {path = "../cwd-macros"} cwd-voting = {path = "../cwd-voting"} exec-control = {path = "../exec-control"} -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" serde = {version = "1.0.175", default-features = false, features = ["derive"]} thiserror = {version = "1.0"} diff --git a/packages/neutron-subdao-pre-propose-single/Cargo.toml b/packages/neutron-subdao-pre-propose-single/Cargo.toml index 18831790..6c20ff77 100644 --- a/packages/neutron-subdao-pre-propose-single/Cargo.toml +++ b/packages/neutron-subdao-pre-propose-single/Cargo.toml @@ -13,6 +13,6 @@ cwd-pre-propose-base = { version = "*", path = "../cwd-pre-propose-base" } schemars = "0.8.8" serde = { version = "1.0.175", default-features = false, features = ["derive"] } cosmwasm-std = { version = "1.3.0" } -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} cwd-voting = { path = "../cwd-voting" } cwd-interface = { path = "../cwd-interface" } diff --git a/packages/neutron-subdao-proposal-single/Cargo.toml b/packages/neutron-subdao-proposal-single/Cargo.toml index 8faa7d01..fddebebc 100644 --- a/packages/neutron-subdao-proposal-single/Cargo.toml +++ b/packages/neutron-subdao-proposal-single/Cargo.toml @@ -17,6 +17,6 @@ cwd-interface = {path = "../cwd-interface"} cwd-macros = {path = "../cwd-macros"} cwd-voting = {path = "../cwd-voting"} -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" serde = {version = "1.0.175", default-features = false, features = ["derive"]} diff --git a/packages/neutron-subdao-timelock-single/Cargo.toml b/packages/neutron-subdao-timelock-single/Cargo.toml index f6d58090..50e25df0 100644 --- a/packages/neutron-subdao-timelock-single/Cargo.toml +++ b/packages/neutron-subdao-timelock-single/Cargo.toml @@ -8,6 +8,6 @@ version = "0.1.0" [dependencies] cosmwasm-schema = {version = "1.3.0"} cosmwasm-std = {version = "1.3.0"} -neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="feat/sdk47"} +neutron-sdk = {package = "neutron-sdk", git="https://github.com/neutron-org/neutron-sdk", branch="sdk/47"} schemars = "0.8.8" serde = {version = "1.0.175", default-features = false, features = ["derive"]} diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index 7a28d097..896bf208 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -57,8 +57,8 @@ pub enum QueryMsg { /// Returns errors of the failed proposal. /// Expected in the form of [execution_height, "codespace=? code=?"]. - /// Returns `types::FailedProposalErrors` - #[returns(String)] + /// Returns `Option)` + #[returns(Option)] ProposalFailedExecutionError { proposal_id: u64 }, } From 71b6b2c5c3d9044c5eff82c5acecea00fba5c3ce Mon Sep 17 00:00:00 2001 From: nhpd Date: Sat, 7 Oct 2023 19:05:48 +0300 Subject: [PATCH 18/23] review fixes --- .../dao/proposal/cwd-proposal-multiple/src/state.rs | 2 +- .../dao/proposal/cwd-proposal-single/src/state.rs | 2 +- .../subdaos/cwd-subdao-timelock-single/src/state.rs | 2 +- .../cwd-subdao-timelock-single/src/testing/tests.rs | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs index 85efbdb7..840a196b 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs @@ -67,5 +67,5 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// The address of the pre-propose module associated with this /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); -// Execution errors for proposals that do execute only once +/// Execution errors for proposals that do execute only once pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/contracts/dao/proposal/cwd-proposal-single/src/state.rs b/contracts/dao/proposal/cwd-proposal-single/src/state.rs index 49a0da9d..f5a668f7 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/state.rs @@ -64,5 +64,5 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// The address of the pre-propose module associated with this /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); -// Execution errors for proposals that do execute only once +/// Execution errors for proposals that do execute only once pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs index b3ce43e7..cd02adb8 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/state.rs @@ -6,5 +6,5 @@ pub const DEFAULT_LIMIT: u64 = 30; pub const CONFIG: Item = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); -// Execution errors for proposals that do execute only once +/// Execution errors for proposals that do execute only once pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index 1d4cee05..3b15f83f 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -229,13 +229,13 @@ fn test_execute_proposal() { // check proposal execution close_proposal_on_execution_failure = false deps.querier.set_close_proposal_on_execution_failure(false); - let proposal = SingleChoiceProposal { + let proposal2 = SingleChoiceProposal { id: 10, msgs: vec![NeutronMsg::remove_interchain_query(1).into()], status: ProposalStatus::Timelocked, }; PROPOSALS - .save(deps.as_mut().storage, proposal.id, &proposal) + .save(deps.as_mut().storage, proposal2.id, &proposal2) .unwrap(); let res = execute(deps.as_mut(), env, info, msg).unwrap(); let expected_attributes = vec![ @@ -245,14 +245,14 @@ fn test_execute_proposal() { ]; assert_eq!(expected_attributes, res.attributes); // added as messages without reply - let expected_msgs = proposal + let expected_msgs = proposal2 .msgs .iter() .map(|msg| SubMsg::new(msg.clone())) .collect::>>(); assert_eq!(expected_msgs, res.messages); - let updated_prop = PROPOSALS.load(deps.as_mut().storage, 10).unwrap(); - assert_eq!(ProposalStatus::Executed, updated_prop.status); + let updated_prop_2 = PROPOSALS.load(deps.as_mut().storage, 10).unwrap(); + assert_eq!(ProposalStatus::Executed, updated_prop_2.status); } #[test] From 8b2dda5b3794d185ca059e74525fc74bba285367 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 10 Oct 2023 01:32:24 +0400 Subject: [PATCH 19/23] Get back check for subdao search --- .../pre-propose/cwd-pre-propose-single-overrule/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs index b523161d..aa3d8318 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs @@ -198,7 +198,7 @@ fn is_subdao_legit(deps: &DepsMut, subdao_core: &Addr) -> Result Ok(true), + Ok(subdao) => Ok(subdao.addr == *subdao_core), Err(_) => Ok(false), } } From 27c663f8c2042a9c7b30db3289e9569bc7043a32 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 10 Oct 2023 14:42:37 +0400 Subject: [PATCH 20/23] add comment explaining subdao addr check --- .../cwd-pre-propose-single-overrule/src/contract.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs index aa3d8318..5923bf93 100644 --- a/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs +++ b/contracts/dao/pre-propose/cwd-pre-propose-single-overrule/src/contract.rs @@ -198,7 +198,11 @@ fn is_subdao_legit(deps: &DepsMut, subdao_core: &Addr) -> Result Ok(subdao.addr == *subdao_core), + Ok(subdao) => { + // sanity check to make sure that query returned correct subdao + let correct_subdao = subdao.addr == *subdao_core; + Ok(correct_subdao) + } Err(_) => Ok(false), } } From 76304aba70b5078192bcab9beef72f02e1dbf305 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 10 Oct 2023 18:46:02 +0400 Subject: [PATCH 21/23] review fixes - rename failed_execution_proposal_errors -> failed_proposal_errors and more --- .../schema/cwd-proposal-multiple.json | 8 ++++---- .../cwd-proposal-multiple/schema/raw/query.json | 6 +++--- .../raw/response_to_proposal_execution_error.json | 8 ++++++++ .../proposal/cwd-proposal-multiple/src/contract.rs | 12 ++++++------ .../dao/proposal/cwd-proposal-multiple/src/msg.rs | 4 ++-- .../dao/proposal/cwd-proposal-multiple/src/state.rs | 4 ++-- .../cwd-proposal-multiple/src/testing/tests.rs | 4 ++-- .../schema/cwd-proposal-single.json | 8 ++++---- .../cwd-proposal-single/schema/raw/query.json | 6 +++--- .../raw/response_to_proposal_execution_error.json | 8 ++++++++ .../dao/proposal/cwd-proposal-single/src/contract.rs | 12 ++++++------ .../dao/proposal/cwd-proposal-single/src/msg.rs | 4 ++-- .../dao/proposal/cwd-proposal-single/src/state.rs | 4 ++-- .../cwd-proposal-single/src/testing/tests.rs | 4 ++-- .../schema/cwd-subdao-timelock-single.json | 8 ++++---- .../cwd-subdao-timelock-single/schema/raw/query.json | 6 +++--- .../raw/response_to_proposal_execution_error.json | 8 ++++++++ .../cwd-subdao-timelock-single/src/contract.rs | 12 ++++++------ .../subdaos/cwd-subdao-timelock-single/src/state.rs | 4 ++-- .../cwd-subdao-timelock-single/src/testing/tests.rs | 4 ++-- packages/neutron-subdao-timelock-single/src/msg.rs | 6 +++--- packages/neutron-subdao-timelock-single/src/types.rs | 6 ------ 22 files changed, 82 insertions(+), 64 deletions(-) create mode 100644 contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_execution_error.json create mode 100644 contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_execution_error.json create mode 100644 contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_execution_error.json diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json index f54b8b28..b416bdee 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/cwd-proposal-multiple.json @@ -2615,13 +2615,13 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", + "description": "Returns errors of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ - "proposal_failed_execution_error" + "proposal_execution_error" ], "properties": { - "proposal_failed_execution_error": { + "proposal_execution_error": { "type": "object", "required": [ "proposal_id" @@ -7031,7 +7031,7 @@ } } }, - "proposal_failed_execution_error": { + "proposal_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Nullable_String", "type": [ diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json index d9665ba3..6cedd8c0 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/query.json @@ -227,13 +227,13 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", + "description": "Returns errors of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ - "proposal_failed_execution_error" + "proposal_execution_error" ], "properties": { - "proposal_failed_execution_error": { + "proposal_execution_error": { "type": "object", "required": [ "proposal_id" diff --git a/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_execution_error.json b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_execution_error.json new file mode 100644 index 00000000..f4c601d9 --- /dev/null +++ b/contracts/dao/proposal/cwd-proposal-multiple/schema/raw/response_to_proposal_execution_error.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_String", + "type": [ + "string", + "null" + ] +} diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs index 33a3b691..32b4fa5d 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/contract.rs @@ -26,7 +26,7 @@ use cwd_voting::{ voting::{get_total_power, get_voting_power, validate_voting_period}, }; -use crate::state::PROPOSAL_FAILED_EXECUTION_ERRORS; +use crate::state::PROPOSAL_EXECUTION_ERRORS; use crate::{msg::MigrateMsg, state::CREATION_POLICY}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, QueryMsg}, @@ -731,8 +731,8 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), QueryMsg::Dao {} => query_dao(deps), - QueryMsg::ProposalFailedExecutionError { proposal_id } => { - query_proposal_failed_execution_error(deps, proposal_id) + QueryMsg::ProposalExecutionError { proposal_id } => { + query_proposal_execution_error(deps, proposal_id) } } } @@ -845,8 +845,8 @@ pub fn query_info(deps: Deps) -> StdResult { to_binary(&cwd_interface::voting::InfoResponse { info }) } -pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; +pub fn query_proposal_execution_error(deps: Deps, proposal_id: u64) -> StdResult { + let error = PROPOSAL_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; to_binary(&error) } @@ -870,7 +870,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result` #[returns(Option)] - ProposalFailedExecutionError { proposal_id: u64 }, + ProposalExecutionError { proposal_id: u64 }, } #[cw_serde] diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs index 840a196b..96272b9d 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/state.rs @@ -67,5 +67,5 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// The address of the pre-propose module associated with this /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); -/// Execution errors for proposals that do execute only once -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); +/// Execution errors for proposals that do not close on failure (Config.close_proposal_on_execution_failure set to false) +pub const PROPOSAL_EXECUTION_ERRORS: Map = Map::new("proposal_execution_errors"); diff --git a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs index fd730690..1907d445 100644 --- a/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-multiple/src/testing/tests.rs @@ -45,7 +45,7 @@ use crate::{ }; use cwd_pre_propose_multiple as cppm; -use crate::contract::query_proposal_failed_execution_error; +use crate::contract::query_proposal_execution_error; use crate::testing::execute::mint_natives; use cwd_testing::ShouldExecute; use cwd_voting::reply::mask_proposal_execution_proposal_id; @@ -2184,7 +2184,7 @@ fn test_reply_proposal_mock() { assert_eq!(prop.status, Status::ExecutionFailed); // reply writes the failed proposal error - let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); + let query_res = query_proposal_execution_error(deps.as_ref(), 1).unwrap(); let error: Option = from_binary(&query_res).unwrap(); assert_eq!(error, Some("error".to_string())); } diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json b/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json index 6afd36b5..8f8a7eb7 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/cwd-proposal-single.json @@ -2677,13 +2677,13 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", + "description": "Returns errors of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ - "proposal_failed_execution_error" + "proposal_execution_error" ], "properties": { - "proposal_failed_execution_error": { + "proposal_execution_error": { "type": "object", "required": [ "proposal_id" @@ -6965,7 +6965,7 @@ } } }, - "proposal_failed_execution_error": { + "proposal_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Nullable_String", "type": [ diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json index 018232d2..86a5452b 100644 --- a/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/query.json @@ -234,13 +234,13 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option`", + "description": "Returns errors of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ - "proposal_failed_execution_error" + "proposal_execution_error" ], "properties": { - "proposal_failed_execution_error": { + "proposal_execution_error": { "type": "object", "required": [ "proposal_id" diff --git a/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_execution_error.json b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_execution_error.json new file mode 100644 index 00000000..f4c601d9 --- /dev/null +++ b/contracts/dao/proposal/cwd-proposal-single/schema/raw/response_to_proposal_execution_error.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_String", + "type": [ + "string", + "null" + ] +} diff --git a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs index 944365c2..0fdf9583 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/contract.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/contract.rs @@ -23,7 +23,7 @@ use neutron_sdk::bindings::msg::NeutronMsg; use crate::msg::MigrateMsg; use crate::proposal::SingleChoiceProposal; -use crate::state::{Config, CREATION_POLICY, PROPOSAL_FAILED_EXECUTION_ERRORS}; +use crate::state::{Config, CREATION_POLICY, PROPOSAL_EXECUTION_ERRORS}; use crate::{ error::ContractError, @@ -667,8 +667,8 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::ProposalCreationPolicy {} => query_creation_policy(deps), QueryMsg::ProposalHooks {} => to_binary(&PROPOSAL_HOOKS.query_hooks(deps)?), QueryMsg::VoteHooks {} => to_binary(&VOTE_HOOKS.query_hooks(deps)?), - QueryMsg::ProposalFailedExecutionError { proposal_id } => { - query_proposal_failed_execution_error(deps, proposal_id) + QueryMsg::ProposalExecutionError { proposal_id } => { + query_proposal_execution_error(deps, proposal_id) } } } @@ -781,8 +781,8 @@ pub fn query_info(deps: Deps) -> StdResult { to_binary(&cwd_interface::voting::InfoResponse { info }) } -pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; +pub fn query_proposal_execution_error(deps: Deps, proposal_id: u64) -> StdResult { + let error = PROPOSAL_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; to_binary(&error) } @@ -812,7 +812,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result` #[returns(Option)] - ProposalFailedExecutionError { proposal_id: u64 }, + ProposalExecutionError { proposal_id: u64 }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] diff --git a/contracts/dao/proposal/cwd-proposal-single/src/state.rs b/contracts/dao/proposal/cwd-proposal-single/src/state.rs index f5a668f7..429fd658 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/state.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/state.rs @@ -64,5 +64,5 @@ pub const VOTE_HOOKS: Hooks = Hooks::new("vote_hooks"); /// The address of the pre-propose module associated with this /// proposal module (if any). pub const CREATION_POLICY: Item = Item::new("creation_policy"); -/// Execution errors for proposals that do execute only once -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); +/// Execution errors for proposals that do not close on failure (Config.close_proposal_on_execution_failure set to false) +pub const PROPOSAL_EXECUTION_ERRORS: Map = Map::new("proposal_execution_errors"); diff --git a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs index 8b0f4aed..13f18eb6 100644 --- a/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs +++ b/contracts/dao/proposal/cwd-proposal-single/src/testing/tests.rs @@ -26,7 +26,7 @@ use cwd_voting::{ }; use neutron_sdk::bindings::msg::NeutronMsg; -use crate::contract::query_proposal_failed_execution_error; +use crate::contract::query_proposal_execution_error; use crate::testing::execute::{execute_proposal, execute_proposal_should_fail}; use crate::{ contract::{CONTRACT_NAME, CONTRACT_VERSION}, @@ -981,7 +981,7 @@ fn test_reply_proposal_mock() { assert_eq!(prop.status, Status::ExecutionFailed); // reply writes the failed proposal error - let query_res = query_proposal_failed_execution_error(deps.as_ref(), 1).unwrap(); + let query_res = query_proposal_execution_error(deps.as_ref(), 1).unwrap(); let error: Option = from_binary(&query_res).unwrap(); assert_eq!(error, Some("error".to_string())); } diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json index 9206f0ff..b24119d1 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/cwd-subdao-timelock-single.json @@ -1733,13 +1733,13 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option)`", + "description": "Returns errors of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ - "proposal_failed_execution_error" + "proposal_execution_error" ], "properties": { - "proposal_failed_execution_error": { + "proposal_execution_error": { "type": "object", "required": [ "proposal_id" @@ -4999,7 +4999,7 @@ } } }, - "proposal_failed_execution_error": { + "proposal_execution_error": { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Nullable_String", "type": [ diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json index c83117f7..38d63f4b 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/query.json @@ -75,13 +75,13 @@ "additionalProperties": false }, { - "description": "Returns errors of the failed proposal. Expected in the form of [execution_height, \"codespace=? code=?\"]. Returns `Option)`", + "description": "Returns errors of the failed proposal. Expected in the form of \"codespace=? code=?\". Returns `Option`", "type": "object", "required": [ - "proposal_failed_execution_error" + "proposal_execution_error" ], "properties": { - "proposal_failed_execution_error": { + "proposal_execution_error": { "type": "object", "required": [ "proposal_id" diff --git a/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_execution_error.json b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_execution_error.json new file mode 100644 index 00000000..f4c601d9 --- /dev/null +++ b/contracts/subdaos/cwd-subdao-timelock-single/schema/raw/response_to_proposal_execution_error.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_String", + "type": [ + "string", + "null" + ] +} diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs index a90288a9..4422ed03 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs @@ -26,7 +26,7 @@ use neutron_subdao_timelock_single::{ }; use crate::error::ContractError; -use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS, PROPOSAL_FAILED_EXECUTION_ERRORS}; +use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS, PROPOSAL_EXECUTION_ERRORS}; pub(crate) const CONTRACT_NAME: &str = "crates.io:cwd-subdao-timelock-single"; pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -269,8 +269,8 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { QueryMsg::ListProposals { start_after, limit } => { query_list_proposals(deps, start_after, limit) } - QueryMsg::ProposalFailedExecutionError { proposal_id } => { - query_proposal_failed_execution_error(deps, proposal_id) + QueryMsg::ProposalExecutionError { proposal_id } => { + query_proposal_execution_error(deps, proposal_id) } } } @@ -298,8 +298,8 @@ pub fn query_list_proposals( to_binary(&ProposalListResponse { proposals: props }) } -pub fn query_proposal_failed_execution_error(deps: Deps, proposal_id: u64) -> StdResult { - let error = PROPOSAL_FAILED_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; +pub fn query_proposal_execution_error(deps: Deps, proposal_id: u64) -> StdResult { + let error = PROPOSAL_EXECUTION_ERRORS.may_load(deps.storage, proposal_id)?; to_binary(&error) } @@ -356,7 +356,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result = Item::new("config"); pub const PROPOSALS: Map = Map::new("proposals"); -/// Execution errors for proposals that do execute only once -pub const PROPOSAL_FAILED_EXECUTION_ERRORS: Map = Map::new("failed_proposal_errors"); +/// Execution errors for proposals that do not close on failure (Config.close_proposal_on_execution_failure set to false) +pub const PROPOSAL_EXECUTION_ERRORS: Map = Map::new("proposal_execution_errors"); diff --git a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs index 3b15f83f..479db0c1 100644 --- a/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs +++ b/contracts/subdaos/cwd-subdao-timelock-single/src/testing/tests.rs @@ -14,7 +14,7 @@ use neutron_subdao_timelock_single::{ use std::cell::RefCell; use std::rc::Rc; -use crate::contract::query_proposal_failed_execution_error; +use crate::contract::query_proposal_execution_error; use crate::testing::mock_querier::{MOCK_MAIN_DAO_ADDR, MOCK_OVERRULE_PREPROPOSAL}; use crate::{ contract::{execute, instantiate, query, reply}, @@ -557,7 +557,7 @@ fn test_reply() { assert_eq!(expected_attributes, res_ok.attributes); // reply writes the failed proposal error - let query_res = query_proposal_failed_execution_error(deps.as_ref(), 10).unwrap(); + let query_res = query_proposal_execution_error(deps.as_ref(), 10).unwrap(); let error: Option = from_binary(&query_res).unwrap(); assert_eq!(error, Some("error".to_string())); } diff --git a/packages/neutron-subdao-timelock-single/src/msg.rs b/packages/neutron-subdao-timelock-single/src/msg.rs index 896bf208..e58fa76a 100644 --- a/packages/neutron-subdao-timelock-single/src/msg.rs +++ b/packages/neutron-subdao-timelock-single/src/msg.rs @@ -56,10 +56,10 @@ pub enum QueryMsg { }, /// Returns errors of the failed proposal. - /// Expected in the form of [execution_height, "codespace=? code=?"]. - /// Returns `Option)` + /// Expected in the form of "codespace=? code=?". + /// Returns `Option` #[returns(Option)] - ProposalFailedExecutionError { proposal_id: u64 }, + ProposalExecutionError { proposal_id: u64 }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] diff --git a/packages/neutron-subdao-timelock-single/src/types.rs b/packages/neutron-subdao-timelock-single/src/types.rs index 340b95e9..d966c0ce 100644 --- a/packages/neutron-subdao-timelock-single/src/types.rs +++ b/packages/neutron-subdao-timelock-single/src/types.rs @@ -53,9 +53,3 @@ impl std::fmt::Display for ProposalStatus { pub struct ProposalListResponse { pub proposals: Vec, } - -/// A proposal error returned by `ProposalFailedExecutionError`. -#[derive(Serialize, Deserialize, Clone, JsonSchema, Debug)] -pub struct FailedProposalError { - pub error: String, -} From 6cd56245c100685ef590481e25beac88ec47805b Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 10 Oct 2023 19:21:21 +0400 Subject: [PATCH 22/23] review fixes - rename arg --- contracts/subdaos/cwd-subdao-core/src/contract.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-core/src/contract.rs b/contracts/subdaos/cwd-subdao-core/src/contract.rs index 0a2ef632..db40904d 100644 --- a/contracts/subdaos/cwd-subdao-core/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-core/src/contract.rs @@ -677,9 +677,9 @@ pub(crate) fn execution_access_check(deps: Deps, sender: Addr) -> Result<(), Con } } -/// Tries to find proposal module for a given timelock address (`sender`). +/// Tries to find proposal module for a given timelock contract (`timelock_contract`). /// Returns Ok(None) if not found -fn proposal_from_timelock(deps: Deps, sender: String) -> Result, StdError> { +fn proposal_from_timelock(deps: Deps, timelock_contract: String) -> Result, StdError> { let proposal_modules = PROPOSAL_MODULES .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) .map(|kv| Ok(kv?.1)) @@ -690,13 +690,13 @@ fn proposal_from_timelock(deps: Deps, sender: String) -> Result( + if let Ok(proposal_timelock_contract) = deps.querier.query_wasm_smart::( &addr, &PreProposeQueryMsg::QueryExtension { msg: PreProposeQueryExt::TimelockAddress {}, }, ) { - if sender == timelock_contract { + if timelock_contract == proposal_timelock_contract { return Ok(Some(proposal_module)); } } From 381a00031be1957b8406439a7b8d7371b5866097 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 10 Oct 2023 19:56:21 +0400 Subject: [PATCH 23/23] timelock_contract -> Addr --- contracts/subdaos/cwd-subdao-core/src/contract.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contracts/subdaos/cwd-subdao-core/src/contract.rs b/contracts/subdaos/cwd-subdao-core/src/contract.rs index db40904d..a5526bf4 100644 --- a/contracts/subdaos/cwd-subdao-core/src/contract.rs +++ b/contracts/subdaos/cwd-subdao-core/src/contract.rs @@ -604,7 +604,7 @@ pub fn query_verify_timelock(deps: Deps, timelock: String) -> StdResult } pub fn query_timelock_proposal_module_address(deps: Deps, timelock: String) -> StdResult { - let maybe_proposal = proposal_from_timelock(deps, timelock)?; + let maybe_proposal = proposal_from_timelock(deps, deps.api.addr_validate(&timelock)?)?; let proposal = maybe_proposal.ok_or_else(|| StdError::generic_err("incorrect timelock addr provided"))?; to_binary(&proposal.address) @@ -670,7 +670,7 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result<(), ContractError> { - let res = proposal_from_timelock(deps, sender.to_string())?; + let res = proposal_from_timelock(deps, sender)?; match res { Some(_) => Ok(()), None => Err(ContractError::Unauthorized {}), @@ -679,7 +679,10 @@ pub(crate) fn execution_access_check(deps: Deps, sender: Addr) -> Result<(), Con /// Tries to find proposal module for a given timelock contract (`timelock_contract`). /// Returns Ok(None) if not found -fn proposal_from_timelock(deps: Deps, timelock_contract: String) -> Result, StdError> { +fn proposal_from_timelock( + deps: Deps, + timelock_contract: Addr, +) -> Result, StdError> { let proposal_modules = PROPOSAL_MODULES .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) .map(|kv| Ok(kv?.1))