Skip to content

Commit 49dff81

Browse files
authored
Merge branch 'alpha-1.3' into alpha-1.3
2 parents 20674da + d01cbcb commit 49dff81

File tree

213 files changed

+42821
-795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+42821
-795
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,3 @@ pip-delete-this-directory.txt
6060

6161
# Packaging
6262
chia-blockchain.tar.gz
63-
64-
# Dependencies
65-
flint2

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ Mypy is very useful for ensuring objects are of the correct type, so try to alwa
4141
To submit changes, please make a pull request to the appropriate development branch.
4242
For example, after the 1.2 release, the 1.3 branch is used for development, etc.
4343
The master branch is updated with the latest releases only.
44+
45+
### Copyright
46+
By contributing to this repository, you agree to license your work under the Apache License Version 2.0, or the MIT License, or release your work to the public domain. Any work contributed where you are not the original author must contain its license header with the original author(s) and be in the public domain, or licensed under the Apache License Version 2.0 or the MIT License.

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ For alpha testnet most should only install harvesters, farmers, plotter and full
1313

1414
```bash
1515
sudo apt-get update
16-
sudo apt-get install build-essential git cmake libssl-dev libffi-dev --no-install-recommends
16+
sudo apt-get install build-essential git cmake libssl-dev libffi-dev libgmp3-dev --no-install-recommends
1717
sudo apt-get install python3-dev python3-venv --no-install-recommends
1818

1919
git clone https://github.com/Chia-Network/chia-blockchain.git
@@ -27,7 +27,7 @@ sh install.sh
2727

2828
```bash
2929
sudo yum update
30-
sudo yum install gcc-c++ cmake3 wget git openssl openssl-devel
30+
sudo yum install gcc-c++ cmake3 wget git openssl openssl-devel gmp-devel
3131
sudo yum install python3 python3-devel libffi-devel
3232

3333
# CMake - add a symlink for cmake3 - required by blspy
@@ -46,7 +46,7 @@ sh install.sh
4646
sudo yum update
4747
sudo yum install centos-release-scl-rh epel-release
4848
sudo yum install devtoolset-8-toolchain cmake3 libffi-devel
49-
sudo yum install wget git openssl openssl-devel
49+
sudo yum install wget git openssl openssl-devel gmp-devel
5050

5151
# CMake - add a symlink for cmake3 - required by blspy
5252
sudo ln -s /usr/bin/cmake3 /usr/local/bin/cmake
@@ -82,7 +82,7 @@ sudo apt-get -y update
8282
sudo apt-get -y upgrade
8383
sudo do-release-upgrade
8484

85-
sudo apt-get install -y build-essential cmake python3-dev python3-venv software-properties-common --no-install-recommends
85+
sudo apt-get install -y build-essential cmake python3-dev python3-venv software-properties-common libgmp3-dev --no-install-recommends
8686

8787
git clone https://github.com/Chia-Network/chia-blockchain.git
8888
cd chia-blockchain
@@ -98,7 +98,7 @@ Each line that starts with `pip ...` becomes `python -m pip ...`
9898

9999
```bash
100100
sudo apt-get -y update
101-
sudo apt-get install -y build-essential cmake python3-dev python3-venv software-properties-common --no-install-recommends
101+
sudo apt-get install -y build-essential cmake python3-dev python3-venv software-properties-common libgmp3-dev --no-install-recommends
102102

103103
# Install python3.7 with ppa
104104
sudo add-apt-repository -y ppa:deadsnakes/ppa
@@ -116,7 +116,7 @@ sudo sh install.sh
116116
Make sure [brew](https://brew.sh/) is available before starting the setup.
117117
```bash
118118
brew upgrade python
119-
brew install cmake boost gmp mpir mpfr
119+
brew install cmake gmp
120120

121121
git clone https://github.com/Chia-Network/chia-blockchain.git
122122
cd chia-blockchain
@@ -149,11 +149,6 @@ cd boost_1_72_0
149149
./bootstrap.sh --prefix=/usr/local
150150
sudo ./b2 install --prefix=/usr/local --with=all; cd ..
151151

152-
# Install Flint2
153-
git clone https://github.com/wbhart/flint2
154-
cd flint2; ./configure; sudo make install; cd ..
155-
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
156-
157152
cd chia-blockchain
158153

159154
sh install_timelord.sh
@@ -176,12 +171,10 @@ sudo apt-get install libboost1.70 libboost1.70-dev
176171

177172
### MacOS
178173
```bash
179-
brew install boost gmp mpir mpfr
174+
brew install boost
180175

181176
cd chia-blockchain
182177

183-
git clone https://github.com/wbhart/flint2
184-
185178
sh install_timelord.sh
186179
```
187180

