Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
fde03640
Commit
fde03640
authored
Jul 24, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts + add `CannonErrors()`
parent
bb006bef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
CannonErrors.sol
...racts-bedrock/contracts/cannon/libraries/CannonErrors.sol
+5
-0
PreimageOracle.sol
packages/contracts-bedrock/src/cannon/PreimageOracle.sol
+6
-2
IPreimageOracle.sol
...ntracts-bedrock/src/cannon/interfaces/IPreimageOracle.sol
+2
-1
No files found.
packages/contracts-bedrock/contracts/cannon/libraries/CannonErrors.sol
0 → 100644
View file @
fde03640
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
/// @notice Thrown when a passed part offset is out of bounds.
error PartOffsetOOB();
packages/contracts-bedrock/src/cannon/PreimageOracle.sol
View file @
fde03640
...
...
@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol";
import { PreimageKeyLib } from "./PreimageKeyLib.sol";
import "./libraries/CannonErrors.sol";
/// @title PreimageOracle
/// @notice A contract for storing permissioned pre-images.
...
...
@@ -62,7 +63,7 @@ contract PreimageOracle is IPreimageOracle {
// Revert if the given part offset is not within bounds.
if (_partOffset > _size + 8 || _size > 32) {
revert
("part offset must be within bounds"
);
revert
PartOffsetOOB(
);
}
// Prepare the local data part at the given offset
...
...
@@ -97,7 +98,10 @@ contract PreimageOracle is IPreimageOracle {
// revert if part offset > size+8 (i.e. parts must be within bounds)
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,
// and everything after as scratch-memory.
...
...
packages/contracts-bedrock/src/cannon/interfaces/IPreimageOracle.sol
View file @
fde03640
...
...
@@ -35,7 +35,8 @@ interface IPreimageOracle {
function loadLocalData(
uint256 _ident,
bytes32 _word,
uint8 _size
uint256 _size,
uint256 _partOffset
) external returns (bytes32 key_);
/// @notice Prepares a preimage to be read by keccak256 key, starting at
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment