From e66cdd6238544f4b0442e8ede32af8955096fce7 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Tue, 27 Aug 2024 19:41:10 -0400 Subject: [PATCH] maint: add interfaces for cannon contracts --- .../src/cannon/interfaces/IMIPS.sol | 22 +++++++++++++++++++ .../src/cannon/interfaces/IMIPS2.sol | 19 ++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 packages/contracts-bedrock/src/cannon/interfaces/IMIPS.sol create mode 100644 packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol diff --git a/packages/contracts-bedrock/src/cannon/interfaces/IMIPS.sol b/packages/contracts-bedrock/src/cannon/interfaces/IMIPS.sol new file mode 100644 index 0000000000000..139a01d81be18 --- /dev/null +++ b/packages/contracts-bedrock/src/cannon/interfaces/IMIPS.sol @@ -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); +} diff --git a/packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol b/packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol new file mode 100644 index 0000000000000..bbc9edb0d4350 --- /dev/null +++ b/packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol @@ -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: <, . + /// 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); +}