1

I took a look at the check-weight SignedExtention to see what happens when a block is full. It appears that it returns an error InvalidTransaction::ExhaustsResources. It think it puts it back into the transaction pool but cannot find any documentation around this.

What happens when an error occurs in pre-dispatch?

How can I put something back into the transaction pool and reprioritize if in pre-dispatch? Perhaps, using something like ValidTransaction.

2
  • Does anything in specific happen when you try to use ValidTransaction? Jun 14, 2022 at 18:33
  • @JustinFrevert The trait SignedExtesion pre-dispatch returns, Pre, which is a type that is passed to post-dispatch.
    – Yatusabes
    Jun 15, 2022 at 0:41

1 Answer 1

5

The transaction is not really put back if verification fails with InvalidTransaction::ExhaustsResources, it is just kept in the transaction pool.

You can find some notes about it here: https://github.com/paritytech/substrate/tree/master/client/transaction-pool#invalid-transaction

And also look at the code where it happens here: https://github.com/paritytech/substrate/blob/master/client/basic-authorship/src/basic_authorship.rs#L466-L496

The invalid txs that are not InvalidTransaction::ExhaustsResources are pushed to unqueue_invalid: https://github.com/paritytech/substrate/blob/master/client/basic-authorship/src/basic_authorship.rs#L495

to be removed afterwards from the transaction pool: https://github.com/paritytech/substrate/blob/master/client/basic-authorship/src/basic_authorship.rs#L507

About how to give them a higher priority after being invalid... I am afraid that it might not be possible without modifying the client since validate() can only return either ValidTransaction or TransactionValidityError. Might be a workaround I am not able to think about right now. You could solve your issue resending the tx with a higher priority though. If 2 transactions are received from the same sender with an identical nonce, only one transaction can be included on-chain. The client will choose the transaction with a higher priority to be stored in the transaction pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.