feat(cosmos): ism dry-run (#3077)
### Description Implements `dry_run_verify` for the aggregation ISM on cosmwasm. One remaining issue is that the estimated gas is hardcoded to `1`, because we're actually [just querying](pull/3074/head37fea49429/contracts/isms/aggregate/src/lib.rs (L108)
) via rpc rather than simulating a tx. The `verify` tx isn't marked as a contract [entrypoint](https://book.cosmwasm.com/basics/entry-points.html) so it can't be called from outside iiuc. (here's the [verify](37fea49429/contracts/isms/aggregate/src/lib.rs (L124)
) fn for reference). Worth mentioning that the query interface for the aggregation ISM is named incorrectly - it should return fields called `threshold` and `modules`, but instead copies the response from the multisig ISM and returns `threshold` and `validators`. This can be particularly misleading because validators have 20-bytes long addresses, whereas modules (contracts) have 32-bytes long addresses. ### Related issues - Fixes https://github.com/hyperlane-xyz/issues/issues/807 ### Backward compatibility yes ### Testing E2E. The ISM setup is `routing` -> `aggregation (1/1)` -> `multisig (1/1)`
parent
f73ee0b273
commit
c2cf7be8f2
@ -1,30 +1,17 @@ |
||||
use hyperlane_core::{HyperlaneMessage, RawHyperlaneMessage}; |
||||
use serde::{Deserialize, Serialize}; |
||||
|
||||
#[derive(Serialize, Deserialize, Debug)] |
||||
pub struct ModulesAndThresholdRequest { |
||||
modules_and_threshold: ModulesAndThresholdRequestInner, |
||||
} |
||||
|
||||
impl ModulesAndThresholdRequest { |
||||
pub fn new(message: &HyperlaneMessage) -> Self { |
||||
Self { |
||||
modules_and_threshold: ModulesAndThresholdRequestInner { |
||||
message: hex::encode(RawHyperlaneMessage::from(message)), |
||||
}, |
||||
} |
||||
} |
||||
pub struct VerifyRequest { |
||||
pub verify: VerifyRequestInner, |
||||
} |
||||
|
||||
#[derive(Serialize, Deserialize, Debug)] |
||||
struct ModulesAndThresholdRequestInner { |
||||
/// Hex-encoded Hyperlane message
|
||||
pub struct VerifyRequestInner { |
||||
pub metadata: String, |
||||
pub message: String, |
||||
} |
||||
|
||||
#[derive(Serialize, Deserialize, Debug)] |
||||
pub struct ModulesAndThresholdResponse { |
||||
pub threshold: u8, |
||||
/// Bech32-encoded module addresses
|
||||
pub modules: Vec<String>, |
||||
pub struct VerifyResponse { |
||||
pub verified: bool, |
||||
} |
||||
|
Loading…
Reference in new issue