ledgerloops / strategy-pit

Testing ground for LedgerLoop strategies
Apache License 2.0
0 stars 0 forks source link

probes cross when Stingray triangle completes #7

Closed michielbdejong closed 3 months ago

michielbdejong commented 4 months ago

As you can see in https://github.com/ledgerloops/strategy-pit/blob/6a0a148004e0a4e0be7a7d71ba7180de3617c372/__tests__/batched-stingray-triangle.test.ts#L387-L408, when Charlie meets Alice and the triangle closes, they both send each other all their probes in that same message batch, and when those messages are delivered, they are considered not virgin on both sides.

I'll create a new node type where one of the two sides holds off on offering their probes to avoid this. I have to work out though whether that will be a water tight remedy.

Maybe the message simulation should be timed differently, to simulate half duplex instead of duplex message channels, in which a message from Alice to Charlie cannot be sent until the message in the opposite direction is fully delivered and processed. Or something like that.

But hold on, if Charlie offers its probes in the same batch as the Meet message, then why does Alice already react?

michielbdejong commented 4 months ago

if Charlie offers its probes in the same batch as the Meet message, then why does Alice already react?

Ah, its simply because in Alice https://github.com/ledgerloops/strategy-pit/blob/30a1e67de51665db90b19c4178a6c315806c949f/src/stingray.ts#L188 is executed before Charlie's messages from https://github.com/ledgerloops/strategy-pit/blob/30a1e67de51665db90b19c4178a6c315806c949f/src/stingray.ts#L182 arrive.

michielbdejong commented 4 months ago

I could batch-process the messages but that feels unnatural. what actually happens with the third probe, that should travel separately to Alice and Bob in the Charlie-meets-Alice round and then cross in between Alice and Bob in the next round, right? A square would probably not have the same problem?

michielbdejong commented 4 months ago

Let me try with Pauze/Unpauze messages that make channels essentially half duplex.