This commit is contained in:
Louis Bettens 2022-11-18 22:48:12 +01:00
commit ae632523b8
20 changed files with 1583 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.direnv
result*

9
default.nix Normal file
View File

@ -0,0 +1,9 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
inherit (lock.nodes.flake-compat.locked) rev narHash;
flake-compat = fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
sha256 = narHash;
};
in
(import flake-compat {src = ./.;}).defaultNix

77
flake.lock Normal file
View File

@ -0,0 +1,77 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"fup": {
"inputs": {
"flake-utils": "flake-utils"
},
"locked": {
"lastModified": 1638172912,
"narHash": "sha256-jxhQGNEsZTdop/Br3JPS+xmBf6t9cIWRzVZFxbT76Rw=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "166d6ebd9f0de03afc98060ac92cba9c71cfe550",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"ref": "v1.3.1",
"repo": "flake-utils-plus",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1668681245,
"narHash": "sha256-IH8t+b9hCfNwEvdC55UEymn8jL457Fo/hx3N/kNTZso=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bd4bfd814e96488febb38b4b4d0549c56b840c7f",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"fup": "fup",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View File

@ -0,0 +1,31 @@
# The flake file is the entry point for nix commands
{
description = "A reproducible Nix package set for Chia";
# Inputs are how Nix can use code from outside the flake during evaluation.
inputs.fup.url = "github:gytis-ivaskevicius/flake-utils-plus/v1.3.1";
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;
# Outputs are the public-facing interface to the flake.
outputs = inputs @ {
self,
fup,
nixpkgs,
...
}:
fup.lib.mkFlake {
inherit self inputs;
overlays.default = import ./overlay.nix;
channels.nixpkgs.overlaysBuilder = _: [
self.overlays.default
];
outputsBuilder = channels: {
formatter = channels.nixpkgs.alejandra;
packages = channels.nixpkgs.chiaNix;
};
};
}

25
overlay.nix Normal file
View File

@ -0,0 +1,25 @@
final: prev: let
pkgs = final;
python.overrides = final: prev: {
blspy = final.callPackage packages/blspy {};
chia-rs = final.callPackage packages/chia-rs {};
chiapos = final.callPackage packages/chiapos {};
chiavdf = final.callPackage packages/chiavdf {};
clvm-tools = final.callPackage packages/clvm-tools {};
clvm-tools-rs = final.callPackage packages/clvm-tools-rs {};
typing-extensions = final.callPackage packages/typing-extensions {};
cryptography = final.callPackage packages/cryptography {
inherit (pkgs.darwin) libiconv;
inherit (pkgs.darwin.apple_sdk.frameworks) Security;
openssl = pkgs.openssl_1_1;
};
};
in {
chiaNix = {
chia-beta = final.callPackage packages/chia-beta {
python3Packages = final.python3Packages.override {
inherit (python) overrides;
};
};
};
}

View File

@ -0,0 +1,71 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
setuptools-scm,
substituteAll,
cmake,
boost,
gmp,
pybind11,
pythonOlder,
}:
buildPythonPackage rec {
pname = "blspy";
version = "1.0.16";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-XABdS6CCUJpZ9N1Vra078V0HoDU32u1l3yz96ZKHwFc=";
};
patches = [
# prevent CMake from trying to get libraries on the Internet
(substituteAll {
src = ./dont_fetch_dependencies.patch;
pybind11_src = pybind11.src;
relic_src = fetchFromGitHub {
owner = "Chia-Network";
repo = "relic";
rev = "215c69966cb78b255995f0ee9c86bbbb41c3c42b"; # pinned by blspy
hash = "sha256-wivK18Cp7BMZJvrYxJgSHInRZgFgsgSzd0YIy5IWoYA=";
};
sodium_src = fetchFromGitHub {
owner = "AmineKhaldi";
repo = "libsodium-cmake";
rev = "f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65"; # pinned by blspy
sha256 = "sha256-lGz7o6DQVAuEc7yTp8bYS2kwjzHwGaNjugDi1ruRJOA=";
fetchSubmodules = true;
};
catch2_src = fetchFromGitHub {
owner = "catchorg";
repo = "Catch2";
rev = "v3.0.0-preview5"; # pinned by blspy
sha256 = "sha256-IQ1yGZo3nKHTqScUoq3i3Njxqvk7uW8hQ3GT0/SxGaw=";
};
})
];
nativeBuildInputs = [cmake setuptools-scm];
buildInputs = [boost gmp.static pybind11];
pythonImportsCheck = [
"blspy"
];
# Note: upstream testsuite is just a single test.py script outside of any framework
doCheck = false;
# CMake needs to be run by setuptools rather than by its hook
dontConfigure = true;
meta = with lib; {
description = "BLS signatures with aggregation";
homepage = "https://github.com/Chia-Network/bls-signatures/";
license = licenses.asl20;
maintainers = teams.chia.members;
};
}