install_timelord.sh

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@ set -e
33

44
if [ `uname` = "Linux" ] && type apt-get; then
55
# Debian/Ubuntu
6-
sudo apt-get install -y libgmp3-dev libflint-dev \
7-
libboost-dev libboost-system-dev
8-
fi
9-
10-
# Install libgmp, libboost, and libflint, and then run the following
11-
# Check for git clone of flint2 on MacOS and install if found
12-
if [ -f flint2/configure ]; then
13-
cd flint2/
14-
if [ ! -f Makefile ]; then
15-
./configure
16-
fi
17-
make -j4
18-
make install
19-
cd ../
6+
sudo apt-get install -y libgmp3-dev libboost-dev libboost-system-dev
207
fi
218

229
make -C lib/chiavdf/fast_vdf

lib/chiavdf/fast_vdf/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
/vdf
77
/server
88
/vdf_server
9-
10-
# Flint dependency
11-
/flint
9+
/verifier
10+
/verifier_test
11+
/build/*
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR)
2+
3+
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
5+
6+
IF(NOT CMAKE_BUILD_TYPE)
7+
SET(CMAKE_BUILD_TYPE "RELEASE")
8+
ENDIF()
9+
10+
project(chiavdf)
11+
12+
set(CMAKE_MODULE_PATH
13+
${CMAKE_CURRENT_LIST_DIR}/cmake
14+
${CMAKE_MODULE_PATH}
15+
)
16+
17+
find_package(GMP REQUIRED)
18+
find_package(GMPXX REQUIRED)
19+
20+
include_directories(
21+
${INCLUDE_DIRECTORIES}
22+
${CMAKE_CURRENT_SOURCE_DIR}
23+
${GMP_INCLUDE_DIR}
24+
${GMPXX_INCLUDE_DIR}
25+
)
26+
27+
set (CMAKE_CXX_FLAGS "-std=c++1z")
28+
29+
add_subdirectory(lib/pybind11)
30+
pybind11_add_module(chiavdf ${CMAKE_CURRENT_SOURCE_DIR}/python_bindings/chiavdf.cpp)
31+
32+
add_executable(verifier_test
33+
verifier_test.cpp
34+
)
35+
36+
target_link_libraries(chiavdf PRIVATE ${GMP_LIBRARIES} ${GMPXX_LIBRARIES} -pthread)
37+
target_link_libraries(verifier_test ${GMP_LIBRARIES} ${GMPXX_LIBRARIES} -pthread)

lib/chiavdf/fast_vdf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ALL_INSTR := 0
88
endif
99

1010
LDFLAGS += -no-pie
11-
LDLIBS += -lgmpxx -lgmp -lflint -lboost_system -pthread
11+
LDLIBS += -lgmpxx -lgmp -lboost_system -pthread
1212
CXXFLAGS += -std=c++1z -D VDF_MODE=0 -D ENABLE_ALL_INSTRUCTIONS=$(ALL_INSTR) \
1313
-no-pie -pthread -march=native
1414
ifeq ($(UNAME),Darwin)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Try to find the GMP library
2+
# https://gmplib.org/
3+
#
4+
# This module supports requiring a minimum version, e.g. you can do
5+
# find_package(GMP 6.0.0)
6+
# to require version 6.0.0 to newer of GMP.
7+
#
8+
# Once done this will define
9+
#
10+
# GMP_FOUND - system has GMP lib with correct version
11+
# GMP_INCLUDES - the GMP include directory
12+
# GMP_LIBRARIES - the GMP library
13+
# GMP_VERSION - GMP version
14+
#
15+
# Copyright (c) 2016 Jack Poulson, <[email protected]>
16+
# Redistribution and use is allowed according to the terms of the BSD license.
17+
18+
find_path(GMP_INCLUDES NAMES gmp.h PATHS $ENV{GMPDIR} ${INCLUDE_INSTALL_DIR})
19+
20+
# Set GMP_FIND_VERSION to 5.1.0 if no minimum version is specified
21+
if(NOT GMP_FIND_VERSION)
22+
if(NOT GMP_FIND_VERSION_MAJOR)
23+
set(GMP_FIND_VERSION_MAJOR 5)
24+
endif()
25+
if(NOT GMP_FIND_VERSION_MINOR)
26+
set(GMP_FIND_VERSION_MINOR 1)
27+
endif()
28+
if(NOT GMP_FIND_VERSION_PATCH)
29+
set(GMP_FIND_VERSION_PATCH 0)
30+
endif()
31+
set(GMP_FIND_VERSION
32+
"${GMP_FIND_VERSION_MAJOR}.${GMP_FIND_VERSION_MINOR}.${GMP_FIND_VERSION_PATCH}")
33+
endif()
34+
35+
message("GMP_INCLUDES=${GMP_INCLUDES}")
36+
if(GMP_INCLUDES)
37+
# Since the GMP version macros may be in a file included by gmp.h of the form
38+
# gmp-.*[_]?.*.h (e.g., gmp-x86_64.h), we search each of them.
39+
file(GLOB GMP_HEADERS "${GMP_INCLUDES}/gmp.h" "${GMP_INCLUDES}/gmp-*.h")
40+
foreach(gmp_header_filename ${GMP_HEADERS})
41+
file(READ "${gmp_header_filename}" _gmp_version_header)
42+
string(REGEX MATCH
43+
"define[ \t]+__GNU_MP_VERSION[ \t]+([0-9]+)" _gmp_major_version_match
44+
"${_gmp_version_header}")
45+
if(_gmp_major_version_match)
46+
set(GMP_MAJOR_VERSION "${CMAKE_MATCH_1}")
47+
string(REGEX MATCH "define[ \t]+__GNU_MP_VERSION_MINOR[ \t]+([0-9]+)"
48+
_gmp_minor_version_match "${_gmp_version_header}")
49+
set(GMP_MINOR_VERSION "${CMAKE_MATCH_1}")
50+
string(REGEX MATCH "define[ \t]+__GNU_MP_VERSION_PATCHLEVEL[ \t]+([0-9]+)"
51+
_gmp_patchlevel_version_match "${_gmp_version_header}")
52+
set(GMP_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")
53+
set(GMP_VERSION
54+
${GMP_MAJOR_VERSION}.${GMP_MINOR_VERSION}.${GMP_PATCHLEVEL_VERSION})
55+
endif()
56+
endforeach()
57+
58+
# Check whether found version exists and exceeds the minimum requirement
59+
if(NOT GMP_VERSION)
60+
set(GMP_VERSION_OK FALSE)
61+
message(STATUS "GMP version was not detected")
62+
elseif(${GMP_VERSION} VERSION_LESS ${GMP_FIND_VERSION})
63+
set(GMP_VERSION_OK FALSE)
64+
message(STATUS "GMP version ${GMP_VERSION} found in ${GMP_INCLUDES}, "
65+
"but at least version ${GMP_FIND_VERSION} is required")
66+
else()
67+
set(GMP_VERSION_OK TRUE)
68+
endif()
69+
endif()
70+
71+
find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})
72+
73+
include(FindPackageHandleStandardArgs)
74+
find_package_handle_standard_args(GMP DEFAULT_MSG
75+
GMP_INCLUDES GMP_LIBRARIES GMP_VERSION_OK)
76+
mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# https://svn.zib.de/lenne3d/lib/qpl_cgal/3.5.1/cmake/modules/FindGMPXX.cmake
2+
#
3+
# Try to find the GMPXX libraries
4+
# GMPXX_FOUND - system has GMPXX lib
5+
# GMPXX_INCLUDE_DIR - the GMPXX include directory
6+
# GMPXX_LIBRARIES - Libraries needed to use GMPXX
7+
8+
# TODO: support Windows and MacOSX
9+
10+
# GMPXX needs GMP
11+
12+
find_package( GMP QUIET )
13+
14+
if(GMP_FOUND)
15+
16+
if (GMPXX_INCLUDE_DIR AND GMPXX_LIBRARIES)
17+
# Already in cache, be silent
18+
set(GMPXX_FIND_QUIETLY TRUE)
19+
endif()
20+
21+
find_path(GMPXX_INCLUDE_DIR NAMES gmpxx.h
22+
PATHS ${GMP_INCLUDE_DIR_SEARCH}
23+
DOC "The directory containing the GMPXX include files"
24+
)
25+
26+
find_library(GMPXX_LIBRARIES NAMES gmpxx
27+
PATHS ${GMP_LIBRARIES_DIR_SEARCH}
28+
DOC "Path to the GMPXX library"
29+
)
30+
31+
32+
33+
find_package_handle_standard_args(GMPXX "DEFAULT_MSG" GMPXX_LIBRARIES GMPXX_INCLUDE_DIR )
34+
35+
endif()

lib/chiavdf/fast_vdf/compile_asm.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <x86intrin.h>
2+
13
#include "include.h"
24

35
#include "parameters.h"
@@ -35,4 +37,4 @@ int main(int argc, char** argv) {
3537
set_rounding_mode();
3638

3739
asm_code::compile_asm();
38-
}
40+
}

0 commit comments

Comments
 (0)