Optimizing Distributed Protocols with Query Rewrites | Synapse