Skip to content

Commit

Permalink
Add test for testing invalid proof size on rvsol
Browse files Browse the repository at this point in the history
  • Loading branch information
mininny committed Dec 10, 2024
1 parent 2d5a55e commit 95f2a0e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rvsol/test/RISCV.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2371,11 +2371,21 @@ contract RISCV_Test is CommonTest {
riscv.step(encodedState, proof, 0);
}

function test_invalid_proof_size() public {
uint32 insn = encodeRType(0xff, 0, 0, 0, 0, 0);
(State memory state, bytes memory proof) = constructRISCVState(0, insn);
bytes memory encodedState = encodeState(state);
proof = hex"00"; // Invalid memory proof size

vm.expectRevert();
riscv.step(encodedState, proof, 0);
}

function test_invalid_proof() public {
uint32 insn = encodeRType(0xff, 0, 0, 0, 0, 0);
(State memory state, bytes memory proof) = constructRISCVState(0, insn);
bytes memory encodedState = encodeState(state);
proof = hex"00"; // Invalid memory proof
proof = hex"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; // Invalid memory proof

vm.expectRevert(hex"00000000000000000000000000000000000000000000000000000000badf00d1");
riscv.step(encodedState, proof, 0);
Expand Down

0 comments on commit 95f2a0e

Please sign in to comment.