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

Voice does not work on Injective #64

Closed
NoahSaso opened this issue May 24, 2024 · 0 comments · Fixed by #65
Closed

Voice does not work on Injective #64

NoahSaso opened this issue May 24, 2024 · 0 comments · Fixed by #65

Comments

@NoahSaso
Copy link
Member

NoahSaso commented May 24, 2024

The voice does not work on injective. It successfully generates proxy contracts on message execution events but saves the incorrect address to state, so it fails to find the generated proxy contract when attempting to execute. This has to do with the way Injective creates contract addresses.

I believe the issue is here:

let proxy = deps.api.addr_humanize(&instantiate2_address(
&checksum, &contract, &salt,
)?)?;
SENDER_TO_PROXY.save(
deps.storage,
(connection_id, counterparty_port, sender.clone()),
&proxy,
)?;

In one on-chain attempt, the instantiated proxy contract had address inj1mlrq3jpkftn7ad2r2fp4n772s7ekl4w7medmth, but the voice contract saved inj1mlrq3jpkftn7ad2r2fp4n772s7ekl4w744m6dz0632umxrv3dneqgy06fl to the SENDER_TO_PROXY map.

The instantiated contract has the following bech32 data:

[223, 198, 8, 200, 54, 74, 231, 238, 181, 67, 82, 67, 89, 251, 202, 135, 179, 111, 213, 222]

while the address saved to the voice's map has the following:

[223, 198, 8, 200, 54, 74, 231, 238, 181, 67, 82, 67, 89, 251, 202, 135, 179, 111, 213, 222, 173, 119, 166, 137, 250, 138, 185, 179, 13, 145, 108, 242]

They contain the same first 20 bytes, but the voice contract is generating 12 more bytes (32 bytes being the length of contract addresses on standard CosmWasm chains).

The normal instantiate2 implementation uses a SHA-256 hash to produce 32 bytes that get converted into a bech32 contract address. It appears Injective just slices off the first 20, but we need to verify this with the Injective wasm module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant