@@ -1899,6 +1899,57 @@ fn test_verify_rejects_inflated_table_counts() {
18991899 ) ;
19001900}
19011901
1902+ /// Proves a program that uses W-suffix instructions (ADDIW, SRLIW) on a
1903+ /// register holding a 64-bit value with non-zero upper 32 bits.
1904+ /// Verifies that the full 64-bit value is preserved in the MEMW_R chain.
1905+ #[ test]
1906+ fn test_prove_wsuffix_64bit ( ) {
1907+ let elf_bytes = crate :: test_utils:: asm_elf_bytes ( "test_wsuffix_64bit" ) ;
1908+ let result = crate :: prove_and_verify ( & elf_bytes) . expect ( "prove_and_verify failed" ) ;
1909+ assert ! ( result, "W-suffix 64-bit register test should verify" ) ;
1910+ }
1911+
1912+ /// Proves a minimal Rust std program that uses `init_allocator()` and
1913+ /// `String::from("Hello World") + commit`. Exercises the full Rust-std stack:
1914+ /// TLSF heap init (SRL on high-bit values), CSR instructions injected by
1915+ /// the Rust toolchain, and the allocator's memory access patterns.
1916+ #[ test]
1917+ fn test_prove_allocator_minimal_reproducer ( ) {
1918+ let _ = env_logger:: builder ( ) . is_test ( true ) . try_init ( ) ;
1919+ let workspace_root = std:: path:: PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) )
1920+ . parent ( )
1921+ . unwrap ( )
1922+ . to_path_buf ( ) ;
1923+ let elf_bytes =
1924+ std:: fs:: read ( workspace_root. join ( "executor/program_artifacts/rust/allocator.elf" ) )
1925+ . expect ( "allocator.elf not found — run `make compile-programs-rust`" ) ;
1926+ let proof = crate :: prove ( & elf_bytes) . expect ( "prove should succeed" ) ;
1927+ assert ! (
1928+ crate :: verify( & proof, & elf_bytes) . expect( "verify should not error" ) ,
1929+ "allocator.elf should verify"
1930+ ) ;
1931+ assert_eq ! ( proof. public_output, b"Hello World" ) ;
1932+ }
1933+
1934+ /// Minimal Rust program that proves: no_std, no_main, no allocator, no
1935+ /// syscalls crate. Only Commit + Halt ecalls (both have receivers).
1936+ #[ test]
1937+ fn test_pure_commit_rust ( ) {
1938+ let workspace_root = std:: path:: PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) )
1939+ . parent ( )
1940+ . unwrap ( )
1941+ . to_path_buf ( ) ;
1942+ let elf_bytes =
1943+ std:: fs:: read ( workspace_root. join ( "executor/program_artifacts/rust/pure_commit.elf" ) )
1944+ . expect ( "pure_commit.elf not found — run `make compile-programs-rust`" ) ;
1945+ let proof = crate :: prove ( & elf_bytes) . expect ( "prove should succeed" ) ;
1946+ assert ! (
1947+ crate :: verify( & proof, & elf_bytes) . expect( "verify should not error" ) ,
1948+ "pure_commit.elf should verify"
1949+ ) ;
1950+ assert_eq ! ( proof. public_output, vec![ 0xAA , 0xBB , 0xCC , 0xDD ] ) ;
1951+ }
1952+
19021953/// Regression test: addiw with negative immediate must verify.
19031954/// arg2_sign_bit is the sign bit of rv2 (bit 31), not of arg2, per spec
19041955/// constraint CPU-CE61: MSB16[arg2_sign_bit; rv2[1]].
0 commit comments