-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### 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](https://github.com/many-things/cw-hyperlane/blob/37fea49429108d0cad46c64c3c1ebc467817ff8c/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](https://github.com/many-things/cw-hyperlane/blob/37fea49429108d0cad46c64c3c1ebc467817ff8c/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 hyperlane-xyz/issues#807 ### Backward compatibility yes ### Testing E2E. The ISM setup is `routing` -> `aggregation (1/1)` -> `multisig (1/1)`
- Loading branch information
1 parent
f73ee0b
commit c2cf7be
Showing
6 changed files
with
68 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 6 additions & 19 deletions
25
rust/chains/hyperlane-cosmos/src/payloads/aggregate_ism.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters