We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9dd0508 commit 80e8cc8Copy full SHA for 80e8cc8
src/bridge.rs
@@ -0,0 +1,18 @@
1
+use crate::state_machine::{IntentState, TransitionEvent};
2
+use crate::proof::CompletionProof;
3
+pub fn apply_completion_proof(
4
+ state: IntentState,
5
+ proof: &CompletionProof,
6
+) -> Result<IntentState, &'static str> {
7
+ if state != IntentState::Committed {
8
+ return Err("Completion proof can only be applied in Committed state");
9
+ }
10
+
11
+ let event = if proof.validate().is_ok() {
12
+ TransitionEvent::CompletionProofVerified
13
+ } else {
14
+ TransitionEvent::ProofInvalid
15
+ };
16
17
+ state.transition(event)
18
+}
0 commit comments