Commit fde03640 authored by clabby's avatar clabby

Resolve conflicts + add `CannonErrors()`

parent bb006bef
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
/// @notice Thrown when a passed part offset is out of bounds.
error PartOffsetOOB();
...@@ -3,6 +3,7 @@ pragma solidity 0.8.15; ...@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol";
import { PreimageKeyLib } from "./PreimageKeyLib.sol"; import { PreimageKeyLib } from "./PreimageKeyLib.sol";
import "./libraries/CannonErrors.sol";
/// @title PreimageOracle /// @title PreimageOracle
/// @notice A contract for storing permissioned pre-images. /// @notice A contract for storing permissioned pre-images.
...@@ -62,7 +63,7 @@ contract PreimageOracle is IPreimageOracle { ...@@ -62,7 +63,7 @@ contract PreimageOracle is IPreimageOracle {
// Revert if the given part offset is not within bounds. // Revert if the given part offset is not within bounds.
if (_partOffset > _size + 8 || _size > 32) { if (_partOffset > _size + 8 || _size > 32) {
revert("part offset must be within bounds"); revert PartOffsetOOB();
} }
// Prepare the local data part at the given offset // Prepare the local data part at the given offset
...@@ -97,7 +98,10 @@ contract PreimageOracle is IPreimageOracle { ...@@ -97,7 +98,10 @@ contract PreimageOracle is IPreimageOracle {
// revert if part offset > size+8 (i.e. parts must be within bounds) // revert if part offset > size+8 (i.e. parts must be within bounds)
if gt(_partOffset, add(size, 8)) { if gt(_partOffset, add(size, 8)) {
revert(0, 0) // Store "PartOffsetOOB()"
mstore(0, 0xfe254987)
// Revert with "PartOffsetOOB()"
revert(0x1c, 4)
} }
// we leave solidity slots 0x40 and 0x60 untouched, // we leave solidity slots 0x40 and 0x60 untouched,
// and everything after as scratch-memory. // and everything after as scratch-memory.
......
...@@ -35,7 +35,8 @@ interface IPreimageOracle { ...@@ -35,7 +35,8 @@ interface IPreimageOracle {
function loadLocalData( function loadLocalData(
uint256 _ident, uint256 _ident,
bytes32 _word, bytes32 _word,
uint8 _size uint256 _size,
uint256 _partOffset
) external returns (bytes32 key_); ) 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
......
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