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

callSmartContract should consider the candidate balance #601

Open
Thykof opened this issue May 7, 2024 · 3 comments
Open

callSmartContract should consider the candidate balance #601

Thykof opened this issue May 7, 2024 · 3 comments

Comments

@Thykof
Copy link
Contributor

Thykof commented May 7, 2024

here

if (senderBalance.final < callData.coins) {
we check if the caller has enough funds to call the smart contract but we check the final balance of the caller. It prevents from calling the smart contract whereas the call it actually possible and will succeed.

It should check the candidate balance

cc @AurelienFT @Ben-Rey WDYT?

@Ben-Rey
Copy link
Collaborator

Ben-Rey commented May 7, 2024

here

if (senderBalance.final < callData.coins) {
we check if the caller has enough funds to call the smart contract but we check the final balance of the caller. It prevents from calling the smart contract whereas the call it actually possible and will succeed.

It should check the candidate balance

cc @AurelienFT @Ben-Rey WDYT?

Can you give an example?

@Thykof
Copy link
Contributor Author

Thykof commented May 7, 2024

  • I have an account A in massa wallet that have 0 MAS
  • using an account B that have MAS I send MAS to account A
  • I switch to account A and I see the balance higher than zero
  • I send FT token with the wallet, but it fails because account A MAS balance is not final

In anyway I think it's better to rely on the candidate balance in a more general case. I see no reason to enforce a final balance for a call sc, even more in massa-web3 lib.

@Ben-Rey
Copy link
Collaborator

Ben-Rey commented May 8, 2024

Ok thanks, I agree

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

No branches or pull requests

2 participants