-
Notifications
You must be signed in to change notification settings - Fork 99
Description
I’ve been exploring Miden’s node implementation over the past few days and like its architecture, especially that it is designed around actors.
Based on the code I have read so far, I would suggest a few changes to the current actor design. When working on other distributed systems, I found these constraints particularly effective:
- Give actors full data ownership and avoid shared references
- Using a non-async
on_messagefunction that mutates the internal state directly in response to events - Assign each actor a unique identity (e.g.
TypeId, metadata) - Spawn actors through an actor system
- Route messages to destination actors via handles (e.g.
ActorRef) through a bus
These constraints have various benefits: As actors operate only on local state, they can use &mut self and thus avoid locks. Actors with this design can be tested in isolation. Not using async enables Deterministic Simulation Testing which TigerBeetle used to find subtle bugs.
The Akka framework is worth looking at in this context. It has additional features such as network transparency and automated actor restarts, which might not be relevant for Miden at this stage.
I am currently exploring how these constraints could be applied after #1219 has been merged. Here is a rough sketch of what I have in mind: https://gist.github.com/tindzk/e53772c940ac0fb2e3e886b0431c21e3
If this is a direction you deem worth exploring, I’d be happy to spend more time on it.