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

Most of OP constants are not used #13440

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

Most of OP constants are not used #13440

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
Of all these OP constants defined, only OP_LOAD_DOUBLE_LEFT and OP_LOAD_DOUBLE_RIGHT are used, but only in some places. In others, the values 0x1A and 0x1B` are used directly.

Recommendation
At very least, OP_LOAD_DOUBLE_LEFT and OP_LOAD_DOUBLE_RIGHT should be used whenever possible.

But ideally, all opcodes should have constants to be used though the code, at least on == comparisons, as it would greatly improve the code readability. Even better if the constant names were the same as in the MIPS documentation, e.g. OP_LDR or OP_LDL.

packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol
uint32 internal constant OP_LOAD_LINKED = 0x30;
uint32 internal constant OP_STORE_CONDITIONAL = 0x38;
uint32 internal constant OP_LOAD_LINKED64 = 0x34;
uint32 internal constant OP_STORE_CONDITIONAL64 = 0x3C;
uint32 internal constant OP_LOAD_DOUBLE_LEFT = 0x1A;
uint32 internal constant OP_LOAD_DOUBLE_RIGHT = 0x1B;
packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol
if (_args.opcode == 0x27 || _args.opcode == 0x1A || _args.opcode == 0x1B) {

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