-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arbitrum Stylus #170
Arbitrum Stylus #170
Conversation
User Programs (copied from stylus repo)
Stylus Memory Model
Stylus master 6/20/22
Nitro master `ca73cbc`
Remove blockhash and difficulty from unit tests
Block benchmarks
* Change cost to per eighth of a kb * Add getter for call scalar
Stylus hostio timings
SDK Storage Tests
} | ||
|
||
uint256 lastProvedLeafIdx = ~uint256(0); | ||
bytes32 lastProvedLeafContents; |
Check warning
Code scanning / Slither
Uninitialized local variables Medium
src/challenge/ChallengeLib.sol
Outdated
@@ -62,16 +64,21 @@ | |||
ValueStack memory values = ValueStack({proved: valuesArray, remainingHash: 0}); | |||
ValueStack memory internalStack; | |||
StackFrameWindow memory frameStack; | |||
MultiStack memory emptyMultiStack; |
Check warning
Code scanning / Slither
Uninitialized local variables Medium
function executeLinkModule( | ||
ExecutionContext calldata, | ||
Machine memory mach, | ||
Module memory mod, | ||
Instruction calldata, | ||
bytes calldata proof | ||
) internal pure { | ||
string memory prefix = "Module merkle tree:"; | ||
bytes32 root = mach.modulesRoot; | ||
|
||
uint256 pointer = mach.valueStack.pop().assumeI32(); | ||
if (!mod.moduleMemory.isValidLeaf(pointer)) { | ||
mach.status = MachineStatus.ERRORED; | ||
return; | ||
} | ||
(bytes32 userMod, uint256 offset, ) = mod.moduleMemory.proveLeaf( | ||
pointer / LEAF_SIZE, | ||
proof, | ||
0 | ||
); | ||
|
||
(uint256 leaf, , MerkleProof memory zeroProof) = proveLastLeaf(mach, offset, proof); | ||
|
||
bool balanced = isPowerOfTwo(leaf + 1); | ||
if (balanced) { | ||
mach.modulesRoot = MerkleProofLib.growToNewRoot(root, leaf + 1, userMod, 0, prefix); | ||
} else { | ||
mach.modulesRoot = zeroProof.computeRootUnsafe(leaf + 1, userMod, prefix); | ||
} | ||
|
||
mach.valueStack.push(ValueLib.newI32(uint32(leaf + 1))); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
function executeSwitchCoThread( | ||
ExecutionContext calldata, | ||
Machine memory mach, | ||
Module memory, | ||
Instruction calldata inst, | ||
bytes calldata | ||
) internal pure { | ||
if (mach.frameMultiStack.inactiveStackHash == MultiStackLib.NO_STACK_HASH) { | ||
// cannot switch cothread if there isn't one | ||
mach.status = MachineStatus.ERRORED; | ||
return; | ||
} | ||
if (inst.argumentData == 0) { | ||
if (mach.recoveryPc == MachineLib.NO_RECOVERY_PC) { | ||
// switching to main thread, from main thread | ||
mach.status = MachineStatus.ERRORED; | ||
return; | ||
} | ||
mach.recoveryPc = MachineLib.NO_RECOVERY_PC; | ||
} else { | ||
if (mach.recoveryPc != MachineLib.NO_RECOVERY_PC) { | ||
// switching from cothread to cothread | ||
mach.status = MachineStatus.ERRORED; | ||
return; | ||
} | ||
mach.setRecoveryFromPc(uint32(inst.argumentData)); | ||
} | ||
mach.switchCoThreadStacks(); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
Add unit test for conditional OSP
Unique Module Hashes
This is a temporary measure until OffchainLabs/nitro-contracts#170 is merged.
This PR adds support for Arbitrum Stylus, which is slated to go live as part of ArbOS 30 pending DAO approval.