Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cosmos contract byte lengths other than 32 #3147

Merged
merged 13 commits into from
Jan 23, 2024

Conversation

tkporter
Copy link
Collaborator

Description

fixes #3143

Initially went down a path that would use protocol-specific types for addresses as suggested by #3143. I had made a HyperlaneConnectionConf enum with protocol-specific variants whose values were addresses: CoreContractAddresses<ProtocolSpecificAddressType> and connection: ProtocolSpecificConnectionConf. This worked pretty well until I hit the ISM logic.

Because hyperlane-core is where the Mailbox trait is defined, the return type of recipient_ism in the trait cannot involve protocol specific types. It can't be moved to hyperlane-base because hyperlane-base imports the chain crates, so we'd have a cyclic dependency. I experimented with moving away from H256 to something like a Vec or string, but this felt a bit weird.

In the end we decided to keep H256s as the global representation for contract addresses for now, with the intent of eventually changing this, and to support the varying length situation in a cosmos config

Drive-by changes

  • Added some cosmos specific agent configurations into the sdk
  • Moved to bech32_prefix in the agents for consistency with what the SDK's chain metadata already does
  • I guess no one's ran cargo test in a while so vectors/message.json got a new v3 message lol

Related issues

Fixes #3143

Backward compatibility

Changes prefix to bech32_prefix in the agent config, and now requires contractAddressBytes

Testing

Tested merged with #3144 and all worked

Copy link

changeset-bot bot commented Jan 11, 2024

⚠️ No Changeset found

Latest commit: 7df4f04

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@daniel-savu daniel-savu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

rust/chains/hyperlane-cosmos/src/libs/address.rs Outdated Show resolved Hide resolved
rust/chains/hyperlane-cosmos/src/libs/address.rs Outdated Show resolved Hide resolved
vectors/message.json Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Merging #3147 (7df4f04) into main (528a190) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3147   +/-   ##
=======================================
  Coverage   67.18%   67.18%           
=======================================
  Files         101      101           
  Lines        1021     1021           
  Branches      106      106           
=======================================
  Hits          686      686           
  Misses        291      291           
  Partials       44       44           
Components Coverage Δ
core 50.00% <ø> (ø)
hooks 68.79% <ø> (ø)
isms 65.94% <ø> (ø)
token 54.62% <ø> (ø)
middlewares 81.46% <ø> (ø)

@tkporter tkporter enabled auto-merge (squash) January 23, 2024 11:44
@tkporter tkporter merged commit 0cad4f7 into main Jan 23, 2024
28 of 29 checks passed
@tkporter tkporter deleted the trevor/add-contract-address-bytes branch January 23, 2024 11:56
ltyu pushed a commit to ltyu/hyperlane-monorepo that referenced this pull request Mar 13, 2024
### Description

fixes hyperlane-xyz#3143 

Initially went down a path that would use protocol-specific types for
addresses as suggested by hyperlane-xyz#3143. I had made a `HyperlaneConnectionConf`
enum with protocol-specific variants whose values were `addresses:
CoreContractAddresses<ProtocolSpecificAddressType>` and `connection:
ProtocolSpecificConnectionConf`. This worked pretty well until I hit the
ISM logic.

Because hyperlane-core is where the Mailbox trait is defined, the return
type of `recipient_ism` in the trait cannot involve protocol specific
types. It can't be moved to hyperlane-base because hyperlane-base
imports the chain crates, so we'd have a cyclic dependency. I
experimented with moving away from H256 to something like a Vec<u8> or
string, but this felt a bit weird.

In the end we decided to keep H256s as the global representation for
contract addresses for now, with the intent of eventually changing this,
and to support the varying length situation in a cosmos config

### Drive-by changes

- Added some cosmos specific agent configurations into the sdk
- Moved to bech32_prefix in the agents for consistency with what the
SDK's chain metadata already does
- I guess no one's ran cargo test in a while so vectors/message.json got
a new v3 message lol

### Related issues

Fixes hyperlane-xyz#3143 

### Backward compatibility

Changes prefix to bech32_prefix in the agent config, and now requires
`contractAddressBytes`

### Testing

Tested merged with hyperlane-xyz#3144 and all worked

---------

Co-authored-by: Daniel Savu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Cosmwasm contract addresses w/ lengths other than 32 bytes should be supported
4 participants