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
e5a2cb80
Commit
e5a2cb80
authored
Oct 09, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a few comments and TODOs
parent
e7e88805
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
MIPSMemory.sol
contracts/MIPSMemory.sol
+4
-0
No files found.
contracts/MIPSMemory.sol
View file @
e5a2cb80
...
@@ -17,6 +17,7 @@ contract MIPSMemory {
...
@@ -17,6 +17,7 @@ contract MIPSMemory {
// one per owner (at a time)
// one per owner (at a time)
mapping(address => uint64[25]) public largePreimage;
mapping(address => uint64[25]) public largePreimage;
// TODO: also track the offset into the largePreimage to know what to store
function AddLargePreimageInit() public {
function AddLargePreimageInit() public {
Lib_Keccak256.CTX memory c;
Lib_Keccak256.CTX memory c;
...
@@ -24,6 +25,8 @@ contract MIPSMemory {
...
@@ -24,6 +25,8 @@ contract MIPSMemory {
largePreimage[msg.sender] = c.A;
largePreimage[msg.sender] = c.A;
}
}
// TODO: input 136 bytes, as many times as you'd like
// Uses about 1M gas, 7352 gas/byte
function AddLargePreimageUpdate(uint64[17] calldata data) public {
function AddLargePreimageUpdate(uint64[17] calldata data) public {
// sha3_process_block
// sha3_process_block
Lib_Keccak256.CTX memory c;
Lib_Keccak256.CTX memory c;
...
@@ -35,6 +38,7 @@ contract MIPSMemory {
...
@@ -35,6 +38,7 @@ contract MIPSMemory {
largePreimage[msg.sender] = c.A;
largePreimage[msg.sender] = c.A;
}
}
// TODO: input <136 bytes and do the end of hash | 0x01 / | 0x80
function AddLargePreimageFinal() public view returns (bytes32) {
function AddLargePreimageFinal() public view returns (bytes32) {
Lib_Keccak256.CTX memory c;
Lib_Keccak256.CTX memory c;
c.A = largePreimage[msg.sender];
c.A = largePreimage[msg.sender];
...
...
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