Skip to content

Commit

Permalink
misc: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Jan 7, 2024
1 parent 4aefb39 commit 5ac6ec0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
#os: [windows-2019, macos-10.15, ubuntu-18.04, ubuntu-20.04]
os: [windows-latest, ubuntu-20.04]
python-version: ["3.8", "3.9", "^3"]
python-version: ["3.8", "3.9", "3.11"]
include:
- os: ubuntu-22.04
python-version: 3.9
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ r2libr = { version = "^5.7.4", optional = true }
[tool.poetry.extras]
evm = ["blake2b-py", "eth-keys", "eth-typing", "eth-utils", "eth_abi", "lru-dict", "py-ecc", "rlp", "trie", "numpy", "rich", "cmd2", "eth-hash"]
fuzz = ["unicornafl", "fuzzercorn"]
re = ["r2libr"]
RE = ["r2libr"]

[build-system]
requires = ["poetry-core"]
Expand Down
12 changes: 6 additions & 6 deletions qiling/arch/evm/abi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from eth_abi import encode_abi, decode_abi, encode_single, decode_single
from eth_abi import encode, decode
from eth_utils.abi import collapse_if_tuple
from eth_utils import function_signature_to_4byte_selector, function_abi_to_4byte_selector, decode_hex, encode_hex
from .vm.utils import bytecode_to_bytes
Expand All @@ -20,11 +20,11 @@ def encode_params(datatypes:list, values:list) -> str:
elif isinstance(values[idx], str):
values[idx] = bytecode_to_bytes(values[idx])

return encode_abi(datatypes, values).hex()
return encode(datatypes, values).hex()

@staticmethod
def decode_params(datatypes:list, value:str) -> list:
return decode_abi(datatypes, value)
return decode(datatypes, value)

@staticmethod
def encode_function_call(abi:str, params:list) -> str:
Expand All @@ -33,7 +33,7 @@ def encode_function_call(abi:str, params:list) -> str:
raise ValueError(f'Function signature must contain "(" and ")": {abi}')
signature = function_signature_to_4byte_selector(abi)
inputs = abi[abi.index('('):]
params = encode_single(inputs, params)
params = encode((inputs,), (params,))
return encode_hex(signature + params)

@staticmethod
Expand All @@ -42,5 +42,5 @@ def encode_function_call_abi(abi:dict, params:list) -> str:
inputs = ",".join(
[collapse_if_tuple(abi_input) for abi_input in abi.get("inputs", [])]
)
params = encode_single(f"({inputs})", params)
return encode_hex(signature + params)
params = encode((f"({inputs})",), (params,))
return encode_hex(signature + params)

0 comments on commit 5ac6ec0

Please sign in to comment.