Skip to main content

charms/
lib.rs

1pub mod app;
2pub mod cli;
3pub mod script;
4pub mod spell;
5pub mod tx;
6pub mod utils;
7
8pub use charms_proof_wrapper::SPELL_CHECKER_VK;
9
10/// RISC-V binary compiled from `charms-spell-checker`.
11pub const SPELL_CHECKER_BINARY: &[u8] = include_bytes!("./bin/charms-spell-checker");
12/// RISC-V binary compiled from `charms-proof-wrapper`.
13pub const PROOF_WRAPPER_BINARY: &[u8] = include_bytes!("./bin/charms-proof-wrapper");
14
15#[cfg(test)]
16mod test {
17    use super::*;
18    use charms_lib::SPELL_VK;
19    use sp1_sdk::{HashableKey, Prover, ProverClient};
20
21    #[test]
22    fn test_spell_vk() {
23        let a = std::fs::metadata("./src/bin/charms-spell-checker")
24            .unwrap()
25            .modified()
26            .unwrap();
27        let b = std::fs::metadata("./src/bin/charms-proof-wrapper")
28            .unwrap()
29            .modified()
30            .unwrap();
31        assert!(
32            a < b,
33            "charms-spell-checker MUST be OLDER than charms-proof-wrapper"
34        );
35
36        let client = ProverClient::builder().cpu().build();
37
38        let (_, vk) = client.setup(PROOF_WRAPPER_BINARY);
39        let s = vk.bytes32();
40        assert_eq!(SPELL_VK, s.as_str());
41    }
42}