Commit 063e52ac authored by clabby's avatar clabby

chore: Upgrade `MIPS.sol` solc version

parent 6020e6b7
This diff is collapsed.
This diff is collapsed.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.7.6; pragma solidity 0.8.15;
/// @title PreimageKeyLib /// @title PreimageKeyLib
/// @notice Shared utilities for localizing local keys in the preimage oracle. /// @notice Shared utilities for localizing local keys in the preimage oracle.
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.7.6; pragma solidity 0.8.15;
import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol";
import { PreimageKeyLib } from "./PreimageKeyLib.sol"; import { PreimageKeyLib } from "./PreimageKeyLib.sol";
/// @title PreimageOracle /// @title PreimageOracle
/// @notice A contract for storing permissioned pre-images. /// @notice A contract for storing permissioned pre-images.
contract PreimageOracle { contract PreimageOracle is IPreimageOracle {
/// @notice Mapping of pre-image keys to pre-image lengths. /// @notice Mapping of pre-image keys to pre-image lengths.
mapping(bytes32 => uint256) public preimageLengths; mapping(bytes32 => uint256) public preimageLengths;
/// @notice Mapping of pre-image keys to pre-image parts. /// @notice Mapping of pre-image keys to pre-image parts.
...@@ -13,11 +14,7 @@ contract PreimageOracle { ...@@ -13,11 +14,7 @@ contract PreimageOracle {
/// @notice Mapping of pre-image keys to pre-image part offsets. /// @notice Mapping of pre-image keys to pre-image part offsets.
mapping(bytes32 => mapping(uint256 => bool)) public preimagePartOk; mapping(bytes32 => mapping(uint256 => bool)) public preimagePartOk;
/// @notice Reads a pre-image from the oracle. /// @inheritdoc IPreimageOracle
/// @param _key The key of the pre-image to read.
/// @param _offset The offset of the pre-image to read.
/// @return dat_ The pre-image data.
/// @return datLen_ The length of the pre-image data.
function readPreimage(bytes32 _key, uint256 _offset) function readPreimage(bytes32 _key, uint256 _offset)
external external
view view
...@@ -53,24 +50,7 @@ contract PreimageOracle { ...@@ -53,24 +50,7 @@ contract PreimageOracle {
preimageLengths[key] = size; preimageLengths[key] = size;
} }
/// @notice Loads a word of local data into the preimage oracle in two separate parts. /// @inheritdoc IPreimageOracle
/// @param _ident The identifier of the local data.
/// @param _word The local data word.
/// @param _size The number of bytes in `_word` to load.
/// @dev The local data parts are loaded into the preimage oracle under the context
/// of the caller - no other account can write to the caller's context
/// specific data.
///
/// There are 5 local data identifiers:
/// ┌────────────┬────────────────────────┐
/// │ Identifier │ Data │
/// ├────────────┼────────────────────────┤
/// │ 1 │ L1 Head Hash (bytes32) │
/// │ 2 │ Output Root (bytes32) │
/// │ 3 │ Root Claim (bytes32) │
/// │ 4 │ L2 Block Number (u64) │
/// │ 5 │ Chain ID (u64) │
/// └────────────┴────────────────────────┘
function loadLocalData( function loadLocalData(
uint256 _ident, uint256 _ident,
bytes32 _word, bytes32 _word,
...@@ -106,10 +86,7 @@ contract PreimageOracle { ...@@ -106,10 +86,7 @@ contract PreimageOracle {
preimageLengths[key_] = _size; preimageLengths[key_] = _size;
} }
/// @notice Prepares a pre-image to be read by keccak256 key, starting at /// @inheritdoc IPreimageOracle
/// the given offset and up to 32 bytes (clipped at pre-image length, if out of data).
/// @param _partOffset The offset of the pre-image to read.
/// @param _preimage The preimage data.
function loadKeccak256PreimagePart(uint256 _partOffset, bytes calldata _preimage) external { function loadKeccak256PreimagePart(uint256 _partOffset, bytes calldata _preimage) external {
uint256 size; uint256 size;
bytes32 key; bytes32 key;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.7.6; pragma solidity 0.8.15;
/// @title IPreimageOracle /// @title IPreimageOracle
/// @notice Interface for a preimage oracle. /// @notice Interface for a preimage oracle.
...@@ -14,10 +14,29 @@ interface IPreimageOracle { ...@@ -14,10 +14,29 @@ interface IPreimageOracle {
view view
returns (bytes32 dat_, uint256 datLen_); returns (bytes32 dat_, uint256 datLen_);
/// @notice Computes and returns the key for a pre-image. /// @notice Loads a word of local data into the preimage oracle in two separate parts.
/// @param _preimage The pre-image. /// @param _ident The identifier of the local data.
/// @return key_ The pre-image key. /// @param _word The local data word.
function computePreimageKey(bytes calldata _preimage) external pure returns (bytes32 key_); /// @param _size The number of bytes in `_word` to load.
/// @dev The local data parts are loaded into the preimage oracle under the context
/// of the caller - no other account can write to the caller's context
/// specific data.
///
/// There are 5 local data identifiers:
/// ┌────────────┬────────────────────────┐
/// │ Identifier │ Data │
/// ├────────────┼────────────────────────┤
/// │ 1 │ L1 Head Hash (bytes32) │
/// │ 2 │ Output Root (bytes32) │
/// │ 3 │ Root Claim (bytes32) │
/// │ 4 │ L2 Block Number (u64) │
/// │ 5 │ Chain ID (u64) │
/// └────────────┴────────────────────────┘
function loadLocalData(
uint256 _ident,
bytes32 _word,
uint8 _size
) external returns (bytes32 key_);
/// @notice Prepares a preimage to be read by keccak256 key, starting at /// @notice Prepares a preimage to be read by keccak256 key, starting at
/// the given offset and up to 32 bytes (clipped at preimage length, if out of data). /// the given offset and up to 32 bytes (clipped at preimage length, if out of data).
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
import { IPreimageOracle } from "../../cannon/interfaces/IPreimageOracle.sol";
/// @title IBigStepper /// @title IBigStepper
/// @notice An interface for a contract with a state transition function that /// @notice An interface for a contract with a state transition function that
/// will accept a pre state and return a post state. /// will accept a pre state and return a post state.
...@@ -35,14 +37,3 @@ interface IBigStepper { ...@@ -35,14 +37,3 @@ interface IBigStepper {
/// @notice Returns the preimage oracle used by the stepper. /// @notice Returns the preimage oracle used by the stepper.
function oracle() external view returns (IPreimageOracle oracle_); function oracle() external view returns (IPreimageOracle oracle_);
} }
/// @notice Temporary interface for the `IPreimageOracle`. Remove once we've upgraded
/// the cannon contracts to a newer version of solc.
interface IPreimageOracle {
function loadLocalData(
uint256 _ident,
bytes32 _word,
uint256 _size,
uint256 _partOffset
) external returns (bytes32 key_);
}
...@@ -64,6 +64,7 @@ contract AssetReceiver is Transactor { ...@@ -64,6 +64,7 @@ contract AssetReceiver is Transactor {
function withdrawETH(address payable _to, uint256 _amount) public onlyOwner { function withdrawETH(address payable _to, uint256 _amount) public onlyOwner {
// slither-disable-next-line reentrancy-unlimited-gas // slither-disable-next-line reentrancy-unlimited-gas
(bool success, ) = _to.call{ value: _amount }(""); (bool success, ) = _to.call{ value: _amount }("");
success; // Suppress warning; We ignore the low-level call result.
emit WithdrewETH(msg.sender, _to, _amount); emit WithdrewETH(msg.sender, _to, _amount);
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.7.6; pragma solidity 0.8.15;
pragma abicoder v2;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment