Skip to content

Commit

Permalink
Add solidity test for revert case
Browse files Browse the repository at this point in the history
  • Loading branch information
mininny committed Dec 16, 2024
1 parent 81622bb commit da9d3e2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rvsol/test/RISCV.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2460,6 +2460,18 @@ contract RISCV_Test is CommonTest {
riscv.step(encodedState, proof, 0);
}

function test_revert_reserved_slliw_instruction() public {
uint16 shamt = 0x15;
uint16 imm = (0 << 7) | shamt | 0x20; // set 0x20 to make imm[5] != 0
uint32 insn = encodeIType(0x1b, 17, 1, 25, imm); // slliw x17, x25, 0x15
(State memory state, bytes memory proof) = constructRISCVState(0, insn);
state.registers[25] = 0xf956;
bytes memory encodedState = encodeState(state);

vm.expectRevert(hex"00000000000000000000000000000000000000000000000000000000f001ca11");
riscv.step(encodedState, proof, 0);
}

/* Helper methods */

function encodeState(State memory state) internal pure returns (bytes memory) {
Expand Down

0 comments on commit da9d3e2

Please sign in to comment.