Files
papers/lux-fraud-proofs/sections/23-references-implementation-code.tex
zeekay abf99d05fc papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

55 lines
1.2 KiB
TeX

\section{References Implementation Code}
Key implementation snippets for reference:
\begin{lstlisting}[language=C, caption=Bisection Game Implementation (Rust)]
pub struct BisectionGame {
challenger: Address,
defender: Address,
start_state: StateRoot,
end_state: StateRoot,
current_round: u32,
search_space: (u64, u64),
}
impl BisectionGame {
pub fn submit_bisection(
&mut self,
midpoint: u64,
midpoint_hash: Hash,
proof: Vec<u8>,
) -> Result<(), Error> {
// Verify proof
self.verify_bisection_proof(midpoint, midpoint_hash, &proof)?;
// Update search space
self.current_round += 1;
// Check if complete
if self.search_space.1 - self.search_space.0 == 1 {
self.resolve_with_one_step_proof()?;
}
Ok(())
}
fn verify_bisection_proof(
&self,
midpoint: u64,
hash: Hash,
proof: &[u8],
) -> Result<(), Error> {
// Verify Merkle proof
let computed_hash = self.compute_state_hash(midpoint, proof)?;
if computed_hash != hash {
return Err(Error::InvalidProof);
}
Ok(())
}
}
\end{lstlisting}