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

fix: return correct operations from coin and message inputs #2782

Merged
merged 23 commits into from
Jul 30, 2024

Conversation

maschad
Copy link
Member

@maschad maschad commented Jul 17, 2024

Release notes

In this release, we:

  • Fixed getInputFromAssetId so it returns the correct InputCoin and InputMessage

Summary

At the moment getContractCallOperations is currently returning empty operations on wallets that only have an InputMessage but no InputCoin , this is because getInputFromAssetId function was only returning messageInputs with the 32ZeroBytes hex, which of course excludes any input from a contract call that has a separate assetId such as a predicate call.

Notes

The best way to verify that this fix works is to use this branches build with the fuel-wallet and test it against the connectors. FuelLabs/fuels-wallet#1415 goes into greater detail on how to reproduce the scenarios.

Checklist

  • I addedtests to prove my changes
  • I've tested this on https://connectors.fuel.network/ with the fuel-wallet
  • I updated — all the necessary docs
  • I reviewed — the entire PR myself, using the GitHub UI
  • I described — all breaking changes and the Migration Guide

Copy link

vercel bot commented Jul 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-ts ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2024 2:32pm

@maschad maschad self-assigned this Jul 17, 2024
@github-actions github-actions bot added the bug Issue is a bug label Jul 17, 2024
Copy link
Contributor

@petertonysmith94 petertonysmith94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do a contract call with an account that only have message to fund the transaction (to do that you can receive from the bridge as funds bridged will be message in fuel side)

Would it be worth adding a fuel-gauge test around this use-case?

@maschad maschad marked this pull request as draft July 19, 2024 16:16
Copy link
Contributor

github-actions bot commented Jul 23, 2024

This PR is published in NPM with version 0.0.0-pr-2782-20240724204846

@maschad maschad changed the title fix: ensure getInputFromAssetId returns correct InputMessage fix: return correct operations from coinInput and InputMessage inputs Jul 24, 2024
@maschad maschad marked this pull request as ready for review July 24, 2024 20:27
@maschad maschad requested a review from arboleya July 24, 2024 20:27
@maschad
Copy link
Member Author

maschad commented Jul 26, 2024

Thanks for the confirmation @Torres-ssf I was unaware that's how a spendable message could be seeded. I've added a corresponding test in 2a5abea I had to remove the zero amountPerCoin constraint as well so that we could simulate the scenario in the issue.

Co-authored-by: Peter Smith <[email protected]>
@maschad maschad requested a review from LuizAsFight July 29, 2024 14:28
Copy link
Contributor

@danielbate danielbate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻

Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
79.5%(+0.01%) 71.8%(+0.01%) 77.48%(+0.02%) 79.64%(+0.01%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/transaction-summary/input.ts 96.42%
(-3.58%)
93.33%
(-6.67%)
100%
(+0%)
96.77%
(-3.23%)
🔴 packages/account/src/providers/transaction-summary/operations.ts 95.49%
(+0.95%)
71.92%
(+1.02%)
92.5%
(+0%)
94.16%
(+0.89%)

@maschad maschad merged commit fc39124 into master Jul 30, 2024
20 checks passed
@maschad maschad deleted the mc/fix/ensure-correct-input-message-returned branch July 30, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty operation being returned in txSummary
7 participants