Most of OP constants are not used #13440
Labels
MT cannon - audit findings
grouping for audit findings
MT cannon - Mainnet relevant
issues needed to complete the work for our Mainnet release
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) {
The text was updated successfully, but these errors were encountered: