Extend the way of verifying the transaction in the transaction pool #11520
Replies: 2 comments 7 replies
-
Wrapping the substrate/client/transaction-pool/src/api.rs Lines 129 to 164 in 73d1fc6 |
Beta Was this translation helpful? Give feedback.
-
Any individual transaction is either valid or invalid, but we never demand this be the whole story. In fact, we multiple unfinished "transaction" types in Polkadot itself, like on-chain multi-sigs, and parachain candidate backing. Approval assignments too, and some places in approval & parachain rewards too, except they stay off chain because we do not require consensus upon the exact approval checker set. |
Beta Was this translation helpful? Give feedback.
-
Currently, when an extrinsic is submitted to the transaction pool, there is only one way to verify the transaction before actually importing it to the pool, which is using the runtime API
validate_transaction
.substrate/client/transaction-pool/src/api.rs
Line 232 in ce449a5
In Subspace, we have an extrinsic for submitting a fraud proof(FraudProof can have a non-trivial StorageProof), the execution proof check is an std only function, in that way, we have to add a new host function, but calling into the runtime to verify this function imposes some constraints:
For this specific use case, when an extrinsic is submitted, we can first check if it's about submitting a fraud proof, if true, verify the fraud proof directly using the underlying verification function in the transaction pool, if the proof is invalid, we just drop it without having to call the runtime API
validate_transaction
, then the heaviest part of fraud proof verification can happen on the client only. So, nice to have some kind of hook around the current verify_transaction, which will be invoked before calling the runtime APIvalidate_transaction
.Overall, it's beneficial to have an additional way to verify the transaction besides the only way of existing runtime API
validate_transaction
, which can be a universal enhancement to the transaction pool IMHO. The alternative way is to make a wrapper around the existing transaction pool to satisfy our need, but nice to have your opinion about this. If you think it's generally useful and can be integrated into Substrate, I'm happy to help and push it forward :D.Beta Was this translation helpful? Give feedback.
All reactions