You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior emits every event from the VM in real-time with the execution. Due to the rolling finality PR, when an event occurs, it is never immediately finalized. This may cause issues for clients, as they need to manage the rollback of these events' effects.
Detailed Description (optional)
The VM emits events in real-time as they occur. However, based on the rolling finality PR, these events are not finalized immediately. This creates a burden on clients, as they must handle the rollback of effects triggered by these events.
There are two possible solutions:
Accept only finalized events:
Instead of listening to contract events in real-time, a client could listen for the state_changed event of a block and, once that block is finalized, query the archival node for the list of events related to that block.
Accept real-time events and manage rollbacks:
This approach is more complex because the client needs to handle rollbacks both when online and offline. When a rollback event is emitted, it doesn’t contain information about the relevant contract events. However, every contract event has the transaction ID that originated it, and the transaction ID is part of the block accepted event. Therefore, it is possible (although not immediately straightforward) to determine which block hash each event is related to.
Online rollback management:
Each time a rollback event is emitted, remove all side effects of the contract events associated with the rolled-back block hash.
Offline rollback management:
On client startup, request the state of blocks for which there are locally non-finalized events. If these blocks are no longer present, remove all side effects of the contract events related to the missing block hash.
Relevant Context (optional)
This issue arises due to the rolling finality PR, which causes events to be emitted before they are finalized.
Clients must manage event rollbacks both online and offline to ensure data consistency.
Possible Solution (optional)
The two proposed solutions are:
Listen only to finalized events by querying the archival node after blocks are finalized.
Accept real-time events and implement both online and offline rollback handling mechanisms.
The text was updated successfully, but these errors were encountered:
Summary
The current behavior emits every event from the VM in real-time with the execution. Due to the rolling finality PR, when an event occurs, it is never immediately finalized. This may cause issues for clients, as they need to manage the rollback of these events' effects.
Detailed Description (optional)
The VM emits events in real-time as they occur. However, based on the rolling finality PR, these events are not finalized immediately. This creates a burden on clients, as they must handle the rollback of effects triggered by these events.
There are two possible solutions:
Accept only finalized events:
Instead of listening to contract events in real-time, a client could listen for the
state_changed
event of a block and, once that block is finalized, query the archival node for the list of events related to that block.Accept real-time events and manage rollbacks:
This approach is more complex because the client needs to handle rollbacks both when online and offline. When a rollback event is emitted, it doesn’t contain information about the relevant contract events. However, every contract event has the transaction ID that originated it, and the transaction ID is part of the
block accepted
event. Therefore, it is possible (although not immediately straightforward) to determine which block hash each event is related to.Online rollback management:
Each time a rollback event is emitted, remove all side effects of the contract events associated with the rolled-back block hash.
Offline rollback management:
On client startup, request the state of blocks for which there are locally non-finalized events. If these blocks are no longer present, remove all side effects of the contract events related to the missing block hash.
Relevant Context (optional)
Possible Solution (optional)
The two proposed solutions are:
The text was updated successfully, but these errors were encountered: