Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

bug: gomu gomu yields InvalidNonce errors #1541

Closed
apoorvsadana opened this issue Mar 30, 2024 · 6 comments
Closed

bug: gomu gomu yields InvalidNonce errors #1541

apoorvsadana opened this issue Mar 30, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@apoorvsadana
Copy link
Collaborator

Running gomu gomu on Madara gives invalid nonce errors. Need to understand why this happens. The validate_unsigned logic inside Madara might be a good starting point.

@apoorvsadana apoorvsadana added the bug Something isn't working label Mar 30, 2024
@swetshaw
Copy link
Contributor

I can take this up

@apoorvsadana
Copy link
Collaborator Author

Assinged

@swetshaw
Copy link
Contributor

swetshaw commented Apr 1, 2024

Problem

  • When running gomu gomu with madara, gomu gomu exits with an error shown in image below
Screenshot 2024-04-01 at 11 34 42 AM - At the same time the following invalid nonce error gets logged in madara node Screenshot 2024-04-01 at 11 36 22 AM

Observation

  • Although all the transactions fired by gomu gomu goes through, the invalid nonce error pops up only when it waits for the transaction. That is, it calls wait_for_tx function defined here

Note : After firing all the transactions -- gomu looks for transaction receipt for the last transaction hash

Reason for invalid nonce

  • Every wait_for_tx function call in gomu triggers the function get_transaction_receipt in the madara node here
  • This is the function trail: get_transaction_receipt --> prepare_tx_receipt --> simulate_tx --> simulate_user_tx --> simulate_transactions --> simulate_transactions_inner --> execute_transaction_with_state_diff --> execute --> handle_nonce_and_check_fee_balance --> handle_nonce
  • handle_nonce checks for the nonce here and errors out with invalid nonce if check fails
  • It's obvious the check will fail because the first set of transactions have not yet been completed yet, hence the value of nonce is still at say 1, but gomu is trying to look for transaction receipt for transaction N (N>1, nonce > 1)

Potential solution

  • We can avoid simulating transaction for the get_transaction_receipt, it should simply query for the transaction hash and return it's status

Notes:

  • Madara main branch was tested with gomu's main branch as well as the PR by LimeChain here
  • Tested with Gomu's config in default.yaml with following settings:
  • 1
     run:
      num_erc20_transfers: 2
      num_erc721_mints: 0
      concurrency: 1
    
  • 2
     run:
      num_erc20_transfers: 1000
      num_erc721_mints: 1000
      concurrency: 1
    
  • 3
     run:
      num_erc20_transfers: 1000
      num_erc721_mints: 1000
      concurrency: 5
    
  • And the same error Transaction execution failed during simulation: Invalid transaction nonce of contract were observed

@swetshaw
Copy link
Contributor

swetshaw commented Apr 2, 2024

It seems the PR #1455 should fix this issue. Need to test this again with the PR

@tdelabro
Copy link
Collaborator

tdelabro commented May 6, 2024

@swetshaw @Angel-Petrov can you confirm this had been fixed?

@apoorvsadana
Copy link
Collaborator Author

Yes @tdelabro, it's been fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants