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

Ethermint support #1295

Merged
merged 8 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changelog/unreleased/features/1267-ethermint-support.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Added Ethermint support ([#1267] [#1071])
- Added post-Stargate (v0.5+) Ethermint support ([#1267] [#1071])

[#1267]: https://github.com/informalsystems/ibc-rs/issues/1267
[#1071]: https://github.com/informalsystems/ibc-rs/issues/1071
28 changes: 14 additions & 14 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ account_prefix = 'cosmos'
# https://hermes.informal.systems/commands/keys/index.html#adding-keys
key_name = 'testkey'

# Specify the address type which determines:
# 1) address derivation;
# 2) how to retrieve and decode accounts and pubkeys;
# 3) the message signing method.
# The current configuration options are for Cosmos SDK and Ethermint.
#
# Example configuration for Ethermint:
#
# address_type = { derivation = 'ethermint', proto_type = { pk_type = '/injective.crypto.v1beta1.ethsecp256k1.PubKey' } }
#
# Default: { derivation = 'cosmos' }, i.e. address derivation as in Cosmos SDK
# Warning: This is an advanced feature! Modify with caution.
address_type = { derivation = 'cosmos' }

# Specify the store prefix used by the on-chain IBC modules. Required
# Recommended value for Cosmos SDK: 'ibc'
store_prefix = 'ibc'
Expand Down Expand Up @@ -131,20 +145,6 @@ trusting_period = '14days'
# Warning: This is an advanced feature! Modify with caution.
trust_threshold = { numerator = '1', denominator = '3' }

# Specify the address type which determines:
# 1) address derivation;
# 2) how to retrieve and decode accounts and pubkeys;
# 3) the message signing method.
# The current configuration options are for Cosmos SDK and Ethermint.
#
# Example configuration for Ethermint:
#
# address_type = { derivation = 'ethermint', proto_type = { pk_type = '/injective.crypto.v1beta1.ethsecp256k1.PubKey' } }
#
# Default: { derivation = 'cosmos' }, i.e. address derivation as in Cosmos SDK
# Warning: This is an advanced feature! Modify with caution.
address_type = { derivation = 'cosmos' }

# This section specifies the filters for policy based relaying.
# Default: no policy/ filters
# The section is ignored if the global 'filter' option is set to 'false'.
Expand Down
2 changes: 2 additions & 0 deletions proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub mod cosmos {
pub mod v1beta1 {
include!("prost/cosmos.auth.v1beta1.rs");
/// EthAccount defines an Ethermint account.
/// TODO: remove when https://github.com/cosmos/cosmos-sdk/pull/9981
tomtau marked this conversation as resolved.
Show resolved Hide resolved
/// lands in the next Cosmos SDK release
adizere marked this conversation as resolved.
Show resolved Hide resolved
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EthAccount {
#[prost(message, optional, tag = "1")]
Expand Down
4 changes: 4 additions & 0 deletions relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ impl Default for RestConfig {
}
}

/// It defines the address generation method
/// TODO: Ethermint `pk_type` to be restricted
/// after the Cosmos SDK release with ethsecp256k1
/// https://github.com/cosmos/cosmos-sdk/pull/9981
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(
rename_all = "lowercase",
Expand Down
6 changes: 5 additions & 1 deletion relayer/src/keyring/pub_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ impl FromStr for EncodedPubKey {
);

// Ethermint pubkey types:
// "/ethermint.crypto.v1alpha1.ethsecp256k1.PubKey", "/injective.crypto.v1beta1.ethsecp256k1.PubKey"
// e.g. "/ethermint.crypto.v1alpha1.ethsecp256k1.PubKey", "/injective.crypto.v1beta1.ethsecp256k1.PubKey"
// "/ethermint.crypto.v1beta1.ethsecp256k1.PubKey", "/ethermint.crypto.v1.ethsecp256k1.PubKey",
// "/cosmos.crypto.ethsecp256k1.PubKey"
// TODO: to be restricted after the Cosmos SDK release with ethsecp256k1
// https://github.com/cosmos/cosmos-sdk/pull/9981
if proto.tpe != "/cosmos.crypto.secp256k1.PubKey"
&& !proto.tpe.ends_with(".ethsecp256k1.PubKey")
adizere marked this conversation as resolved.
Show resolved Hide resolved
{
Expand Down