Skip to content

Commit

Permalink
maint: add interfaces for cannon contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcontracts committed Aug 27, 2024
1 parent ebdae42 commit e66cdd6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/contracts-bedrock/src/cannon/interfaces/IMIPS.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import { ISemver } from "src/universal/ISemver.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";

/// @title IMIPS
/// @notice Interface for MIPS.
interface IMIPS is ISemver {
/// @notice Getter for the pre-image oracle contract.
/// @return oracle_ The PreimageOracle contract.
function oracle() external view returns (IPreimageOracle oracle_);

/// @notice Executes a single step of the VM.
/// Will revert if any required input state is missing.
/// @param _stateData The encoded state witness data.
/// @param _proof The encoded proof data for leaves within the MIPS VM's memory.
/// @param _localContext The local key context for the preimage oracle. Optional, can be set as a constant
/// if the caller only requires one set of local keys.
/// @return The hashed MIPS state.
function step(bytes calldata _stateData, bytes calldata _proof, bytes32 _localContext) external returns (bytes32);
}
19 changes: 19 additions & 0 deletions packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import { ISemver } from "src/universal/ISemver.sol";

/// @title IMIPS2
/// @notice Interface for MIPS2.
interface IMIPS2 is ISemver {
/// @notice Executes a single step of the multi-threaded vm.
/// Will revert if any required input state is missing.
/// @param _stateData The encoded state witness data.
/// @param _proof The encoded proof data: <<thread_context, inner_root>, <memory proof>.
/// Contains the thread context witness and the memory proof data for leaves within the MIPS VM's memory.
/// The thread context witness is a packed tuple of the thread context and the immediate inner root of the current thread stack.
/// @param _localContext The local key context for the preimage oracle. Optional, can be set as a constant
/// if the caller only requires one set of local keys.
function step(bytes calldata _stateData, bytes calldata _proof, bytes32 _localContext) external returns (bytes32);
}

0 comments on commit e66cdd6

Please sign in to comment.