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

[Bug] MsgConvertCoinToEvm Tx - Intended toEthAddr Not Final Receiver #391

Closed
CalicoNino opened this issue Nov 28, 2024 · 0 comments · Fixed by NibiruChain/nibiru#2120
Closed
Assignees
Labels
prio: p0 (critical) critical/urgent priority S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5

Comments

@CalicoNino
Copy link
Contributor

When triggering MsgConvertCoinToEvm, the intended toEthAddr does not end up being the final receiver.

Example:

const msgs: EncodeObject[] = [
  {
    // ERC20 0xcA0a9Fb5FBF692fa12fD13c0A900EC56Bb3f0a7b
    typeUrl: "/eth.evm.v1.MsgConvertCoinToEvm",
    value: MsgConvertCoinToEvm.fromPartial({
      toEthAddr: "0x59005464D636ECd97Da8F15adFD36B16808f66F0",
      sender: signerAddress, // Your wallet address
      bankCoin: { denom, amount: "1" },
    }),
  },
];


const tx = await txClient.signAndBroadcast(signerAddress, msgs, "auto");

console.log(tx);

// Parsing the tx, we see that the receiver of the token is
// 0x4631356164464433364231363830386636364630
// Can also confirm that 0x4631356164464433364231363830386636364630 received tokens instead of the intended receiver.

Initially, I thought it had something to do with encoding during the signing of the tx, but after testing, I can confirm that the correct address is being signed and broadcasted. You can check this by calling txClient.sign(...) and then decoding the signed raw tx bodyBytes. Also, when performing with Keplr, you can also decode the correct ETH address.
Next, I checked the ts Protos, which list toEthAddr as a string. Upon comparing it with the initial Protos, I noticed that it is listed as a custom type.


happy to take ideas but my thought was the issue with MsgConvertCoinToEvm had something to do with the proto custom type. Since it doesn't take it as string

@github-project-automation github-project-automation bot moved this to ⚡ Building 🧱 in ⚛️ Nibiru (Hougyoku) Nov 28, 2024
@github-actions github-actions bot added the S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5 label Nov 28, 2024
@CalicoNino CalicoNino changed the title bug: in MsgConvertCoinToEvm tx, the intended toEthAddr does not end up being the final receiver bug: MsgConvertCoinToEvm Tx - Intended toEthAddr Not Final Receiver Nov 28, 2024
@CalicoNino CalicoNino added the prio: p0 (critical) critical/urgent priority label Nov 28, 2024
@CalicoNino CalicoNino changed the title bug: MsgConvertCoinToEvm Tx - Intended toEthAddr Not Final Receiver [Bug] MsgConvertCoinToEvm Tx - Intended toEthAddr Not Final Receiver Nov 28, 2024
@CalicoNino CalicoNino self-assigned this Nov 28, 2024
@CalicoNino CalicoNino moved this from ⚡ Building 🧱 to ➡️ Pending Review/Merge in ⚛️ Nibiru (Hougyoku) Dec 6, 2024
@github-project-automation github-project-automation bot moved this from ➡️ Pending Review/Merge to ✅ Completed in ⚛️ Nibiru (Hougyoku) Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: p0 (critical) critical/urgent priority S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5
Projects
Status: ✅ Completed
Development

Successfully merging a pull request may close this issue.

1 participant