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
df3e5674
Unverified
Commit
df3e5674
authored
Jun 27, 2023
by
protolambda
Committed by
inphi
Jun 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cannon: fix preimage memory alignment issue
parent
317028c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
MIPS.sol
packages/contracts-bedrock/contracts/cannon/MIPS.sol
+2
-2
No files found.
packages/contracts-bedrock/contracts/cannon/MIPS.sol
View file @
df3e5674
...
@@ -145,9 +145,9 @@ contract MIPS {
...
@@ -145,9 +145,9 @@ contract MIPS {
if lt(space, datLen) { datLen := space } // if less space than data, shorten data
if lt(space, datLen) { datLen := space } // if less space than data, shorten data
if lt(a2, datLen) { datLen := a2 } // if requested to read less, read less
if lt(a2, datLen) { datLen := a2 } // if requested to read less, read less
dat := shr(sub(256, mul(datLen, 8)), dat) // right-align data
dat := shr(sub(256, mul(datLen, 8)), dat) // right-align data
dat := shl(mul(a
lignment
, 8), dat) // position data to insert into memory word
dat := shl(mul(a
dd(sub(4, datLen), alignment)
, 8), dat) // position data to insert into memory word
let mask := sub(shl(mul(sub(4, alignment), 8), 1), 1) // mask all bytes after start
let mask := sub(shl(mul(sub(4, alignment), 8), 1), 1) // mask all bytes after start
let suffixMask := sub(shl(mul(
add
(sub(4, alignment), datLen), 8), 1), 1) // mask of all bytes starting from end, maybe none
let suffixMask := sub(shl(mul(
sub
(sub(4, alignment), datLen), 8), 1), 1) // mask of all bytes starting from end, maybe none
mask := and(mask, not(suffixMask)) // reduce mask to just cover the data we insert
mask := and(mask, not(suffixMask)) // reduce mask to just cover the data we insert
mem := or(and(mem, not(mask)), dat) // clear masked part of original memory, and insert data
mem := or(and(mem, not(mask)), dat) // clear masked part of original memory, and insert data
}
}
...
...
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