Skip to content

Commit

Permalink
bytecode: decode opcodes with immediate arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Jan 5, 2024
1 parent ed0056e commit 89aa150
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/utils/bytecode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,16 @@ inline std::string decode(bytes_view bytecode)
it += push_data_size;
}
}
else if (size_t imm_data_size = evmone::instr::traits[opcode].immediate_size;
imm_data_size > 0)
{
const auto imm_data_start = it + 1;
imm_data_size = std::min(static_cast<std::size_t>(imm_data_size),
static_cast<std::size_t>(bytecode.end() - imm_data_start));

Check warning on line 601 in test/utils/bytecode.hpp

View check run for this annotation

Codecov / codecov/patch

test/utils/bytecode.hpp#L599-L601

Added lines #L599 - L601 were not covered by tests

s += " + \"" + hex({&*imm_data_start, imm_data_size}) + '"';
it += imm_data_size;

Check warning on line 604 in test/utils/bytecode.hpp

View check run for this annotation

Codecov / codecov/patch

test/utils/bytecode.hpp#L603-L604

Added lines #L603 - L604 were not covered by tests
}
}
else
s += " + \"" + hex(opcode) + '"';
Expand Down

0 comments on commit 89aa150

Please sign in to comment.