proto-kit / framework

Apache License 2.0
28 stars 10 forks source link

Error in inclusion of tx, skipping Error: Protocol hooks not executable: Nonce not matching: tx sent 44, onchain value is 50 #194

Closed Chomtana closed 2 months ago

Chomtana commented 3 months ago

Describe the bug

Error in inclusion of tx, skipping Error: Protocol hooks not executable: Nonce not matching: tx sent 44, onchain value is 50

Transaction stuck in the mempool and keep retrying over and over again

Even in unit test we are having this problem if not producing block after every tx

To Reproduce Do multiple transaction simultaneously especially without waiting or in parallel from the same wallet

Expected behavior Either that transaction must be rejected from the mempool or executed. Next transaction should be able to be executed next no matter what happen to that failed transaction.

Screenshots

image

maht0rz commented 2 months ago

Hi @Chomtana, this behavior is consistent with the implementation of the transaction API, it fetches the latest known nonce from the chain state. It does not account for pending transactions in the mempool. The transaction API offers an extra option where you can specify { nonce: ...}. Its what we use internally as well.

In the near future we may implement a mempool nonce tracker as well - it should be relatively simple to add. Please keep an eye out on future releases.