Skip to content
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

Tests for branch in delay slot are incomplete (and not needed) #13441

Open
BlocksOnAChain opened this issue Dec 17, 2024 · 0 comments
Open

Tests for branch in delay slot are incomplete (and not needed) #13441

BlocksOnAChain opened this issue Dec 17, 2024 · 0 comments
Labels
MT cannon - audit findings grouping for audit findings MT cannon - Mainnet relevant issues needed to complete the work for our Mainnet release

Comments

@BlocksOnAChain
Copy link

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) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MT cannon - audit findings grouping for audit findings MT cannon - Mainnet relevant issues needed to complete the work for our Mainnet release
Projects
Development

No branches or pull requests

1 participant