CosmWasm / CosmWasm/wasmd

IBC port id creation is not compatible with Bech32 characters space

Open
#1,707 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
416
Forks
538
PR merge metrics
No merged PRs in 30d

Description

## Description

The Bech32 address format allows the use of 1 to 83 US-ASCII characters for the Human-Readable Part (hrp). An address could have an hrp like this:

`xxx:yyy`

Wasmd generates the port ID for IBC using the address of a contract, which is in Bech32 format. When the hrp is used as shown above, the resulting port ID takes the following form:

`wasm.xxx:yyy1......`

However, as specified in [ICS-024 Host Requirements](https://github.com/cosmos/ibc/blob/main/spec/core/ics-024-host-requirements/README.md), IBC port IDs are only allowed to contain alphanumeric characters, as well as the following symbols:

`'.', '_', '+', '-', '#', '[', ']', '<', '>'`

This means that Bech32 addresses are incompatible with the requirements of ICS-024 Host Requirements.

The code responsible for creating the port ID in this way can be found in the following location:

[ibc.go](https://github.com/CosmWasm/wasmd/blob/main/x/wasm/keeper/ibc.go)

The functions involved in this issue are:

- PortIDForContract
- ContractFromPortID

## Possible Solutions

1. Create parameters within the Wasmd module to allow for the translation of disallowed characters into the permitted set. For example, in the Wasmd module, you can add a parameter that specifies the translation of `:` to `.`, or to another compatible character.
2. Change the method for creating the port ID by using, for example, using hexadecimal representation of the address and adding the chain ID as a prefix.
3. Create a fork of the Wasmd repository, keep it aligned with the original, and add a custom translation. This is more of a question than a solution: Is it possible to do this without introducing compatibility issues?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.