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
ba74f8a8
Unverified
Commit
ba74f8a8
authored
Nov 08, 2024
by
mbaxter
Committed by
GitHub
Nov 08, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cannon: Port step post-checks to MIPS2.sol (#12815)
parent
56624482
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
7 deletions
+45
-7
MIPS2.json
packages/contracts-bedrock/snapshots/abi/MIPS2.json
+1
-1
semver-lock.json
packages/contracts-bedrock/snapshots/semver-lock.json
+2
-2
MIPS2.sol
packages/contracts-bedrock/src/cannon/MIPS2.sol
+35
-3
IMIPS2.sol
packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol
+7
-1
No files found.
packages/contracts-bedrock/snapshots/abi/MIPS2.json
View file @
ba74f8a8
...
...
@@ -45,7 +45,7 @@
"outputs"
:
[
{
"internalType"
:
"bytes32"
,
"name"
:
""
,
"name"
:
"
postState_
"
,
"type"
:
"bytes32"
}
],
...
...
packages/contracts-bedrock/snapshots/semver-lock.json
View file @
ba74f8a8
...
...
@@ -144,8 +144,8 @@
"sourceCodeHash"
:
"0xd8467700c80b3e62fa37193dc6513bac35282094b686b50e162e157f704dde00"
},
"src/cannon/MIPS2.sol"
:
{
"initCodeHash"
:
"0x
aedf0d0b0e94a0c5e7d987331d2fdba84230f5704a6ca33677e70cde7051b17e
"
,
"sourceCodeHash"
:
"0x
9fa2d1297ad1e93b4d3c5c0fed08bedcd8f746807589f0fd3369e79347c6a027
"
"initCodeHash"
:
"0x
c38c76ab3aad78c81ca01b3235b402614972d6604b22fda1e870f1bf47be1194
"
,
"sourceCodeHash"
:
"0x
3d38b1924669d1bde756f1306601c764a6d31f428ac72667a3dd194b3388210d
"
},
"src/cannon/MIPS64.sol"
:
{
"initCodeHash"
:
"0x93aa8d7f9fd3c22276c0d303a3fefdf8f73cc55807b35e483bba64c92d02aaef"
,
...
...
packages/contracts-bedrock/src/cannon/MIPS2.sol
View file @
ba74f8a8
...
...
@@ -60,8 +60,8 @@ contract MIPS2 is ISemver {
}
/// @notice The semantic version of the MIPS2 contract.
/// @custom:semver 1.0.0-beta.2
1
string public constant version = "1.0.0-beta.2
1
";
/// @custom:semver 1.0.0-beta.2
2
string public constant version = "1.0.0-beta.2
2
";
/// @notice The preimage oracle contract.
IPreimageOracle internal immutable ORACLE;
...
...
@@ -102,7 +102,39 @@ contract MIPS2 is ISemver {
/// 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) public returns (bytes32) {
/// @return postState_ The hash of the post state witness after the state transition.
function step(
bytes calldata _stateData,
bytes calldata _proof,
bytes32 _localContext
)
public
returns (bytes32 postState_)
{
postState_ = doStep(_stateData, _proof, _localContext);
assertPostStateChecks();
}
function assertPostStateChecks() internal pure {
State memory state;
assembly {
state := STATE_MEM_OFFSET
}
bytes32 activeStack = state.traverseRight ? state.rightThreadStack : state.leftThreadStack;
if (activeStack == EMPTY_THREAD_ROOT) {
revert("MIPS2: post-state active thread stack is empty");
}
}
function doStep(
bytes calldata _stateData,
bytes calldata _proof,
bytes32 _localContext
)
internal
returns (bytes32)
{
unchecked {
State memory state;
ThreadState memory thread;
...
...
packages/contracts-bedrock/src/cannon/interfaces/IMIPS2.sol
View file @
ba74f8a8
...
...
@@ -46,7 +46,13 @@ interface IMIPS2 is ISemver {
error InvalidRMWInstruction();
function oracle() external view returns (IPreimageOracle oracle_);
function step(bytes memory _stateData, bytes memory _proof, bytes32 _localContext) external returns (bytes32);
function step(
bytes memory _stateData,
bytes memory _proof,
bytes32 _localContext
)
external
returns (bytes32 postState_);
function __constructor__(IPreimageOracle _oracle) external;
}
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