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

feat(tendermint): support unsigned txs for ledger's keplr extension #2148

Merged
merged 11 commits into from
Jul 2, 2024

Conversation

onur-ozkan
Copy link
Member

@onur-ozkan onur-ozkan commented Jun 25, 2024

Currently, pubkey-only mode fails with Ledger's Keplr extension. This is because Ledger doesn't support SIGN_MODE_DIRECT transaction signing (more context).

Ledger supports two signing modes at the moment:

  1. SIGN_MODE_LEGACY_AMINO_JSON
  2. SIGN_MODE_TEXTUAL

The first one is a legacy signing type and doesn't support HTLC transactions, meaning we can't support swaps with it.

Unlike the first one, the second one is actively maintained but Keplr doesn't support it yet.

So we end up with having one option only; use SIGN_MODE_LEGACY_AMINO_JSON and only support withdrawals for Ledger's Keplr extension.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@onur-ozkan onur-ozkan added the in progress Changes will be made from the author label Jun 27, 2024
@onur-ozkan onur-ozkan marked this pull request as draft June 27, 2024 09:47
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@onur-ozkan onur-ozkan added enhancement New feature or request under review and removed in progress Changes will be made from the author labels Jul 1, 2024
@onur-ozkan onur-ozkan marked this pull request as ready for review July 1, 2024 07:06
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@shamardy shamardy self-requested a review July 1, 2024 16:19
Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

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

Amazing work! Only one comment from my side.

mm2src/coins/tendermint/tendermint_coin.rs Show resolved Hide resolved
mariocynicys
mariocynicys previously approved these changes Jul 1, 2024
Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -234,6 +236,7 @@ impl PlatformCoinWithTokensActivationOps for TendermintCoin {
protocol_conf: Self::PlatformProtocolInfo,
) -> Result<Self, MmError<Self::ActivationError>> {
let conf = TendermintConf::try_from_json(&ticker, coin_conf)?;
let is_keplr_from_ledger = activation_request.is_keplr_from_ledger && activation_request.with_pubkey.is_some();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Q: Can this be a keplr from ledger but not with pubkey?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it can't. If you are using hardware wallet, with-pubkey is the only way you can use your wallet with mm2.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Aha, then does it make sense to && activation_request.with_pubkey.is_some(). If we suspect the activation request might be malformed, maybe we could error here instead.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
@shamardy shamardy merged commit 9f241c0 into dev Jul 2, 2024
22 of 25 checks passed
@shamardy shamardy deleted the external-sign-keplr-ledger branch July 2, 2024 06:28
dimxy added a commit that referenced this pull request Jul 3, 2024
* dev:
  fix(restrictions): remove wallet-only restriction from max_maker_vol (#2153)
  feat(tendermint): support unsigned txs for ledger's keplr extension (#2148)
  chore(toolchain): upgrade to 1.72 nightly (#2149)
  feat(solana-swap): solana swap protocol v1 POC (#2091)
  fix(docs): update cargo test command (#2144)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants