fizzbee icon indicating copy to clipboard operation
fizzbee copied to clipboard

Rollback when using a custom channel

Open cjen1-msft opened this issue 10 months ago • 0 comments

It appears that nodes' state is rolled back when using a custom channel in the following spec:

----
options:
  maxActions: 10

deadlock_detection: false
----
NUM_NODES = 2

NonBlockingFifo = Channel(ordering='unordered', delivery='exactly_once', blocking='fire_and_forget')

NextSteps = enum("GOSSIP", "VOTE", "OPENJOIN", "OPEN", "JOIN")

role Node:
  atomic action Init:
    self.next_step = NextSteps.GOSSIP
    self.recv_gossips = {}
  
  action Gossip:
    if self.next_step == NextSteps.GOSSIP:
      self.next_step = NextSteps.VOTE
      for n in nodes:
        if n.__id__ != self.__id__:
          n.gossip(self.__id__, self.txid)

  func gossip(src_id, txid):
    self.recv_gossips[src_id] = txid
  
atomic action Init:
  nodes = []
  for i in range(0, NUM_NODES):
    node = Node(txid=i)
    stub = NonBlockingFifo.stub(node)
    nodes.append(stub)

Using the explorer this appears to roll back the sender's state on completion of the rpc, although I'm not 100% sure if this is exactly what is happening, it could just be that at some point a state is cached, and one of the actions triggers it to be written.

Here is a minimal repro of the issue in the above spec?

Initial state
Step 2: Node#1.Gossip
Step 3: action-1
Step 4: channel-0-message-0
Step 5: action-1

I've reproduced it in the playground, and running a docker image built off of main, the number of states is the same.

cjen1-msft avatar May 22 '25 10:05 cjen1-msft