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

Invoking txs fail if fee-token strk is selected and --max-fee is used #2697

Closed
1 task
amanusk opened this issue Nov 21, 2024 · 2 comments
Closed
1 task

Invoking txs fail if fee-token strk is selected and --max-fee is used #2697

amanusk opened this issue Nov 21, 2024 · 2 comments
Labels
bug Something isn't working sncast

Comments

@amanusk
Copy link
Contributor

amanusk commented Nov 21, 2024

Which component is your bug related to?

sncast

Foundry Version

0.33.0

What operating system are you using?

Linux

What system architecture are you using?

x86

What happened

Running a command like:

sncast -a sep_acc_1 invoke  -d 0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d -f transfer -c 0x7f3ebe4b3851f8a266dd4fa3dd77bad41aa5c0e18dab00efc505b5ceb96a286 --url https://starknet-sepolia.public.blastapi.io/rpc/v0_7 --fee-token strk  --max-fee 9999999999999 

Yields an error
error: Unexpected RPC error occurred: Transaction must commit to pay a positive amount on fee.

max-fee is a param that should only work with V1 tx (paying ETH), while V3 txs require specifying gas per unit.

In this case it seems the max-fee overrides the selection of strk token, and expects ETH payment. The error should be more informative, or to automatically derive the needed params for the specified max-fee.

This is also the way it is presetned in the docs:
https://foundry-rs.github.io/starknet-foundry/starknet/account.html#deploy-account-with-the-sncast-account-deploy-command

The command yields a similar error

Trace

No response

Is there an existing issue for this?

  • I have searched the existing issues and verified no issue exits for this problem.
@amanusk amanusk added the bug Something isn't working label Nov 21, 2024
@github-actions github-actions bot added the new label Nov 21, 2024
@cptartur cptartur added sncast and removed new labels Nov 21, 2024
@ddoktorski
Copy link
Contributor

Hi @amanusk

In the current implementation --max-fee is treated the same for both tokens: it represents the total maximum gas that can be paid for the transaction. In your example, what really happens under the hood is that sncast first makes an RPC call to get the current gas price in FRI. Then it divides the provided max_fee by this value to calculate the max_gas (referred to as max_amount in the RPC). Here is the link to the implementation for your reference. Following this, it attempts to execute the request.

With the value --max-fee 9999999999999, the current gas price in FRI is higher, and the resulting division is 0, which ultimately causes the above error. The same error can be replicated if you use the following flags: --fee-token strk --max-gas 0 --max-gas-unit-price X.

@cptartur
Copy link
Member

Created #2707 and #2706 from this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sncast
Projects
Archived in project
Development

No branches or pull requests

3 participants