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 d43f40a commit f35812f
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_reserved_load_instruction() public {
bytes32 value = hex"61fb11d66dcc9d48";
uint16 offset = 0x6bf;
uint64 addr = 0xd34d + offset;
uint32 insn = encodeIType(0x3, 21, 0x7, 4, offset); // lhu x21, funct 0x7, offset(x4)
(State memory state, bytes memory proof) = constructRISCVState(0, insn, addr, value);
state.registers[4] = 0xd34d;
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 f35812f

Please sign in to comment.