-
Notifications
You must be signed in to change notification settings - Fork 9
sdk/state: when channel closes at stale state the channel does not update to closed state #308
Comments
this is because the state depends on the sequence num, which never reaches the latest declTx or closeTx seqNums. @leighmcculloch I think the best way to handle is adding a flag like 🤔 we can also add the state: |
I think what we can do is, if the channel is open, and seq num is less than latest closing, we could mod the seq to find out whether it is the closing/closed tx. Theoretically we could do that for the latest closing/closed too, but I think when you were working on that logic I suggested you use the stored value inside the transactions and check for exact equality. Maybe that was short-sighted of me, because we don't have all txns stored for earlier revisions to do the same thing. I think we could change to the approach I think you had suggested previously, checking what type of tx the seq would be. Wdyt?
+1. I think this is worthwhile. |
sgtm 👍 seems simpler. My concern with But since we're blocking IngestTx if the channel is closed, shouldn't be an issue. |
Good point. Having IngestTx not ingest after that point becomes more critical. 👍🏻 Something else that this reinforces is that while #312 and #319 made it safe for For example, this ingestion order is supported where ER's txs are ingested before EI's.
But, this ingestion order is not supported where ER's txs are ingested out of order.
|
why isn't this supported? If we see an older transaction we're ignoring it atm, is that what you mean by not supported? |
You're correct we ignore transactions that would shift a seq num backwards, and we ignore older txs when updating balances, but it is still not safe to ingest txs for a single account out of order, only that txs across two accounts can be, even if they are shared. This isn't supported because we'd miss states. For example, if I close a channel with an old state and then continue to transact on it, if you ingested those txs out of order you might see the channel close at the latest state, and then see the early close tx later. |
🤔 good point, I hadn't thought about that |
I think I thought #312 and #319 would make it okay to ingest all transactions out of order, but when I got into it, not so much. But that's okay, we still get a big win out of #312 and #319 because we can now do: which means we no longer need to stream all transations on the whole network to ingest. 🎉 |
When testing with the example console application manually and running through the scenario where a participant closes using stale data using #302, I saw that the channel of both participants update to the
ClosingWithStaleState
after the declaration transaction is ingested, but it did not change state when the close transaction was ingested.State
3
is theClosingWithStaleState
. I expected to see state4
which is theClosed
state to occur after the close transaction was ingested, which was the1e5e89
transaction.The text was updated successfully, but these errors were encountered: