osmosis-labs / osmosis

The AMM Laboratory
https://app.osmosis.zone
Apache License 2.0
875 stars 563 forks source link

IBC hooks: Allow custom prefix for derive intermediate sender #5961

Open nicolaslara opened 11 months ago

nicolaslara commented 11 months ago

Background

IBC hooks exposes a function to derive the intermediate sender: https://github.com/osmosis-labs/osmosis/blob/main/x/ibc-hooks/client/cli/query.go#L62. This is very similar to the function used by PFM, the only difference is the prefix used.

Allowing users to customize the prefix would make it easy to predict the PFM addresses using this function. This will be useful in tests (https://github.com/osmosis-labs/osmosis/pull/5954/files#diff-7d1fc1e232b55677582b51e2623aae6d8c15b5f0960ac6100fc7d733cb795dacR1308) and when crafting packets to forward that may depend on the sender (XCSv2)

Suggested Design

Modify the query to take two optional parameters --hash-prefix and bech32-prefix and pass them to a helper function. The basic function used in ibc hooks should still have the hash prefix hardcoded and just use the helper internally

Acceptance Criteria

osmosisd q ibchooks wasmsender should support the two extra params

pysel commented 11 months ago

hey @nicolaslara! is this free to pick up?

nicolaslara commented 11 months ago

yes!

pysel commented 11 months ago

I have one question: is hash-prefix this issue refers to and the one we want to provide as an argument is this?

const types.SenderPrefix untyped string = "ibc-wasm-hook-intermediary"

CC: @nicolaslara

nicolaslara commented 11 months ago

Yeah, exactly