diff --git a/bin/client/src/interop/consolidate.rs b/bin/client/src/interop/consolidate.rs
index 14cbe282..9a027094 100644
--- a/bin/client/src/interop/consolidate.rs
+++ b/bin/client/src/interop/consolidate.rs
@@ -6,8 +6,9 @@ use core::fmt::Debug;
use kona_interop::MessageGraph;
use kona_preimage::{HintWriterClient, PreimageOracleClient};
use kona_proof::CachingOracle;
-use kona_proof_interop::{OracleInteropProvider, PreState};
+use kona_proof_interop::{BootInfo, OracleInteropProvider, PreState};
use revm::primitives::HashMap;
+use tracing::info;
/// Executes the consolidation phase of the interop proof with the given [PreimageOracleClient] and
/// [HintWriterClient].
@@ -18,6 +19,7 @@ use revm::primitives::HashMap;
/// [OptimisticBlock]: kona_proof_interop::OptimisticBlock
pub(crate) async fn consolidate_dependencies
(
oracle: Arc>,
+ boot: BootInfo,
pre: PreState,
) -> Result<(), FaultProofProgramError>
where
@@ -26,15 +28,17 @@ where
{
let provider = OracleInteropProvider::new(oracle, pre.clone());
+ info!(target: "client_interop", "Deriving local-safe headers from prestate");
+
// Ensure that the pre-state is a transition state.
- let PreState::TransitionState(transition_state) = pre else {
+ let PreState::TransitionState(ref transition_state) = pre else {
return Err(FaultProofProgramError::StateTransitionFailed);
};
let block_hashes = transition_state
.pending_progress
.iter()
- .zip(transition_state.pre_state.output_roots)
+ .zip(transition_state.pre_state.output_roots.iter())
.map(|(optimistic_block, pre_state)| (pre_state.chain_id, optimistic_block.block_hash))
.collect::>();
@@ -44,8 +48,23 @@ where
headers.push((chain_id, header.seal(block_hash)));
}
+ info!(target: "client_interop", "Loaded {} local-safe headers", headers.len());
+
+ // TODO: Re-execution w/ bad blocks. Not complete, we just panic if any deps are invalid atm.
let graph = MessageGraph::derive(headers.as_slice(), provider).await.unwrap();
graph.resolve().await.unwrap();
+ // Transition to the Super Root at the next timestamp.
+ //
+ // TODO: This won't work if we replace blocks, `transition` doesn't allow replacement of pending progress
+ // just yet.
+ let post = pre.transition(None).ok_or(FaultProofProgramError::StateTransitionFailed)?;
+ let post_commitment = post.hash();
+
+ // Ensure that the post-state matches the claimed post-state.
+ if post_commitment != boot.claimed_post_state {
+ return Err(FaultProofProgramError::InvalidClaim(boot.claimed_post_state, post_commitment));
+ }
+
Ok(())
}
diff --git a/bin/client/src/interop/mod.rs b/bin/client/src/interop/mod.rs
index 18b9305b..73a550ea 100644
--- a/bin/client/src/interop/mod.rs
+++ b/bin/client/src/interop/mod.rs
@@ -91,7 +91,7 @@ where
if transition_state.step < TRANSITION_STATE_MAX_STEPS {
sub_transition(oracle, handle_register, boot, pre).await
} else {
- consolidate_dependencies(oracle, pre).await
+ consolidate_dependencies(oracle, boot, pre).await
}
}
}