View File

@ -0,0 +1,64 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7922652..d85b058 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,29 +31,18 @@ set(CMAKE_MODULE_PATH
include(FetchContent)
FetchContent_Declare(Sodium
- GIT_REPOSITORY https://github.com/AmineKhaldi/libsodium-cmake.git
- # Latest commit at the moment this was added here
- # Anchored to libsodium v1.0.18
- GIT_TAG f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65
+ URL /nix/store/2nj48a8vb7rzxhwaigdcpa0yyax7yrv7-source
)
set(SODIUM_PCH "on" CACHE STRING "")
set(SODIUM_DISABLE_TESTS "on" CACHE STRING "")
set(SODIUM_CHIA_MINIMAL "on" CACHE STRING "")
FetchContent_MakeAvailable(Sodium)
-if (DEFINED ENV{RELIC_MAIN})
- set(RELIC_GIT_TAG "origin/main")
-else ()
- # This is currently anchored to upstream aecdcae7956f542fbee2392c1f0feb0a8ac41dc5
- set(RELIC_GIT_TAG "215c69966cb78b255995f0ee9c86bbbb41c3c42b")
-endif ()
-
message(STATUS "Relic will be built from: ${RELIC_GIT_TAG}")
FetchContent_Declare(
relic
- GIT_REPOSITORY https://github.com/Chia-Network/relic.git
- GIT_TAG ${RELIC_GIT_TAG}
+ SOURCE_DIR /nix/store/6r9v1cmmy535q2y0pk0bkjh3ppyzb2ch-source
)
# Relic related options
diff --git a/python-bindings/CMakeLists.txt b/python-bindings/CMakeLists.txt
index 2e331c3..d9aa940 100644
--- a/python-bindings/CMakeLists.txt
+++ b/python-bindings/CMakeLists.txt
@@ -1,8 +1,7 @@
FetchContent_Declare(
pybind11
- GIT_REPOSITORY https://github.com/pybind/pybind11.git
- GIT_TAG v2.10.0
+ SOURCE_DIR @pybind11_src@
)
FetchContent_MakeAvailable(pybind11 relic)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3164f7f..15a955e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,8 +37,7 @@ install(FILES $<TARGET_FILE:bls> DESTINATION lib)
if(BUILD_BLS_TESTS)
FetchContent_Declare(
Catch2
- GIT_REPOSITORY https://github.com/catchorg/Catch2.git
- GIT_TAG v3.0.0-preview5
+ URL @catch2_src@
)
FetchContent_MakeAvailable(Catch2)
add_executable(runtest test.cpp)

View File

@ -0,0 +1,100 @@
{
lib,
cacert,
fetchFromGitHub,
fetchpatch,
python3Packages,
}: let
chia = python3Packages.buildPythonApplication rec {
pname = "chia";
version = "1.7.0-b2";
src = fetchFromGitHub {
owner = "Chia-Network";
repo = "chia-blockchain";
rev = version;
fetchSubmodules = true;
hash = "sha256-zKL1SBHeljjvDRsutwEZdYOQYupPmm8hnqJD399HhVc=";
};
postPatch = ''
substituteInPlace setup.py \
--replace "==" ">="
cp ${cacert}/etc/ssl/certs/ca-bundle.crt mozilla-ca/cacert.pem
'';
nativeBuildInputs = [
python3Packages.setuptools-scm
];
# give a hint to setuptools-scm on package version
SETUPTOOLS_SCM_PRETEND_VERSION = "v${version}";
propagatedBuildInputs = with python3Packages; [
aiofiles
aiohttp
aiosqlite
bitstring
blspy
chiapos
chiavdf
chiabip158
chia-rs
click
clvm
clvm-rs
clvm-tools
clvm-tools-rs
colorama
colorlog
concurrent-log-handler
cryptography
dnslib
dnspython
fasteners
filelock
keyrings-cryptfile
psutil
pyyaml
setproctitle
setuptools # needs pkg_resources at runtime
sortedcontainers
watchdog
websockets
zstd
];
checkInputs = with python3Packages; [
pytestCheckHook
];
# Testsuite is expensive and non-deterministic, so it is available in
# passthru.tests instead.
doCheck = false;
disabledTests = [
"test_spend_through_n"
"test_spend_zero_coin"
"test_default_cached_master_passphrase"
"test_using_legacy_keyring"
];
preCheck = ''
export HOME=`mktemp -d`
'';
passthru.tests = {
chiaWithTests = chia.overrideAttrs (_: {doCheck = true;});
};
meta = with lib; {
homepage = "https://www.chia.net/";
description = "Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure.";
license = with licenses; [asl20];
maintainers = teams.chia.members;
platforms = platforms.all;
};
};
in
chia

712
packages/chia-rs/Cargo.lock generated Normal file
View File

@ -0,0 +1,712 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitvec"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
dependencies = [
"funty",
"radium",
"tap",
"wyz",
]
[[package]]
name = "block-buffer"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [
"generic-array",
]
[[package]]
name = "bls12_381"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62250ece575fa9b22068b3a8d59586f01d426dd7785522efd97632959e71c986"
dependencies = [
"ff",
"group",
"pairing",
"rand_core",
"subtle",
]
[[package]]
name = "bumpalo"
version = "3.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chia"
version = "0.1.14"
dependencies = [
"chia_streamable_macro",
"clvmr",
"hex",
"num-traits",
"pyo3",
]
[[package]]
name = "chia_rs"
version = "0.1.14"
dependencies = [
"chia",
"chia_streamable_macro",
"clvmr",
"hex",
"py_streamable",
"pyo3",
]
[[package]]
name = "chia_streamable_macro"
version = "0.2.3"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "chia_wasm"
version = "0.1.14"
dependencies = [
"chia",
"wasm-bindgen",
"wasm-bindgen-test",
]
[[package]]
name = "clvmr"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5e907612d322d0d7def6b0ecb3ad681f6af2db106bcfabe4153746c60ef9e4"
dependencies = [
"bls12_381",
"hex",
"lazy_static",
"num-bigint",
"num-integer",
"num-traits",
"sha2",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "cpufeatures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "ctor"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
name = "ff"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160"
dependencies = [
"bitvec",
"rand_core",
"subtle",
]
[[package]]
name = "funty"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "generic-array"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "ghost"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb19fe8de3ea0920d282f7b77dd4227aea6b8b999b42cdf0ca41b2472b14443a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "group"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
dependencies = [
"ff",
"rand_core",
"subtle",
]
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "indoc"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8"
dependencies = [
"indoc-impl",
"proc-macro-hack",
]
[[package]]
name = "indoc-impl"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
"unindent",
]
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
]
[[package]]
name = "inventory"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0eb5160c60ba1e809707918ee329adb99d222888155835c6feedba19f6c3fd4"
dependencies = [
"ctor",
"ghost",
"inventory-impl",
]
[[package]]
name = "inventory-impl"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e41b53715c6f0c4be49510bb82dee2c1e51c8586d885abe65396e82ed518548"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "js-sys"
version = "0.3.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce791b7ca6638aae45be056e068fc756d871eb3b3b10b8efa62d1c9cec616752"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "lock_api"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]]
name = "num-bigint"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "pairing"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "135590d8bdba2b31346f9cd1fb2a912329f5135e832a4f422942eb6ead8b6b3b"
dependencies = [
"group",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall",
"smallvec",
"winapi",
]
[[package]]
name = "paste"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
dependencies = [
"paste-impl",
"proc-macro-hack",
]
[[package]]
name = "paste-impl"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
dependencies = [
"proc-macro-hack",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
dependencies = [
"unicode-ident",
]
[[package]]
name = "py_streamable"
version = "0.1.0"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "pyo3"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cf01dbf1c05af0a14c7779ed6f3aa9deac9c3419606ac9de537a2d649005720"
dependencies = [
"cfg-if",
"indoc",
"inventory",
"libc",
"parking_lot",
"paste",
"pyo3-build-config",
"pyo3-macros",
"unindent",
]
[[package]]
name = "pyo3-build-config"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "779239fc40b8e18bc8416d3a37d280ca9b9fb04bda54b98037bb6748595c2410"
dependencies = [
"once_cell",
]
[[package]]
name = "pyo3-macros"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67701eb32b1f9a9722b4bc54b548ff9d7ebfded011c12daece7b9063be1fd755"
dependencies = [
"pyo3-macros-backend",
"quote",
"syn",
]
[[package]]
name = "pyo3-macros-backend"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f44f09e825ee49a105f2c7b23ebee50886a9aee0746f4dd5a704138a64b0218a"
dependencies = [
"proc-macro2",
"pyo3-build-config",
"quote",
"syn",
]
[[package]]
name = "quote"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
[[package]]
name = "radium"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sha2"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "subtle"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "syn"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tap"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "typenum"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "unicode-ident"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
[[package]]
name = "unindent"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58ee9362deb4a96cef4d437d1ad49cffc9b9e92d202b6995674e928ce684f112"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasm-bindgen"
version = "0.2.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16646b21c3add8e13fdb8f20172f8a28c3dbf62f45406bcff0233188226cfe0c"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2"
[[package]]
name = "wasm-bindgen-test"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce783b6c3854292723f498b7bfcf65a782a320b6f1cb3012d08dfbc603fa62f5"
dependencies = [
"console_error_panic_hook",
"js-sys",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3859815cf8435b92f3a34381bef950daffc1403bbb77ef99e35422a7b0abb194"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "web-sys"
version = "0.3.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wyz"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e"
dependencies = [
"tap",
]

View File

@ -0,0 +1,49 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,
pytestCheckHook,
rustPlatform,
}:
buildPythonPackage rec {
pname = "chia-rs";
version = "0.1.14";
src = fetchFromGitHub {
owner = "chia-network";
repo = "chia_rs";
rev = version;
hash = "sha256-aqR55rfMRwED6KWkJqhDd+16zuIyEa1W+kzUtVpmgo0=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
postPatch = ''
cp ${./Cargo.lock} Cargo.lock
'';
nativeBuildInputs = with rustPlatform; [
cargoSetupHook
maturinBuildHook
];
preBuild = ''
# avoid ENOENT in maturinBuildHook
touch wheel/Cargo.lock
'';
checkInputs = [
pytestCheckHook
];
buildAndTestSubdir = "wheel";
meta = with lib; {
description = "Rust crate & wheel with consensus code";
homepage = "https://github.com/Chia-Network/chia_rs/";
license = licenses.asl20;
maintainers = teams.chia.members;
};
}

View File

@ -0,0 +1,56 @@
{
stdenv,
lib,
substituteAll,
buildPythonPackage,
fetchPypi,
catch2,
cmake,
cxxopts,
ghc_filesystem,
pybind11,
pytestCheckHook,
pythonOlder,
psutil,
setuptools-scm,
}:
buildPythonPackage rec {
pname = "chiapos";
version = "1.0.11";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-TMRf9549z3IQzGt5c53Rk1Vq3tdrpZ3Pqc8jhj4AKzo=";
};
patches = [
# prevent CMake from trying to get libraries on the Internet
(substituteAll {
src = ./dont_fetch_dependencies.patch;
inherit cxxopts ghc_filesystem;
catch2_src = catch2.src;
pybind11_src = pybind11.src;
})
];
nativeBuildInputs = [cmake setuptools-scm];
buildInputs = [pybind11];
checkInputs = [
psutil
pytestCheckHook
];
# CMake needs to be run by setuptools rather than by its hook
dontConfigure = true;
meta = with lib; {
broken = stdenv.isDarwin;
description = "Chia proof of space library";
homepage = "https://www.chia.net/";
license = licenses.asl20;
maintainers = teams.chia.members;
};
}

View File

@ -0,0 +1,41 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1dd25d..96abc65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,23 +21,20 @@ include(${CMAKE_INSTALL_PREFIX}/share/cmake/pybind11/pybind11Config.cmake)
else()
FetchContent_Declare(
pybind11-src
- GIT_REPOSITORY https://github.com/pybind/pybind11.git
- GIT_TAG v2.10.0
+ SOURCE_DIR @pybind11_src@
)
FetchContent_MakeAvailable(pybind11-src)
endif()
FetchContent_Declare(
cxxopts
- GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
- GIT_TAG v2.2.1
+ SOURCE_DIR @cxxopts@
)
FetchContent_MakeAvailable(cxxopts)
FetchContent_Declare(
gulrak
- GIT_REPOSITORY https://github.com/gulrak/filesystem.git
- GIT_TAG v1.5.6
+ SOURCE_DIR @ghc_filesystem@
)
FetchContent_MakeAvailable(gulrak)
@@ -150,8 +147,7 @@ ENDIF()
FetchContent_Declare(
Catch2
- GIT_REPOSITORY https://github.com/catchorg/Catch2.git
- GIT_TAG v2.13.7
+ SOURCE_DIR @catch2_src@
)
FetchContent_MakeAvailable(Catch2)

View File

@ -0,0 +1,54 @@
{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
setuptools-scm,
substituteAll,
cmake,
boost,
gmp,
pybind11,
pytestCheckHook,
pythonOlder,
}:
buildPythonPackage rec {
pname = "chiavdf";
version = "1.0.8";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-ilT7tCdX8ak3qmpXJ0LITf0ZGAdFSN4tm6GKw06A/m8=";
};
patches = [
# prevent CMake from trying to get libraries on the Internet
(substituteAll {
src = ./dont_fetch_dependencies.patch;
pybind11_src = pybind11.src;
})
];
# x86 instructions are needed for this component
BUILD_VDF_CLIENT = lib.optionalString (!stdenv.isx86_64) "N";
nativeBuildInputs = [cmake setuptools-scm];
buildInputs = [boost gmp pybind11];
checkInputs = [
pytestCheckHook
];
# CMake needs to be run by setuptools rather than by its hook
dontConfigure = true;
meta = with lib; {
broken = stdenv.isDarwin;
description = "Chia verifiable delay function utilities";
homepage = "https://www.chia.net/";
license = licenses.asl20;
maintainers = teams.chia.members;
};
}

