Improve style consistency in root directory docs files (#4493)

* Improve style consistency

* black python required blank

Co-authored-by: Nikolaj Kuntner <>
This commit is contained in:
Nikolaj Kuntner 2021-05-12 22:12:30 +02:00 committed by GitHub
parent 080e830bb1
commit 2faab1ea83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 103 additions and 104 deletions

View File

@ -12,14 +12,14 @@ the virtual environment.
sh install-timelord.sh sh install-timelord.sh
``` ```
If the compile fails, it's likely due to a missing dependency. If the compile fails, it's likely due to a missing dependency. The script
[install-timelord.sh](https://github.com/Chia-Network/chia-blockchain/blob/main/install-timelord.sh) [install-timelord.sh](https://github.com/Chia-Network/chia-blockchain/blob/main/install-timelord.sh)
attempts to install required build dependencies for Linux and MacOS before attempts to install required build dependencies for Linux and MacOS before
invoking pip to build from the source python distribution of chiavdf. invoking pip to build from the source python distribution of chiavdf.
The `install-timelord.sh` install script leverages two environmental variables The `install-timelord.sh` install script leverages two environmental variables
that the chiavdf wheels can use to specify how to build. `vdf_client` is the that the chiavdf wheels can use to specify how to build. The service that the
service that the Timelord uses to run the VDF and prove the Proof of Time. Timelord uses to run the VDF and prove the Proof of Time is `vdf_client` and
`vdf_bench` is a utility to get a sense of a given CPU's iterations per second. `vdf_bench` is a utility to get a sense of a given CPU's iterations per second.
- To build vdf_client set the environment variable BUILD_VDF_CLIENT to "Y". - To build vdf_client set the environment variable BUILD_VDF_CLIENT to "Y".

View File

@ -1,12 +1,11 @@
# Introduction # Introduction
Welcome to the chia-blockchain project! Welcome to the chia-blockchain project!
We are happy that you are taking a look at the code for Chia, a proof of space and time cryptocurrency. We are happy that you are taking a look at the code for Chia, a proof of space and time cryptocurrency.
A lot of fascinating new cryptography and blockchain concepts are used and implemented here. A lot of fascinating new cryptography and blockchain concepts are used and implemented here.
This repo includes the code for the Chia full node, farmer, and timelord (in chia folder), which are all written in python. This repo includes the code for the Chia full node, farmer, and timelord (in chia folder), which are all written in python.
It also includes a verifiable delay function implementation that it imports from the [chiavdf repo](https://github.com/Chia-Network/chiavdf) (in c/c++), and a proof of space implementation that it imports from the [chiapos repo](https://github.com/Chia-Network/chiapos). BLS signatures are imported from the [bls-signatures repo](https://github.com/Chia-Network/bls-signatures) as blspy. There is an additional dependency on the [chiabip158 repo](https://github.com/Chia-Network/chiabip158). For major platforms, binary and source wheels are shipped to PyPI from each dependent repo and then chia-blockchain can pip install those from PyPI or they can be prepackaged as is done for the Windows installer. On unsupported platforms, pip will fall back to the source distributions to be compiled locally. It also includes a verifiable delay function implementation that it imports from the [chiavdf repo](https://github.com/Chia-Network/chiavdf) (in c/c++), and a proof of space implementation that it imports from the [chiapos repo](https://github.com/Chia-Network/chiapos). BLS signatures are imported from the [bls-signatures repo](https://github.com/Chia-Network/bls-signatures) as blspy. There is an additional dependency on the [chiabip158 repo](https://github.com/Chia-Network/chiabip158). For major platforms, binary and source wheels are shipped to PyPI from each dependent repo. Then chia-blockchain can pip install those from PyPI or they can be prepackaged as is done for the Windows installer. On unsupported platforms, pip will fall back to the source distributions, to be compiled locally.
If you want to learn more about this project, read the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki), or check out the [green paper](https://www.chia.net/assets/ChiaGreenPaper.pdf). If you want to learn more about this project, read the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki), or check out the [green paper](https://www.chia.net/assets/ChiaGreenPaper.pdf).
@ -17,16 +16,16 @@ Please review this [diagram](https://drive.google.com/file/d/1r7AXTrj7gtD0Xy-9Bt
We would be pleased to accept code contributions to this project. We would be pleased to accept code contributions to this project.
As we have now released, the main priority is improving the mainnet blockchain. As we have now released, the main priority is improving the mainnet blockchain.
You can visit our [Trello project board](https://trello.com/b/ZuNx7sET) to get a sense of what is in the backlog. You can visit our [Trello project board](https://trello.com/b/ZuNx7sET) to get a sense of what is in the backlog.
Generally things to the left are in progress or done. Some things go through "Coming up soon" but some will come directly out of other columns. Generally, things to the left are in progress or done. Some things go through "Coming up soon", but some will come directly out of other columns.
Usually the things closer to the top of each column are the ones that will be worked on soonest. Usually, the things closer to the top of each column are the ones that will be worked on soonest.
If you are interested in cryptography, math, or just like hacking in python, there are many interesting problems to work on. If you are interested in cryptography, math, or just like hacking in python, there are many interesting problems to work on.
Contact any of the team members on [Keybase](https://keybase.io/team/chia_network.public), which we use as the main communication method and you can comment on any Trello card. Contact any of the team members on [Keybase](https://keybase.io/team/chia_network.public), which we use as the main communication method. You can also comment on any Trello card.
We ask that external contributors create a fork of the `main` branch for any feature work they wish to take on. We ask that external contributors create a fork of the `main` branch for any feature work they wish to take on.
Members of the Chia organization may create feature branches from the `main` branch. Members of the Chia organization may create feature branches from the `main` branch.
In the event an emergency fix is required for the release version of Chia, members of the chia organization will create a feature branch from the current release branch `1.0.0` In the event an emergency fix is required for the release version of Chia, members of the Chia organization will create a feature branch from the current release branch `1.0.0`.
## Branching Strategy ## Branching Strategy
@ -35,19 +34,19 @@ In the event an emergency fix is required for the release version of Chia, membe
1. All changes go into the main branch. 1. All changes go into the main branch.
2. Main is stable at all times, all tests pass. 2. Main is stable at all times, all tests pass.
3. Features (with tests) are developed and fully tested on feature branches, and reviewed before landing in main. 3. Features (with tests) are developed and fully tested on feature branches, and reviewed before landing in main.
4. Chia Network's nodes on the public testnet are running latest version x.y.z 4. Chia Network's nodes on the public testnet are running the latest version `x.y.z`.
5. The `main` branch will have a long running `beta testnet` to allow previewing of changes. 5. The `main` branch will have a long running `beta testnet` to allow previewing of changes.
6. Pull Request events may require a `beta testnet` review environment, at the moment this is at the discretion of the reviewer. 6. Pull Request events may require a `beta testnet` review environment. At the moment this is at the discretion of the reviewer.
7. Hotfixes land in the release branch they fix, and all later versions. (this will be achieved by regularly merging from 1.0.x -> main). 7. Hotfixes land in the release branch they fix, and all later versions. (This will be achieved by regularly merging from `1.0.x` to main).
8. Hotfixes that are emergency fixes for a specific version will be merged into, and removed from down-stream branches. This allows future merges without issues. 8. Hotfixes that are emergency fixes for a specific version will be merged into (???), and removed from down-stream branches. This allows future merges without issues.
9. Whoever develops a hotfix is also responsible for merging it into all later branches. 9. Whoever develops a hotfix is also responsible for merging it into all later branches.
10. A release branch (e.g. 1.1.x) will be cut prior to a release, in order to separate work that should go into the release from work going into the next major release (main branch). (this pre-release branch will also have a `beta testnet` spun up for preview) 10. A release branch (e.g. `1.1.x`) will be cut prior to a release, in order to separate work that should go into the release from work going into the next major release (main branch). (This pre-release branch will also have a `beta testnet` spun up for preview).
11. All Merge events will be squashed and merged. 11. All Merge events will be squash merged.
## Run tests and linting ## Run tests and linting
The first time the tests are run, BlockTools will create and persist many plots. These are used for creating The first time the tests are run, BlockTools will create and persist many plots. These are used for creating
proofs of space during testing. The next time tests are run, this won't be necessary. proofs of space during testing. The next time tests are run, this will not be necessary.
```bash ```bash
. ./activate . ./activate
@ -56,20 +55,21 @@ black chia tests && mypy chia tests && flake8 chia tests
py.test tests -v --durations 0 py.test tests -v --durations 0
``` ```
Black is used as an automatic style formatter to make things easier, and flake8 helps ensure consistent style. The [black library](https://black.readthedocs.io/en/stable/) is used as an automatic style formatter to make things easier.
Mypy is very useful for ensuring objects are of the correct type, so try to always add the type of the return value, and the type of local variables. The [flake8 library](https://readthedocs.org/projects/flake8/) helps ensure consistent style.
The [Mypy library](https://mypy.readthedocs.io/en/stable/) is very useful for ensuring objects are of the correct type, so try to always add the type of the return value, and the type of local variables.
If you want verbose logging for tests, edit the tests/pytest.ini file. If you want verbose logging for tests, edit the `tests/pytest.ini` file.
## Configure VS code ## Configure VS code
1. Install Python extension 1. Install python extension
2. Set the environment to ./venv/bin/python 2. Set the environment to `./venv/bin/python`
3. Install mypy plugin 3. Install mypy plugin
4. Preferences > Settings > Python > Linting > flake8 enabled 4. Preferences > Settings > Python > Linting > flake8 enabled
5. Preferences > Settings > Python > Linting > mypy enabled 5. Preferences > Settings > Python > Linting > mypy enabled
6. Preferences > Settings > Formatting > Python > Provider > black 6. Preferences > Settings > Formatting > Python > Provider > black
7. Preferences > Settings > mypy > Targets: set to ./chia and ./tests 7. Preferences > Settings > mypy > Targets: set to `./chia` and `./tests`
## Configure Pycharm ## Configure Pycharm
@ -93,13 +93,13 @@ Following the release of `1.1.0`, the official `testnet` will include all change
Prior to proposing changes to `main`, proposers should consider if running a `beta testnet` review environment will make the reviewer more effective when evaluating a change. Prior to proposing changes to `main`, proposers should consider if running a `beta testnet` review environment will make the reviewer more effective when evaluating a change.
Changes that impact the blockchain could require a review environment before acceptance into `main`. This is at the discretion of the reviewer. Changes that impact the blockchain could require a review environment before acceptance into `main`. This is at the discretion of the reviewer.
Chia organization members have been granted CI access to deploy `beta testnets`. Chia organization members have been granted CI access to deploy `beta testnets`.
If you are not a Chia organization member, you can enquire about deploying a `beta testnet` in the public dev keybase channel. If you are not a Chia organization member, you can enquire about deploying a `beta testnet` in the public dev Keybase channel.
## Submit changes ## Submit changes
To propose changes, please make a pull request to the `main` branch. To propose changes, please make a pull request to the `main` branch. See Branching Strategy above.
To propose changes, for production releases of chia please make a pull request to the latest release branch. To propose changes for the production releases of Chia, please make a pull request to the latest release branch.
## Copyright ## Copyright

View File

@ -1,6 +1,6 @@
# Installation # Installation
Install instructions have been moved to the [INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) section of the repository [Wiki](https://github.com/Chia-Network/chia-blockchain/wiki) Install instructions have been moved to the [INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) section of the repository [Wiki](https://github.com/Chia-Network/chia-blockchain/wiki).
After installing, follow the remaining instructions in the After installing, follow the remaining instructions in the
[Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide) [Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide)

View File

@ -1,4 +1,5 @@
# chia-blockchain # chia-blockchain
![Alt text](https://www.chia.net/img/chia_logo.svg) ![Alt text](https://www.chia.net/img/chia_logo.svg)
| Current Release/main | Development Branch/dev | | Current Release/main | Development Branch/dev |
@ -7,8 +8,7 @@
![GitHub contributors](https://img.shields.io/github/contributors/Chia-Network/chia-blockchain?logo=GitHub) ![GitHub contributors](https://img.shields.io/github/contributors/Chia-Network/chia-blockchain?logo=GitHub)
Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of the features and benefits:
the features and benefits:
* [Proof of space and time](https://docs.google.com/document/d/1tmRIb7lgi4QfKkNaxuKOBHRmwbVlGL4f7EsBDr_5xZE/edit) based consensus which allows anyone to farm with commodity hardware * [Proof of space and time](https://docs.google.com/document/d/1tmRIb7lgi4QfKkNaxuKOBHRmwbVlGL4f7EsBDr_5xZE/edit) based consensus which allows anyone to farm with commodity hardware
* Very easy to use full node and farmer GUI and cli (thousands of nodes active on mainnet) * Very easy to use full node and farmer GUI and cli (thousands of nodes active on mainnet)
* Simplified UTXO based transaction model, with small on chain state * Simplified UTXO based transaction model, with small on chain state
@ -16,7 +16,7 @@ the features and benefits:
* BLS keys and aggregate signatures (only one signature per block) * BLS keys and aggregate signatures (only one signature per block)
* [Pooling protocol](https://www.chia.net/2020/11/10/pools-in-chia.html) (in development) that allows farmers to have control of making blocks * [Pooling protocol](https://www.chia.net/2020/11/10/pools-in-chia.html) (in development) that allows farmers to have control of making blocks
* Support for light clients with fast, objective syncing * Support for light clients with fast, objective syncing
* Growing community of farmers and developers around the world * A growing community of farmers and developers around the world
Please check out the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki) Please check out the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki)
and [FAQ](https://github.com/Chia-Network/chia-blockchain/wiki/FAQ) for and [FAQ](https://github.com/Chia-Network/chia-blockchain/wiki/FAQ) for
@ -32,18 +32,20 @@ on your router or add a NAT (for IPv4 but not IPv6) and firewall rules to allow
TCP port 8444 access to your peer. TCP port 8444 access to your peer.
These methods tend to be router make/model specific. These methods tend to be router make/model specific.
Most should only install harvesters, farmers, plotter, full nodes, and wallets. Most users should only install harvesters, farmers, plotter, full nodes, and wallets.
Building Timelords and VDFs is for sophisticated users in most environments. Building Timelords and VDFs is for sophisticated users, in most environments.
Chia Network and additional volunteers are running sufficient Timelords Chia Network and additional volunteers are running sufficient Timelords
for consensus. for consensus.
## Installing ## Installing
Install instructions are available in the Install instructions are available in the
[INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) [INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL)
section of the section of the
[chia-blockchain repository wiki](https://github.com/Chia-Network/chia-blockchain/wiki). [chia-blockchain repository wiki](https://github.com/Chia-Network/chia-blockchain/wiki).
## Running ## Running
Once installed, a Once installed, a
[Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide) [Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide)
is available from the repository is available from the repository

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
pip install setuptools_scm pip install setuptools_scm
# The environment variable CHIA_INSTALLER_VERSION needs to be defined # The environment variable CHIA_INSTALLER_VERSION needs to be defined.
# If the env variable NOTARIZE and the username and password variables are # If the env variable NOTARIZE and the username and password variables are
# set, this will attempt to Notarize the signed DMG # set, this will attempt to Notarize the signed DMG.
CHIA_INSTALLER_VERSION=$(python installer-version.py) CHIA_INSTALLER_VERSION=$(python installer-version.py)
if [ ! "$CHIA_INSTALLER_VERSION" ]; then if [ ! "$CHIA_INSTALLER_VERSION" ]; then
@ -91,17 +91,17 @@ fi
# Notes on how to manually notarize # Notes on how to manually notarize
# #
# Ask for username and password - password should be an app specific password # Ask for username and password. password should be an app specific password.
# Generate app specific password https://support.apple.com/en-us/HT204397 # Generate app specific password https://support.apple.com/en-us/HT204397
# xcrun altool --notarize-app -f Chia-0.1.X.dmg --primary-bundle-id net.chia.blockchain -u username -p password # xcrun altool --notarize-app -f Chia-0.1.X.dmg --primary-bundle-id net.chia.blockchain -u username -p password
# xcrun altool --notarize-app; -should return REQUEST-ID, use it in next command # xcrun altool --notarize-app; -should return REQUEST-ID, use it in next command
# #
# Wait until following command return a success message" # Wait until following command return a success message".
# watch -n 20 'xcrun altool --notarization-info {REQUEST-ID} -u username -p password' # watch -n 20 'xcrun altool --notarization-info {REQUEST-ID} -u username -p password'.
# It can take a while, run it every few minutes # It can take a while, run it every few minutes.
# #
# Once that is successful, execute the following command" # Once that is successful, execute the following command":
# xcrun stapler staple Chia-0.1.X.dmg # xcrun stapler staple Chia-0.1.X.dmg
# #
# Validate DMG # Validate DMG:
# xcrun stapler validate Chia-0.1.X.dmg # xcrun stapler validate Chia-0.1.X.dmg

View File

@ -21,7 +21,6 @@ else
Write-Output "miniupnpc download successful." Write-Output "miniupnpc download successful."
} }
Write-Output " ---" Write-Output " ---"
Write-Output "Create venv - python3.7 or 3.8 is required in PATH" Write-Output "Create venv - python3.7 or 3.8 is required in PATH"
Write-Output " ---" Write-Output " ---"

View File

@ -1,26 +1,23 @@
from setuptools_scm import get_version
import sys
import os import os
import sys
from setuptools_scm import get_version
# example: 1.0b5.dev225 # example: 1.0b5.dev225
def main(): def main():
windows = len(sys.argv) > 1 and "win" in sys.argv[1] # Special case windows to 0.1.6225
if len(sys.argv) > 1 and "win" in sys.argv[1]: # Special case windows to 0.1.6225
windows = True
else:
windows = False
scm_full_version = get_version(root="..", relative_to=__file__) scm_full_version = get_version(root="..", relative_to=__file__)
# scm_full_version = "1.0.5.dev22" # scm_full_version = "1.0.5.dev22"
os.environ["SCM_VERSION"] = scm_full_version os.environ["SCM_VERSION"] = scm_full_version
left_full_version = scm_full_version.split("+") left_full_version = scm_full_version.split("+")
version = left_full_version[0].split(".") version = left_full_version[0].split(".")
scm_major_version = version[0] scm_major_version = version[0]
scm_minor_version = version[1] scm_minor_version = version[1]
if len(version) == 3: # if the length of the version array is more than 2
if len(version) == 3: # If the length of the version array is more than 2
patch_release_number = version[2] patch_release_number = version[2]
smc_patch_version = patch_release_number smc_patch_version = patch_release_number
dev_release_number = "" dev_release_number = ""
@ -34,7 +31,7 @@ def main():
major_release_number = scm_major_version major_release_number = scm_major_version
minor_release_number = scm_minor_version minor_release_number = scm_minor_version
# If this is a beta dev release - get which beta it is # If this is a beta dev release, get which beta it is
if "0b" in scm_minor_version: if "0b" in scm_minor_version:
orignial_minor_ver_list = scm_minor_version.split("0b") orignial_minor_ver_list = scm_minor_version.split("0b")
major_release_number = str(1 - int(scm_major_version)) # decrement the major release for beta major_release_number = str(1 - int(scm_major_version)) # decrement the major release for beta

View File

@ -20,12 +20,12 @@ if [ "$(uname)" = "Linux" ]; then
sudo apt-get install -y npm nodejs libxss1 sudo apt-get install -y npm nodejs libxss1
elif type yum && [ ! -f "/etc/redhat-release" ] && [ ! -f "/etc/centos-release" ] && [ ! -f /etc/rocky-release ]; then elif type yum && [ ! -f "/etc/redhat-release" ] && [ ! -f "/etc/centos-release" ] && [ ! -f /etc/rocky-release ]; then
# AMZN 2 # AMZN 2
echo "Installing on Amazon Linux 2" echo "Installing on Amazon Linux 2."
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash - curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs sudo yum install -y nodejs
elif type yum && [ ! -f /etc/rocky-release ] && [ -f /etc/redhat-release ] || [ -f /etc/centos-release ]; then elif type yum && [ ! -f /etc/rocky-release ] && [ -f /etc/redhat-release ] || [ -f /etc/centos-release ]; then
# CentOS or Redhat # CentOS or Redhat
echo "Installing on CentOS/Redhat" echo "Installing on CentOS/Redhat."
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash - curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs sudo yum install -y nodejs
elif type yum && [ -f /etc/rocky-release ]; then elif type yum && [ -f /etc/rocky-release ]; then
@ -52,7 +52,7 @@ if $UBUNTU; then
fi fi
if [ "$UBUNTU_PRE_2004" = "True" ]; then if [ "$UBUNTU_PRE_2004" = "True" ]; then
echo "Installing on Ubuntu older than 20.04 LTS: Ugrading node.js to stable" echo "Installing on Ubuntu older than 20.04 LTS: Ugrading node.js to stable."
UBUNTU_PRE_2004=true # Unfortunately Python returns True when shell expects true UBUNTU_PRE_2004=true # Unfortunately Python returns True when shell expects true
sudo npm install -g n sudo npm install -g n
sudo n stable sudo n stable
@ -60,12 +60,12 @@ if [ "$UBUNTU_PRE_2004" = "True" ]; then
fi fi
if [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "False" ]; then if [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "False" ]; then
echo "Installing on Ubuntu 20.04 LTS or newer: Using installed node.js version" echo "Installing on Ubuntu 20.04 LTS or newer: Using installed node.js version."
fi fi
# We will set up node.js on GitHub Actions and Azure Pipelines directly # For Mac and Windows, we will set up node.js on GitHub Actions and Azure
# for Mac and Windows so skip unless completing a source/developer install # Pipelines directly, so skip unless you are completing a source/developer install.
# Ubuntu special cases above # Ubuntu special cases above.
if [ ! "$CI" ]; then if [ ! "$CI" ]; then
echo "Running git submodule update --init --recursive." echo "Running git submodule update --init --recursive."
echo "" echo ""
@ -89,10 +89,10 @@ if [ ! "$CI" ]; then
npm audit fix || true npm audit fix || true
npm run build npm run build
else else
echo "Skipping node.js in install.sh on MacOS ci" echo "Skipping node.js in install.sh on MacOS ci."
fi fi
echo "" echo ""
echo "Chia blockchain install-gui.sh complete." echo "Chia blockchain install-gui.sh completed."
echo "" echo ""
echo "Type 'cd chia-blockchain-gui' and then 'npm run electron &' to start the GUI" echo "Type 'cd chia-blockchain-gui' and then 'npm run electron &' to start the GUI."

View File

@ -6,7 +6,7 @@ if [ -z "$VIRTUAL_ENV" ]; then
exit 1 exit 1
fi fi
echo "Timelord requires CMake 3.14+ to compile vdf_client" echo "Timelord requires CMake 3.14+ to compile vdf_client."
PYTHON_VERSION=$(python -c 'import sys; print(f"python{sys.version_info.major}.{sys.version_info.minor}")') PYTHON_VERSION=$(python -c 'import sys; print(f"python{sys.version_info.major}.{sys.version_info.minor}")')
echo "Python version: $PYTHON_VERSION" echo "Python version: $PYTHON_VERSION"
@ -18,7 +18,7 @@ CHIAVDF_VERSION=$(python -c 'from setup import dependencies; t = [_ for _ in dep
ubuntu_cmake_install() { ubuntu_cmake_install() {
UBUNTU_PRE_2004=$(python -c 'import subprocess; process = subprocess.run(["lsb_release", "-rs"], stdout=subprocess.PIPE); print(float(process.stdout) < float(20.04))') UBUNTU_PRE_2004=$(python -c 'import subprocess; process = subprocess.run(["lsb_release", "-rs"], stdout=subprocess.PIPE); print(float(process.stdout) < float(20.04))')
if [ "$UBUNTU_PRE_2004" = "True" ]; then if [ "$UBUNTU_PRE_2004" = "True" ]; then
echo "Ubuntu version is pre 20.04LTS - installing CMake with snap" echo "Ubuntu version is pre 20.04LTS - installing CMake with snap."
sudo apt-get install snap -y sudo apt-get install snap -y
sudo apt-get remove --purge cmake -y sudo apt-get remove --purge cmake -y
hash -r hash -r
@ -36,19 +36,19 @@ symlink_vdf_bench() {
elif [ ! -e venv/lib/"$1"/site-packages/vdf_bench ]; then elif [ ! -e venv/lib/"$1"/site-packages/vdf_bench ]; then
echo "ERROR: Could not find venv/lib/$1/site-packages/vdf_bench" echo "ERROR: Could not find venv/lib/$1/site-packages/vdf_bench"
else else
echo "./vdf_bench link exists" echo "./vdf_bench link exists."
fi fi
} }
if [ "$(uname)" = "Linux" ] && type apt-get; then if [ "$(uname)" = "Linux" ] && type apt-get; then
UBUNTU_DEBIAN=true UBUNTU_DEBIAN=true
echo "Found Ubuntu/Debian" echo "Found Ubuntu/Debian."
elif [ "$(uname)" = "Linux" ] && type dnf || yum; then elif [ "$(uname)" = "Linux" ] && type dnf || yum; then
RHEL_BASED=true RHEL_BASED=true
echo "Found RedHat" echo "Found RedHat."
elif [ "$(uname)" = "Darwin" ]; then elif [ "$(uname)" = "Darwin" ]; then
MACOS=true MACOS=true
echo "Found MacOS" echo "Found MacOS."
fi fi
if [ -e "$THE_PATH" ]; then if [ -e "$THE_PATH" ]; then
@ -74,21 +74,21 @@ else
venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION"
symlink_vdf_bench "$PYTHON_VERSION" symlink_vdf_bench "$PYTHON_VERSION"
elif [ -e venv/bin/python ] && test $MACOS && [ "$(brew info boost | grep -c 'Not installed')" -eq 1 ]; then elif [ -e venv/bin/python ] && test $MACOS && [ "$(brew info boost | grep -c 'Not installed')" -eq 1 ]; then
echo "Installing chiavdf requirement boost for MacOS" echo "Installing chiavdf requirement boost for MacOS."
brew install boost brew install boost
echo "installing chiavdf from source" echo "Installing chiavdf from source."
# User needs to provide required packages # User needs to provide required packages
echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION"
venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION"
symlink_vdf_bench "$PYTHON_VERSION" symlink_vdf_bench "$PYTHON_VERSION"
elif [ -e venv/bin/python ]; then elif [ -e venv/bin/python ]; then
echo "installing chiavdf from source" echo "Installing chiavdf from source."
# User needs to provide required packages # User needs to provide required packages
echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION"
venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION"
symlink_vdf_bench "$PYTHON_VERSION" symlink_vdf_bench "$PYTHON_VERSION"
else else
echo "no venv created yet, please run install.sh" echo "No venv created yet, please run install.sh."
fi fi
fi fi
echo "To estimate a timelord on this CPU try './vdf_bench square_asm 400000' for an ips estimate" echo "To estimate a timelord on this CPU try './vdf_bench square_asm 400000' for an ips estimate."

View File

@ -12,13 +12,13 @@ fi
if [ "$(uname -m)" = "armv7l" ]; then if [ "$(uname -m)" = "armv7l" ]; then
echo "" echo ""
echo "WARNING:" echo "WARNING:"
echo "Chia Blockchain requires a 64 bit OS and this is 32 bit armv7l" echo "The Chia Blockchain requires a 64 bit OS and this is 32 bit armv7l"
echo "For more information:" echo "For more information, see"
echo "https://github.com/Chia-Network/chia-blockchain/wiki/Raspberry-Pi" echo "https://github.com/Chia-Network/chia-blockchain/wiki/Raspberry-Pi"
echo "Exiting." echo "Exiting."
exit 1 exit 1
fi fi
# get submodules # Get submodules
git submodule update --init mozilla-ca git submodule update --init mozilla-ca
UBUNTU_PRE_2004=false UBUNTU_PRE_2004=false
@ -36,28 +36,28 @@ if [ "$(uname)" = "Linux" ]; then
#LINUX=1 #LINUX=1
if [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "1" ]; then if [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "1" ]; then
# Debian/Ubuntu # Debian/Ubuntu
echo "Installing on Ubuntu/Debian pre 20.04 LTS" echo "Installing on Ubuntu/Debian pre 20.04 LTS."
sudo apt-get update sudo apt-get update
sudo apt-get install -y python3.7-venv python3.7-distutils sudo apt-get install -y python3.7-venv python3.7-distutils
elif [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "0" ] && [ "$UBUNTU_2100" = "0" ]; then elif [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "0" ] && [ "$UBUNTU_2100" = "0" ]; then
echo "Installing on Ubuntu/Debian 20.04 LTS" echo "Installing on Ubuntu/Debian 20.04 LTS."
sudo apt-get update sudo apt-get update
sudo apt-get install -y python3.8-venv python3-distutils sudo apt-get install -y python3.8-venv python3-distutils
elif [ "$UBUNTU" = "true" ] && [ "$UBUNTU_2100" = "1" ]; then elif [ "$UBUNTU" = "true" ] && [ "$UBUNTU_2100" = "1" ]; then
echo "Installing on Ubuntu/Debian 21.04 or newer" echo "Installing on Ubuntu/Debian 21.04 or newer."
sudo apt-get update sudo apt-get update
sudo apt-get install -y python3.9-venv python3-distutils sudo apt-get install -y python3.9-venv python3-distutils
elif type pacman && [ -f "/etc/arch-release" ]; then elif type pacman && [ -f "/etc/arch-release" ]; then
# Arch Linux # Arch Linux
echo "Installing on Arch Linux" echo "Installing on Arch Linux."
sudo pacman -S --needed python git sudo pacman -S --needed python git
elif type yum && [ ! -f "/etc/redhat-release" ] && [ ! -f "/etc/centos-release" ] && [ ! -f "/etc/fedora-release" ]; then elif type yum && [ ! -f "/etc/redhat-release" ] && [ ! -f "/etc/centos-release" ] && [ ! -f "/etc/fedora-release" ]; then
# AMZN 2 # AMZN 2
echo "Installing on Amazon Linux 2" echo "Installing on Amazon Linux 2."
sudo yum install -y python3 git sudo yum install -y python3 git
elif type yum && [ -f "/etc/redhat-release" ] || [ -f "/etc/centos-release" ] || [ -f "/etc/fedora-release" ]; then elif type yum && [ -f "/etc/redhat-release" ] || [ -f "/etc/centos-release" ] || [ -f "/etc/fedora-release" ]; then
# CentOS or Redhat or Fedora # CentOS or Redhat or Fedora
echo "Installing on CentOS/Redhat/Fedora" echo "Installing on CentOS/Redhat/Fedora."
fi fi
elif [ "$(uname)" = "Darwin" ] && ! type brew >/dev/null 2>&1; then elif [ "$(uname)" = "Darwin" ] && ! type brew >/dev/null 2>&1; then
echo "Installation currently requires brew on MacOS - https://brew.sh/" echo "Installation currently requires brew on MacOS - https://brew.sh/"
@ -87,8 +87,9 @@ if [ x"$INSTALL_PYTHON_VERSION" = x ]; then
INSTALL_PYTHON_VERSION=$(find_python) INSTALL_PYTHON_VERSION=$(find_python)
fi fi
# this fancy syntax sets INSTALL_PYTHON_PATH to "python3.7" unless INSTALL_PYTHON_VERSION is defined # This fancy syntax sets INSTALL_PYTHON_PATH to "python3.7", unless
# if INSTALL_PYTHON_VERSION=3.8, then INSTALL_PYTHON_PATH becomes python3.8 # INSTALL_PYTHON_VERSION is defined.
# If INSTALL_PYTHON_VERSION equals 3.8, then INSTALL_PYTHON_PATH becomes python3.8
INSTALL_PYTHON_PATH=python${INSTALL_PYTHON_VERSION:-3.7} INSTALL_PYTHON_PATH=python${INSTALL_PYTHON_VERSION:-3.7}
@ -110,12 +111,12 @@ python -m pip install -e . --extra-index-url https://pypi.chia.net/simple/
echo "" echo ""
echo "Chia blockchain install.sh complete." echo "Chia blockchain install.sh complete."
echo "For assistance join us on Keybase in the #testnet chat channel" echo "For assistance join us on Keybase in the #testnet chat channel:"
echo "https://keybase.io/team/chia_network.public" echo "https://keybase.io/team/chia_network.public"
echo "" echo ""
echo "Try the Quick Start Guide to running chia-blockchain" echo "Try the Quick Start Guide to running chia-blockchain:"
echo "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide" echo "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide"
echo "" echo ""
echo "To install the GUI type 'sh install-gui.sh' after '. ./activate'" echo "To install the GUI type 'sh install-gui.sh' after '. ./activate'."
echo "" echo ""
echo "Type '. ./activate' and then 'chia init' to begin" echo "Type '. ./activate' and then 'chia init' to begin."

View File

@ -28,6 +28,7 @@ dependencies = [
upnp_dependencies = [ upnp_dependencies = [
"miniupnpc==2.1", # Allows users to open ports on their router "miniupnpc==2.1", # Allows users to open ports on their router
] ]
dev_dependencies = [ dev_dependencies = [
"pytest", "pytest",
"pytest-asyncio", "pytest-asyncio",

View File

@ -1,23 +1,21 @@
# Test CI Job generation # Test CI Job generation
The CI jobs for these tests are managed by `build-workflows.py` The CI jobs for these tests are managed by `build-workflows.py`.
If you add a test file, or move one to another directory, please run `build-workflows.py`. If you add a test file, or move one to another directory, please run `build-workflows.py`.
Tests are recognized by the file glob `test_*.py`. Tests are recognized by the file glob `test_*.py`.
Changing the contents of a file does not require running `build-workflows.py` Changing the contents of a file does not require running `build-workflows.py`.
We currently use github actions. Default runners have two vcpus. We currently use github actions. Default runners have two vcpus.
The workflows are located in [../.github/workflows/](https://github.com/Chia-Network/chia-blockchain/tree/main/.github/workflows) The workflows are located in [../.github/workflows/](https://github.com/Chia-Network/chia-blockchain/tree/main/.github/workflows).
The inputs to `build-workflows.py` are the templates in `runner-templates`, the file `testconfig.py` in this directory, The inputs to `build-workflows.py` are the templates in `runner-templates`, the file `testconfig.py` in this directory, and the optional `config.py` files in some test subdirectories.
and the optional `config.py` files in some test subdirectories.
Files in the template directory ending in `include.yml` are included in jobs based on the per-directory settings. Files in the template directory ending in `include.yml` are included in jobs based on the per-directory settings.
The generated workflows are output to ../.github/workflows/ The generated workflows are output to `../.github/workflows/`.
Each subdirectory below the directories `root_test_dirs` in `testconfig.py` becomes a job in the github workflow matrix. Each subdirectory below the directories `root_test_dirs` in `testconfig.py` becomes a job in the github workflow matrix.
If your jobs run too long, simply move some tests into new subdirectories, and run `build-workflows.py`. If your jobs run too long, simply move some tests into new subdirectories and run `build-workflows.py`.
A workflow built from a parent directory does not include the tests in its subdirectories. A workflow built from a parent directory does not include the tests in its subdirectories.
The subdirectory jobs do not include the tests from their parents. The subdirectory jobs do not include the tests from their parents.
@ -41,7 +39,7 @@ job_timeout = 30
### Parallel test execution ### Parallel test execution
If you are certain that all the tests in a directory can run in parallel, set `parallel = True` in config.py in that directory. If you are certain that all the tests in a directory can run in parallel, set `parallel = True` in `config.py` inside that directory.
### Optional job stages ### Optional job stages
@ -52,4 +50,4 @@ Set `install_timelord` to `False` to omit the step of installing a Time Lord for
### Job Timeout ### Job Timeout
Set `job_timeout` to the number of minutes you want the CI system to wait before it kills your job. Set `job_timeout` to the number of minutes you want the CI system to wait before it kills your job.
Add two or three minutes to allow for job setup. Add two or three minutes to allow for job setup.

View File

@ -37,17 +37,17 @@ def read_file(filename):
return None return None
# input file # Input file
def workflow_yaml_template_text(os): def workflow_yaml_template_text(os):
return Path(f"runner-templates/build-test-{os}").read_text() return Path(f"runner-templates/build-test-{os}").read_text()
# output files # Output files
def workflow_yaml_file(dir, os, test_name): def workflow_yaml_file(dir, os, test_name):
return Path(dir / f"build-test-{os}-{test_name}.yml") return Path(dir / f"build-test-{os}-{test_name}.yml")
# Function from test dir to test name # String function from test dir to test name
def test_name(dir): def test_name(dir):
return str(dir).replace("/", "-") return str(dir).replace("/", "-")
@ -77,7 +77,7 @@ default_replacements = {
# ----- # -----
# replace with update_config # Replace with update_config
def generate_replacements(defaults, conf, dir, test_files): def generate_replacements(defaults, conf, dir, test_files):
assert len(test_files) > 0 assert len(test_files) > 0
replacements = dict(defaults) replacements = dict(defaults)
@ -102,7 +102,7 @@ def generate_replacements(defaults, conf, dir, test_files):
return replacements return replacements
# overwrite with directory specific values # Overwrite with directory specific values
def update_config(parent, child): def update_config(parent, child):
if child is None: if child is None:
return parent return parent

View File

@ -1,5 +1,6 @@
import asyncio import asyncio
import signal import signal
from secrets import token_bytes from secrets import token_bytes
from typing import Dict, List, Optional from typing import Dict, List, Optional

View File

@ -1,4 +1,4 @@
# Github actions template config # Github actions template config.
oses = ["ubuntu", "macos"] oses = ["ubuntu", "macos"]
root_test_dirs = ["blockchain", "clvm", "core", "generator", "simulation", "wallet"] root_test_dirs = ["blockchain", "clvm", "core", "generator", "simulation", "wallet"]