diff --git a/Cargo.toml b/Cargo.toml index 273f52bd..643fe642 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ panic = "abort" rpath = false [workspace.package] -version = "0.0.6-rc7" +version = "0.0.6-rc6" authors = [ "byeongsu-hong ", "Eric ", diff --git a/contracts/isms/aggregate/src/lib.rs b/contracts/isms/aggregate/src/lib.rs index 7da45373..44f4ec94 100644 --- a/contracts/isms/aggregate/src/lib.rs +++ b/contracts/isms/aggregate/src/lib.rs @@ -12,7 +12,7 @@ use cw_storage_plus::Item; use hpl_interface::{ ism::{ aggregate::{AggregateIsmQueryMsg, ExecuteMsg, InstantiateMsg, IsmsResponse, QueryMsg}, - IsmQueryMsg, IsmType, ModuleTypeResponse, ModulesAndThresholdResponse, VerifyResponse, + IsmQueryMsg, IsmType, ModuleTypeResponse, VerifyInfoResponse, VerifyResponse, }, to_binary, types::{bech32_decode, AggregateMetadata}, @@ -100,11 +100,6 @@ pub fn execute( Ok(Response::new() .add_event(new_event("set_isms").add_attribute("isms", isms.join(",")))) } - ExecuteMsg::SimulateVerify { metadata, message } => { - verify(deps.as_ref(), metadata, message)?; - - Ok(Response::new()) - } } } @@ -122,7 +117,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result to_binary(verify(deps, metadata, message)), - ModulesAndThreshold { message } => to_binary(modules_and_threshold(deps, message)), + VerifyInfo { message } => to_binary(verify_info(deps, message)), }, QueryMsg::AggregateIsm(msg) => match msg { @@ -164,13 +159,10 @@ fn verify( }) } -fn modules_and_threshold( - deps: Deps, - _message: HexBinary, -) -> Result { - Ok(ModulesAndThresholdResponse { +fn verify_info(deps: Deps, _message: HexBinary) -> Result { + Ok(VerifyInfoResponse { threshold: THRESHOLD.load(deps.storage)?, - modules: ISMS + validators: ISMS .load(deps.storage)? .into_iter() .map(|v| Ok(bech32_decode(v.as_str())?.into())) diff --git a/contracts/isms/multisig/src/contract.rs b/contracts/isms/multisig/src/contract.rs index 03016450..ce4075a1 100644 --- a/contracts/isms/multisig/src/contract.rs +++ b/contracts/isms/multisig/src/contract.rs @@ -94,16 +94,10 @@ pub fn execute( Ok(Response::new().add_event( Event::new("ism_multisig_unset_domain") - .add_attribute("sender", info.sender) + .add_attribute("sener", info.sender) .add_attribute("domain", domain.to_string()), )) } - - SimulateVerify { metadata, message } => { - crate::query::verify_message(deps.as_ref(), metadata, message)?; - - Ok(Response::new()) - } } } @@ -121,9 +115,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result to_binary(query::verify_message(deps, raw_metadata, raw_message)), - ModulesAndThreshold { + VerifyInfo { message: raw_message, - } => to_binary(query::modules_and_threshold(deps, raw_message)), + } => to_binary(query::get_verify_info(deps, raw_message)), }, QueryMsg::MultisigIsm(msg) => match msg { MultisigIsmQueryMsg::EnrolledValidators { domain } => to_binary({ diff --git a/contracts/isms/multisig/src/query.rs b/contracts/isms/multisig/src/query.rs index 662c78be..2c265092 100644 --- a/contracts/isms/multisig/src/query.rs +++ b/contracts/isms/multisig/src/query.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{Deps, HexBinary}; use hpl_interface::{ - ism::{IsmType, ModuleTypeResponse, ModulesAndThresholdResponse, VerifyResponse}, + ism::{IsmType, ModuleTypeResponse, VerifyInfoResponse, VerifyResponse}, types::{eth_addr, eth_hash, Message, MessageIdMultisigIsmMetadata}, }; @@ -60,18 +60,18 @@ pub fn verify_message( }) } -pub fn modules_and_threshold( +pub fn get_verify_info( deps: Deps, raw_message: HexBinary, -) -> Result { +) -> Result { let message: Message = raw_message.into(); let threshold = THRESHOLD.load(deps.storage, message.origin_domain)?; let validators = VALIDATORS.load(deps.storage, message.origin_domain)?; - Ok(ModulesAndThresholdResponse { + Ok(VerifyInfoResponse { threshold, - modules: validators, + validators, }) } @@ -87,7 +87,7 @@ mod test { use k256::{ecdsa::SigningKey, elliptic_curve::rand_core::OsRng}; use rstest::rstest; - use super::{get_module_type, modules_and_threshold, verify_message}; + use super::{get_module_type, get_verify_info, verify_message}; #[test] fn test_get_module_type() { @@ -155,9 +155,9 @@ mod test { .unwrap(); THRESHOLD.save(deps.as_mut().storage, 26658, &1u8).unwrap(); - let info = modules_and_threshold(deps.as_ref(), raw_message).unwrap(); + let info = get_verify_info(deps.as_ref(), raw_message).unwrap(); - assert_eq!(info.modules, vec![addr]); + assert_eq!(info.validators, vec![addr]); assert_eq!(info.threshold, 1); } } diff --git a/contracts/isms/routing/src/contract.rs b/contracts/isms/routing/src/contract.rs index b38c2878..3cb2e23a 100644 --- a/contracts/isms/routing/src/contract.rs +++ b/contracts/isms/routing/src/contract.rs @@ -96,19 +96,6 @@ pub fn execute( ), )) } - SimulateVerify { metadata, message } => { - let decoded = Message::from(message.clone()); - - let ism = MODULES - .may_load(deps.storage, decoded.origin_domain)? - .ok_or(ContractError::RouteNotFound {})?; - - let _: VerifyResponse = deps - .querier - .query_wasm_smart(ism, &IsmQueryMsg::Verify { metadata, message }.wrap())?; - - Ok(Response::new()) - } } } @@ -135,7 +122,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result { + VerifyInfo { message } => { let decoded = Message::from(message.clone()); let ism = MODULES @@ -144,7 +131,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result StdResult match msg { ModuleType {} => Ok(to_json_binary(&IsmType::Null)?), Verify { .. } => Ok(to_json_binary(&VerifyResponse { verified: true })?), - ModulesAndThreshold { .. } => Ok(to_json_binary(&ModulesAndThresholdResponse { + VerifyInfo { .. } => Ok(to_json_binary(&VerifyInfoResponse { threshold: 1u8, - modules: vec![], + validators: vec![], })?), }, } diff --git a/packages/interface/src/ism/aggregate.rs b/packages/interface/src/ism/aggregate.rs index 144f849e..708c166a 100644 --- a/packages/interface/src/ism/aggregate.rs +++ b/packages/interface/src/ism/aggregate.rs @@ -1,5 +1,4 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::HexBinary; use crate::ownable::{OwnableMsg, OwnableQueryMsg}; @@ -16,15 +15,7 @@ pub struct InstantiateMsg { pub enum ExecuteMsg { Ownable(OwnableMsg), - SimulateVerify { - metadata: HexBinary, - message: HexBinary, - }, - - SetIsms { - isms: Vec, - threshold: u8, - }, + SetIsms { isms: Vec, threshold: u8 }, } #[cw_serde] @@ -56,18 +47,10 @@ mod test { use cosmwasm_std::HexBinary; use super::*; - use crate::{ - ism::{ExpectedIsmMsg, IsmQueryMsg}, - msg_checker, - }; + use crate::{ism::IsmQueryMsg, msg_checker}; #[test] fn test_ism_interface() { - let _checked: ExecuteMsg = msg_checker(ExpectedIsmMsg::SimulateVerify { - metadata: HexBinary::default(), - message: HexBinary::default(), - }); - let _checked: QueryMsg = msg_checker(IsmQueryMsg::ModuleType {}.wrap()); let _checked: QueryMsg = msg_checker( IsmQueryMsg::Verify { @@ -77,7 +60,7 @@ mod test { .wrap(), ); let _checked: QueryMsg = msg_checker( - IsmQueryMsg::ModulesAndThreshold { + IsmQueryMsg::VerifyInfo { message: HexBinary::default(), } .wrap(), diff --git a/packages/interface/src/ism/mod.rs b/packages/interface/src/ism/mod.rs index 795350ea..13cccbe4 100644 --- a/packages/interface/src/ism/mod.rs +++ b/packages/interface/src/ism/mod.rs @@ -18,14 +18,6 @@ pub enum IsmType { CcipRead = 7, } -#[cw_serde] -pub enum ExpectedIsmMsg { - SimulateVerify { - metadata: HexBinary, - message: HexBinary, - }, -} - #[cw_serde] #[derive(QueryResponses)] pub enum IsmQueryMsg { @@ -38,8 +30,8 @@ pub enum IsmQueryMsg { message: HexBinary, }, - #[returns(ModulesAndThresholdResponse)] - ModulesAndThreshold { message: HexBinary }, + #[returns(VerifyInfoResponse)] + VerifyInfo { message: HexBinary }, } impl IsmQueryMsg { @@ -87,9 +79,9 @@ pub struct VerifyResponse { } #[cw_serde] -pub struct ModulesAndThresholdResponse { +pub struct VerifyInfoResponse { pub threshold: u8, - pub modules: Vec, + pub validators: Vec, } #[cw_serde] diff --git a/packages/interface/src/ism/multisig.rs b/packages/interface/src/ism/multisig.rs index 77f7253d..dda6d9d8 100644 --- a/packages/interface/src/ism/multisig.rs +++ b/packages/interface/src/ism/multisig.rs @@ -5,7 +5,7 @@ use crate::ownable::{OwnableMsg, OwnableQueryMsg}; use super::IsmQueryMsg; #[allow(unused_imports)] -use super::{ModuleTypeResponse, ModulesAndThresholdResponse, VerifyResponse}; +use super::{ModuleTypeResponse, VerifyInfoResponse, VerifyResponse}; #[cw_serde] pub struct InstantiateMsg { @@ -22,11 +22,6 @@ pub struct ValidatorSet { pub enum ExecuteMsg { Ownable(OwnableMsg), - SimulateVerify { - metadata: HexBinary, - message: HexBinary, - }, - SetValidators { domain: u32, threshold: u8, @@ -62,15 +57,10 @@ pub struct EnrolledValidatorsResponse { #[cfg(test)] mod test { use super::*; - use crate::{ism::ExpectedIsmMsg, msg_checker}; + use crate::msg_checker; #[test] fn test_ism_interface() { - let _checked: ExecuteMsg = msg_checker(ExpectedIsmMsg::SimulateVerify { - metadata: HexBinary::default(), - message: HexBinary::default(), - }); - let _checked: QueryMsg = msg_checker(IsmQueryMsg::ModuleType {}.wrap()); let _checked: QueryMsg = msg_checker( IsmQueryMsg::Verify { @@ -80,7 +70,7 @@ mod test { .wrap(), ); let _checked: QueryMsg = msg_checker( - IsmQueryMsg::ModulesAndThreshold { + IsmQueryMsg::VerifyInfo { message: HexBinary::default(), } .wrap(), diff --git a/packages/interface/src/ism/routing.rs b/packages/interface/src/ism/routing.rs index d722fb97..27c444ff 100644 --- a/packages/interface/src/ism/routing.rs +++ b/packages/interface/src/ism/routing.rs @@ -23,17 +23,8 @@ pub struct InstantiateMsg { pub enum ExecuteMsg { Ownable(OwnableMsg), - SimulateVerify { - metadata: HexBinary, - message: HexBinary, - }, - - Set { - ism: IsmSet, - }, - Unset { - domains: Vec, - }, + Set { ism: IsmSet }, + Unset { domains: Vec }, } #[cw_serde] @@ -62,18 +53,10 @@ mod test { use cosmwasm_std::HexBinary; use super::*; - use crate::{ - ism::{ExpectedIsmMsg, IsmQueryMsg}, - msg_checker, - }; + use crate::{ism::IsmQueryMsg, msg_checker}; #[test] fn test_ism_interface() { - let _checked: ExecuteMsg = msg_checker(ExpectedIsmMsg::SimulateVerify { - metadata: HexBinary::default(), - message: HexBinary::default(), - }); - let _checked: QueryMsg = msg_checker(IsmQueryMsg::ModuleType {}.wrap()); let _checked: QueryMsg = msg_checker( IsmQueryMsg::Verify { @@ -83,7 +66,7 @@ mod test { .wrap(), ); let _checked: QueryMsg = msg_checker( - IsmQueryMsg::ModulesAndThreshold { + IsmQueryMsg::VerifyInfo { message: HexBinary::default(), } .wrap(),