0

I've been playing around with substrate a lot lately and I was wondering how one would go with implementing optimistic block execution.

What I mean by this is that transactions are executed as if they are valid, but their validity depends on some criteria that is only available to know after block propagation. Therefore, if an invalid trasaction is found, nodes would have to revert the world state to the state resulting from the last valid transaction.

More specifically, I was wondering whether or not this is doable within FRAME.

1 Answer 1

1

You could look at the ValidateUnsigned.

This check is at the transaction pool level. Once the verification fails, the transaction will be dropped and won't be broadcast.

There are a lot of examples in the substrate/frontier repository.

Here is one.

3
  • Thanks for you answer, however I believe what you propose assumes you can detect if a transaction is valid at the transaction pool level. As I explained, in my case it is only possible to know if a transaction is valid after the block has been built and propagated.
    – lippil
    Commented Aug 23, 2022 at 12:14
  • could you give an example? what transaction will be invaild after the propagated?
    – aurexav
    Commented Aug 23, 2022 at 13:56
  • With in mind optimistic execution, one could think of the example where transactions in the block are executed as if they are valid, and once the block has been propagated, a validator can flag a fraudulent transaction that was included in the block. In this case, nodes have to revert to the state given by the execution of the last valid transaction in the block.
    – lippil
    Commented Aug 25, 2022 at 12:38

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.