View File

@ -0,0 +1,14 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fb92c4d..9fa52ef 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -31,8 +31,7 @@ include(FetchContent)
FetchContent_Declare(
pybind11-src
- GIT_REPOSITORY https://github.com/pybind/pybind11.git
- GIT_TAG v2.10.0
+ SOURCE_DIR @pybind11_src@
)
FetchContent_MakeAvailable(pybind11-src)

View File

@ -0,0 +1,40 @@
{
lib,
fetchFromGitHub,
buildPythonPackage,
rustPlatform,
pythonOlder,
}:
buildPythonPackage rec {
pname = "clvm-tools-rs";
version = "0.1.25";
disabled = pythonOlder "3.7";
format = "pyproject";
src = fetchFromGitHub {
owner = "Chia-Network";
repo = "clvm_tools_rs";
rev = version;
sha256 = "sha256-s4AeXoLOtEIxCSnW5CWVZoZrAJ+wKQPklEehPAvnHMw=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
sha256 = "sha256-4SjSpEMu6NAPn50u7iyAznTw4AL4+KmBvppMV4+w6Jk=";
};
nativeBuildInputs = with rustPlatform; [
cargoSetupHook
maturinBuildHook
];
pythonImportsCheck = ["clvm_tools_rs"];
meta = with lib; {
homepage = "https://chialisp.com/";
description = "Rust port of clvm_tools";
license = licenses.asl20;
maintainers = teams.chia.members;
};
}

View File

@ -0,0 +1,53 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
clvm,
clvm-tools-rs,
setuptools-scm,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "clvm_tools";
version = "0.4.6";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "Chia-Network";
repo = "clvm_tools";
rev = version;
sha256 = "sha256-MAtVTSv1RR2/7QEKCOEQ+QH5vK4aE0Us2TXyRRAMl8U=";
};
nativeBuildInputs = [
setuptools-scm
];
propagatedBuildInputs = [
clvm
clvm-tools-rs
];
checkInputs = [
pytestCheckHook
];
pythonImportsCheck = [
"clvm_tools"
];
disabledTests = [
"test_cmd_unknown-1_txt"
];
# give a hint to setuptools-scm on package version
SETUPTOOLS_SCM_PRETEND_VERSION = "v${version}";
meta = with lib; {
description = "Tools for clvm development";
homepage = "https://www.chialisp.com/";
license = licenses.asl20;
maintainers = teams.chia.members;
};
}

View File

@ -0,0 +1,14 @@
Delete the warning that breaks tests of dependent projects.
--- a/src/cryptography/__init__.py
+++ b/src/cryptography/__init__.py
@@ -33,9 +32,0 @@ __all__ = [
-
-if sys.version_info[0] == 2:
- warnings.warn(
- "Python 2 is no longer supported by the Python core team. Support for "
- "it is now deprecated in cryptography, and will be removed in the "
- "next release.",
- CryptographyDeprecationWarning,
- stacklevel=2,
- )

View File

@ -0,0 +1,101 @@
{
lib,
stdenv,
callPackage,
buildPythonPackage,
fetchPypi,
rustPlatform,
setuptools-rust,
openssl,
Security,
packaging,
six,
isPyPy,
cffi,
pytestCheckHook,
pytest-benchmark,
pytest-subtests,
pythonOlder,
pretend,
libiconv,
iso8601,
pytz,
hypothesis,
}: let
cryptography-vectors = callPackage ./vectors.nix {};
in
buildPythonPackage rec {
pname = "cryptography";
version = "38.0.3"; # Also update the hash in vectors.nix
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
hash = "sha256-v75u4ZYVsHqYsdIofWpgc/c0c1tJ7kWxEyTYXvxNXL0=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${pname}-${version}/${cargoRoot}";
name = "${pname}-${version}";
hash = "sha256-lzHLW1N4hZj+nn08NZiPVM/X+SEcIsuZDjEOy0OOkSc=";
};
cargoRoot = "src/rust";
nativeBuildInputs =
lib.optionals (!isPyPy) [
cffi
]
++ [
rustPlatform.cargoSetupHook
setuptools-rust
]
++ (with rustPlatform; [rust.cargo rust.rustc]);
buildInputs =
[openssl]
++ lib.optionals stdenv.isDarwin [Security libiconv];
propagatedBuildInputs = lib.optionals (!isPyPy) [
cffi
];
checkInputs = [
cryptography-vectors
hypothesis
iso8601
pretend
pytestCheckHook
pytest-benchmark
pytest-subtests
pytz
];
pytestFlagsArray = [
"--disable-pytest-warnings"
];
disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# aarch64-darwin forbids W+X memory, but this tests depends on it:
# * https://cffi.readthedocs.io/en/latest/using.html#callbacks
"tests/hazmat/backends/test_openssl_memleak.py"
];
meta = with lib; {
description = "A package which provides cryptographic recipes and primitives";
longDescription = ''
Cryptography includes both high level recipes and low level interfaces to
common cryptographic algorithms such as symmetric ciphers, message
digests, and key derivation functions.
Our goal is for it to be your "cryptographic standard library". It
supports Python 2.7, Python 3.5+, and PyPy 5.4+.
'';
homepage = "https://github.com/pyca/cryptography";
changelog =
"https://cryptography.io/en/latest/changelog/#v"
+ replaceStrings ["."] ["-"] version;
license = with licenses; [asl20 bsd3 psfl];
maintainers = with maintainers; [SuperSandro2000];
};
}

View File

@ -0,0 +1,30 @@
{
buildPythonPackage,
fetchPypi,
lib,
cryptography,
}:
buildPythonPackage rec {
pname = "cryptography-vectors";
# The test vectors must have the same version as the cryptography package
inherit (cryptography) version;
src = fetchPypi {
pname = "cryptography_vectors";
inherit version;
hash = "sha256-HNr9QvU0jXfk5+R5Gu/R9isWvVUqAnSvyTRlM/4y6SU=";
};
# No tests included
doCheck = false;
pythonImportsCheck = ["cryptography_vectors"];
meta = with lib; {
description = "Test vectors for the cryptography package";
homepage = "https://cryptography.io/en/latest/development/test-vectors/";
# Source: https://github.com/pyca/cryptography/tree/master/vectors;
license = with licenses; [asl20 bsd3];
maintainers = with maintainers; [SuperSandro2000];
};
}

View File

@ -0,0 +1,40 @@
{
lib,
buildPythonPackage,
fetchPypi,
flit-core,
python,
pythonOlder,
}:
buildPythonPackage rec {
pname = "typing-extensions";
version = "4.4.0";
format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchPypi {
pname = "typing_extensions";
inherit version;
hash = "sha256-FRFDS7kr+N0ZjBKxzIEugA1Bgc/LhnZ04PgnnMkwh6o=";
};
nativeBuildInputs = [
flit-core
];
# Tests are not part of PyPI releases. GitHub source can't be used
# as it ends with an infinite recursion
doCheck = false;
pythonImportsCheck = [
"typing_extensions"
];
meta = with lib; {
description = "Backported and Experimental Type Hints for Python 3.5+";
homepage = "https://github.com/python/typing";
license = licenses.psfl;
maintainers = with maintainers; [pmiddend];
};
}