I'm generating the cfg of a very simple contract to try heimdall.
everything works fine but I don't understand why heimdall uses offset in the bytecode starting from 0x01 instead of 0x00.
This creates some confusion because, take the example I have in the image, the first block has a jumpi that should point to 0x20. But heimdall shows the jumpdest at offset 0x21 (because of the shifts of the offset). While at offset 0x20 heimdall shows a different opcode (JUMP in this example).
The contract:
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.27;
contract Faucet {
// Give out ether to anyone who asks
function withdraw(uint256 _withdrawAmount, address payable _to) public {
// Limit withdrawal amount
require(_withdrawAmount <= 1000000000000);
// Send the amount to the address that requested it
_to.transfer(_withdrawAmount);
}
fallback() external payable {}
}
I took the runtime bytecode through solc and gave it to heimdall cfg
Component
Heimdall (Core)
Have you ensured that you are up to date?
What version of Heimdall are you on?
heimdall 0.8.4
Operating System
macOS (Apple Silicon)
Describe the bug
I'm generating the cfg of a very simple contract to try heimdall.
everything works fine but I don't understand why heimdall uses offset in the bytecode starting from 0x01 instead of 0x00.
This creates some confusion because, take the example I have in the image, the first block has a jumpi that should point to 0x20. But heimdall shows the jumpdest at offset 0x21 (because of the shifts of the offset). While at offset 0x20 heimdall shows a different opcode (JUMP in this example).
The contract:
I took the runtime bytecode through solc and gave it to heimdall cfg
The graph:
tg discussion here: https://t.me/heimdallsupport/388