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
9f84a4e3
Unverified
Commit
9f84a4e3
authored
Nov 29, 2024
by
Michael Amadi
Committed by
GitHub
Nov 29, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix mip2 test stack too deep error (#13138)
parent
8118fff7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
MIPS2.t.sol
packages/contracts-bedrock/test/cannon/MIPS2.t.sol
+12
-21
No files found.
packages/contracts-bedrock/test/cannon/MIPS2.t.sol
View file @
9f84a4e3
...
...
@@ -789,8 +789,9 @@ contract MIPS2_Test is CommonTest {
vm.expectRevert(InvalidMemoryProof.selector);
mips.step(encodeState(state), bytes.concat(threadWitness, invalidInsnAndMemProof, memProof2), 0);
(, bytes memory invalidMemProof2) =
ffi.getCannonMemoryProof2(pc, insn, timespecAddr, secs + 1, timespecAddr + 4);
uint32 _secs = secs + 1;
uint32 _timespecAddr = timespecAddr + 4;
(, bytes memory invalidMemProof2) = ffi.getCannonMemoryProof2(pc, insn, timespecAddr, _secs, _timespecAddr);
vm.expectRevert(InvalidSecondMemoryProof.selector);
mips.step(encodeState(state), bytes.concat(threadWitness, insnAndMemProof, invalidMemProof2), 0);
}
...
...
@@ -2766,31 +2767,21 @@ contract MIPS2_Test is CommonTest {
}
function encodeState(IMIPS2.State memory _state) internal pure returns (bytes memory) {
// Split up encoding to get around stack-too-deep error
return abi.encodePacked(encodeStateA(_state), encodeStateB(_state));
}
function encodeStateA(IMIPS2.State memory _state) internal pure returns (bytes memory) {
return abi.encodePacked(
bytes memory a = abi.encodePacked(
_state.memRoot,
_state.preimageKey,
_state.preimageOffset,
_state.heap,
_state.llReservationStatus,
_state.llAddress,
_state.llOwnerThread,
_state.exitCode,
_state.exited,
_state.step,
_state.stepsSinceLastContextSwitch,
_state.wakeup,
_state.traverseRight,
_state.leftThreadStack
_state.llAddress
);
}
function encodeStateB(IMIPS2.State memory _state) internal pure returns (bytes memory) {
return abi.encodePacked(_state.rightThreadStack, _state.nextThreadID);
bytes memory b = abi.encodePacked(
_state.llOwnerThread, _state.exitCode, _state.exited, _state.step, _state.stepsSinceLastContextSwitch
);
bytes memory c = abi.encodePacked(
_state.wakeup, _state.traverseRight, _state.leftThreadStack, _state.rightThreadStack, _state.nextThreadID
);
return abi.encodePacked(a, b, c);
}
function copyState(IMIPS2.State memory _state) internal pure returns (IMIPS2.State memory out_) {
...
...
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