Description
Some time ago we noticed that we are doing unnecessary duplicate signature verification on transactions. In particular, we verify signatures when we receive the tx from the RPC nodes before putting them in the tx pool; and then again when we remove the tx from pool to produce a chunk.
This issue is to track the work to fix this duplicate work.
Our approach will not be to simply disable signature verification when we remove the tx from the pool. This change is risky because a reader might not have a clear picture of when exactly signatures are being verified and we will run the danger of someone accidentally disabling verification on txs before they are inserted in the pool and introducing a huge bug in the protocol.
Instead, we will use the new type idiom to introduce a type ValidatedTransaction
that can only be constructed by verifying signatures and the pool will be updated to hold ValidatedTransaction
s instead. This will provide clear signals to readers that they need to verify signatures before they can insert a tx in the pool and that a tx that they remove from the pool has had its signatures verified. We will also have type safety from the compiler to upload this guarantee.
As this issue is being created after some of the initial work was done, I will recording the various PRs relevant to this work in comments below.