Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove annoying pysha dependency #8

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions greed/TAC/TAC_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import json
import logging
import os
import sha3

from eth_utils import keccak

from ast import literal_eval
from collections import defaultdict
Expand Down Expand Up @@ -291,9 +292,8 @@ def parse_abi(self):
funcs = [e for e in abi if e['type'] == 'function']
for f in funcs:
f_proto = f['name'] + '(' + ",".join([i['internalType'] for i in f['inputs']]) + ')'
k = sha3.keccak_256()
k.update(f_proto.encode('utf-8'))
sig_to_name[f"0x{k.hexdigest()[0:8]}"] = f_proto
hexdigest = bytes(keccak(f_proto.encode('utf-8'))).hex()
sig_to_name[f"0x{hexdigest[0:8]}"] = f_proto

# Set the function names
for f in self.factory.project.function_at.values():
Expand Down
3 changes: 1 addition & 2 deletions greed/TAC/special_ops.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

import sha3
from eth_utils import keccak

from greed import options
from greed.utils import encoding
Expand Down Expand Up @@ -60,7 +60,6 @@ def handle(self, state: SymbolicEVMState):
log.debug(f" Cannot calculate concrete SHA3 for {new_sha.symbol.name} due to multiple SHA solutions")
else:
# Everything has only one solution, we can calculate the SHA
keccak256 = sha3.keccak_256()
buffer_sol = bv_unsigned_value(buffer_sol).to_bytes(bv_unsigned_value(size_sol), 'big')

# Constraining the SHA3 input buffer to the solution just calculated
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
install_requires=[
'ipython>=7.16.3',
'networkx>=2.5.1',
'pysha3>=1.0.2',
'pytest==7.2.1',
'solc-select>=0.2.1',
'sympy>=1.9',
Expand Down
Loading