Open michielbdejong opened 1 month ago
Thanks to ack/nack on meet, the DISBURSEMENT transactions have become orders of magnitude faster. Can now run up to line 7950 (27 STANDARD and 7922 DISBURSEMENT transactions) in 29 seconds.
I'm feeling like I want to rewrite a node implementation from scratch. The separation between FriendsEngine and ProbesEngine (which itself keeps track of friends), all wired through the main Badger class with events, is annoying.
Are events (reacting to incoming messages) even the right approach? Or should the design be more state-driven (incoming messages update the state, and at any point the node can decide to look at its state and trigger some action)? The latter feels like it may become cleaner, so the node has a better model of its environment and doesn't depend on replies from other nodes to continue what it was doing.
In any case, the Sarafu data set has 1,000,000 transactions of which 422,721 are standard, across 55,000 nodes, so we'll have to do a about 4 orders of magnitude more than what the simulation is handling right now.
In any case, we don't want to trigger a flood probe from every meet event, and we want to build in queuing and filtering, and in general be much more deliberate about when a probe is forwarded.
Maybe nacks coming back from probes can be very useful to identify dead-end branches. Each node should keep state of that. When two nodes meet, if previously both of them were on acyclic trees, they don't know if they're on the same acyclic tree or on a different one. That's what the probe checks. Does it need to bounce back from all leaves to prove that?
Leaf nodes never have to participate in any probes Line nodes can just pass them on transparently, unless maybe a special line probe to detect perfect circles. Fork nodes play a role though, and should try to find one loop per trade pair.
In the light of #37 I'm thinking of
nack
messages that indicate that a node knows it has no further loops. This can be because it is a leaf, or because all its other neighbours have sent anack
message. So I'm going to tracknack
messages in the FriendsEngine. As an extra step in the meet process, ameet
will either be followed by anack
, or be replied to with anack
or anack
, and the flood probe for the newly created link will only be sent if nonack
was sent and anack
was received.I'm also considering
ack
in response toprobe
but I think that will be too expensive.