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
220b0517
Unverified
Commit
220b0517
authored
Jun 16, 2023
by
protolambda
Committed by
GitHub
Jun 16, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #125 from wangtsiao/pr/add_prue_typo
add pure and fix typo 0x44
parents
32c76db4
bd63cb31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
MIPS.sol
contracts/src/MIPS.sol
+3
-3
Oracle.sol
contracts/src/Oracle.sol
+1
-1
No files found.
contracts/src/MIPS.sol
View file @
220b0517
...
...
@@ -308,7 +308,7 @@ contract MIPS {
return outputState();
}
function proofOffset(uint8 proofIndex) internal returns (uint256 offset) {
function proofOffset(uint8 proofIndex) internal
pure
returns (uint256 offset) {
// A proof of 32 bit memory, with 32-byte leaf values, is (32-5)=27 bytes32 entries.
// And the leaf value itself needs to be encoded as well. And proof.offset == 390
offset = 390 + (uint256(proofIndex) * (28*32));
...
...
@@ -318,7 +318,7 @@ contract MIPS {
return offset;
}
function readMem(uint32 addr, uint8 proofIndex) internal returns (uint32 out) {
function readMem(uint32 addr, uint8 proofIndex) internal
pure
returns (uint32 out) {
uint256 offset = proofOffset(proofIndex);
assembly {
if and(addr, 3) { revert(0, 0) } // quick addr alignment check
...
...
@@ -351,7 +351,7 @@ contract MIPS {
}
// writeMem writes the value by first overwriting the part of the leaf, and then recomputing the memory merkle root.
function writeMem(uint32 addr, uint8 proofIndex, uint32 value) internal {
function writeMem(uint32 addr, uint8 proofIndex, uint32 value) internal
pure
{
uint256 offset = proofOffset(proofIndex);
assembly {
if and(addr, 3) { revert(0, 0) } // quick addr alignment check
...
...
contracts/src/Oracle.sol
View file @
220b0517
...
...
@@ -35,7 +35,7 @@ contract Oracle {
bytes32 key;
bytes32 part;
assembly {
size := calldataload(0x44) // len(sig) + len(partOffset) + len(preimage offset) = 4 + 32 + 32 = 0x
6
4
size := calldataload(0x44) // len(sig) + len(partOffset) + len(preimage offset) = 4 + 32 + 32 = 0x
4
4
if iszero(lt(partOffset, add(size, 8))) { // revert if part offset >= size+8 (i.e. parts must be within bounds)
revert(0, 0)
}
...
...
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