Tests for branch in delay slot are incomplete (and not needed) #13441
Labels
MT cannon - audit findings
grouping for audit findings
MT cannon - Mainnet relevant
issues needed to complete the work for our Mainnet release
Description
The test if (_cpu.nextPC != _cpu.pc + 4), used to detect if there is a jump in the delay slot, has 2 problems:
Will not detect that there is a jump in the delay slot if the previous instruction was a jump to pc + 8;
Is not strictly needed, given the assumption that the guest code is trusted (i.e. that it will not try to exploit differences between this and other MIPS implementations to cause the execution to diverge).\
Recommendation:
Remove the tests.
packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol
if (_cpu.nextPC != _cpu.pc + 4) {
packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol
if (_cpu.nextPC != _cpu.pc + 4) {
The text was updated successfully, but these errors were encountered: