Use ContextualCheck when receiving commits.
When handling commits message we make simple transaction check only. It means we don't detect permissions issues on this step and trust for any vote. In the worst scenario, we will download blocks, trigger the fork choice rule, and try to reorg to the malicious fork. Then, during reorg, we will reject this fork.
This problem could be solved by performing ContextualCheck to commit transactions. But ContextualChecks relies on checking of the prev transaction which effectively loaded from the disk — during commits full sync we basically don't have such a data on the disk. However, there are commit transactions in CBlockIndex-es, and we can try to scan the map block index and find them there. But, for instance, the deposit has a regular transaction as an input. Also, this solution might be inefficient a lot.
I'm thinking to add an additional transaction cache we can use during full sync.
The corresponding code: https://github.com/dtr-org/unit-e/blob/c225302fc2ce325e89c3506802d77180d25f4f44/src/p2p/finalizer_commits_handler_impl.cpp#L342
Maybe related #547.