LiteSVM / litesvm

Apache License 2.0
51 stars 10 forks source link

feat: avoid mut constraint for simulation #64

Closed losman0s closed 3 months ago

losman0s commented 3 months ago

In cases where this is used as an a amnesiac executor, the self mut on the tx processing functions unnecessarily prevent parallelisation due to a single shared line.

This PR splits the necessary code into a read-only branch that gets used by the simulate function, and allows the removal of mut for self.

It does introduce a bit of duplication between execute_sanitized_transaction_readonly and execute_sanitized_transaction and the naming might be suboptimal. If you have proposal to make it cleaner on those points lmk.