3.2 State Transition Monitoring
To register a protocol, please view the steps outlined in the "For Onchain Protocols" section.
--- title: "Figure 3.1: State Transition Monitoring Sequence Diagram" --- %%{ init: { 'theme': 'base', 'themeVariables': { 'primaryColor': '#1e1e2e', 'primaryTextColor': '#cdd6f4', 'primaryBorderColor': '#89b4fa', 'lineColor': '#fab387', 'secondaryColor': '#181825', 'tertiaryColor': '#1e1e2e', "clusterBorder": "#f2cdcd", 'noteTextColor': '#f5e0dc', 'noteBkgColor': '#f5c2e7', 'notesBorderColor': '#cba6f7', 'textColor': '#f5e0dc', 'fontSize': '16px', 'labelTextColor': '#f5e0dc', 'actorBorder': '#89b4fa', 'actorBkg': '#1e1e2e', 'actorTextColor': '#f5e0dc', 'actorLineColor': '#89b4fa', 'signalColor': '#cdd6f4', 'signalTextColor': '#f5e0dc', 'messageTextColor': '#f5e0dc', 'messageLine0TextColor': '#f5e0dc', 'messageLine1TextColor': '#f5e0dc', 'loopTextColor': '#f5e0dc', 'activationBorderColor': '#f5c2e7', 'activationBkgColor': '#1e1e2e', 'sequenceNumberColor': '#1e1e2e' } } }%% sequenceDiagram participant BC as Protocol participant PM as Watcher participant STD as State Transition Detector participant RG as Record Generator BC->>PM: Event signal (e) PM->>STD: Forward Event signal (e) STD->>STD: Reconstruct States (s, s') STD->>STD: Compare States (ΔS) alt δ ≠ 0 STD->>RG: Detected State-Transition (e, s, s') RG->>RG: Hash(s') for h' RG->>RG: Hash(s) for h alt h' ≠ h RG->>RG: Record State-Transition (e, s, s') else h'= h RG->>RG: Discard end else δ = 0 STD->>STD: Discard end
The process follows these steps:
-
Protocol Registration: Protocols are registered with the ASP system, providing their function and event signatures.
-
Event Listening: The Watcher subscribes to signals (event emission) from registered protocols that indicates a state change and forwards the event signal to the State Transition Detector.
-
State Reconstruction:
It is expensive & inefficient for the Observer to reconstruct or store the entire state of the protocol.
and are only state representations / proofs which carry enough information to verify a state-transition with comparator function .
For example: could be a merkle-proof of a state-root, and could be the new state-root.
-
State Comparison: The function is applied to determine if a meaningful state transition has occurred:
Where indicates a state transition.
-
Trigger Record Generation: Tuple is sent to the Record Generator to compose a cryptographic record of the state transition if .
-
Record Generation: The Record Generator hashes the new state and the previous state to create a record of the state transition:
Where and are the hashes of the previous and new states and .