Support custom transaction validation code #1482
Description
We would like to use Burrow in an environment where Burrow runs as a side chain and to a ‘main’ blockchain and the provider of the main chain would want to enforce (or simply audit) some conditions on the transactions (actually smart contract calls) on the side chain. One way to achieve this would be to have their own node within the side chain that runs their custom validation code on all transactions. Or they may want to force all side chain nodes to run their validation code.
The idea is to include running some pluggable validation code in Burrow.
What point in Burrow’s operation would be a good place to do this?
I was thinking since Burrow uses Tendermint for consensus, this feature could be implemented at the point where Burrow checks whether a block (=> its transactions) is valid in the Prevote step. In addition to whatever validation code runs there (so far I was unable find this in Burrow’s source code; I found some validation code in execution/execution.go
but I am not sure this is where to look), Burrow would also run some custom validation code.
As to how to implement pluggable validation code, a simple solution would be to use Go plugins, similar to how Fabric does it. I coded a primitive proof-of-concept kind of thing at bzp99@ed3b045
Now I would like to improve on this by pulling the code out of the execution
module into a new one and possibly moving the logic that runs the pluggable endorsement code to where it belongs (where Burrow validates blocks in Prevote).