Skip to content

Commit cbff758

Browse files
committed
base myhril package, py-ecc-410 and eth-utils-110
1 parent a92d885 commit cbff758

File tree

3 files changed

+221
-6
lines changed

3 files changed

+221
-6
lines changed

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

overlay.nix

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
_finalNixpkgs: prevNixpkgs: let
2+
solana-rust-artifacts = prevNixpkgs.callPackage ./packages/solana-rust-artifacts {};
3+
4+
solana-bpf-tools = prevNixpkgs.callPackage ./packages/solana-bpf-tools {};
5+
6+
solana-full-sdk = prevNixpkgs.callPackage ./packages/solana-full-sdk {
7+
inherit solana-rust-artifacts solana-bpf-tools;
8+
};
9+
10+
cosmos-theta-testnet = prevNixpkgs.callPackage ./packages/cosmos-theta-testnet {};
11+
12+
circom = prevNixpkgs.callPackage ./packages/circom/default.nix {};
13+
circ = prevNixpkgs.callPackage ./packages/circ/default.nix {};
14+
15+
wasmd = prevNixpkgs.callPackage ./packages/wasmd/default.nix {};
16+
17+
# erdpy depends on cattrs >= 22.2
18+
cattrs22-2 = prevNixpkgs.python3Packages.cattrs.overrideAttrs (finalAttrs: previousAttrs: {
19+
version = "22.2.0";
20+
21+
src = prevNixpkgs.fetchFromGitHub {
22+
owner = "python-attrs";
23+
repo = "cattrs";
24+
rev = "v22.2.0";
25+
hash = "sha256-Qnrq/mIA/t0mur6IAen4vTmMIhILWS6v5nuf+Via2hA=";
26+
};
27+
28+
patches = [];
29+
});
30+
31+
# https://discourse.nixos.org/t/inconsistent-vendoring-in-buildgomodule-when-overriding-source/9225/6
32+
go-ethereum-capella = prevNixpkgs.go-ethereum.override rec {
33+
buildGoModule = args:
34+
prevNixpkgs.buildGoModule (args
35+
// {
36+
version = "1.11.1";
37+
src = prevNixpkgs.fetchFromGitHub {
38+
owner = "ethereum";
39+
repo = "go-ethereum";
40+
rev = "v1.11.1";
41+
sha256 = "sha256-mYLxwJ0oiKfiz+NZ5bnlY0h2uq5wbeQKrwoCCw23Bg0=";
42+
};
43+
subPackages = builtins.filter (x: x != "cmd/puppeth") args.subPackages;
44+
vendorSha256 = "sha256-6yLkeT5DrAPUohAmobssKkvxgXI8kACxiu17WYbw+n0=";
45+
});
46+
};
47+
48+
# copied from https://github.com/NixOS/nixpkgs/blob/8df7949791250b580220eb266e72e77211bedad9/pkgs/development/python-modules/cryptography/default.nix
49+
cryptography36 = prevNixpkgs.callPackage ./packages/python-modules/cryptography36/default.nix {};
50+
51+
ledgercomm = prevNixpkgs.callPackage ./packages/python-modules/ledgercomm/default.nix {};
52+
requests-cache = prevNixpkgs.callPackage ./packages/python-modules/requests-cache/default.nix {};
53+
54+
erdpy = prevNixpkgs.callPackage ./packages/erdpy/default.nix {};
55+
elrond-go = prevNixpkgs.callPackage ./packages/elrond-go/default.nix {};
56+
elrond-proxy-go = prevNixpkgs.callPackage ./packages/elrond-proxy-go/default.nix {};
57+
58+
go-opera = prevNixpkgs.callPackage ./packages/go-opera/default.nix {};
59+
60+
leap = prevNixpkgs.callPackage ./packages/leap/default.nix {};
61+
eos-vm = prevNixpkgs.callPackage ./packages/eos-vm/default.nix {};
62+
cdt = prevNixpkgs.callPackage ./packages/cdt/default.nix {};
63+
64+
nimbus = prevNixpkgs.callPackage ./packages/nimbus/default.nix {};
65+
66+
pistache = prevNixpkgs.callPackage ./packages/pistache/default.nix {};
67+
ffiasm-src = prevNixpkgs.callPackage ./packages/ffiasm/src.nix {};
68+
zqfield = prevNixpkgs.callPackage ./packages/ffiasm/zqfield.nix {
69+
inherit ffiasm-src;
70+
};
71+
# Pairing Groups on BN-254, aka alt_bn128
72+
# Source:
73+
# https://zips.z.cash/protocol/protocol.pdf (section 5.4.9.1)
74+
# See also:
75+
# https://eips.ethereum.org/EIPS/eip-196
76+
# https://eips.ethereum.org/EIPS/eip-197
77+
# https://hackmd.io/@aztec-network/ByzgNxBfd
78+
# https://hackmd.io/@jpw/bn254
79+
zqfield-bn254 = prevNixpkgs.symlinkJoin {
80+
name = "zqfield-bn254";
81+
paths = [
82+
(zqfield {
83+
primeNumber = "21888242871839275222246405745257275088696311157297823662689037894645226208583";
84+
name = "Fq";
85+
})
86+
(zqfield
87+
{
88+
primeNumber = "21888242871839275222246405745257275088548364400416034343698204186575808495617";
89+
name = "Fr";
90+
})
91+
];
92+
};
93+
ffiasm = prevNixpkgs.callPackage ./packages/ffiasm/default.nix {
94+
inherit ffiasm-src zqfield-bn254;
95+
};
96+
circom_runtime = prevNixpkgs.callPackage ./packages/circom_runtime/default.nix {};
97+
rapidsnark = prevNixpkgs.callPackage ./packages/rapidsnark/default.nix {
98+
inherit ffiasm zqfield-bn254;
99+
};
100+
rapidsnark-server = prevNixpkgs.callPackage ./packages/rapidsnark-server/default.nix {
101+
inherit ffiasm zqfield-bn254 rapidsnark pistache;
102+
};
103+
104+
py-ecc-410 = prevNixpkgs.python3Packages.py-ecc.overrideAttrs (finalAttrs: previousAttrs: {
105+
version = "4.1.0";
106+
107+
src = prevNixpkgs.fetchFromGitHub {
108+
owner = "ethereum";
109+
repo = "py_ecc";
110+
rev = "v4.1.0";
111+
hash = "sha256-qs4dvfdrl6o74FAst6XBAvzjJ7ZCA58s447aCTGIt2Y=";
112+
};
113+
});
114+
115+
eth-utils-110 = prevNixpkgs.python3Packages.eth-utils.overrideAttrs (finalAttrs: previousAttrs: {
116+
version = "1.10.0";
117+
118+
src = prevNixpkgs.fetchFromGitHub {
119+
owner = "ethereum";
120+
repo = "eth-utils";
121+
rev = "v1.10.0";
122+
sha256 = "sha256-sq3H4HmUFUipqVYleZxWLG1gBsQEoNwcZAXiKckacek=";
123+
};
124+
});
125+
mythril = prevNixpkgs.callPackage ./packages/python-modules/mythril/default.nix {inherit py-ecc-410 eth-utils-110;};
126+
in {
127+
metacraft-labs = rec {
128+
solana = solana-full-sdk;
129+
inherit cosmos-theta-testnet;
130+
inherit circom;
131+
132+
# Disabled until cvc4 compiles again
133+
# inherit circ;
134+
135+
inherit wasmd;
136+
inherit ledgercomm;
137+
inherit cryptography36;
138+
inherit requests-cache;
139+
inherit erdpy;
140+
inherit cattrs22-2;
141+
142+
# Disabled until elrond-go can build with Go >= 1.19
143+
# inherit elrond-go;
144+
# inherit elrond-proxy-go;
145+
inherit go-opera;
146+
inherit leap;
147+
inherit eos-vm;
148+
inherit cdt;
149+
150+
# Ethereum
151+
inherit nimbus;
152+
inherit go-ethereum-capella;
153+
154+
inherit pistache;
155+
inherit zqfield-bn254;
156+
inherit zqfield;
157+
inherit ffiasm;
158+
inherit circom_runtime;
159+
inherit rapidsnark;
160+
inherit rapidsnark-server;
161+
162+
inherit eth-utils-110 mythril;
163+
};
164+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
lib,
3+
stdenv,
4+
python3Packages,
5+
fetchFromGitHub,
6+
py-ecc-410,
7+
eth-utils-110,
8+
}:
9+
python3Packages.buildPythonPackage rec {
10+
pname = "mythril";
11+
version = "0.23.17";
12+
format = "setuptools";
13+
14+
disabled = python3Packages.pythonOlder "3.6";
15+
16+
src = fetchFromGitHub {
17+
owner = "ConsenSys";
18+
repo = "mythril";
19+
rev = "v${version}";
20+
hash = "sha256-lzxAhaQfiGygxI98x1hWP8wrHVbf9DuZuEnjJcKMRCo=";
21+
};
22+
23+
nativeBuildInputs = [
24+
];
25+
26+
propagatedBuildInputs = with python3Packages; [
27+
py-ecc-410
28+
eth-utils-110
29+
setuptools
30+
];
31+
32+
# postFixup = lib.optionalString withSolc ''
33+
# wrapProgram $out/bin/myhtril \
34+
# --prefix PATH : "${lib.makeBinPath [solc]}"
35+
# '';
36+
37+
# No Python tests
38+
doCheck = false;
39+
40+
meta = with lib; {
41+
description = "Security analysis tool for EVM bytecode.";
42+
longDescription = ''
43+
Mythril is a security analysis tool for EVM bytecode. It detects security vulnerabilities in smart contracts built
44+
for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains. It uses
45+
symbolic execution, SMT solving and taint analysis to detect a variety of security vulnerabilities. It's also used
46+
(in combination with other tools and techniques) in the MythX security analysis platform.
47+
'';
48+
homepage = "https://github.com/ConsenSys/mythril";
49+
license = licenses.mit;
50+
};
51+
}

0 commit comments

Comments
 (0)