Skip to content

Commit

Permalink
adding tstore and tload. Split for the moment
Browse files Browse the repository at this point in the history
  • Loading branch information
tutugordillo committed Jan 16, 2025
1 parent ba9edd0 commit bd1ab12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/parser/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
split_block = {'calldatacopy', 'create', 'codecopy', 'call', 'log4', 'gas', 'delegatecall', 'extcodecopy', 'create2',
'assignimmutable', 'returndatacopy', 'log2', 'log1', 'log3', 'log0', 'datacopy', 'staticcall'}
'assignimmutable', 'returndatacopy', 'log2', 'log1', 'log3', 'log0', 'datacopy', 'staticcall','tstore','tload'}

terminal_ops = {"functionReturn", "functionReturn", "return", "revert"}

Expand Down
7 changes: 6 additions & 1 deletion src/parser/opcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"JUMPDEST": [0x5b, 0, 0],
"SLOADEXT": [0x5c, 2, 1],
"SSTOREEXT": [0x5d, 3, 0],
"TLOAD": [0x5c, 1, 1],
"TSTORE": [0x5d, 2, 0],
"SLOADBYTESEXT": [0x5c, 4, 0],
"SSTOREBYTESEXT": [0x5d, 4, 0],
"LOG0": [0xa0, 2, 0],
Expand Down Expand Up @@ -295,7 +297,10 @@ def get_ins_cost(opcode, params=None, already=False, store_changed_original_valu
return (GCOST["Gcoldsload"] if not already else 0) + (GCOST["Gwarmaccess"] if store_changed_original_value else GCOST["Gsreset"])
elif opcode == "KECCAK256":
return GCOST["Gsha3"]

elif opcode == "TLOAD":
return 100
elif opcode == "TSTORE":
return 100
elif opcode == "SELFDESTRUCT":
return GCOST["Gsuicide"]
return 0
Expand Down

0 comments on commit bd1ab12

Please sign in to comment.