question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] `estimate_fee_sync` always fails with `TRANSACTION_FAILED`

See original GitHub issue

Python version

3.9.12

Expected Behavior

estimate_fee_sync should successfully complete

Current Behavior

It returns the following error:

{"code": "StarknetErrorCode.TRANSACTION_FAILED", "message": "Error at pc=0:392:\nUnknown value for memory cell at address 12:0.\nCairo traceback (most recent call last):\nUnknown location (pc=0:534)\nUnknown location (pc=0:468)"}

Possible Solution

Steps to Reproduce

(nonce,) = keeper_contract.functions["get_nonce"].call_sync()
task_address_felt = int(task["address"], 16)
args, signature = get_account_message_args_sig(keeper_address, registry, "executeTask", [task_address_felt], nonce, key)
unsigned_invocation = keeper_contract.functions["execute"].prepare(*args)

# This is where the error occurs
estimation = unsigned_invocation.estimate_fee_sync()

# This normally runs perfectly fine if I don't do gas estimation for all these transactions that are failing with `estimate_fee`
invocation = unsigned_invocation.invoke_sync(signature=signature, max_fee=0)

FYI - I’m using an older version of an account contract to issue transactions but I’m assuming that this should not impact estimate fee as the other starknet.py apis are working fine?

Context (Environment)

I’ve been using the excellent starknet.py library to power Yagi Keepers (http://www.yagi.fi/automation). I’m trying to upgrade keepers now to use fees on testnet before they are officially mandated.

Detailed Description

Possible Implementation

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Pet3riscommented, Jun 24, 2022

That fixed it thanks (and makes sense)!

1reaction
cptarturcommented, Jun 24, 2022

Are you providing the same signature to Contract.estimate_fee() as you’d be using in Contract.invoke()? It’s

# create my_signature signature somehow
estimate = my_invoke.estimate_fee_sync(signature=my_signature)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Explanation of "Transaction failure predicted" and "Could not ...
To protect your assets we try to predict when your transaction may fail due to a factor out of our control, such as...
Read more >
Error: cannot estimate gas; transaction may fail or may require ...
This is a SCAM and your money WILL be stolen. NEVER SYNC in ANY FORM: QR Codes, seed phrases, secret recovery phrase, private...
Read more >
Polygon transactions are stuck/transaction underpriced error
The transaction fails even before asking the user for a transaction most of the time. With error "err: max fee per gas less...
Read more >
Out of gas issue (ERC20) - Failed transactions - Ledger Support
Ledger Live automatically estimates the optimal fee required for your ETH and ERC20 transactions. However, Ethereum transactions might still ...
Read more >
How To Fix MOST PancakeSwap Errors! (Cannot Estimate ...
(Cannot Estimate Gas, Pancake K, Insufficient Output, Undefined) ... Cannot Estimate Gas Error 06:52 Transaction From Failed (SCAM Error ) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found