From ca9a626d5424e7883c9fafefceacea1e020be7d3 Mon Sep 17 00:00:00 2001 From: Artur Cygan Date: Sun, 18 Oct 2020 22:17:42 +0200 Subject: [PATCH 1/3] pythonPackages.pyevmasm: init at 0.2.3 --- .../python-modules/pyevmasm/default.nix | 30 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/development/python-modules/pyevmasm/default.nix diff --git a/pkgs/development/python-modules/pyevmasm/default.nix b/pkgs/development/python-modules/pyevmasm/default.nix new file mode 100644 index 000000000000..d2923f1ad44a --- /dev/null +++ b/pkgs/development/python-modules/pyevmasm/default.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, future +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "pyevmasm"; + version = "0.2.3"; + + src = fetchFromGitHub { + owner = "crytic"; + repo = pname; + rev = version; + sha256 = "134q0z0dqzxzr0jw5jr98kp90kx2dl0qw9smykwxdgq555q1l6qa"; + }; + + propagatedBuildInputs = [ future ]; + + checkInputs = [ pytestCheckHook ]; + + meta = with lib; { + description = "Ethereum Virtual Machine (EVM) assembler and disassembler"; + homepage = "https://github.com/crytic/pyevmasm"; + changelog = "https://github.com/crytic/pyevmasm/releases/tag/${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ arturcygan ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5ae237047c96..5267e955dbf0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5201,6 +5201,8 @@ in { pyerfa = callPackage ../development/python-modules/pyerfa { }; + pyevmasm = callPackage ../development/python-modules/pyevmasm { }; + pyexcel = callPackage ../development/python-modules/pyexcel { }; pyexcelerator = callPackage ../development/python-modules/pyexcelerator { }; From 0618565e6ff161d7d7b8d4ad40695694882dc3b4 Mon Sep 17 00:00:00 2001 From: Artur Cygan Date: Sun, 18 Oct 2020 22:19:47 +0200 Subject: [PATCH 2/3] pythonPackages.wasm init at 1.2 --- .../python-modules/wasm/default.nix | 27 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/development/python-modules/wasm/default.nix diff --git a/pkgs/development/python-modules/wasm/default.nix b/pkgs/development/python-modules/wasm/default.nix new file mode 100644 index 000000000000..f6c2cc42e387 --- /dev/null +++ b/pkgs/development/python-modules/wasm/default.nix @@ -0,0 +1,27 @@ +{ buildPythonPackage +, fetchPypi +, lib +}: + +buildPythonPackage rec { + pname = "wasm"; + version = "1.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "179xcinfc35xgk0bf9y58kwxzymzk7c1p58w6khmqfiqvb91j3r8"; + }; + + # there are no tests + doCheck = false; + + pythonImportsCheck = [ "wasm" ]; + + meta = with lib; { + description = "WebAssembly decoder and disassembler"; + homepage = "https://github.com/athre0z/wasm"; + changelog = "https://github.com/athre0z/wasm/blob/master/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ arturcygan ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5267e955dbf0..c706c5f05d3a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7903,6 +7903,8 @@ in { wasabi = callPackage ../development/python-modules/wasabi { }; + wasm = callPackage ../development/python-modules/wasm { }; + wasmer = callPackage ../development/python-modules/wasmer { }; watchdog = callPackage ../development/python-modules/watchdog { }; From 9bd0d2fa616c912e9dab3865b22404d891f47839 Mon Sep 17 00:00:00 2001 From: Artur Cygan Date: Sun, 18 Oct 2020 23:26:35 +0200 Subject: [PATCH 3/3] pythonPackages.manticore: init at 0.3.5 --- .../python-modules/manticore/default.nix | 109 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 111 insertions(+) create mode 100644 pkgs/development/python-modules/manticore/default.nix diff --git a/pkgs/development/python-modules/manticore/default.nix b/pkgs/development/python-modules/manticore/default.nix new file mode 100644 index 000000000000..f9ca3afc4b15 --- /dev/null +++ b/pkgs/development/python-modules/manticore/default.nix @@ -0,0 +1,109 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, capstone +, crytic-compile +, ply +, prettytable +, pyelftools +, pyevmasm +, pysha3 +, pyyaml +, rlp +, stdenv +, unicorn +, wasm +, yices +, pytestCheckHook +, z3 +}: + +buildPythonPackage rec { + pname = "manticore"; + version = "0.3.5"; + + src = fetchFromGitHub { + owner = "trailofbits"; + repo = "manticore"; + rev = version; + sha256 = "0z2nhfcraa5dx6srbrw8s11awh2la0x7d88yw9in8g548nv6qa69"; + }; + + propagatedBuildInputs = [ + crytic-compile + ply + prettytable + pyevmasm + pysha3 + pyyaml + rlp + wasm + ] ++ lib.optionals (stdenv.isLinux) [ + capstone + pyelftools + unicorn + ]; + + # Python API is not used in the code, only z3 from PATH + postPatch = '' + sed -ie s/z3-solver// setup.py + ''; + + checkInputs = [ pytestCheckHook ]; + preCheck = "export PATH=${yices}/bin:${z3}/bin:$PATH"; + pytestFlagsArray = [ + "--ignore=tests/ethereum" # TODO: enable when solc works again + "--ignore=tests/ethereum_bench" + ] ++ lib.optionals (!stdenv.isLinux) [ + "--ignore=tests/native" + "--ignore=tests/other/test_locking.py" + ]; + disabledTests = [ + # failing tests + "test_chmod" + "test_timeout" + "test_wasm_main" + # slow tests + "testmprotectFailSymbReading" + "test_ConstraintsForking" + "test_resume" + "test_symbolic" + "test_symbolic_syscall_arg" + "test_state_merging" + "test_decree" + "test_register_comparison" + "test_arguments_assertions_armv7" + "test_integration_basic_stdout" + "test_fclose_linux_amd64" + "test_fileio_linux_amd64" + "test_arguments_assertions_amd64" + "test_ioctl_bogus" + "test_ioctl_socket" + "test_brk_regression" + "test_basic_arm" + "test_logger_verbosity" + "test_profiling_data" + "test_integration_basic_stdin" + "test_getchar" + "test_ccmp_reg" + "test_ld1_mlt_structs" + "test_ccmp_imm" + "test_try_to_allocate_greater_than_last_space_memory_page_12" + "test_not_enough_memory_page_12" + "test_PCMPISTRI_30_symbolic" + "test_ld1_mlt_structs" + "test_time" + "test_implicit_call" + "test_trace" + "test_plugin" + ]; + + meta = with lib; { + description = "Symbolic execution tool for analysis of smart contracts and binaries"; + homepage = "https://github.com/trailofbits/manticore"; + changelog = "https://github.com/trailofbits/manticore/releases/tag/${version}"; + license = licenses.agpl3Only; + platforms = platforms.unix; + maintainers = with maintainers; [ arturcygan ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c706c5f05d3a..41c228801bd2 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3775,6 +3775,8 @@ in { manuel = callPackage ../development/python-modules/manuel { }; + manticore = callPackage ../development/python-modules/manticore { inherit (pkgs) z3; }; + mapbox = callPackage ../development/python-modules/mapbox { }; mapsplotlib = callPackage ../development/python-modules/mapsplotlib { };