Skip to content

Commit 85dbacc

Browse files
committed
collect push4 instructions from all blocks
1 parent 8498a77 commit 85dbacc

File tree

2 files changed

+48
-22
lines changed

2 files changed

+48
-22
lines changed

ethereumetl/service/eth_contract_service.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ def get_function_sighashes(self, bytecode):
3333
evm_code.disassemble(bytecode)
3434
basic_blocks = evm_code.basicblocks
3535
if basic_blocks and len(basic_blocks) > 0:
36-
init_block = basic_blocks[0]
37-
instructions = init_block.instructions
38-
push4_instructions = [inst for inst in instructions if inst.name == 'PUSH4']
39-
return sorted(list(set('0x' + inst.operand for inst in push4_instructions)))
36+
push4_instructions = set()
37+
for block in basic_blocks:
38+
instructions = block.instructions
39+
block_push4_instructions = [inst for inst in instructions if inst.name == 'PUSH4']
40+
push4_instructions.update(block_push4_instructions)
41+
42+
return sorted(list({'0x' + inst.operand for inst in push4_instructions}))
4043
else:
4144
return []
4245
else:

0 commit comments

Comments
 (0)