Skip to content

Commit f4648d4

Browse files
committed
Import VMStatus from DisputeTypes.sol
1 parent c72af6a commit f4648d4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

rvsol/test/RISCV.t.sol

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import {Test} from "forge-std/Test.sol";
44
import {RISCV} from "src/RISCV.sol";
55
import {PreimageOracle} from "@optimism/src/cannon/PreimageOracle.sol";
66
import {CommonTest} from "./CommonTest.sol";
7-
// FIXME: somehow this import gives a multiple declaration error
8-
// This import is for the VMStatus
9-
// import "@optimism/src/libraries/DisputeTypes.sol";
7+
import "@optimism/src/libraries/DisputeTypes.sol";
108

119
contract RISCV_Test is CommonTest {
1210
/// @notice Stores the VM state.
@@ -2385,22 +2383,21 @@ contract RISCV_Test is CommonTest {
23852383
/// 1. Exited with success (Invalid)
23862384
/// 2. Exited with failure (Panic)
23872385
/// 3. Unfinished
2388-
// TODO: import DisputeTypes.sol. For some reason, import is not working
2389-
function vmStatus(State memory state) internal pure returns (uint8 out_) {
2386+
function vmStatus(State memory state) internal pure returns (VMStatus out_) {
23902387
if (!state.exited) {
2391-
return 3; // VMStatuses.UNFINISHED
2388+
return VMStatuses.UNFINISHED;
23922389
} else if (state.exitCode == 0) {
2393-
return 0; // VMStatuses.VALID
2390+
return VMStatuses.VALID;
23942391
} else if (state.exitCode == 1) {
2395-
return 1; // VMStatuses.INVALID
2392+
return VMStatuses.INVALID;
23962393
} else {
2397-
return 2; // VMStatuses.PANIC
2394+
return VMStatuses.PANIC;
23982395
}
23992396
}
24002397

24012398
function outputState(State memory state) internal pure returns (bytes32 out_) {
24022399
bytes memory enc = encodeState(state);
2403-
uint8 status = vmStatus(state);
2400+
VMStatus status = vmStatus(state);
24042401
assembly {
24052402
out_ := keccak256(add(enc, 0x20), 362)
24062403
out_ := or(and(not(shl(248, 0xFF)), out_), shl(248, status))

0 commit comments

Comments
 (0)