penumbra-zone / web

Apache License 2.0
12 stars 15 forks source link

nobletestnet IBC-in error #1053

Closed grod220 closed 5 months ago

grod220 commented 5 months ago

Steps to reproduce: 1 - Get money from usdc faucet. Send to your noble address (can use keplr/leap). 2 - Go to ibc section in minfront (https://localhost:5173/#/ibc) and issue an ibc-in from noble with your new funds. 3 - See error after approving tx

Error: Broadcasting transaction failed with code 1 (codespace: undefined). 
Log: error decoding address (penumbra1g2fpeqzsv702alg33aamp5l8rq56de0h5x87lyjn0mn98jekhfy0dsuecy8364h5qqar8ngkzcsxyc4pt4gg3whtll6dx4gherwz9td7vtl5vnthevxchxknaxnsmglvefvjre): 
decoding bech32 failed: invalid checksum (expected v4u7xm got efvjre)
hdevalence commented 5 months ago

For Noble specifically we need to use a Bech32 encoding rather than Bech32m, because Noble currently has a middleware that decodes as Bech32. This sucks but when we picked Bech32m we didn't really think about it being different than other Cosmos address encodings. Noble plans to change this at some point in the future but until then we need to use a special encoding just for Noble specifically:

  1. Decode the Bech32m address to bytes (or start with bytes)
  2. Encode the inner bytes as Bech32 with prefix "penumbracompat"
  3. All places where Rust code parses addresses will recognize the prefix and parse as Bech32 instead of Bech32m, so it should Just Work

@avahowell has tested this flow with the CLI so we expect it to work.

avahowell commented 5 months ago

The relevant code that pcli uses for this (in pcli view address --compat) is here: https://github.com/penumbra-zone/penumbra/blob/main/crates/core/keys/src/address.rs#L209