@@ -30,7 +30,7 @@ def __init__(self, data, **kwargs):
3030 self ._table = {
3131 int (k ): v for k , v in json .load (opcode ).items ()}
3232 self ._terminal_ops = ['*STOP' , '*RETURN' , '*REVERT' , '*BALANCE' ]
33- self ._jumps_ops = [" *JUMP" , " *JUMPI" ]
33+ self ._jump_ops = [' *JUMP' , ' *JUMPI' ]
3434
3535 self ._opcodes_func = {
3636 0 : self ._stop ,
@@ -179,7 +179,7 @@ def __init__(self, data, **kwargs):
179179 255 : self ._selfdestruct ,
180180 }
181181
182- def _insert_entry_list_dic (self , dict , k , v ):
182+ def _insert_entry_list_dict (self , dict , k , v ):
183183 if k not in dict :
184184 dict [k ] = []
185185 if v not in dict [k ]:
@@ -271,8 +271,10 @@ def _get_func_ret_vals(self, addr):
271271
272272
273273 def _annotation_jump (self , addr , cond ):
274- return '// Incoming jump from 0x{:04X}' .format (addr ),
275- cond
274+ return (
275+ '// Incoming jump from 0x{:04X}' .format (addr ),
276+ cond
277+ )
276278
277279 def _annotation_call (self ):
278280 return (
@@ -292,8 +294,9 @@ def _annotation_return(self, addr):
292294 None
293295 )
294296 def disassemble (self ):
297+
295298 self ._recursive_run ()
296- self .linear_run ()
299+ self ._linear_run ()
297300 return self ._visited , self ._blocks , self ._func_list
298301
299302 def _recursive_run (self ):
@@ -329,7 +332,7 @@ def _recursive_run(self):
329332 self ._blocks ,
330333 self ._pc ,
331334 # might have to concatenate not into cond
332- self ._annotation_jump (self ._pc - 1 , " not" + str ( cond ) )
335+ self ._annotation_jump (self ._pc - 1 , ' not ' + cond )
333336 )
334337
335338 if type (jump_addr ) != int :
@@ -339,7 +342,7 @@ def _recursive_run(self):
339342 self ._insert_entry_list_dict (
340343 self ._blocks ,
341344 jump_addr ,
342- self ._annotation_call (self . _pc , - 1 , cond )
345+ self ._annotation_call ()
343346 )
344347
345348 else :
@@ -525,8 +528,7 @@ def _mulmod(self):
525528
526529 self ._stack .append ('({} * {}) % {}' .format (operand_1 , operand_2 ,
527530 operand_3 ))
528-
529-
531+
530532 def _exp (self ):
531533 operand_1 = self ._stack_pop ()
532534 operand_2 = self ._stack_pop ()
@@ -884,9 +886,9 @@ def _jumpdest(self):
884886 return
885887
886888 def _push (self ):
887- imm_width = int (self ._table [self ._data [self .pc - 1 ]][4 :])
889+ imm_width = int (self ._table [self ._data [self ._pc - 1 ]][4 :])
888890 imm_val = self ._data [self ._pc :self ._pc + imm_width ].hex ()
889- if len (self ._visited [elf ._pc - 1 ][0 ]) <= 6 :
891+ if len (self ._visited [self ._pc - 1 ][0 ]) <= 6 :
890892 self ._visited [self ._pc - 1 ][0 ] += '0x{}' .format (imm_val )
891893 self ._stack .append (int (imm_val , 16 ))
892894 self ._pc += imm_width
0 commit comments