mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 10:05:29 -05:00
Merge branch 'main' into jack-cat-coinselection
This commit is contained in:
@@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- '**'
|
- '**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- '**'
|
||||||
@@ -25,45 +25,51 @@ jobs:
|
|||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ 3.9 ]
|
python-version: [ 3.9 ]
|
||||||
|
env:
|
||||||
|
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Clean workspace
|
||||||
uses: actions/checkout@v3
|
uses: Chia-Network/actions/clean-workspace@main
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Python environment
|
- name: Checkout Code
|
||||||
uses: actions/setup-python@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get pip cache dir
|
- name: Setup Python environment
|
||||||
id: pip-cache
|
uses: actions/setup-python@v2
|
||||||
run: |
|
with:
|
||||||
echo "::set-output name=dir::$(pip cache dir)"
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Cache pip
|
- name: Get pip cache dir
|
||||||
uses: actions/cache@v3
|
id: pip-cache
|
||||||
with:
|
run: |
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
echo "::set-output name=dir::$(pip cache dir)"
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pip-
|
|
||||||
|
|
||||||
- name: Install ubuntu dependencies
|
- name: Cache pip
|
||||||
run: |
|
uses: actions/cache@v3
|
||||||
sudo apt-get install software-properties-common
|
with:
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
sudo apt-get update
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||||
sudo apt-get install python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils git -y
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Run install script
|
- name: Checkout test blocks and plots
|
||||||
env:
|
uses: actions/checkout@v3
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
with:
|
||||||
run: |
|
repository: 'Chia-Network/test-cache'
|
||||||
sh install.sh -d
|
path: '.chia'
|
||||||
|
ref: '0.29.0'
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: pytest
|
- name: Run install script
|
||||||
run: |
|
env:
|
||||||
. ./activate
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
./venv/bin/py.test -n 0 -m benchmark tests
|
run: |
|
||||||
|
sh install.sh -d
|
||||||
|
|
||||||
|
- name: pytest
|
||||||
|
run: |
|
||||||
|
. ./activate
|
||||||
|
./venv/bin/py.test -n 0 -m benchmark tests
|
||||||
|
|||||||
@@ -105,23 +105,23 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: |
|
run: |
|
||||||
sh install.sh
|
sh install.sh
|
||||||
|
|
||||||
- name: Build arm64 .deb package
|
- name: Build arm64 .deb package
|
||||||
|
env:
|
||||||
|
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
|
||||||
ldd --version
|
ldd --version
|
||||||
cd ./chia-blockchain-gui
|
git -C ./chia-blockchain-gui status
|
||||||
git status
|
. ./activate
|
||||||
cd ../build_scripts
|
cd ./build_scripts
|
||||||
sh build_linux_deb.sh arm64
|
sh build_linux_deb.sh arm64
|
||||||
|
|
||||||
- name: Upload Linux artifacts
|
- name: Upload Linux artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Linux-ARM-64-Installer
|
name: chia-installers-linux-deb-arm64
|
||||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||||
|
|
||||||
- name: Configure AWS Credentials
|
- name: Configure AWS Credentials
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: |
|
run: |
|
||||||
sh install.sh
|
sh install.sh
|
||||||
|
|
||||||
@@ -153,18 +152,19 @@ jobs:
|
|||||||
sudo apt-get install -y jq
|
sudo apt-get install -y jq
|
||||||
|
|
||||||
- name: Build .deb package
|
- name: Build .deb package
|
||||||
|
env:
|
||||||
|
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
|
||||||
ldd --version
|
ldd --version
|
||||||
cd ./chia-blockchain-gui
|
git -C ./chia-blockchain-gui status
|
||||||
git status
|
. ./activate
|
||||||
cd ../build_scripts
|
cd ./build_scripts
|
||||||
sh build_linux_deb.sh amd64
|
sh build_linux_deb.sh amd64
|
||||||
|
|
||||||
- name: Upload Linux artifacts
|
- name: Upload Linux artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Linux-Installers
|
name: chia-installers-linux-deb-intel
|
||||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||||
|
|
||||||
- name: Configure AWS Credentials
|
- name: Configure AWS Credentials
|
||||||
|
|||||||
@@ -108,23 +108,23 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: |
|
run: |
|
||||||
sh install.sh
|
sh install.sh
|
||||||
|
|
||||||
- name: Build .rpm package
|
- name: Build .rpm package
|
||||||
|
env:
|
||||||
|
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
|
||||||
ldd --version
|
ldd --version
|
||||||
cd ./chia-blockchain-gui
|
git -C ./chia-blockchain-gui status
|
||||||
git status
|
. ./activate
|
||||||
cd ../build_scripts
|
cd ./build_scripts
|
||||||
sh build_linux_rpm.sh amd64
|
sh build_linux_rpm.sh amd64
|
||||||
|
|
||||||
- name: Upload Linux artifacts
|
- name: Upload Linux artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Linux-Installers
|
name: chia-installers-linux-rpm-intel
|
||||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||||
|
|
||||||
- name: Configure AWS Credentials
|
- name: Configure AWS Credentials
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: |
|
run: |
|
||||||
sh install.sh
|
sh install.sh
|
||||||
|
|
||||||
@@ -138,20 +137,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Build MacOS DMG
|
- name: Build MacOS DMG
|
||||||
env:
|
env:
|
||||||
|
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||||
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
|
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
|
||||||
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
|
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
|
||||||
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
|
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
|
||||||
run: |
|
run: |
|
||||||
|
git -C ./chia-blockchain-gui status
|
||||||
. ./activate
|
. ./activate
|
||||||
cd ./chia-blockchain-gui
|
cd ./build_scripts
|
||||||
git status
|
|
||||||
cd ../build_scripts
|
|
||||||
sh build_macos.sh
|
sh build_macos.sh
|
||||||
|
|
||||||
- name: Upload MacOS artifacts
|
- name: Upload MacOS artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Chia-Installer-MacOS-intel-dmg
|
name: chia-installers-macos-dmg-intel
|
||||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||||
|
|
||||||
- name: Create Checksums
|
- name: Create Checksums
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: |
|
run: |
|
||||||
arch -arm64 sh install.sh
|
arch -arm64 sh install.sh
|
||||||
|
|
||||||
@@ -111,21 +110,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Build MacOS DMG
|
- name: Build MacOS DMG
|
||||||
env:
|
env:
|
||||||
|
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||||
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
|
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
|
||||||
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
|
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
|
||||||
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
|
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
|
||||||
run: |
|
run: |
|
||||||
export PATH=$(brew --prefix node@16)/bin:$PATH
|
export PATH=$(brew --prefix node@16)/bin:$PATH
|
||||||
|
git -C ./chia-blockchain-gui status
|
||||||
. ./activate
|
. ./activate
|
||||||
cd ./chia-blockchain-gui
|
cd ./build_scripts
|
||||||
arch -arm64 git status
|
|
||||||
cd ../build_scripts
|
|
||||||
arch -arm64 sh build_macos_m1.sh
|
arch -arm64 sh build_macos_m1.sh
|
||||||
|
|
||||||
- name: Upload MacOS artifacts
|
- name: Upload MacOS artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Chia-Installer-MacOS-arm64-dmg
|
name: chia-installers-macos-dmg-arm64
|
||||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||||
|
|
||||||
- name: Install AWS CLI
|
- name: Install AWS CLI
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test blockchain code with pytest
|
- name: Test blockchain code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/blockchain/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/blockchain/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ jobs:
|
|||||||
- name: Test clvm code with pytest
|
- name: Test clvm code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/clvm/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/clvm/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test core-cmds code with pytest
|
- name: Test core-cmds code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/cmds/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/cmds/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test core-consensus code with pytest
|
- name: Test core-consensus code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/consensus/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/consensus/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test core-custom_types code with pytest
|
- name: Test core-custom_types code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/custom_types/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/custom_types/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -80,24 +88,16 @@ jobs:
|
|||||||
brew install boost
|
brew install boost
|
||||||
sh install.sh -d
|
sh install.sh -d
|
||||||
|
|
||||||
- name: Install Ubuntu dependencies
|
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
sudo apt-get install software-properties-common
|
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils git -y
|
|
||||||
|
|
||||||
- name: Install timelord
|
- name: Install timelord
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
sh install-timelord.sh
|
sh install-timelord.sh -n
|
||||||
./vdf_bench square_asm 400000
|
./vdf_bench square_asm 400000
|
||||||
|
|
||||||
- name: Test core-daemon code with pytest
|
- name: Test core-daemon code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/daemon/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/daemon/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core-full_node-full_sync code with pytest
|
- name: Test core-full_node-full_sync code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/full_sync/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/full_sync/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core-full_node-stores code with pytest
|
- name: Test core-full_node-stores code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/stores/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/stores/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core-full_node code with pytest
|
- name: Test core-full_node code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core-server code with pytest
|
- name: Test core-server code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/server/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/server/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core-ssl code with pytest
|
- name: Test core-ssl code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/ssl/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/ssl/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core-util code with pytest
|
- name: Test core-util code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/util/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/util/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test core code with pytest
|
- name: Test core code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test farmer_harvester code with pytest
|
- name: Test farmer_harvester code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/farmer_harvester/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/farmer_harvester/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test generator code with pytest
|
- name: Test generator code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/generator/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/generator/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
#
|
||||||
|
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
|
||||||
|
#
|
||||||
|
name: MacOS plot_sync Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# SHA is added to the end if on `main` to let all main workflows run
|
||||||
|
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: MacOS plot_sync Tests
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 30
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
python-version: [3.8, 3.9]
|
||||||
|
os: [macOS-latest]
|
||||||
|
env:
|
||||||
|
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
|
||||||
|
JOB_FILE_NAME: tests_${{ matrix.os }}_python-${{ matrix.python-version }}_plot_sync
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Python environment
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Create keychain for CI use
|
||||||
|
run: |
|
||||||
|
security create-keychain -p foo chiachain
|
||||||
|
security default-keychain -s chiachain
|
||||||
|
security unlock-keychain -p foo chiachain
|
||||||
|
security set-keychain-settings -t 7200 -u chiachain
|
||||||
|
|
||||||
|
- name: Get pip cache dir
|
||||||
|
id: pip-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(pip cache dir)"
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
# Note that new runners may break this https://github.com/actions/cache/issues/292
|
||||||
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
|
- name: Cache test blocks and plots
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/.chia/blocks
|
||||||
|
${{ github.workspace }}/.chia/test-plots
|
||||||
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
|
- name: Run install script
|
||||||
|
env:
|
||||||
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
|
run: |
|
||||||
|
brew install boost
|
||||||
|
sh install.sh -d
|
||||||
|
|
||||||
|
# Omitted installing Timelord
|
||||||
|
|
||||||
|
- name: Test plot_sync code with pytest
|
||||||
|
run: |
|
||||||
|
. ./activate
|
||||||
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/plot_sync/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
|
- name: Process coverage data
|
||||||
|
run: |
|
||||||
|
venv/bin/coverage combine --rcfile=.coveragerc .coverage.*
|
||||||
|
venv/bin/coverage xml --rcfile=.coveragerc -o coverage.xml
|
||||||
|
mkdir coverage_reports
|
||||||
|
cp .coverage "coverage_reports/.coverage.${{ env.JOB_FILE_NAME }}"
|
||||||
|
cp coverage.xml "coverage_reports/coverage.${{ env.JOB_FILE_NAME }}.xml"
|
||||||
|
venv/bin/coverage report --rcfile=.coveragerc --show-missing
|
||||||
|
|
||||||
|
- name: Publish coverage
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: coverage
|
||||||
|
path: coverage_reports/*
|
||||||
|
if-no-files-found: error
|
||||||
|
#
|
||||||
|
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
|
||||||
|
#
|
||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test plotting code with pytest
|
- name: Test plotting code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/plotting/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/plotting/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test pools code with pytest
|
- name: Test pools code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/pools/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/pools/test_*.py --durations=10 -n 2 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -80,24 +88,16 @@ jobs:
|
|||||||
brew install boost
|
brew install boost
|
||||||
sh install.sh -d
|
sh install.sh -d
|
||||||
|
|
||||||
- name: Install Ubuntu dependencies
|
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
sudo apt-get install software-properties-common
|
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils git -y
|
|
||||||
|
|
||||||
- name: Install timelord
|
- name: Install timelord
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
sh install-timelord.sh
|
sh install-timelord.sh -n
|
||||||
./vdf_bench square_asm 400000
|
./vdf_bench square_asm 400000
|
||||||
|
|
||||||
- name: Test simulation code with pytest
|
- name: Test simulation code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/simulation/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/simulation/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test tools code with pytest
|
- name: Test tools code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/tools/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/tools/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test util code with pytest
|
- name: Test util code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/util/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/util/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test wallet-cat_wallet code with pytest
|
- name: Test wallet-cat_wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/cat_wallet/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/cat_wallet/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test wallet-did_wallet code with pytest
|
- name: Test wallet-did_wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/did_wallet/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/did_wallet/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +79,7 @@ jobs:
|
|||||||
- name: Test wallet-rl_wallet code with pytest
|
- name: Test wallet-rl_wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rl_wallet/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rl_wallet/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test wallet-rpc code with pytest
|
- name: Test wallet-rpc code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rpc/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rpc/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test wallet-simple_sync code with pytest
|
- name: Test wallet-simple_sync code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/simple_sync/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/simple_sync/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test wallet-sync code with pytest
|
- name: Test wallet-sync code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/sync/test_*.py -s -v --durations 0 -n 0 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/sync/test_*.py --durations=10 -n 0 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test wallet code with pytest
|
- name: Test wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
- name: Test weight_proof code with pytest
|
- name: Test weight_proof code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/weight_proof/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/weight_proof/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test blockchain code with pytest
|
- name: Test blockchain code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/blockchain/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/blockchain/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ jobs:
|
|||||||
- name: Test clvm code with pytest
|
- name: Test clvm code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/clvm/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/clvm/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test core-cmds code with pytest
|
- name: Test core-cmds code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/cmds/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/cmds/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test core-consensus code with pytest
|
- name: Test core-consensus code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/consensus/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/consensus/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test core-custom_types code with pytest
|
- name: Test core-custom_types code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/custom_types/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/custom_types/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -79,24 +87,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sh install.sh -d
|
sh install.sh -d
|
||||||
|
|
||||||
- name: Install Ubuntu dependencies
|
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
sudo apt-get install software-properties-common
|
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils git -y
|
|
||||||
|
|
||||||
- name: Install timelord
|
- name: Install timelord
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
sh install-timelord.sh
|
sh install-timelord.sh -n
|
||||||
./vdf_bench square_asm 400000
|
./vdf_bench square_asm 400000
|
||||||
|
|
||||||
- name: Test core-daemon code with pytest
|
- name: Test core-daemon code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/daemon/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/daemon/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core-full_node-full_sync code with pytest
|
- name: Test core-full_node-full_sync code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/full_sync/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/full_sync/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core-full_node-stores code with pytest
|
- name: Test core-full_node-stores code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/stores/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/stores/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core-full_node code with pytest
|
- name: Test core-full_node code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/test_*.py -s -v --durations 0 -n 4 -m "not benchmark"
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/full_node/test_*.py --durations=10 -n 4 -m "not benchmark"
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core-server code with pytest
|
- name: Test core-server code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/server/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/server/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core-ssl code with pytest
|
- name: Test core-ssl code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/ssl/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/ssl/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core-util code with pytest
|
- name: Test core-util code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/util/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/util/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test core code with pytest
|
- name: Test core code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/core/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test farmer_harvester code with pytest
|
- name: Test farmer_harvester code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/farmer_harvester/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/farmer_harvester/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test generator code with pytest
|
- name: Test generator code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/generator/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/generator/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
#
|
||||||
|
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
|
||||||
|
#
|
||||||
|
name: Ubuntu plot_sync Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# SHA is added to the end if on `main` to let all main workflows run
|
||||||
|
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Ubuntu plot_sync Test
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 30
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
python-version: [3.7, 3.8, 3.9]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
env:
|
||||||
|
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
|
||||||
|
JOB_FILE_NAME: tests_${{ matrix.os }}_python-${{ matrix.python-version }}_plot_sync
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Python environment
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Cache npm
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Get pip cache dir
|
||||||
|
id: pip-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(pip cache dir)"
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
|
- name: Cache test blocks and plots
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/.chia/blocks
|
||||||
|
${{ github.workspace }}/.chia/test-plots
|
||||||
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
|
- name: Run install script
|
||||||
|
env:
|
||||||
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
|
run: |
|
||||||
|
sh install.sh -d
|
||||||
|
|
||||||
|
# Omitted installing Timelord
|
||||||
|
|
||||||
|
- name: Test plot_sync code with pytest
|
||||||
|
run: |
|
||||||
|
. ./activate
|
||||||
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/plot_sync/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
|
- name: Process coverage data
|
||||||
|
run: |
|
||||||
|
venv/bin/coverage combine --rcfile=.coveragerc .coverage.*
|
||||||
|
venv/bin/coverage xml --rcfile=.coveragerc -o coverage.xml
|
||||||
|
mkdir coverage_reports
|
||||||
|
cp .coverage "coverage_reports/.coverage.${{ env.JOB_FILE_NAME }}"
|
||||||
|
cp coverage.xml "coverage_reports/coverage.${{ env.JOB_FILE_NAME }}.xml"
|
||||||
|
venv/bin/coverage report --rcfile=.coveragerc --show-missing
|
||||||
|
|
||||||
|
- name: Publish coverage
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: coverage
|
||||||
|
path: coverage_reports/*
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
# Omitted resource usage check
|
||||||
|
|
||||||
|
#
|
||||||
|
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
|
||||||
|
#
|
||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test plotting code with pytest
|
- name: Test plotting code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/plotting/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/plotting/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test pools code with pytest
|
- name: Test pools code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/pools/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/pools/test_*.py --durations=10 -n 2 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -79,24 +87,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sh install.sh -d
|
sh install.sh -d
|
||||||
|
|
||||||
- name: Install Ubuntu dependencies
|
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
sudo apt-get install software-properties-common
|
|
||||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils git -y
|
|
||||||
|
|
||||||
- name: Install timelord
|
- name: Install timelord
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
sh install-timelord.sh
|
sh install-timelord.sh -n
|
||||||
./vdf_bench square_asm 400000
|
./vdf_bench square_asm 400000
|
||||||
|
|
||||||
- name: Test simulation code with pytest
|
- name: Test simulation code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/simulation/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/simulation/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test tools code with pytest
|
- name: Test tools code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/tools/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/tools/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test util code with pytest
|
- name: Test util code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/util/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/util/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test wallet-cat_wallet code with pytest
|
- name: Test wallet-cat_wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/cat_wallet/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/cat_wallet/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test wallet-did_wallet code with pytest
|
- name: Test wallet-did_wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/did_wallet/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/did_wallet/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: 'Chia-Network/test-cache'
|
|
||||||
path: '.chia'
|
|
||||||
ref: '0.28.0'
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +78,7 @@ jobs:
|
|||||||
- name: Test wallet-rl_wallet code with pytest
|
- name: Test wallet-rl_wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rl_wallet/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rl_wallet/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test wallet-rpc code with pytest
|
- name: Test wallet-rpc code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rpc/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/rpc/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test wallet-simple_sync code with pytest
|
- name: Test wallet-simple_sync code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/simple_sync/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/simple_sync/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test wallet-sync code with pytest
|
- name: Test wallet-sync code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/sync/test_*.py -s -v --durations 0 -n 0 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/sync/test_*.py --durations=10 -n 0 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test wallet code with pytest
|
- name: Test wallet code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/wallet/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Checkout test blocks and plots
|
- name: Cache test blocks and plots
|
||||||
uses: actions/checkout@v3
|
uses: actions/cache@v2
|
||||||
|
id: test-blocks-plots
|
||||||
with:
|
with:
|
||||||
repository: 'Chia-Network/test-cache'
|
path: |
|
||||||
path: '.chia'
|
${{ github.workspace }}/.chia/blocks
|
||||||
ref: '0.28.0'
|
${{ github.workspace }}/.chia/test-plots
|
||||||
fetch-depth: 1
|
key: 0.29.0
|
||||||
|
|
||||||
|
- name: Checkout test blocks and plots
|
||||||
|
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
|
||||||
|
mkdir ${{ github.workspace }}/.chia
|
||||||
|
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia
|
||||||
|
|
||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
@@ -84,7 +92,7 @@ jobs:
|
|||||||
- name: Test weight_proof code with pytest
|
- name: Test weight_proof code with pytest
|
||||||
run: |
|
run: |
|
||||||
. ./activate
|
. ./activate
|
||||||
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/weight_proof/test_*.py -s -v --durations 0 -n 4 -m "not benchmark" -p no:monitor
|
venv/bin/coverage run --rcfile=.coveragerc ./venv/bin/py.test tests/weight_proof/test_*.py --durations=10 -n 4 -m "not benchmark" -p no:monitor
|
||||||
|
|
||||||
- name: Process coverage data
|
- name: Process coverage data
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
name: Install Python 3.9
|
name: Install Python 3.9
|
||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: "3.9.11"
|
||||||
|
|
||||||
- name: Setup Node 16.x
|
- name: Setup Node 16.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
@@ -145,17 +145,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Windows installer with build_scripts\build_windows.ps1
|
- name: Build Windows installer with build_scripts\build_windows.ps1
|
||||||
env:
|
env:
|
||||||
|
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||||
WIN_CODE_SIGN_PASS: ${{ secrets.WIN_CODE_SIGN_PASS }}
|
WIN_CODE_SIGN_PASS: ${{ secrets.WIN_CODE_SIGN_PASS }}
|
||||||
HAS_SECRET: ${{ steps.check_secrets.outputs.HAS_SIGNING_SECRET }}
|
HAS_SECRET: ${{ steps.check_secrets.outputs.HAS_SIGNING_SECRET }}
|
||||||
run: |
|
run: |
|
||||||
$env:path="C:\Program` Files` (x86)\Microsoft` Visual` Studio\2019\Enterprise\SDK\ScopeCppSDK\vc15\VC\bin\;$env:path"
|
$env:path="C:\Program` Files` (x86)\Microsoft` Visual` Studio\2019\Enterprise\SDK\ScopeCppSDK\vc15\VC\bin\;$env:path"
|
||||||
$env:path="C:\Program` Files` (x86)\Windows` Kits\10\App` Certification` Kit;$env:path"
|
$env:path="C:\Program` Files` (x86)\Windows` Kits\10\App` Certification` Kit;$env:path"
|
||||||
|
git -C .\chia-blockchain-gui status
|
||||||
.\build_scripts\build_windows.ps1
|
.\build_scripts\build_windows.ps1
|
||||||
|
|
||||||
- name: Upload Windows exe's to artifacts
|
- name: Upload Windows exe's to artifacts
|
||||||
uses: actions/upload-artifact@v2.2.2
|
uses: actions/upload-artifact@v2.2.2
|
||||||
with:
|
with:
|
||||||
name: Windows-Exe
|
name: chia-installers-windows-exe-intel
|
||||||
path: ${{ github.workspace }}\chia-blockchain-gui\Chia-win32-x64\
|
path: ${{ github.workspace }}\chia-blockchain-gui\Chia-win32-x64\
|
||||||
|
|
||||||
- name: Upload Installer to artifacts
|
- name: Upload Installer to artifacts
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
cd ./mozilla-ca
|
cd ./mozilla-ca
|
||||||
git pull origin main
|
git pull origin main
|
||||||
- name: "Create Pull Request"
|
- name: "Create Pull Request"
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
base: main
|
base: main
|
||||||
body: "Newest Mozilla CA cert"
|
body: "Newest Mozilla CA cert"
|
||||||
@@ -28,5 +28,6 @@ jobs:
|
|||||||
commit-message: "adding ca updates"
|
commit-message: "adding ca updates"
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
reviewers: "wjblanke,emlowe"
|
reviewers: "wjblanke,emlowe"
|
||||||
|
assignees: "wallentx"
|
||||||
title: "CA Cert updates"
|
title: "CA Cert updates"
|
||||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
# Run Linter against code base #
|
# Run Linter against code base #
|
||||||
################################
|
################################
|
||||||
- name: Lint Code Base
|
- name: Lint Code Base
|
||||||
uses: github/super-linter@v4.9.1
|
uses: github/super-linter@v4.9.2
|
||||||
# uses: docker://github/super-linter:v3.10.2
|
# uses: docker://github/super-linter:v3.10.2
|
||||||
env:
|
env:
|
||||||
VALIDATE_ALL_CODEBASE: true
|
VALIDATE_ALL_CODEBASE: true
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: sh install.sh
|
run: sh install.sh
|
||||||
|
|
||||||
- name: Run install-gui script
|
- name: Run install-gui script
|
||||||
@@ -188,7 +187,6 @@ jobs:
|
|||||||
- name: Run install script
|
- name: Run install script
|
||||||
env:
|
env:
|
||||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
BUILD_VDF_CLIENT: "N"
|
|
||||||
run: sh install.sh -a
|
run: sh install.sh -a
|
||||||
|
|
||||||
- name: Run chia --help
|
- name: Run chia --help
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ extend_skip=
|
|||||||
chia/wallet/did_wallet/did_wallet.py
|
chia/wallet/did_wallet/did_wallet.py
|
||||||
chia/wallet/lineage_proof.py
|
chia/wallet/lineage_proof.py
|
||||||
chia/wallet/payment.py
|
chia/wallet/payment.py
|
||||||
chia/wallet/puzzles/genesis_checkers.py
|
|
||||||
chia/wallet/puzzles/load_clvm.py
|
chia/wallet/puzzles/load_clvm.py
|
||||||
chia/wallet/puzzles/prefarm/make_prefarm_ph.py
|
chia/wallet/puzzles/prefarm/make_prefarm_ph.py
|
||||||
chia/wallet/puzzles/prefarm/spend_prefarm.py
|
chia/wallet/puzzles/prefarm/spend_prefarm.py
|
||||||
|
|||||||
@@ -8,6 +8,19 @@ for setuptools_scm/PEP 440 reasons.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## 1.3.3 Chia blockchain 2022-4-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- In version 1.3.2 our patch for the OpenSSL vulnerability was not complete for the Windows installer. Thank you @xsmolasses of Core-Pool.
|
||||||
|
- MacOS would not update openssl when installing via `install.sh`
|
||||||
|
- Some debugging information remained in `install.sh`
|
||||||
|
|
||||||
|
## 1.3.2 Chia blockchain 2022-4-01
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed OpenSSL vulnerability CVE-2022-0778
|
||||||
|
|
||||||
## 1.3.1 Chia blockchain 2022-3-16
|
## 1.3.1 Chia blockchain 2022-3-16
|
||||||
|
|
||||||
|
|||||||
+67
-8
@@ -1,5 +1,16 @@
|
|||||||
|
param(
|
||||||
|
[Parameter(HelpMessage="install development dependencies")]
|
||||||
|
[switch]$d = $False
|
||||||
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$extras = @()
|
||||||
|
if ($d)
|
||||||
|
{
|
||||||
|
$extras += "dev"
|
||||||
|
}
|
||||||
|
|
||||||
if ([Environment]::Is64BitOperatingSystem -eq $false)
|
if ([Environment]::Is64BitOperatingSystem -eq $false)
|
||||||
{
|
{
|
||||||
Write-Output "Chia requires a 64-bit Windows installation"
|
Write-Output "Chia requires a 64-bit Windows installation"
|
||||||
@@ -32,20 +43,68 @@ if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
|
|||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$pythonVersion = (py --version).split(" ")[1]
|
$supportedPythonVersions = "3.9", "3.8", "3.7"
|
||||||
if ([version]$pythonVersion -lt [version]"3.7.0")
|
if (Test-Path env:INSTALL_PYTHON_VERSION)
|
||||||
{
|
{
|
||||||
Write-Output "Found Python version:" $pythonVersion
|
$pythonVersion = $env:INSTALL_PYTHON_VERSION
|
||||||
Write-Output "Installation requires Python 3.7 or later"
|
|
||||||
Exit 1
|
|
||||||
}
|
}
|
||||||
Write-Output "Python version is:" $pythonVersion
|
else
|
||||||
|
{
|
||||||
|
foreach ($version in $supportedPythonVersions)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
py -$version --version 2>&1 >$null
|
||||||
|
$result = $?
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
$result = $false
|
||||||
|
}
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$pythonVersion = $version
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
py -m venv venv
|
if (-not $pythonVersion)
|
||||||
|
{
|
||||||
|
$reversedPythonVersions = $supportedPythonVersions.clone()
|
||||||
|
[array]::Reverse($reversedPythonVersions)
|
||||||
|
$reversedPythonVersions = $reversedPythonVersions -join ", "
|
||||||
|
Write-Output "No usable Python version found, supported versions are: $reversedPythonVersions"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fullPythonVersion = (py -$pythonVersion --version).split(" ")[1]
|
||||||
|
|
||||||
|
Write-Output "Python version is: $fullPythonVersion"
|
||||||
|
|
||||||
|
$openSSLVersionStr = (py -$pythonVersion -c 'import ssl; print(ssl.OPENSSL_VERSION)')
|
||||||
|
$openSSLVersion = (py -$pythonVersion -c 'import ssl; print(ssl.OPENSSL_VERSION_NUMBER)')
|
||||||
|
if ($openSSLVersion -lt 269488367)
|
||||||
|
{
|
||||||
|
Write-Output "Found Python with OpenSSL version:" $openSSLVersionStr
|
||||||
|
Write-Output "Anything before 1.1.1n is vulnerable to CVE-2022-0778."
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($extras.length -gt 0)
|
||||||
|
{
|
||||||
|
$extras_cli = $extras -join ","
|
||||||
|
$extras_cli = "[$extras_cli]"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$extras_cli = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
py -$pythonVersion -m venv venv
|
||||||
|
|
||||||
venv\scripts\python -m pip install --upgrade pip setuptools wheel
|
venv\scripts\python -m pip install --upgrade pip setuptools wheel
|
||||||
venv\scripts\pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2
|
venv\scripts\pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2
|
||||||
venv\scripts\pip install --editable . --extra-index-url https://pypi.chia.net/simple/
|
venv\scripts\pip install --editable ".$extras_cli" --extra-index-url https://pypi.chia.net/simple/
|
||||||
|
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
Write-Output "Chia blockchain .\Install.ps1 complete."
|
Write-Output "Chia blockchain .\Install.ps1 complete."
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ from chia.util.streamable import Streamable, streamable
|
|||||||
_version = 1
|
_version = 1
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class BenchmarkInner(Streamable):
|
class BenchmarkInner(Streamable):
|
||||||
a: str
|
a: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class BenchmarkMiddle(Streamable):
|
class BenchmarkMiddle(Streamable):
|
||||||
a: uint64
|
a: uint64
|
||||||
b: List[bytes32]
|
b: List[bytes32]
|
||||||
@@ -33,8 +33,8 @@ class BenchmarkMiddle(Streamable):
|
|||||||
e: BenchmarkInner
|
e: BenchmarkInner
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class BenchmarkClass(Streamable):
|
class BenchmarkClass(Streamable):
|
||||||
a: Optional[BenchmarkMiddle]
|
a: Optional[BenchmarkMiddle]
|
||||||
b: Optional[BenchmarkMiddle]
|
b: Optional[BenchmarkMiddle]
|
||||||
|
|||||||
+3
-7
@@ -3,7 +3,7 @@ from chia.util.ints import uint64, uint32, uint8
|
|||||||
from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
|
from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
|
||||||
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32, bytes100
|
||||||
from chia.types.blockchain_format.vdf import VDFInfo, VDFProof
|
from chia.types.blockchain_format.vdf import VDFInfo, VDFProof
|
||||||
from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo
|
from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo
|
||||||
from chia.types.blockchain_format.pool_target import PoolTarget
|
from chia.types.blockchain_format.pool_target import PoolTarget
|
||||||
@@ -56,9 +56,7 @@ def rand_bytes(num) -> bytes:
|
|||||||
|
|
||||||
|
|
||||||
def rand_hash() -> bytes32:
|
def rand_hash() -> bytes32:
|
||||||
# TODO: address hint errors and remove ignores
|
return bytes32(rand_bytes(32))
|
||||||
# error: Incompatible return value type (got "bytes", expected "bytes32") [return-value]
|
|
||||||
return rand_bytes(32) # type: ignore[return-value]
|
|
||||||
|
|
||||||
|
|
||||||
def rand_g1() -> G1Element:
|
def rand_g1() -> G1Element:
|
||||||
@@ -72,9 +70,7 @@ def rand_g2() -> G2Element:
|
|||||||
|
|
||||||
|
|
||||||
def rand_class_group_element() -> ClassgroupElement:
|
def rand_class_group_element() -> ClassgroupElement:
|
||||||
# TODO: address hint errors and remove ignores
|
return ClassgroupElement(bytes100(rand_bytes(100)))
|
||||||
# error: Argument 1 to "ClassgroupElement" has incompatible type "bytes"; expected "bytes100" [arg-type]
|
|
||||||
return ClassgroupElement(rand_bytes(100)) # type: ignore[arg-type]
|
|
||||||
|
|
||||||
|
|
||||||
def rand_vdf() -> VDFInfo:
|
def rand_vdf() -> VDFInfo:
|
||||||
|
|||||||
@@ -13,11 +13,8 @@ else
|
|||||||
DIR_NAME="chia-blockchain-linux-arm64"
|
DIR_NAME="chia-blockchain-linux-arm64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip install setuptools_scm
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||||
|
|||||||
@@ -14,11 +14,8 @@ else
|
|||||||
DIR_NAME="chia-blockchain-linux-arm64"
|
DIR_NAME="chia-blockchain-linux-arm64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip install setuptools_scm
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
set -o errexit -o nounset
|
set -o errexit -o nounset
|
||||||
|
|
||||||
pip install setuptools_scm
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
set -o errexit -o nounset
|
set -o errexit -o nounset
|
||||||
|
|
||||||
pip install setuptools_scm
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||||
|
|||||||
@@ -32,12 +32,9 @@ python -m pip install --upgrade pip
|
|||||||
pip install wheel pep517
|
pip install wheel pep517
|
||||||
pip install pywin32
|
pip install pywin32
|
||||||
pip install pyinstaller==4.9
|
pip install pyinstaller==4.9
|
||||||
pip install setuptools_scm
|
|
||||||
|
|
||||||
Write-Output " ---"
|
Write-Output " ---"
|
||||||
Write-Output "Get CHIA_INSTALLER_VERSION"
|
|
||||||
# The environment variable CHIA_INSTALLER_VERSION needs to be defined
|
# The environment variable CHIA_INSTALLER_VERSION needs to be defined
|
||||||
$env:CHIA_INSTALLER_VERSION = python .\build_scripts\installer-version.py -win
|
|
||||||
|
|
||||||
if (-not (Test-Path env:CHIA_INSTALLER_VERSION)) {
|
if (-not (Test-Path env:CHIA_INSTALLER_VERSION)) {
|
||||||
$env:CHIA_INSTALLER_VERSION = '0.0.0'
|
$env:CHIA_INSTALLER_VERSION = '0.0.0'
|
||||||
|
|||||||
+1
-1
Submodule chia-blockchain-gui updated: 054d7b342e...fccbd3e10d
@@ -38,15 +38,15 @@ and is designed so that you could test with it and then swap in a real rpc clien
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class SimFullBlock(Streamable):
|
class SimFullBlock(Streamable):
|
||||||
transactions_generator: Optional[BlockGenerator]
|
transactions_generator: Optional[BlockGenerator]
|
||||||
height: uint32 # Note that height is not on a regular FullBlock
|
height: uint32 # Note that height is not on a regular FullBlock
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class SimBlockRecord(Streamable):
|
class SimBlockRecord(Streamable):
|
||||||
reward_claims_incorporated: List[Coin]
|
reward_claims_incorporated: List[Coin]
|
||||||
height: uint32
|
height: uint32
|
||||||
@@ -69,8 +69,8 @@ class SimBlockRecord(Streamable):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class SimStore(Streamable):
|
class SimStore(Streamable):
|
||||||
timestamp: uint64
|
timestamp: uint64
|
||||||
block_height: uint32
|
block_height: uint32
|
||||||
|
|||||||
@@ -502,6 +502,7 @@ def chia_init(
|
|||||||
db_path_replaced = new_db_path.replace("CHALLENGE", config["selected_network"])
|
db_path_replaced = new_db_path.replace("CHALLENGE", config["selected_network"])
|
||||||
db_path = path_from_root(root_path, db_path_replaced)
|
db_path = path_from_root(root_path, db_path_replaced)
|
||||||
|
|
||||||
|
mkdir(db_path.parent)
|
||||||
with sqlite3.connect(db_path) as connection:
|
with sqlite3.connect(db_path) as connection:
|
||||||
set_db_version(connection, 1)
|
set_db_version(connection, 1)
|
||||||
|
|
||||||
|
|||||||
+54
-26
@@ -4,7 +4,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Callable, List, Optional, Tuple, Dict
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
@@ -24,6 +24,8 @@ from chia.wallet.trading.trade_status import TradeStatus
|
|||||||
from chia.wallet.transaction_record import TransactionRecord
|
from chia.wallet.transaction_record import TransactionRecord
|
||||||
from chia.wallet.util.wallet_types import WalletType
|
from chia.wallet.util.wallet_types import WalletType
|
||||||
|
|
||||||
|
CATNameResolver = Callable[[bytes32], Awaitable[Optional[Tuple[Optional[uint32], str]]]]
|
||||||
|
|
||||||
|
|
||||||
def print_transaction(tx: TransactionRecord, verbose: bool, name, address_prefix: str, mojo_per_unit: int) -> None:
|
def print_transaction(tx: TransactionRecord, verbose: bool, name, address_prefix: str, mojo_per_unit: int) -> None:
|
||||||
if verbose:
|
if verbose:
|
||||||
@@ -308,21 +310,37 @@ def timestamp_to_time(timestamp):
|
|||||||
return datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
|
return datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
|
||||||
async def print_offer_summary(wallet_client: WalletRpcClient, sum_dict: dict):
|
async def print_offer_summary(cat_name_resolver: CATNameResolver, sum_dict: Dict[str, int], has_fee: bool = False):
|
||||||
for asset_id, amount in sum_dict.items():
|
for asset_id, amount in sum_dict.items():
|
||||||
if asset_id == "xch":
|
description: str = ""
|
||||||
wid: str = "1"
|
unit: int = units["chia"]
|
||||||
name: str = "XCH"
|
wid: str = "1" if asset_id == "xch" else ""
|
||||||
unit: int = units["chia"]
|
mojo_amount: int = int(Decimal(amount))
|
||||||
else:
|
name: str = "XCH"
|
||||||
result = await wallet_client.cat_asset_id_to_name(bytes32.from_hexstr(asset_id))
|
if asset_id != "xch":
|
||||||
wid = "Unknown"
|
|
||||||
name = asset_id
|
name = asset_id
|
||||||
unit = units["cat"]
|
if asset_id == "unknown":
|
||||||
if result is not None:
|
name = "Unknown"
|
||||||
wid = str(result[0])
|
unit = units["mojo"]
|
||||||
name = result[1]
|
if has_fee:
|
||||||
print(f" - {name} (Wallet ID: {wid}): {Decimal(int(amount)) / unit} ({int(Decimal(amount))} mojos)")
|
description = " [Typically represents change returned from the included fee]"
|
||||||
|
else:
|
||||||
|
unit = units["cat"]
|
||||||
|
result = await cat_name_resolver(bytes32.from_hexstr(asset_id))
|
||||||
|
if result is not None:
|
||||||
|
wid = str(result[0])
|
||||||
|
name = result[1]
|
||||||
|
output: str = f" - {name}"
|
||||||
|
mojo_str: str = f"{mojo_amount} {'mojo' if mojo_amount == 1 else 'mojos'}"
|
||||||
|
if len(wid) > 0:
|
||||||
|
output += f" (Wallet ID: {wid})"
|
||||||
|
if unit == units["mojo"]:
|
||||||
|
output += f": {mojo_str}"
|
||||||
|
else:
|
||||||
|
output += f": {mojo_amount / unit} ({mojo_str})"
|
||||||
|
if len(description) > 0:
|
||||||
|
output += f" {description}"
|
||||||
|
print(output)
|
||||||
|
|
||||||
|
|
||||||
async def print_trade_record(record, wallet_client: WalletRpcClient, summaries: bool = False) -> None:
|
async def print_trade_record(record, wallet_client: WalletRpcClient, summaries: bool = False) -> None:
|
||||||
@@ -337,13 +355,16 @@ async def print_trade_record(record, wallet_client: WalletRpcClient, summaries:
|
|||||||
print("Summary:")
|
print("Summary:")
|
||||||
offer = Offer.from_bytes(record.offer)
|
offer = Offer.from_bytes(record.offer)
|
||||||
offered, requested = offer.summary()
|
offered, requested = offer.summary()
|
||||||
|
outbound_balances: Dict[str, int] = offer.get_pending_amounts()
|
||||||
|
fees: Decimal = Decimal(offer.bundle.fees())
|
||||||
|
cat_name_resolver = wallet_client.cat_asset_id_to_name
|
||||||
print(" OFFERED:")
|
print(" OFFERED:")
|
||||||
await print_offer_summary(wallet_client, offered)
|
await print_offer_summary(cat_name_resolver, offered)
|
||||||
print(" REQUESTED:")
|
print(" REQUESTED:")
|
||||||
await print_offer_summary(wallet_client, requested)
|
await print_offer_summary(cat_name_resolver, requested)
|
||||||
print("Pending Balances:")
|
print("Pending Outbound Balances:")
|
||||||
await print_offer_summary(wallet_client, offer.get_pending_amounts())
|
await print_offer_summary(cat_name_resolver, outbound_balances, has_fee=(fees > 0))
|
||||||
print(f"Fees: {Decimal(offer.bundle.fees()) / units['chia']}")
|
print(f"Included Fees: {fees / units['chia']}")
|
||||||
print("---------------")
|
print("---------------")
|
||||||
|
|
||||||
|
|
||||||
@@ -411,12 +432,13 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in
|
|||||||
return
|
return
|
||||||
|
|
||||||
offered, requested = offer.summary()
|
offered, requested = offer.summary()
|
||||||
|
cat_name_resolver = wallet_client.cat_asset_id_to_name
|
||||||
print("Summary:")
|
print("Summary:")
|
||||||
print(" OFFERED:")
|
print(" OFFERED:")
|
||||||
await print_offer_summary(wallet_client, offered)
|
await print_offer_summary(cat_name_resolver, offered)
|
||||||
print(" REQUESTED:")
|
print(" REQUESTED:")
|
||||||
await print_offer_summary(wallet_client, requested)
|
await print_offer_summary(cat_name_resolver, requested)
|
||||||
print(f"Fees: {Decimal(offer.bundle.fees()) / units['chia']}")
|
print(f"Included Fees: {Decimal(offer.bundle.fees()) / units['chia']}")
|
||||||
|
|
||||||
if not examine_only:
|
if not examine_only:
|
||||||
confirmation = input("Would you like to take this offer? (y/n): ")
|
confirmation = input("Would you like to take this offer? (y/n): ")
|
||||||
@@ -534,7 +556,7 @@ async def get_wallet(wallet_client: WalletRpcClient, fingerprint: int = None) ->
|
|||||||
current_sync_status = "Syncing"
|
current_sync_status = "Syncing"
|
||||||
else:
|
else:
|
||||||
current_sync_status = "Not Synced"
|
current_sync_status = "Not Synced"
|
||||||
print("Choose wallet key:")
|
print("Wallet keys:")
|
||||||
for i, fp in enumerate(fingerprints):
|
for i, fp in enumerate(fingerprints):
|
||||||
row: str = f"{i+1}) "
|
row: str = f"{i+1}) "
|
||||||
row += "* " if fp == logged_in_fingerprint else spacing
|
row += "* " if fp == logged_in_fingerprint else spacing
|
||||||
@@ -543,15 +565,21 @@ async def get_wallet(wallet_client: WalletRpcClient, fingerprint: int = None) ->
|
|||||||
row += f" ({current_sync_status})"
|
row += f" ({current_sync_status})"
|
||||||
print(row)
|
print(row)
|
||||||
val = None
|
val = None
|
||||||
|
prompt: str = (
|
||||||
|
f"Choose a wallet key [1-{len(fingerprints)}] ('q' to quit, or Enter to use {logged_in_fingerprint}): "
|
||||||
|
)
|
||||||
while val is None:
|
while val is None:
|
||||||
val = input("Enter a number to pick or q to quit: ")
|
val = input(prompt)
|
||||||
if val == "q":
|
if val == "q":
|
||||||
return None
|
return None
|
||||||
if not val.isdigit():
|
elif val == "" and logged_in_fingerprint is not None:
|
||||||
|
fingerprint = logged_in_fingerprint
|
||||||
|
break
|
||||||
|
elif not val.isdigit():
|
||||||
val = None
|
val = None
|
||||||
else:
|
else:
|
||||||
index = int(val) - 1
|
index = int(val) - 1
|
||||||
if index >= len(fingerprints):
|
if index < 0 or index >= len(fingerprints):
|
||||||
print("Invalid value")
|
print("Invalid value")
|
||||||
val = None
|
val = None
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import logging
|
|||||||
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, Union
|
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
from clvm.casts import int_from_bytes
|
|
||||||
|
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
||||||
@@ -15,23 +14,20 @@ from chia.consensus.cost_calculator import NPCResult
|
|||||||
from chia.consensus.find_fork_point import find_fork_point_in_chain
|
from chia.consensus.find_fork_point import find_fork_point_in_chain
|
||||||
from chia.full_node.block_store import BlockStore
|
from chia.full_node.block_store import BlockStore
|
||||||
from chia.full_node.coin_store import CoinStore
|
from chia.full_node.coin_store import CoinStore
|
||||||
from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions, mempool_check_conditions_dict
|
from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions, mempool_check_time_locks
|
||||||
from chia.types.block_protocol import BlockInfo
|
from chia.types.block_protocol import BlockInfo
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
|
||||||
from chia.types.coin_record import CoinRecord
|
from chia.types.coin_record import CoinRecord
|
||||||
from chia.types.condition_opcodes import ConditionOpcode
|
|
||||||
from chia.types.condition_with_args import ConditionWithArgs
|
|
||||||
from chia.types.full_block import FullBlock
|
from chia.types.full_block import FullBlock
|
||||||
from chia.types.generator_types import BlockGenerator
|
from chia.types.generator_types import BlockGenerator
|
||||||
from chia.types.name_puzzle_condition import NPC
|
|
||||||
from chia.types.unfinished_block import UnfinishedBlock
|
from chia.types.unfinished_block import UnfinishedBlock
|
||||||
from chia.util import cached_bls
|
from chia.util import cached_bls
|
||||||
from chia.util.condition_tools import pkm_pairs
|
from chia.util.condition_tools import pkm_pairs
|
||||||
from chia.util.errors import Err
|
from chia.util.errors import Err
|
||||||
from chia.util.generator_tools import additions_for_npc, tx_removals_and_additions
|
from chia.util.generator_tools import tx_removals_and_additions
|
||||||
from chia.util.hash import std_hash
|
from chia.util.hash import std_hash
|
||||||
from chia.util.ints import uint32, uint64, uint128
|
from chia.util.ints import uint32, uint64
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -153,7 +149,6 @@ async def validate_block_body(
|
|||||||
removals: List[bytes32] = []
|
removals: List[bytes32] = []
|
||||||
coinbase_additions: List[Coin] = list(expected_reward_coins)
|
coinbase_additions: List[Coin] = list(expected_reward_coins)
|
||||||
additions: List[Coin] = []
|
additions: List[Coin] = []
|
||||||
npc_list: List[NPC] = []
|
|
||||||
removals_puzzle_dic: Dict[bytes32, bytes32] = {}
|
removals_puzzle_dic: Dict[bytes32, bytes32] = {}
|
||||||
cost: uint64 = uint64(0)
|
cost: uint64 = uint64(0)
|
||||||
|
|
||||||
@@ -196,7 +191,6 @@ async def validate_block_body(
|
|||||||
|
|
||||||
assert npc_result is not None
|
assert npc_result is not None
|
||||||
cost = npc_result.cost
|
cost = npc_result.cost
|
||||||
npc_list = npc_result.npc_list
|
|
||||||
|
|
||||||
# 7. Check that cost <= MAX_BLOCK_COST_CLVM
|
# 7. Check that cost <= MAX_BLOCK_COST_CLVM
|
||||||
log.debug(
|
log.debug(
|
||||||
@@ -210,11 +204,13 @@ async def validate_block_body(
|
|||||||
if npc_result.error is not None:
|
if npc_result.error is not None:
|
||||||
return Err(npc_result.error), None
|
return Err(npc_result.error), None
|
||||||
|
|
||||||
for npc in npc_list:
|
assert npc_result.conds is not None
|
||||||
removals.append(npc.coin_name)
|
|
||||||
removals_puzzle_dic[npc.coin_name] = npc.puzzle_hash
|
|
||||||
|
|
||||||
additions = additions_for_npc(npc_list)
|
for spend in npc_result.conds.spends:
|
||||||
|
removals.append(spend.coin_id)
|
||||||
|
removals_puzzle_dic[spend.coin_id] = spend.puzzle_hash
|
||||||
|
for puzzle_hash, amount, _ in spend.create_coin:
|
||||||
|
additions.append(Coin(spend.coin_id, puzzle_hash, uint64(amount)))
|
||||||
else:
|
else:
|
||||||
assert npc_result is None
|
assert npc_result is None
|
||||||
|
|
||||||
@@ -245,18 +241,12 @@ async def validate_block_body(
|
|||||||
return root_error, None
|
return root_error, None
|
||||||
|
|
||||||
# 12. The additions and removals must result in the correct filter
|
# 12. The additions and removals must result in the correct filter
|
||||||
byte_array_tx: List[bytes32] = []
|
byte_array_tx: List[bytearray] = []
|
||||||
|
|
||||||
for coin in additions + coinbase_additions:
|
for coin in additions + coinbase_additions:
|
||||||
# TODO: address hint error and remove ignore
|
byte_array_tx.append(bytearray(coin.puzzle_hash))
|
||||||
# error: Argument 1 to "append" of "list" has incompatible type "bytearray"; expected "bytes32"
|
|
||||||
# [arg-type]
|
|
||||||
byte_array_tx.append(bytearray(coin.puzzle_hash)) # type: ignore[arg-type]
|
|
||||||
for coin_name in removals:
|
for coin_name in removals:
|
||||||
# TODO: address hint error and remove ignore
|
byte_array_tx.append(bytearray(coin_name))
|
||||||
# error: Argument 1 to "append" of "list" has incompatible type "bytearray"; expected "bytes32"
|
|
||||||
# [arg-type]
|
|
||||||
byte_array_tx.append(bytearray(coin_name)) # type: ignore[arg-type]
|
|
||||||
|
|
||||||
bip158: PyBIP158 = PyBIP158(byte_array_tx)
|
bip158: PyBIP158 = PyBIP158(byte_array_tx)
|
||||||
encoded_filter = bytes(bip158.GetEncoded())
|
encoded_filter = bytes(bip158.GetEncoded())
|
||||||
@@ -323,7 +313,7 @@ async def validate_block_body(
|
|||||||
mempool_mode=False,
|
mempool_mode=False,
|
||||||
height=curr.height,
|
height=curr.height,
|
||||||
)
|
)
|
||||||
removals_in_curr, additions_in_curr = tx_removals_and_additions(curr_npc_result.npc_list)
|
removals_in_curr, additions_in_curr = tx_removals_and_additions(curr_npc_result.conds)
|
||||||
else:
|
else:
|
||||||
removals_in_curr = []
|
removals_in_curr = []
|
||||||
additions_in_curr = []
|
additions_in_curr = []
|
||||||
@@ -407,16 +397,13 @@ async def validate_block_body(
|
|||||||
|
|
||||||
fees = removed - added
|
fees = removed - added
|
||||||
assert fees >= 0
|
assert fees >= 0
|
||||||
assert_fee_sum: uint128 = uint128(0)
|
|
||||||
|
|
||||||
for npc in npc_list:
|
# reserve fee cannot be greater than UINT64_MAX per consensus rule.
|
||||||
if ConditionOpcode.RESERVE_FEE in npc.condition_dict:
|
# run_generator() would fail
|
||||||
fee_list: List[ConditionWithArgs] = npc.condition_dict[ConditionOpcode.RESERVE_FEE]
|
assert_fee_sum: uint64 = uint64(0)
|
||||||
for cvp in fee_list:
|
if npc_result:
|
||||||
fee = int_from_bytes(cvp.vars[0])
|
assert npc_result.conds is not None
|
||||||
if fee < 0:
|
assert_fee_sum = npc_result.conds.reserve_fee
|
||||||
return Err.RESERVE_FEE_CONDITION_FAILED, None
|
|
||||||
assert_fee_sum = uint128(assert_fee_sum + fee)
|
|
||||||
|
|
||||||
# 17. Check that the assert fee sum <= fees, and that each reserved fee is non-negative
|
# 17. Check that the assert fee sum <= fees, and that each reserved fee is non-negative
|
||||||
if fees < assert_fee_sum:
|
if fees < assert_fee_sum:
|
||||||
@@ -436,12 +423,12 @@ async def validate_block_body(
|
|||||||
return Err.WRONG_PUZZLE_HASH, None
|
return Err.WRONG_PUZZLE_HASH, None
|
||||||
|
|
||||||
# 21. Verify conditions
|
# 21. Verify conditions
|
||||||
for npc in npc_list:
|
# verify absolute/relative height/time conditions
|
||||||
assert height is not None
|
if npc_result is not None:
|
||||||
unspent = removal_coin_records[npc.coin_name]
|
assert npc_result.conds is not None
|
||||||
error = mempool_check_conditions_dict(
|
error = mempool_check_time_locks(
|
||||||
unspent,
|
removal_coin_records,
|
||||||
npc.condition_dict,
|
npc_result.conds,
|
||||||
prev_transaction_block_height,
|
prev_transaction_block_height,
|
||||||
block.foliage_transaction_block.timestamp,
|
block.foliage_transaction_block.timestamp,
|
||||||
)
|
)
|
||||||
@@ -449,7 +436,11 @@ async def validate_block_body(
|
|||||||
return error, None
|
return error, None
|
||||||
|
|
||||||
# create hash_key list for aggsig check
|
# create hash_key list for aggsig check
|
||||||
pairs_pks, pairs_msgs = pkm_pairs(npc_list, constants.AGG_SIG_ME_ADDITIONAL_DATA)
|
pairs_pks: List[bytes48] = []
|
||||||
|
pairs_msgs: List[bytes] = []
|
||||||
|
if npc_result:
|
||||||
|
assert npc_result.conds is not None
|
||||||
|
pairs_pks, pairs_msgs = pkm_pairs(npc_result.conds, constants.AGG_SIG_ME_ADDITIONAL_DATA)
|
||||||
|
|
||||||
# 22. Verify aggregated signature
|
# 22. Verify aggregated signature
|
||||||
# TODO: move this to pre_validate_blocks_multiprocessing so we can sync faster
|
# TODO: move this to pre_validate_blocks_multiprocessing so we can sync faster
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ from chia.util.recursive_replace import recursive_replace
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Incompatible default for argument "seed" (default has type "bytes", argument has type "bytes32")
|
|
||||||
# [assignment]
|
|
||||||
def create_foliage(
|
def create_foliage(
|
||||||
constants: ConsensusConstants,
|
constants: ConsensusConstants,
|
||||||
reward_block_unfinished: RewardChainBlockUnfinished,
|
reward_block_unfinished: RewardChainBlockUnfinished,
|
||||||
@@ -53,7 +50,7 @@ def create_foliage(
|
|||||||
pool_target: PoolTarget,
|
pool_target: PoolTarget,
|
||||||
get_plot_signature: Callable[[bytes32, G1Element], G2Element],
|
get_plot_signature: Callable[[bytes32, G1Element], G2Element],
|
||||||
get_pool_signature: Callable[[PoolTarget, Optional[G1Element]], Optional[G2Element]],
|
get_pool_signature: Callable[[PoolTarget, Optional[G1Element]], Optional[G2Element]],
|
||||||
seed: bytes32 = b"", # type: ignore[assignment]
|
seed: bytes = b"",
|
||||||
) -> Tuple[Foliage, Optional[FoliageTransactionBlock], Optional[TransactionsInfo]]:
|
) -> Tuple[Foliage, Optional[FoliageTransactionBlock], Optional[TransactionsInfo]]:
|
||||||
"""
|
"""
|
||||||
Creates a foliage for a given reward chain block. This may or may not be a tx block. In the case of a tx block,
|
Creates a foliage for a given reward chain block. This may or may not be a tx block. In the case of a tx block,
|
||||||
@@ -95,7 +92,7 @@ def create_foliage(
|
|||||||
height = uint32(prev_block.height + 1)
|
height = uint32(prev_block.height + 1)
|
||||||
|
|
||||||
# Create filter
|
# Create filter
|
||||||
byte_array_tx: List[bytes32] = []
|
byte_array_tx: List[bytearray] = []
|
||||||
tx_additions: List[Coin] = []
|
tx_additions: List[Coin] = []
|
||||||
tx_removals: List[bytes32] = []
|
tx_removals: List[bytes32] = []
|
||||||
|
|
||||||
@@ -192,16 +189,10 @@ def create_foliage(
|
|||||||
additions.extend(reward_claims_incorporated.copy())
|
additions.extend(reward_claims_incorporated.copy())
|
||||||
for coin in additions:
|
for coin in additions:
|
||||||
tx_additions.append(coin)
|
tx_additions.append(coin)
|
||||||
# TODO: address hint error and remove ignore
|
byte_array_tx.append(bytearray(coin.puzzle_hash))
|
||||||
# error: Argument 1 to "append" of "list" has incompatible type "bytearray"; expected "bytes32"
|
|
||||||
# [arg-type]
|
|
||||||
byte_array_tx.append(bytearray(coin.puzzle_hash)) # type: ignore[arg-type]
|
|
||||||
for coin in removals:
|
for coin in removals:
|
||||||
tx_removals.append(coin.name())
|
tx_removals.append(coin.name())
|
||||||
# TODO: address hint error and remove ignore
|
byte_array_tx.append(bytearray(coin.name()))
|
||||||
# error: Argument 1 to "append" of "list" has incompatible type "bytearray"; expected "bytes32"
|
|
||||||
# [arg-type]
|
|
||||||
byte_array_tx.append(bytearray(coin.name())) # type: ignore[arg-type]
|
|
||||||
|
|
||||||
bip158: PyBIP158 = PyBIP158(byte_array_tx)
|
bip158: PyBIP158 = PyBIP158(byte_array_tx)
|
||||||
encoded = bytes(bip158.GetEncoded())
|
encoded = bytes(bip158.GetEncoded())
|
||||||
@@ -289,9 +280,6 @@ def create_foliage(
|
|||||||
return foliage, foliage_transaction_block, transactions_info
|
return foliage, foliage_transaction_block, transactions_info
|
||||||
|
|
||||||
|
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Incompatible default for argument "seed" (default has type "bytes", argument has type "bytes32")
|
|
||||||
# [assignment]
|
|
||||||
def create_unfinished_block(
|
def create_unfinished_block(
|
||||||
constants: ConsensusConstants,
|
constants: ConsensusConstants,
|
||||||
sub_slot_start_total_iters: uint128,
|
sub_slot_start_total_iters: uint128,
|
||||||
@@ -308,7 +296,7 @@ def create_unfinished_block(
|
|||||||
signage_point: SignagePoint,
|
signage_point: SignagePoint,
|
||||||
timestamp: uint64,
|
timestamp: uint64,
|
||||||
blocks: BlockchainInterface,
|
blocks: BlockchainInterface,
|
||||||
seed: bytes32 = b"", # type: ignore[assignment]
|
seed: bytes = b"",
|
||||||
block_generator: Optional[BlockGenerator] = None,
|
block_generator: Optional[BlockGenerator] = None,
|
||||||
aggregate_sig: G2Element = G2Element(),
|
aggregate_sig: G2Element = G2Element(),
|
||||||
additions: Optional[List[Coin]] = None,
|
additions: Optional[List[Coin]] = None,
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ from chia.util.ints import uint8, uint32, uint64, uint128
|
|||||||
from chia.util.streamable import Streamable, streamable
|
from chia.util.streamable import Streamable, streamable
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class BlockRecord(Streamable):
|
class BlockRecord(Streamable):
|
||||||
"""
|
"""
|
||||||
This class is not included or hashed into the blockchain, but it is kept in memory as a more
|
This class is not included or hashed into the blockchain, but it is kept in memory as a more
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ from multiprocessing.context import BaseContext
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, Set, Tuple
|
from typing import Dict, List, Optional, Set, Tuple
|
||||||
|
|
||||||
from clvm.casts import int_from_bytes
|
|
||||||
|
|
||||||
from chia.consensus.block_body_validation import validate_block_body
|
from chia.consensus.block_body_validation import validate_block_body
|
||||||
from chia.consensus.block_header_validation import validate_unfinished_header_block
|
from chia.consensus.block_header_validation import validate_unfinished_header_block
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
@@ -38,7 +36,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32
|
|||||||
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
|
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
|
||||||
from chia.types.blockchain_format.vdf import VDFInfo
|
from chia.types.blockchain_format.vdf import VDFInfo
|
||||||
from chia.types.coin_record import CoinRecord
|
from chia.types.coin_record import CoinRecord
|
||||||
from chia.types.condition_opcodes import ConditionOpcode
|
|
||||||
from chia.types.end_of_slot_bundle import EndOfSubSlotBundle
|
from chia.types.end_of_slot_bundle import EndOfSubSlotBundle
|
||||||
from chia.types.full_block import FullBlock
|
from chia.types.full_block import FullBlock
|
||||||
from chia.types.generator_types import BlockGenerator
|
from chia.types.generator_types import BlockGenerator
|
||||||
@@ -182,10 +179,9 @@ class Blockchain(BlockchainInterface):
|
|||||||
if self._peak_height is None:
|
if self._peak_height is None:
|
||||||
return None
|
return None
|
||||||
""" Return list of FullBlocks that are peaks"""
|
""" Return list of FullBlocks that are peaks"""
|
||||||
# TODO: address hint error and remove ignore
|
peak_hash: Optional[bytes32] = self.height_to_hash(self._peak_height)
|
||||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
assert peak_hash is not None # Since we must have the peak block
|
||||||
# expected "bytes32" [arg-type]
|
block = await self.block_store.get_full_block(peak_hash)
|
||||||
block = await self.block_store.get_full_block(self.height_to_hash(self._peak_height)) # type: ignore[arg-type]
|
|
||||||
assert block is not None
|
assert block is not None
|
||||||
return block
|
return block
|
||||||
|
|
||||||
@@ -275,6 +271,8 @@ class Blockchain(BlockchainInterface):
|
|||||||
|
|
||||||
# Then update the memory cache. It is important that this task is not cancelled and does not throw
|
# Then update the memory cache. It is important that this task is not cancelled and does not throw
|
||||||
self.add_block_record(block_record)
|
self.add_block_record(block_record)
|
||||||
|
if fork_height is not None:
|
||||||
|
self.__height_map.rollback(fork_height)
|
||||||
for fetched_block_record in records:
|
for fetched_block_record in records:
|
||||||
self.__height_map.update_height(
|
self.__height_map.update_height(
|
||||||
fetched_block_record.height,
|
fetched_block_record.height,
|
||||||
@@ -300,19 +298,14 @@ class Blockchain(BlockchainInterface):
|
|||||||
return ReceiveBlockResult.ADDED_AS_ORPHAN, None, None, ([], {})
|
return ReceiveBlockResult.ADDED_AS_ORPHAN, None, None, ([], {})
|
||||||
|
|
||||||
def get_hint_list(self, npc_result: NPCResult) -> List[Tuple[bytes32, bytes]]:
|
def get_hint_list(self, npc_result: NPCResult) -> List[Tuple[bytes32, bytes]]:
|
||||||
|
if npc_result.conds is None:
|
||||||
|
return []
|
||||||
h_list = []
|
h_list = []
|
||||||
for npc in npc_result.npc_list:
|
for spend in npc_result.conds.spends:
|
||||||
for opcode, conditions in npc.conditions:
|
for puzzle_hash, amount, hint in spend.create_coin:
|
||||||
if opcode == ConditionOpcode.CREATE_COIN:
|
if hint != b"":
|
||||||
for condition in conditions:
|
coin_id = Coin(spend.coin_id, puzzle_hash, amount).name()
|
||||||
if len(condition.vars) > 2 and condition.vars[2] != b"":
|
h_list.append((coin_id, hint))
|
||||||
puzzle_hash, amount_bin = condition.vars[0], condition.vars[1]
|
|
||||||
amount = int_from_bytes(amount_bin)
|
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Argument 2 to "Coin" has incompatible type "bytes"; expected "bytes32"
|
|
||||||
# [arg-type]
|
|
||||||
coin_id = Coin(npc.coin_name, puzzle_hash, amount).name() # type: ignore[arg-type]
|
|
||||||
h_list.append((coin_id, condition.vars[2]))
|
|
||||||
return h_list
|
return h_list
|
||||||
|
|
||||||
async def _reconsider_peak(
|
async def _reconsider_peak(
|
||||||
@@ -343,7 +336,7 @@ class Blockchain(BlockchainInterface):
|
|||||||
assert block is not None
|
assert block is not None
|
||||||
|
|
||||||
if npc_result is not None:
|
if npc_result is not None:
|
||||||
tx_removals, tx_additions = tx_removals_and_additions(npc_result.npc_list)
|
tx_removals, tx_additions = tx_removals_and_additions(npc_result.conds)
|
||||||
else:
|
else:
|
||||||
tx_removals, tx_additions = [], []
|
tx_removals, tx_additions = [], []
|
||||||
if block.is_transaction_block():
|
if block.is_transaction_block():
|
||||||
@@ -381,10 +374,6 @@ class Blockchain(BlockchainInterface):
|
|||||||
for coin_record in roll_changes:
|
for coin_record in roll_changes:
|
||||||
latest_coin_state[coin_record.name] = coin_record
|
latest_coin_state[coin_record.name] = coin_record
|
||||||
|
|
||||||
# Rollback sub_epoch_summaries
|
|
||||||
self.__height_map.rollback(fork_height)
|
|
||||||
await self.block_store.rollback(fork_height)
|
|
||||||
|
|
||||||
# Collect all blocks from fork point to new peak
|
# Collect all blocks from fork point to new peak
|
||||||
blocks_to_add: List[Tuple[FullBlock, BlockRecord]] = []
|
blocks_to_add: List[Tuple[FullBlock, BlockRecord]] = []
|
||||||
curr = block_record.header_hash
|
curr = block_record.header_hash
|
||||||
@@ -445,6 +434,9 @@ class Blockchain(BlockchainInterface):
|
|||||||
hint_coin_state[key] = {}
|
hint_coin_state[key] = {}
|
||||||
hint_coin_state[key][coin_id] = latest_coin_state[coin_id]
|
hint_coin_state[key][coin_id] = latest_coin_state[coin_id]
|
||||||
|
|
||||||
|
# we made it to the end successfully
|
||||||
|
# Rollback sub_epoch_summaries
|
||||||
|
await self.block_store.rollback(fork_height)
|
||||||
await self.block_store.set_in_chain([(br.header_hash,) for br in records_to_add])
|
await self.block_store.set_in_chain([(br.header_hash,) for br in records_to_add])
|
||||||
|
|
||||||
# Changes the peak to be the new peak
|
# Changes the peak to be the new peak
|
||||||
@@ -476,7 +468,7 @@ class Blockchain(BlockchainInterface):
|
|||||||
mempool_mode=False,
|
mempool_mode=False,
|
||||||
height=block.height,
|
height=block.height,
|
||||||
)
|
)
|
||||||
tx_removals, tx_additions = tx_removals_and_additions(npc_result.npc_list)
|
tx_removals, tx_additions = tx_removals_and_additions(npc_result.conds)
|
||||||
return tx_removals, tx_additions, npc_result
|
return tx_removals, tx_additions, npc_result
|
||||||
|
|
||||||
def get_next_difficulty(self, header_hash: bytes32, new_slot: bool) -> uint64:
|
def get_next_difficulty(self, header_hash: bytes32, new_slot: bool) -> uint64:
|
||||||
@@ -678,11 +670,11 @@ class Blockchain(BlockchainInterface):
|
|||||||
return self.__block_records[header_hash]
|
return self.__block_records[header_hash]
|
||||||
|
|
||||||
def height_to_block_record(self, height: uint32) -> BlockRecord:
|
def height_to_block_record(self, height: uint32) -> BlockRecord:
|
||||||
header_hash = self.height_to_hash(height)
|
# Precondition: height is in the blockchain
|
||||||
# TODO: address hint error and remove ignore
|
header_hash: Optional[bytes32] = self.height_to_hash(height)
|
||||||
# error: Argument 1 to "block_record" of "Blockchain" has incompatible type "Optional[bytes32]"; expected
|
if header_hash is None:
|
||||||
# "bytes32" [arg-type]
|
raise ValueError(f"Height is not in blockchain: {height}")
|
||||||
return self.block_record(header_hash) # type: ignore[arg-type]
|
return self.block_record(header_hash)
|
||||||
|
|
||||||
def get_ses_heights(self) -> List[uint32]:
|
def get_ses_heights(self) -> List[uint32]:
|
||||||
return self.__height_map.get_ses_heights()
|
return self.__height_map.get_ses_heights()
|
||||||
@@ -760,11 +752,8 @@ class Blockchain(BlockchainInterface):
|
|||||||
) -> Dict[bytes32, HeaderBlock]:
|
) -> Dict[bytes32, HeaderBlock]:
|
||||||
hashes = []
|
hashes = []
|
||||||
for height in range(start, stop + 1):
|
for height in range(start, stop + 1):
|
||||||
if self.contains_height(uint32(height)):
|
header_hash: Optional[bytes32] = self.height_to_hash(uint32(height))
|
||||||
# TODO: address hint error and remove ignore
|
if header_hash is not None:
|
||||||
# error: Incompatible types in assignment (expression has type "Optional[bytes32]", variable has
|
|
||||||
# type "bytes32") [assignment]
|
|
||||||
header_hash: bytes32 = self.height_to_hash(uint32(height)) # type: ignore[assignment]
|
|
||||||
hashes.append(header_hash)
|
hashes.append(header_hash)
|
||||||
|
|
||||||
blocks: List[FullBlock] = []
|
blocks: List[FullBlock] = []
|
||||||
@@ -809,23 +798,20 @@ class Blockchain(BlockchainInterface):
|
|||||||
gets block records by height (only blocks that are part of the chain)
|
gets block records by height (only blocks that are part of the chain)
|
||||||
"""
|
"""
|
||||||
records: List[BlockRecord] = []
|
records: List[BlockRecord] = []
|
||||||
hashes = []
|
hashes: List[bytes32] = []
|
||||||
assert batch_size < 999 # sqlite in python 3.7 has a limit on 999 variables in queries
|
assert batch_size < 999 # sqlite in python 3.7 has a limit on 999 variables in queries
|
||||||
for height in heights:
|
for height in heights:
|
||||||
hashes.append(self.height_to_hash(height))
|
header_hash: Optional[bytes32] = self.height_to_hash(height)
|
||||||
|
if header_hash is None:
|
||||||
|
raise ValueError(f"Do not have block at height {height}")
|
||||||
|
hashes.append(header_hash)
|
||||||
if len(hashes) > batch_size:
|
if len(hashes) > batch_size:
|
||||||
# TODO: address hint error and remove ignore
|
res = await self.block_store.get_block_records_by_hash(hashes)
|
||||||
# error: Argument 1 to "get_block_records_by_hash" of "BlockStore" has incompatible type
|
|
||||||
# "List[Optional[bytes32]]"; expected "List[bytes32]" [arg-type]
|
|
||||||
res = await self.block_store.get_block_records_by_hash(hashes) # type: ignore[arg-type]
|
|
||||||
records.extend(res)
|
records.extend(res)
|
||||||
hashes = []
|
hashes = []
|
||||||
|
|
||||||
if len(hashes) > 0:
|
if len(hashes) > 0:
|
||||||
# TODO: address hint error and remove ignore
|
res = await self.block_store.get_block_records_by_hash(hashes)
|
||||||
# error: Argument 1 to "get_block_records_by_hash" of "BlockStore" has incompatible type
|
|
||||||
# "List[Optional[bytes32]]"; expected "List[bytes32]" [arg-type]
|
|
||||||
res = await self.block_store.get_block_records_by_hash(hashes) # type: ignore[arg-type]
|
|
||||||
records.extend(res)
|
records.extend(res)
|
||||||
return records
|
return records
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from chia.types.name_puzzle_condition import NPC
|
from chia.types.spend_bundle_conditions import SpendBundleConditions
|
||||||
from chia.util.ints import uint16, uint64
|
from chia.util.ints import uint16, uint64
|
||||||
from chia.util.streamable import Streamable, streamable
|
from chia.util.streamable import Streamable, streamable
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class NPCResult(Streamable):
|
class NPCResult(Streamable):
|
||||||
error: Optional[uint16]
|
error: Optional[uint16]
|
||||||
npc_list: List[NPC]
|
conds: Optional[SpendBundleConditions]
|
||||||
cost: uint64 # The total cost of the block, including CLVM cost, cost of
|
cost: uint64 # The total cost of the block, including CLVM cost, cost of
|
||||||
# conditions and cost of bytes
|
# conditions and cost of bytes
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ from chia.util.streamable import Streamable, dataclass_from_dict, streamable
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class PreValidationResult(Streamable):
|
class PreValidationResult(Streamable):
|
||||||
error: Optional[uint16]
|
error: Optional[uint16]
|
||||||
required_iters: Optional[uint64] # Iff error is None
|
required_iters: Optional[uint64] # Iff error is None
|
||||||
@@ -56,9 +56,9 @@ def batch_pre_validate_blocks(
|
|||||||
expected_sub_slot_iters: List[uint64],
|
expected_sub_slot_iters: List[uint64],
|
||||||
validate_signatures: bool,
|
validate_signatures: bool,
|
||||||
) -> List[bytes]:
|
) -> List[bytes]:
|
||||||
blocks: Dict[bytes, BlockRecord] = {}
|
blocks: Dict[bytes32, BlockRecord] = {}
|
||||||
for k, v in blocks_pickled.items():
|
for k, v in blocks_pickled.items():
|
||||||
blocks[k] = BlockRecord.from_bytes(v)
|
blocks[bytes32(k)] = BlockRecord.from_bytes(v)
|
||||||
results: List[PreValidationResult] = []
|
results: List[PreValidationResult] = []
|
||||||
constants: ConsensusConstants = dataclass_from_dict(ConsensusConstants, constants_dict)
|
constants: ConsensusConstants = dataclass_from_dict(ConsensusConstants, constants_dict)
|
||||||
if full_blocks_pickled is not None and header_blocks_pickled is not None:
|
if full_blocks_pickled is not None and header_blocks_pickled is not None:
|
||||||
@@ -75,8 +75,8 @@ def batch_pre_validate_blocks(
|
|||||||
if block.height in npc_results:
|
if block.height in npc_results:
|
||||||
npc_result = NPCResult.from_bytes(npc_results[block.height])
|
npc_result = NPCResult.from_bytes(npc_results[block.height])
|
||||||
assert npc_result is not None
|
assert npc_result is not None
|
||||||
if npc_result.npc_list is not None:
|
if npc_result.conds is not None:
|
||||||
removals, tx_additions = tx_removals_and_additions(npc_result.npc_list)
|
removals, tx_additions = tx_removals_and_additions(npc_result.conds)
|
||||||
else:
|
else:
|
||||||
removals, tx_additions = [], []
|
removals, tx_additions = [], []
|
||||||
|
|
||||||
@@ -93,18 +93,15 @@ def batch_pre_validate_blocks(
|
|||||||
mempool_mode=False,
|
mempool_mode=False,
|
||||||
height=block.height,
|
height=block.height,
|
||||||
)
|
)
|
||||||
removals, tx_additions = tx_removals_and_additions(npc_result.npc_list)
|
removals, tx_additions = tx_removals_and_additions(npc_result.conds)
|
||||||
if npc_result is not None and npc_result.error is not None:
|
if npc_result is not None and npc_result.error is not None:
|
||||||
results.append(PreValidationResult(uint16(npc_result.error), None, npc_result, False))
|
results.append(PreValidationResult(uint16(npc_result.error), None, npc_result, False))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
header_block = get_block_header(block, tx_additions, removals)
|
header_block = get_block_header(block, tx_additions, removals)
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Argument 1 to "BlockCache" has incompatible type "Dict[bytes, BlockRecord]"; expected
|
|
||||||
# "Dict[bytes32, BlockRecord]" [arg-type]
|
|
||||||
required_iters, error = validate_finished_header_block(
|
required_iters, error = validate_finished_header_block(
|
||||||
constants,
|
constants,
|
||||||
BlockCache(blocks), # type: ignore[arg-type]
|
BlockCache(blocks),
|
||||||
header_block,
|
header_block,
|
||||||
check_filter,
|
check_filter,
|
||||||
expected_difficulty[i],
|
expected_difficulty[i],
|
||||||
@@ -123,7 +120,8 @@ def batch_pre_validate_blocks(
|
|||||||
# validate it later. receive_block will attempt to validate the signature later.
|
# validate it later. receive_block will attempt to validate the signature later.
|
||||||
if validate_signatures:
|
if validate_signatures:
|
||||||
if npc_result is not None and block.transactions_info is not None:
|
if npc_result is not None and block.transactions_info is not None:
|
||||||
pairs_pks, pairs_msgs = pkm_pairs(npc_result.npc_list, constants.AGG_SIG_ME_ADDITIONAL_DATA)
|
assert npc_result.conds
|
||||||
|
pairs_pks, pairs_msgs = pkm_pairs(npc_result.conds, constants.AGG_SIG_ME_ADDITIONAL_DATA)
|
||||||
pks_objects: List[G1Element] = [G1Element.from_bytes(pk) for pk in pairs_pks]
|
pks_objects: List[G1Element] = [G1Element.from_bytes(pk) for pk in pairs_pks]
|
||||||
if not AugSchemeMPL.aggregate_verify(
|
if not AugSchemeMPL.aggregate_verify(
|
||||||
pks_objects, pairs_msgs, block.transactions_info.aggregated_signature
|
pks_objects, pairs_msgs, block.transactions_info.aggregated_signature
|
||||||
@@ -144,12 +142,9 @@ def batch_pre_validate_blocks(
|
|||||||
for i in range(len(header_blocks_pickled)):
|
for i in range(len(header_blocks_pickled)):
|
||||||
try:
|
try:
|
||||||
header_block = HeaderBlock.from_bytes(header_blocks_pickled[i])
|
header_block = HeaderBlock.from_bytes(header_blocks_pickled[i])
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Argument 1 to "BlockCache" has incompatible type "Dict[bytes, BlockRecord]"; expected
|
|
||||||
# "Dict[bytes32, BlockRecord]" [arg-type]
|
|
||||||
required_iters, error = validate_finished_header_block(
|
required_iters, error = validate_finished_header_block(
|
||||||
constants,
|
constants,
|
||||||
BlockCache(blocks), # type: ignore[arg-type]
|
BlockCache(blocks),
|
||||||
header_block,
|
header_block,
|
||||||
check_filter,
|
check_filter,
|
||||||
expected_difficulty[i],
|
expected_difficulty[i],
|
||||||
@@ -393,6 +388,6 @@ def _run_generator(
|
|||||||
)
|
)
|
||||||
return bytes(npc_result)
|
return bytes(npc_result)
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
return bytes(NPCResult(uint16(e.code.value), [], uint64(0)))
|
return bytes(NPCResult(uint16(e.code.value), None, uint64(0)))
|
||||||
except Exception:
|
except Exception:
|
||||||
return bytes(NPCResult(uint16(Err.UNKNOWN.value), [], uint64(0)))
|
return bytes(NPCResult(uint16(Err.UNKNOWN.value), None, uint64(0)))
|
||||||
|
|||||||
+48
-18
@@ -5,7 +5,7 @@ from contextlib import asynccontextmanager
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import websockets
|
import aiohttp
|
||||||
|
|
||||||
from chia.util.config import load_config
|
from chia.util.config import load_config
|
||||||
from chia.util.json_util import dict_to_json_str
|
from chia.util.json_util import dict_to_json_str
|
||||||
@@ -13,31 +13,52 @@ from chia.util.ws_message import WsRpcMessage, create_payload_dict
|
|||||||
|
|
||||||
|
|
||||||
class DaemonProxy:
|
class DaemonProxy:
|
||||||
def __init__(self, uri: str, ssl_context: Optional[ssl.SSLContext]):
|
def __init__(
|
||||||
|
self,
|
||||||
|
uri: str,
|
||||||
|
ssl_context: Optional[ssl.SSLContext],
|
||||||
|
max_message_size: Optional[int] = 50 * 1000 * 1000,
|
||||||
|
):
|
||||||
self._uri = uri
|
self._uri = uri
|
||||||
self._request_dict: Dict[str, asyncio.Event] = {}
|
self._request_dict: Dict[str, asyncio.Event] = {}
|
||||||
self.response_dict: Dict[str, Any] = {}
|
self.response_dict: Dict[str, Any] = {}
|
||||||
self.ssl_context = ssl_context
|
self.ssl_context = ssl_context
|
||||||
|
self.client_session: Optional[aiohttp.ClientSession] = None
|
||||||
|
self.websocket: Optional[aiohttp.ClientWebSocketResponse] = None
|
||||||
|
self.max_message_size = max_message_size
|
||||||
|
|
||||||
def format_request(self, command: str, data: Dict[str, Any]) -> WsRpcMessage:
|
def format_request(self, command: str, data: Dict[str, Any]) -> WsRpcMessage:
|
||||||
request = create_payload_dict(command, data, "client", "daemon")
|
request = create_payload_dict(command, data, "client", "daemon")
|
||||||
return request
|
return request
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
self.websocket = await websockets.connect(self._uri, max_size=None, ssl=self.ssl_context)
|
try:
|
||||||
|
self.client_session = aiohttp.ClientSession()
|
||||||
|
self.websocket = await self.client_session.ws_connect(
|
||||||
|
self._uri,
|
||||||
|
autoclose=True,
|
||||||
|
autoping=True,
|
||||||
|
heartbeat=60,
|
||||||
|
ssl_context=self.ssl_context,
|
||||||
|
max_msg_size=self.max_message_size,
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
await self.close()
|
||||||
|
raise
|
||||||
|
|
||||||
async def listener():
|
async def listener():
|
||||||
while True:
|
while True:
|
||||||
try:
|
message = await self.websocket.receive()
|
||||||
message = await self.websocket.recv()
|
if message.type == aiohttp.WSMsgType.TEXT:
|
||||||
except websockets.exceptions.ConnectionClosedOK:
|
decoded = json.loads(message.data)
|
||||||
return None
|
request_id = decoded["request_id"]
|
||||||
decoded = json.loads(message)
|
|
||||||
id = decoded["request_id"]
|
|
||||||
|
|
||||||
if id in self._request_dict:
|
if request_id in self._request_dict:
|
||||||
self.response_dict[id] = decoded
|
self.response_dict[request_id] = decoded
|
||||||
self._request_dict[id].set()
|
self._request_dict[request_id].set()
|
||||||
|
else:
|
||||||
|
await self.close()
|
||||||
|
return None
|
||||||
|
|
||||||
asyncio.create_task(listener())
|
asyncio.create_task(listener())
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
@@ -46,7 +67,9 @@ class DaemonProxy:
|
|||||||
request_id = request["request_id"]
|
request_id = request["request_id"]
|
||||||
self._request_dict[request_id] = asyncio.Event()
|
self._request_dict[request_id] = asyncio.Event()
|
||||||
string = dict_to_json_str(request)
|
string = dict_to_json_str(request)
|
||||||
asyncio.create_task(self.websocket.send(string))
|
if self.websocket is None:
|
||||||
|
raise Exception("Websocket is not connected")
|
||||||
|
asyncio.create_task(self.websocket.send_str(string))
|
||||||
|
|
||||||
async def timeout():
|
async def timeout():
|
||||||
await asyncio.sleep(30)
|
await asyncio.sleep(30)
|
||||||
@@ -117,19 +140,24 @@ class DaemonProxy:
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
await self.websocket.close()
|
if self.websocket is not None:
|
||||||
|
await self.websocket.close()
|
||||||
|
if self.client_session is not None:
|
||||||
|
await self.client_session.close()
|
||||||
|
|
||||||
async def exit(self) -> WsRpcMessage:
|
async def exit(self) -> WsRpcMessage:
|
||||||
request = self.format_request("exit", {})
|
request = self.format_request("exit", {})
|
||||||
return await self._get(request)
|
return await self._get(request)
|
||||||
|
|
||||||
|
|
||||||
async def connect_to_daemon(self_hostname: str, daemon_port: int, ssl_context: ssl.SSLContext) -> DaemonProxy:
|
async def connect_to_daemon(
|
||||||
|
self_hostname: str, daemon_port: int, max_message_size: int, ssl_context: ssl.SSLContext
|
||||||
|
) -> DaemonProxy:
|
||||||
"""
|
"""
|
||||||
Connect to the local daemon.
|
Connect to the local daemon.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
client = DaemonProxy(f"wss://{self_hostname}:{daemon_port}", ssl_context)
|
client = DaemonProxy(f"wss://{self_hostname}:{daemon_port}", ssl_context, max_message_size)
|
||||||
await client.start()
|
await client.start()
|
||||||
return client
|
return client
|
||||||
|
|
||||||
@@ -143,12 +171,15 @@ async def connect_to_daemon_and_validate(root_path: Path, quiet: bool = False) -
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
net_config = load_config(root_path, "config.yaml")
|
net_config = load_config(root_path, "config.yaml")
|
||||||
|
daemon_max_message_size = net_config.get("daemon_max_message_size", 50 * 1000 * 1000)
|
||||||
crt_path = root_path / net_config["daemon_ssl"]["private_crt"]
|
crt_path = root_path / net_config["daemon_ssl"]["private_crt"]
|
||||||
key_path = root_path / net_config["daemon_ssl"]["private_key"]
|
key_path = root_path / net_config["daemon_ssl"]["private_key"]
|
||||||
ca_crt_path = root_path / net_config["private_ssl_ca"]["crt"]
|
ca_crt_path = root_path / net_config["private_ssl_ca"]["crt"]
|
||||||
ca_key_path = root_path / net_config["private_ssl_ca"]["key"]
|
ca_key_path = root_path / net_config["private_ssl_ca"]["key"]
|
||||||
ssl_context = ssl_context_for_client(ca_crt_path, ca_key_path, crt_path, key_path)
|
ssl_context = ssl_context_for_client(ca_crt_path, ca_key_path, crt_path, key_path)
|
||||||
connection = await connect_to_daemon(net_config["self_hostname"], net_config["daemon_port"], ssl_context)
|
connection = await connect_to_daemon(
|
||||||
|
net_config["self_hostname"], net_config["daemon_port"], daemon_max_message_size, ssl_context
|
||||||
|
)
|
||||||
r = await connection.ping()
|
r = await connection.ping()
|
||||||
|
|
||||||
if "value" in r["data"] and r["data"]["value"] == "pong":
|
if "value" in r["data"] and r["data"]["value"] == "pong":
|
||||||
@@ -168,7 +199,6 @@ async def acquire_connection_to_daemon(root_path: Path, quiet: bool = False):
|
|||||||
block exits scope, execution resumes in this function, wherein the connection is
|
block exits scope, execution resumes in this function, wherein the connection is
|
||||||
closed.
|
closed.
|
||||||
"""
|
"""
|
||||||
from chia.daemon.client import connect_to_daemon_and_validate
|
|
||||||
|
|
||||||
daemon: Optional[DaemonProxy] = None
|
daemon: Optional[DaemonProxy] = None
|
||||||
try:
|
try:
|
||||||
|
|||||||
+69
-151
@@ -14,8 +14,7 @@ from enum import Enum
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, TextIO, Tuple, cast
|
from typing import Any, Dict, List, Optional, TextIO, Tuple, cast
|
||||||
|
|
||||||
from websockets import ConnectionClosedOK, WebSocketException, WebSocketServerProtocol, serve
|
from chia import __version__
|
||||||
|
|
||||||
from chia.cmds.init_funcs import check_keys, chia_init
|
from chia.cmds.init_funcs import check_keys, chia_init
|
||||||
from chia.cmds.passphrase_funcs import default_passphrase, using_default_passphrase
|
from chia.cmds.passphrase_funcs import default_passphrase, using_default_passphrase
|
||||||
from chia.daemon.keychain_server import KeychainServer, keychain_commands
|
from chia.daemon.keychain_server import KeychainServer, keychain_commands
|
||||||
@@ -39,12 +38,12 @@ from chia.util.path import mkdir
|
|||||||
from chia.util.service_groups import validate_service
|
from chia.util.service_groups import validate_service
|
||||||
from chia.util.setproctitle import setproctitle
|
from chia.util.setproctitle import setproctitle
|
||||||
from chia.util.ws_message import WsRpcMessage, create_payload, format_response
|
from chia.util.ws_message import WsRpcMessage, create_payload, format_response
|
||||||
from chia import __version__
|
|
||||||
|
|
||||||
io_pool_exc = ThreadPoolExecutor()
|
io_pool_exc = ThreadPoolExecutor()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from aiohttp import ClientSession, web
|
from aiohttp import ClientSession, WSMsgType, web
|
||||||
|
from aiohttp.web_ws import WebSocketResponse
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
print("Error: Make sure to run . ./activate from the project folder before starting Chia.")
|
print("Error: Make sure to run . ./activate from the project folder before starting Chia.")
|
||||||
quit()
|
quit()
|
||||||
@@ -134,24 +133,24 @@ class WebSocketServer:
|
|||||||
ca_key_path: Path,
|
ca_key_path: Path,
|
||||||
crt_path: Path,
|
crt_path: Path,
|
||||||
key_path: Path,
|
key_path: Path,
|
||||||
|
shutdown_event: asyncio.Event,
|
||||||
run_check_keys_on_unlock: bool = False,
|
run_check_keys_on_unlock: bool = False,
|
||||||
):
|
):
|
||||||
self.root_path = root_path
|
self.root_path = root_path
|
||||||
self.log = log
|
self.log = log
|
||||||
self.services: Dict = dict()
|
self.services: Dict = dict()
|
||||||
self.plots_queue: List[Dict] = []
|
self.plots_queue: List[Dict] = []
|
||||||
self.connections: Dict[str, List[WebSocketServerProtocol]] = dict() # service_name : [WebSocket]
|
self.connections: Dict[str, List[WebSocketResponse]] = dict() # service_name : [WebSocket]
|
||||||
self.remote_address_map: Dict[WebSocketServerProtocol, str] = dict() # socket: service_name
|
self.remote_address_map: Dict[WebSocketResponse, str] = dict() # socket: service_name
|
||||||
self.ping_job: Optional[asyncio.Task] = None
|
|
||||||
self.net_config = load_config(root_path, "config.yaml")
|
self.net_config = load_config(root_path, "config.yaml")
|
||||||
self.self_hostname = self.net_config["self_hostname"]
|
self.self_hostname = self.net_config["self_hostname"]
|
||||||
self.daemon_port = self.net_config["daemon_port"]
|
self.daemon_port = self.net_config["daemon_port"]
|
||||||
self.daemon_max_message_size = self.net_config.get("daemon_max_message_size", 50 * 1000 * 1000)
|
self.daemon_max_message_size = self.net_config.get("daemon_max_message_size", 50 * 1000 * 1000)
|
||||||
self.websocket_server = None
|
self.websocket_runner: Optional[web.AppRunner] = None
|
||||||
self.ssl_context = ssl_context_for_server(ca_crt_path, ca_key_path, crt_path, key_path, log=self.log)
|
self.ssl_context = ssl_context_for_server(ca_crt_path, ca_key_path, crt_path, key_path, log=self.log)
|
||||||
self.shut_down = False
|
|
||||||
self.keychain_server = KeychainServer()
|
self.keychain_server = KeychainServer()
|
||||||
self.run_check_keys_on_unlock = run_check_keys_on_unlock
|
self.run_check_keys_on_unlock = run_check_keys_on_unlock
|
||||||
|
self.shutdown_event = shutdown_event
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
self.log.info("Starting Daemon Server")
|
self.log.info("Starting Daemon Server")
|
||||||
@@ -184,16 +183,19 @@ class WebSocketServer:
|
|||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
self.log.info("Not implemented")
|
self.log.info("Not implemented")
|
||||||
|
|
||||||
self.websocket_server = await serve(
|
app = web.Application(client_max_size=self.daemon_max_message_size)
|
||||||
self.safe_handle,
|
app.add_routes([web.get("/", self.incoming_connection)])
|
||||||
self.self_hostname,
|
self.websocket_runner = web.AppRunner(app, access_log=None, logger=self.log, keepalive_timeout=300)
|
||||||
self.daemon_port,
|
await self.websocket_runner.setup()
|
||||||
max_size=self.daemon_max_message_size,
|
|
||||||
ping_interval=500,
|
site = web.TCPSite(
|
||||||
ping_timeout=300,
|
self.websocket_runner,
|
||||||
ssl=self.ssl_context,
|
host=self.self_hostname,
|
||||||
|
port=self.daemon_port,
|
||||||
|
shutdown_timeout=3,
|
||||||
|
ssl_context=self.ssl_context,
|
||||||
)
|
)
|
||||||
self.log.info("Waiting Daemon WebSocketServer closure")
|
await site.start()
|
||||||
|
|
||||||
def cancel_task_safe(self, task: Optional[asyncio.Task]):
|
def cancel_task_safe(self, task: Optional[asyncio.Task]):
|
||||||
if task is not None:
|
if task is not None:
|
||||||
@@ -203,22 +205,28 @@ class WebSocketServer:
|
|||||||
self.log.error(f"Error while canceling task.{e} {task}")
|
self.log.error(f"Error while canceling task.{e} {task}")
|
||||||
|
|
||||||
async def stop(self) -> Dict[str, Any]:
|
async def stop(self) -> Dict[str, Any]:
|
||||||
self.shut_down = True
|
jobs = []
|
||||||
self.cancel_task_safe(self.ping_job)
|
for service_name in self.services.keys():
|
||||||
await self.exit()
|
jobs.append(kill_service(self.root_path, self.services, service_name))
|
||||||
if self.websocket_server is not None:
|
if jobs:
|
||||||
self.websocket_server.close()
|
await asyncio.wait(jobs)
|
||||||
|
self.services.clear()
|
||||||
|
asyncio.create_task(self.exit())
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
async def safe_handle(self, websocket: WebSocketServerProtocol, path: str):
|
async def incoming_connection(self, request):
|
||||||
service_name = ""
|
ws: WebSocketResponse = web.WebSocketResponse(max_msg_size=self.daemon_max_message_size, heartbeat=30)
|
||||||
try:
|
await ws.prepare(request)
|
||||||
async for message in websocket:
|
|
||||||
|
while True:
|
||||||
|
msg = await ws.receive()
|
||||||
|
self.log.debug(f"Received message: {msg}")
|
||||||
|
if msg.type == WSMsgType.TEXT:
|
||||||
try:
|
try:
|
||||||
decoded = json.loads(message)
|
decoded = json.loads(msg.data)
|
||||||
if "data" not in decoded:
|
if "data" not in decoded:
|
||||||
decoded["data"] = {}
|
decoded["data"] = {}
|
||||||
response, sockets_to_use = await self.handle_message(websocket, decoded)
|
response, sockets_to_use = await self.handle_message(ws, decoded)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
self.log.error(f"Error while handling message: {tb}")
|
self.log.error(f"Error while handling message: {tb}")
|
||||||
@@ -228,28 +236,27 @@ class WebSocketServer:
|
|||||||
if len(sockets_to_use) > 0:
|
if len(sockets_to_use) > 0:
|
||||||
for socket in sockets_to_use:
|
for socket in sockets_to_use:
|
||||||
try:
|
try:
|
||||||
await socket.send(response)
|
await socket.send_str(response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
||||||
self.remove_connection(socket)
|
self.remove_connection(socket)
|
||||||
await socket.close()
|
await socket.close()
|
||||||
except Exception as e:
|
break
|
||||||
tb = traceback.format_exc()
|
|
||||||
service_name = "Unknown"
|
|
||||||
if websocket in self.remote_address_map:
|
|
||||||
service_name = self.remote_address_map[websocket]
|
|
||||||
if isinstance(e, ConnectionClosedOK):
|
|
||||||
self.log.info(f"ConnectionClosedOk. Closing websocket with {service_name} {e}")
|
|
||||||
elif isinstance(e, WebSocketException):
|
|
||||||
self.log.info(f"Websocket exception. Closing websocket with {service_name} {e} {tb}")
|
|
||||||
else:
|
else:
|
||||||
self.log.error(f"Unexpected exception in websocket: {e} {tb}")
|
service_name = "Unknown"
|
||||||
finally:
|
if ws in self.remote_address_map:
|
||||||
self.remove_connection(websocket)
|
service_name = self.remote_address_map[ws]
|
||||||
await websocket.close()
|
if msg.type == WSMsgType.CLOSE:
|
||||||
|
self.log.info(f"ConnectionClosed. Closing websocket with {service_name}")
|
||||||
|
elif msg.type == WSMsgType.ERROR:
|
||||||
|
self.log.info(f"Websocket exception. Closing websocket with {service_name}. {ws.exception()}")
|
||||||
|
|
||||||
def remove_connection(self, websocket: WebSocketServerProtocol):
|
self.remove_connection(ws)
|
||||||
|
await ws.close()
|
||||||
|
break
|
||||||
|
|
||||||
|
def remove_connection(self, websocket: WebSocketResponse):
|
||||||
service_name = None
|
service_name = None
|
||||||
if websocket in self.remote_address_map:
|
if websocket in self.remote_address_map:
|
||||||
service_name = self.remote_address_map[websocket]
|
service_name = self.remote_address_map[websocket]
|
||||||
@@ -263,31 +270,8 @@ class WebSocketServer:
|
|||||||
after_removal.append(connection)
|
after_removal.append(connection)
|
||||||
self.connections[service_name] = after_removal
|
self.connections[service_name] = after_removal
|
||||||
|
|
||||||
async def ping_task(self) -> None:
|
|
||||||
restart = True
|
|
||||||
await asyncio.sleep(30)
|
|
||||||
for remote_address, service_name in self.remote_address_map.items():
|
|
||||||
if service_name in self.connections:
|
|
||||||
sockets = self.connections[service_name]
|
|
||||||
for socket in sockets:
|
|
||||||
if socket.remote_address[1] == remote_address:
|
|
||||||
try:
|
|
||||||
self.log.info(f"About to ping: {service_name}")
|
|
||||||
await socket.ping()
|
|
||||||
except asyncio.CancelledError:
|
|
||||||
self.log.info("Ping task received Cancel")
|
|
||||||
restart = False
|
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
self.log.info(f"Ping error: {e}")
|
|
||||||
self.log.warning("Ping failed, connection closed.")
|
|
||||||
self.remove_connection(socket)
|
|
||||||
await socket.close()
|
|
||||||
if restart is True:
|
|
||||||
self.ping_job = asyncio.create_task(self.ping_task())
|
|
||||||
|
|
||||||
async def handle_message(
|
async def handle_message(
|
||||||
self, websocket: WebSocketServerProtocol, message: WsRpcMessage
|
self, websocket: WebSocketResponse, message: WsRpcMessage
|
||||||
) -> Tuple[Optional[str], List[Any]]:
|
) -> Tuple[Optional[str], List[Any]]:
|
||||||
"""
|
"""
|
||||||
This function gets called when new message is received via websocket.
|
This function gets called when new message is received via websocket.
|
||||||
@@ -631,7 +615,7 @@ class WebSocketServer:
|
|||||||
|
|
||||||
for websocket in websockets:
|
for websocket in websockets:
|
||||||
try:
|
try:
|
||||||
await websocket.send(response)
|
await websocket.send_str(response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
||||||
@@ -690,7 +674,7 @@ class WebSocketServer:
|
|||||||
|
|
||||||
for websocket in websockets:
|
for websocket in websockets:
|
||||||
try:
|
try:
|
||||||
await websocket.send(response)
|
await websocket.send_str(response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
||||||
@@ -1150,20 +1134,13 @@ class WebSocketServer:
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
async def exit(self) -> Dict[str, Any]:
|
async def exit(self) -> None:
|
||||||
jobs = []
|
if self.websocket_runner is not None:
|
||||||
for k in self.services.keys():
|
await self.websocket_runner.cleanup()
|
||||||
jobs.append(kill_service(self.root_path, self.services, k))
|
self.shutdown_event.set()
|
||||||
if jobs:
|
|
||||||
await asyncio.wait(jobs)
|
|
||||||
self.services.clear()
|
|
||||||
|
|
||||||
log.info("chia daemon exiting")
|
log.info("chia daemon exiting")
|
||||||
|
|
||||||
response = {"success": True}
|
async def register_service(self, websocket: WebSocketResponse, request: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
return response
|
|
||||||
|
|
||||||
async def register_service(self, websocket: WebSocketServerProtocol, request: Dict[str, Any]) -> Dict[str, Any]:
|
|
||||||
self.log.info(f"Register service {request}")
|
self.log.info(f"Register service {request}")
|
||||||
service = request["service"]
|
service = request["service"]
|
||||||
if service not in self.connections:
|
if service not in self.connections:
|
||||||
@@ -1179,8 +1156,6 @@ class WebSocketServer:
|
|||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
self.remote_address_map[websocket] = service
|
self.remote_address_map[websocket] = service
|
||||||
if self.ping_job is None:
|
|
||||||
self.ping_job = asyncio.create_task(self.ping_task())
|
|
||||||
self.log.info(f"registered for service {service}")
|
self.log.info(f"registered for service {service}")
|
||||||
log.info(f"{response}")
|
log.info(f"{response}")
|
||||||
return response
|
return response
|
||||||
@@ -1351,7 +1326,6 @@ async def kill_service(
|
|||||||
if process is None:
|
if process is None:
|
||||||
return False
|
return False
|
||||||
del services[service_name]
|
del services[service_name]
|
||||||
|
|
||||||
result = await kill_process(process, root_path, service_name, "", delay_before_kill)
|
result = await kill_process(process, root_path, service_name, "", delay_before_kill)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -1361,68 +1335,6 @@ def is_running(services: Dict[str, subprocess.Popen], service_name: str) -> bool
|
|||||||
return process is not None and process.poll() is None
|
return process is not None and process.poll() is None
|
||||||
|
|
||||||
|
|
||||||
def create_server_for_daemon(root_path: Path):
|
|
||||||
routes = web.RouteTableDef()
|
|
||||||
|
|
||||||
services: Dict = dict()
|
|
||||||
|
|
||||||
@routes.get("/daemon/ping/")
|
|
||||||
async def ping(request: web.Request) -> web.Response:
|
|
||||||
return web.Response(text="pong")
|
|
||||||
|
|
||||||
@routes.get("/daemon/service/start/")
|
|
||||||
async def start_service(request: web.Request) -> web.Response:
|
|
||||||
service_name = request.query.get("service")
|
|
||||||
if service_name is None or not validate_service(service_name):
|
|
||||||
r = f"{service_name} unknown service"
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
|
|
||||||
if is_running(services, service_name):
|
|
||||||
r = f"{service_name} already running"
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
|
|
||||||
try:
|
|
||||||
process, pid_path = launch_service(root_path, service_name)
|
|
||||||
services[service_name] = process
|
|
||||||
r = f"{service_name} started"
|
|
||||||
except (subprocess.SubprocessError, IOError):
|
|
||||||
log.exception(f"problem starting {service_name}")
|
|
||||||
r = f"{service_name} start failed"
|
|
||||||
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
|
|
||||||
@routes.get("/daemon/service/stop/")
|
|
||||||
async def stop_service(request: web.Request) -> web.Response:
|
|
||||||
service_name = request.query.get("service")
|
|
||||||
if service_name is None:
|
|
||||||
r = f"{service_name} unknown service"
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
r = str(await kill_service(root_path, services, service_name))
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
|
|
||||||
@routes.get("/daemon/service/is_running/")
|
|
||||||
async def is_running_handler(request: web.Request) -> web.Response:
|
|
||||||
service_name = request.query.get("service")
|
|
||||||
if service_name is None:
|
|
||||||
r = f"{service_name} unknown service"
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
|
|
||||||
r = str(is_running(services, service_name))
|
|
||||||
return web.Response(text=str(r))
|
|
||||||
|
|
||||||
@routes.get("/daemon/exit/")
|
|
||||||
async def exit(request: web.Request):
|
|
||||||
jobs = []
|
|
||||||
for k in services.keys():
|
|
||||||
jobs.append(kill_service(root_path, services, k))
|
|
||||||
if jobs:
|
|
||||||
await asyncio.wait(jobs)
|
|
||||||
services.clear()
|
|
||||||
|
|
||||||
# we can't await `site.stop()` here because that will cause a deadlock, waiting for this
|
|
||||||
# request to exit
|
|
||||||
|
|
||||||
|
|
||||||
def singleton(lockfile: Path, text: str = "semaphore") -> Optional[TextIO]:
|
def singleton(lockfile: Path, text: str = "semaphore") -> Optional[TextIO]:
|
||||||
"""
|
"""
|
||||||
Open a lockfile exclusively.
|
Open a lockfile exclusively.
|
||||||
@@ -1474,14 +1386,20 @@ async def async_run_daemon(root_path: Path, wait_for_unlock: bool = False) -> in
|
|||||||
print("daemon: already launching")
|
print("daemon: already launching")
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
|
shutdown_event = asyncio.Event()
|
||||||
|
|
||||||
# TODO: clean this up, ensuring lockfile isn't removed until the listen port is open
|
# TODO: clean this up, ensuring lockfile isn't removed until the listen port is open
|
||||||
create_server_for_daemon(root_path)
|
|
||||||
ws_server = WebSocketServer(
|
ws_server = WebSocketServer(
|
||||||
root_path, ca_crt_path, ca_key_path, crt_path, key_path, run_check_keys_on_unlock=wait_for_unlock
|
root_path,
|
||||||
|
ca_crt_path,
|
||||||
|
ca_key_path,
|
||||||
|
crt_path,
|
||||||
|
key_path,
|
||||||
|
shutdown_event,
|
||||||
|
run_check_keys_on_unlock=wait_for_unlock,
|
||||||
)
|
)
|
||||||
await ws_server.start()
|
await ws_server.start()
|
||||||
assert ws_server.websocket_server is not None
|
await shutdown_event.wait()
|
||||||
await ws_server.websocket_server.wait_closed()
|
|
||||||
log.info("Daemon WebSocketServer closed")
|
log.info("Daemon WebSocketServer closed")
|
||||||
# sys.stdout.close()
|
# sys.stdout.close()
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
+24
-98
@@ -18,6 +18,8 @@ from chia.daemon.keychain_proxy import (
|
|||||||
connect_to_keychain_and_validate,
|
connect_to_keychain_and_validate,
|
||||||
wrap_local_keychain,
|
wrap_local_keychain,
|
||||||
)
|
)
|
||||||
|
from chia.plot_sync.receiver import Receiver
|
||||||
|
from chia.plot_sync.delta import Delta
|
||||||
from chia.pools.pool_config import PoolWalletConfig, load_pool_config, add_auth_key
|
from chia.pools.pool_config import PoolWalletConfig, load_pool_config, add_auth_key
|
||||||
from chia.protocols import farmer_protocol, harvester_protocol
|
from chia.protocols import farmer_protocol, harvester_protocol
|
||||||
from chia.protocols.pool_protocol import (
|
from chia.protocols.pool_protocol import (
|
||||||
@@ -59,32 +61,12 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
UPDATE_POOL_INFO_INTERVAL: int = 3600
|
UPDATE_POOL_INFO_INTERVAL: int = 3600
|
||||||
UPDATE_POOL_FARMER_INFO_INTERVAL: int = 300
|
UPDATE_POOL_FARMER_INFO_INTERVAL: int = 300
|
||||||
UPDATE_HARVESTER_CACHE_INTERVAL: int = 90
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
HARVESTER PROTOCOL (FARMER <-> HARVESTER)
|
HARVESTER PROTOCOL (FARMER <-> HARVESTER)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class HarvesterCacheEntry:
|
|
||||||
def __init__(self):
|
|
||||||
self.data: Optional[dict] = None
|
|
||||||
self.last_update: float = 0
|
|
||||||
|
|
||||||
def bump_last_update(self):
|
|
||||||
self.last_update = time.time()
|
|
||||||
|
|
||||||
def set_data(self, data):
|
|
||||||
self.data = data
|
|
||||||
self.bump_last_update()
|
|
||||||
|
|
||||||
def needs_update(self, update_interval: int):
|
|
||||||
return time.time() - self.last_update > update_interval
|
|
||||||
|
|
||||||
def expired(self, update_interval: int):
|
|
||||||
return time.time() - self.last_update > update_interval * 10
|
|
||||||
|
|
||||||
|
|
||||||
class Farmer:
|
class Farmer:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -115,8 +97,7 @@ class Farmer:
|
|||||||
# to periodically clear the memory
|
# to periodically clear the memory
|
||||||
self.cache_add_time: Dict[bytes32, uint64] = {}
|
self.cache_add_time: Dict[bytes32, uint64] = {}
|
||||||
|
|
||||||
# Interval to request plots from connected harvesters
|
self.plot_sync_receivers: Dict[bytes32, Receiver] = {}
|
||||||
self.update_harvester_cache_interval = UPDATE_HARVESTER_CACHE_INTERVAL
|
|
||||||
|
|
||||||
self.cache_clear_task: Optional[asyncio.Task] = None
|
self.cache_clear_task: Optional[asyncio.Task] = None
|
||||||
self.update_pool_state_task: Optional[asyncio.Task] = None
|
self.update_pool_state_task: Optional[asyncio.Task] = None
|
||||||
@@ -137,10 +118,8 @@ class Farmer:
|
|||||||
# Last time we updated pool_state based on the config file
|
# Last time we updated pool_state based on the config file
|
||||||
self.last_config_access_time: uint64 = uint64(0)
|
self.last_config_access_time: uint64 = uint64(0)
|
||||||
|
|
||||||
self.harvester_cache: Dict[str, Dict[str, HarvesterCacheEntry]] = {}
|
|
||||||
|
|
||||||
async def ensure_keychain_proxy(self) -> KeychainProxy:
|
async def ensure_keychain_proxy(self) -> KeychainProxy:
|
||||||
if not self.keychain_proxy:
|
if self.keychain_proxy is None:
|
||||||
if self.local_keychain:
|
if self.local_keychain:
|
||||||
self.keychain_proxy = wrap_local_keychain(self.local_keychain, log=self.log)
|
self.keychain_proxy = wrap_local_keychain(self.local_keychain, log=self.log)
|
||||||
else:
|
else:
|
||||||
@@ -212,11 +191,16 @@ class Farmer:
|
|||||||
def _close(self):
|
def _close(self):
|
||||||
self._shut_down = True
|
self._shut_down = True
|
||||||
|
|
||||||
async def _await_closed(self):
|
async def _await_closed(self, shutting_down: bool = True):
|
||||||
if self.cache_clear_task is not None:
|
if self.cache_clear_task is not None:
|
||||||
await self.cache_clear_task
|
await self.cache_clear_task
|
||||||
if self.update_pool_state_task is not None:
|
if self.update_pool_state_task is not None:
|
||||||
await self.update_pool_state_task
|
await self.update_pool_state_task
|
||||||
|
if shutting_down and self.keychain_proxy is not None:
|
||||||
|
proxy = self.keychain_proxy
|
||||||
|
self.keychain_proxy = None
|
||||||
|
await proxy.close()
|
||||||
|
await asyncio.sleep(0.5) # https://docs.aiohttp.org/en/stable/client_advanced.html#graceful-shutdown
|
||||||
self.started = False
|
self.started = False
|
||||||
|
|
||||||
def _set_state_changed_callback(self, callback: Callable):
|
def _set_state_changed_callback(self, callback: Callable):
|
||||||
@@ -251,6 +235,7 @@ class Farmer:
|
|||||||
self.harvester_handshake_task = None
|
self.harvester_handshake_task = None
|
||||||
|
|
||||||
if peer.connection_type is NodeType.HARVESTER:
|
if peer.connection_type is NodeType.HARVESTER:
|
||||||
|
self.plot_sync_receivers[peer.peer_node_id] = Receiver(peer, self.plot_sync_callback)
|
||||||
self.harvester_handshake_task = asyncio.create_task(handshake_task())
|
self.harvester_handshake_task = asyncio.create_task(handshake_task())
|
||||||
|
|
||||||
def set_server(self, server):
|
def set_server(self, server):
|
||||||
@@ -269,6 +254,13 @@ class Farmer:
|
|||||||
def on_disconnect(self, connection: ws.WSChiaConnection):
|
def on_disconnect(self, connection: ws.WSChiaConnection):
|
||||||
self.log.info(f"peer disconnected {connection.get_peer_logging()}")
|
self.log.info(f"peer disconnected {connection.get_peer_logging()}")
|
||||||
self.state_changed("close_connection", {})
|
self.state_changed("close_connection", {})
|
||||||
|
if connection.connection_type is NodeType.HARVESTER:
|
||||||
|
del self.plot_sync_receivers[connection.peer_node_id]
|
||||||
|
|
||||||
|
async def plot_sync_callback(self, peer_id: bytes32, delta: Delta) -> None:
|
||||||
|
log.info(f"plot_sync_callback: peer_id {peer_id}, delta {delta}")
|
||||||
|
if not delta.empty():
|
||||||
|
self.state_changed("new_plots", await self.get_harvesters())
|
||||||
|
|
||||||
async def _pool_get_pool_info(self, pool_config: PoolWalletConfig) -> Optional[Dict]:
|
async def _pool_get_pool_info(self, pool_config: PoolWalletConfig) -> Optional[Dict]:
|
||||||
try:
|
try:
|
||||||
@@ -637,80 +629,17 @@ class Farmer:
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def update_cached_harvesters(self) -> bool:
|
|
||||||
# First remove outdated cache entries
|
|
||||||
self.log.debug(f"update_cached_harvesters cache entries: {len(self.harvester_cache)}")
|
|
||||||
remove_hosts = []
|
|
||||||
for host, host_cache in self.harvester_cache.items():
|
|
||||||
remove_peers = []
|
|
||||||
for peer_id, peer_cache in host_cache.items():
|
|
||||||
# If the peer cache is expired it means the harvester didn't respond for too long
|
|
||||||
if peer_cache.expired(self.update_harvester_cache_interval):
|
|
||||||
remove_peers.append(peer_id)
|
|
||||||
for key in remove_peers:
|
|
||||||
del host_cache[key]
|
|
||||||
if len(host_cache) == 0:
|
|
||||||
self.log.debug(f"update_cached_harvesters remove host: {host}")
|
|
||||||
remove_hosts.append(host)
|
|
||||||
for key in remove_hosts:
|
|
||||||
del self.harvester_cache[key]
|
|
||||||
# Now query each harvester and update caches
|
|
||||||
updated = False
|
|
||||||
for connection in self.server.get_connections(NodeType.HARVESTER):
|
|
||||||
cache_entry = await self.get_cached_harvesters(connection)
|
|
||||||
if cache_entry.needs_update(self.update_harvester_cache_interval):
|
|
||||||
self.log.debug(f"update_cached_harvesters update harvester: {connection.peer_node_id}")
|
|
||||||
cache_entry.bump_last_update()
|
|
||||||
response = await connection.request_plots(
|
|
||||||
harvester_protocol.RequestPlots(), timeout=self.update_harvester_cache_interval
|
|
||||||
)
|
|
||||||
if response is not None:
|
|
||||||
if isinstance(response, harvester_protocol.RespondPlots):
|
|
||||||
new_data: Dict = response.to_json_dict()
|
|
||||||
if cache_entry.data != new_data:
|
|
||||||
updated = True
|
|
||||||
self.log.debug(f"update_cached_harvesters cache updated: {connection.peer_node_id}")
|
|
||||||
else:
|
|
||||||
self.log.debug(f"update_cached_harvesters no changes for: {connection.peer_node_id}")
|
|
||||||
cache_entry.set_data(new_data)
|
|
||||||
else:
|
|
||||||
self.log.error(
|
|
||||||
f"Invalid response from harvester:"
|
|
||||||
f"peer_host {connection.peer_host}, peer_node_id {connection.peer_node_id}"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self.log.error(
|
|
||||||
f"Harvester '{connection.peer_host}/{connection.peer_node_id}' did not respond: "
|
|
||||||
f"(version mismatch or time out {UPDATE_HARVESTER_CACHE_INTERVAL}s)"
|
|
||||||
)
|
|
||||||
return updated
|
|
||||||
|
|
||||||
async def get_cached_harvesters(self, connection: WSChiaConnection) -> HarvesterCacheEntry:
|
|
||||||
host_cache = self.harvester_cache.get(connection.peer_host)
|
|
||||||
if host_cache is None:
|
|
||||||
host_cache = {}
|
|
||||||
self.harvester_cache[connection.peer_host] = host_cache
|
|
||||||
node_cache = host_cache.get(connection.peer_node_id.hex())
|
|
||||||
if node_cache is None:
|
|
||||||
node_cache = HarvesterCacheEntry()
|
|
||||||
host_cache[connection.peer_node_id.hex()] = node_cache
|
|
||||||
return node_cache
|
|
||||||
|
|
||||||
async def get_harvesters(self) -> Dict:
|
async def get_harvesters(self) -> Dict:
|
||||||
harvesters: List = []
|
harvesters: List = []
|
||||||
for connection in self.server.get_connections(NodeType.HARVESTER):
|
for connection in self.server.get_connections(NodeType.HARVESTER):
|
||||||
self.log.debug(f"get_harvesters host: {connection.peer_host}, node_id: {connection.peer_node_id}")
|
self.log.debug(f"get_harvesters host: {connection.peer_host}, node_id: {connection.peer_node_id}")
|
||||||
cache_entry = await self.get_cached_harvesters(connection)
|
receiver = self.plot_sync_receivers.get(connection.peer_node_id)
|
||||||
if cache_entry.data is not None:
|
if receiver is not None:
|
||||||
harvester_object: dict = dict(cache_entry.data)
|
harvesters.append(receiver.to_dict())
|
||||||
harvester_object["connection"] = {
|
|
||||||
"node_id": connection.peer_node_id.hex(),
|
|
||||||
"host": connection.peer_host,
|
|
||||||
"port": connection.peer_port,
|
|
||||||
}
|
|
||||||
harvesters.append(harvester_object)
|
|
||||||
else:
|
else:
|
||||||
self.log.debug(f"get_harvesters no cache: {connection.peer_host}, node_id: {connection.peer_node_id}")
|
self.log.debug(
|
||||||
|
f"get_harvesters invalid peer: {connection.peer_host}, node_id: {connection.peer_node_id}"
|
||||||
|
)
|
||||||
|
|
||||||
return {"harvesters": harvesters}
|
return {"harvesters": harvesters}
|
||||||
|
|
||||||
@@ -761,9 +690,6 @@ class Farmer:
|
|||||||
self.state_changed("add_connection", {})
|
self.state_changed("add_connection", {})
|
||||||
refresh_slept = 0
|
refresh_slept = 0
|
||||||
|
|
||||||
# Handles harvester plots cache cleanup and updates
|
|
||||||
if await self.update_cached_harvesters():
|
|
||||||
self.state_changed("new_plots", await self.get_harvesters())
|
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error(f"_periodically_clear_cache_and_refresh_task failed: {traceback.format_exc()}")
|
log.error(f"_periodically_clear_cache_and_refresh_task failed: {traceback.format_exc()}")
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,13 @@ from chia.consensus.network_type import NetworkType
|
|||||||
from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
|
from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
|
||||||
from chia.farmer.farmer import Farmer
|
from chia.farmer.farmer import Farmer
|
||||||
from chia.protocols import farmer_protocol, harvester_protocol
|
from chia.protocols import farmer_protocol, harvester_protocol
|
||||||
from chia.protocols.harvester_protocol import PoolDifficulty
|
from chia.protocols.harvester_protocol import (
|
||||||
|
PoolDifficulty,
|
||||||
|
PlotSyncStart,
|
||||||
|
PlotSyncPlotList,
|
||||||
|
PlotSyncPathList,
|
||||||
|
PlotSyncDone,
|
||||||
|
)
|
||||||
from chia.protocols.pool_protocol import (
|
from chia.protocols.pool_protocol import (
|
||||||
get_current_authentication_token,
|
get_current_authentication_token,
|
||||||
PoolErrorCode,
|
PoolErrorCode,
|
||||||
@@ -518,3 +524,38 @@ class FarmerAPI:
|
|||||||
@peer_required
|
@peer_required
|
||||||
async def respond_plots(self, _: harvester_protocol.RespondPlots, peer: ws.WSChiaConnection):
|
async def respond_plots(self, _: harvester_protocol.RespondPlots, peer: ws.WSChiaConnection):
|
||||||
self.farmer.log.warning(f"Respond plots came too late from: {peer.get_peer_logging()}")
|
self.farmer.log.warning(f"Respond plots came too late from: {peer.get_peer_logging()}")
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_start(self, message: PlotSyncStart, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].sync_started(message)
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_loaded(self, message: PlotSyncPlotList, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].process_loaded(message)
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_removed(self, message: PlotSyncPathList, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].process_removed(message)
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_invalid(self, message: PlotSyncPathList, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].process_invalid(message)
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_keys_missing(self, message: PlotSyncPathList, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].process_keys_missing(message)
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_duplicates(self, message: PlotSyncPathList, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].process_duplicates(message)
|
||||||
|
|
||||||
|
@api_request
|
||||||
|
@peer_required
|
||||||
|
async def plot_sync_done(self, message: PlotSyncDone, peer: ws.WSChiaConnection):
|
||||||
|
await self.farmer.plot_sync_receivers[peer.peer_node_id].sync_done(message)
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ from chia.util.db_wrapper import DBWrapper2
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclass(frozen=True)
|
||||||
class SesCache(Streamable):
|
class SesCache(Streamable):
|
||||||
content: List[Tuple[uint32, bytes]]
|
content: List[Tuple[uint32, bytes]]
|
||||||
|
|
||||||
@@ -184,6 +184,10 @@ class BlockHeightMap:
|
|||||||
ordered[bytes32.fromhex(r[0])] = (r[2], bytes32.fromhex(r[1]), r[3])
|
ordered[bytes32.fromhex(r[0])] = (r[2], bytes32.fromhex(r[1]), r[3])
|
||||||
|
|
||||||
while height > window_end:
|
while height > window_end:
|
||||||
|
if prev_hash not in ordered:
|
||||||
|
raise ValueError(
|
||||||
|
f"block with header hash is missing from your blockchain database: {prev_hash.hex()}"
|
||||||
|
)
|
||||||
entry = ordered[prev_hash]
|
entry = ordered[prev_hash]
|
||||||
assert height == entry[0] + 1
|
assert height == entry[0] + 1
|
||||||
height = entry[0]
|
height = entry[0]
|
||||||
@@ -226,6 +230,7 @@ class BlockHeightMap:
|
|||||||
heights_to_delete.append(ses_included_height)
|
heights_to_delete.append(ses_included_height)
|
||||||
for height in heights_to_delete:
|
for height in heights_to_delete:
|
||||||
del self.__sub_epoch_summaries[height]
|
del self.__sub_epoch_summaries[height]
|
||||||
|
del self.__height_to_hash[(fork_height + 1) * 32 :]
|
||||||
|
|
||||||
def get_ses(self, height: uint32) -> SubEpochSummary:
|
def get_ses(self, height: uint32) -> SubEpochSummary:
|
||||||
return SubEpochSummary.from_bytes(self.__sub_epoch_summaries[height])
|
return SubEpochSummary.from_bytes(self.__sub_epoch_summaries[height])
|
||||||
|
|||||||
@@ -421,12 +421,9 @@ class BlockStore:
|
|||||||
async with self.db_wrapper.read_db() as conn:
|
async with self.db_wrapper.read_db() as conn:
|
||||||
async with conn.execute(formatted_str, header_hashes_db) as cursor:
|
async with conn.execute(formatted_str, header_hashes_db) as cursor:
|
||||||
for row in await cursor.fetchall():
|
for row in await cursor.fetchall():
|
||||||
header_hash = self.maybe_from_hex(row[0])
|
header_hash = bytes32(self.maybe_from_hex(row[0]))
|
||||||
full_block: FullBlock = self.maybe_decompress(row[1])
|
full_block: FullBlock = self.maybe_decompress(row[1])
|
||||||
# TODO: address hint error and remove ignore
|
all_blocks[header_hash] = full_block
|
||||||
# error: Invalid index type "bytes" for "Dict[bytes32, FullBlock]";
|
|
||||||
# expected type "bytes32" [index]
|
|
||||||
all_blocks[header_hash] = full_block # type: ignore[index]
|
|
||||||
self.block_cache.put(header_hash, full_block)
|
self.block_cache.put(header_hash, full_block)
|
||||||
ret: List[FullBlock] = []
|
ret: List[FullBlock] = []
|
||||||
for hh in header_hashes:
|
for hh in header_hashes:
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
from typing import List, Optional, Set, Dict, Any, Tuple
|
from typing import List, Optional, Set, Dict, Any, Tuple
|
||||||
|
|
||||||
|
from aiosqlite import Cursor
|
||||||
|
|
||||||
from chia.protocols.wallet_protocol import CoinState
|
from chia.protocols.wallet_protocol import CoinState
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
@@ -285,7 +288,8 @@ class CoinStore:
|
|||||||
async with self.db_wrapper.read_db() as conn:
|
async with self.db_wrapper.read_db() as conn:
|
||||||
async with conn.execute(
|
async with conn.execute(
|
||||||
f"SELECT confirmed_index, spent_index, coinbase, puzzle_hash, "
|
f"SELECT confirmed_index, spent_index, coinbase, puzzle_hash, "
|
||||||
f'coin_parent, amount, timestamp FROM coin_record WHERE coin_name in ({"?," * (len(names) - 1)}?) '
|
f"coin_parent, amount, timestamp FROM coin_record INDEXED BY sqlite_autoindex_coin_record_1 "
|
||||||
|
f'WHERE coin_name in ({"?," * (len(names) - 1)}?) '
|
||||||
f"AND confirmed_index>=? AND confirmed_index<? "
|
f"AND confirmed_index>=? AND confirmed_index<? "
|
||||||
f"{'' if include_spent_coins else 'AND spent_index=0'}",
|
f"{'' if include_spent_coins else 'AND spent_index=0'}",
|
||||||
names_db + (start_height, end_height),
|
names_db + (start_height, end_height),
|
||||||
@@ -515,16 +519,27 @@ class CoinStore:
|
|||||||
for coin_name in coin_names:
|
for coin_name in coin_names:
|
||||||
r = self.coin_record_cache.get(coin_name)
|
r = self.coin_record_cache.get(coin_name)
|
||||||
if r is not None:
|
if r is not None:
|
||||||
|
if r.spent_block_index != uint32(0):
|
||||||
|
raise ValueError(f"Coin already spent in cache: {coin_name}")
|
||||||
|
|
||||||
self.coin_record_cache.put(
|
self.coin_record_cache.put(
|
||||||
r.name, CoinRecord(r.coin, r.confirmed_block_index, index, r.coinbase, r.timestamp)
|
r.name, CoinRecord(r.coin, r.confirmed_block_index, index, r.coinbase, r.timestamp)
|
||||||
)
|
)
|
||||||
updates.append((index, self.maybe_to_hex(coin_name)))
|
updates.append((index, self.maybe_to_hex(coin_name)))
|
||||||
|
|
||||||
if updates != []:
|
assert len(updates) == len(coin_names)
|
||||||
async with self.db_wrapper.write_db() as conn:
|
async with self.db_wrapper.write_db() as conn:
|
||||||
if self.db_wrapper.db_version == 2:
|
if self.db_wrapper.db_version == 2:
|
||||||
await conn.executemany("UPDATE OR FAIL coin_record SET spent_index=? WHERE coin_name=?", updates)
|
ret: Cursor = await conn.executemany(
|
||||||
else:
|
"UPDATE OR FAIL coin_record SET spent_index=? WHERE coin_name=? AND spent_index=0", updates
|
||||||
await conn.executemany(
|
)
|
||||||
"UPDATE OR FAIL coin_record SET spent=1,spent_index=? WHERE coin_name=?", updates
|
|
||||||
)
|
else:
|
||||||
|
ret = await conn.executemany(
|
||||||
|
"UPDATE OR FAIL coin_record SET spent=1,spent_index=? WHERE coin_name=? AND spent_index=0",
|
||||||
|
updates,
|
||||||
|
)
|
||||||
|
if ret.rowcount != len(coin_names):
|
||||||
|
raise ValueError(
|
||||||
|
f"Invalid operation to set spent, total updates {ret.rowcount} expected {len(coin_names)}"
|
||||||
|
)
|
||||||
|
|||||||
@@ -1297,10 +1297,9 @@ class FullNode:
|
|||||||
fork_block: Optional[BlockRecord] = None
|
fork_block: Optional[BlockRecord] = None
|
||||||
if fork_height != block.height - 1 and block.height != 0:
|
if fork_height != block.height - 1 and block.height != 0:
|
||||||
# This is a reorg
|
# This is a reorg
|
||||||
# TODO: address hint error and remove ignore
|
fork_hash: Optional[bytes32] = self.blockchain.height_to_hash(fork_height)
|
||||||
# error: Argument 1 to "block_record" of "Blockchain" has incompatible type "Optional[bytes32]";
|
assert fork_hash is not None
|
||||||
# expected "bytes32" [arg-type]
|
fork_block = self.blockchain.block_record(fork_hash)
|
||||||
fork_block = self.blockchain.block_record(self.blockchain.height_to_hash(fork_height)) # type: ignore[arg-type] # noqa: E501
|
|
||||||
|
|
||||||
fns_peak_result: FullNodeStorePeakResult = self.full_node_store.new_peak(
|
fns_peak_result: FullNodeStorePeakResult = self.full_node_store.new_peak(
|
||||||
record,
|
record,
|
||||||
@@ -1737,7 +1736,10 @@ class FullNode:
|
|||||||
npc_result = await self.blockchain.run_generator(block_bytes, block_generator, height)
|
npc_result = await self.blockchain.run_generator(block_bytes, block_generator, height)
|
||||||
pre_validation_time = time.time() - pre_validation_start
|
pre_validation_time = time.time() - pre_validation_start
|
||||||
|
|
||||||
pairs_pks, pairs_msgs = pkm_pairs(npc_result.npc_list, self.constants.AGG_SIG_ME_ADDITIONAL_DATA)
|
# blockchain.run_generator throws on errors, so npc_result is
|
||||||
|
# guaranteed to represent a successful run
|
||||||
|
assert npc_result.conds is not None
|
||||||
|
pairs_pks, pairs_msgs = pkm_pairs(npc_result.conds, self.constants.AGG_SIG_ME_ADDITIONAL_DATA)
|
||||||
if not cached_bls.aggregate_verify(
|
if not cached_bls.aggregate_verify(
|
||||||
pairs_pks, pairs_msgs, block.transactions_info.aggregated_signature, True
|
pairs_pks, pairs_msgs, block.transactions_info.aggregated_signature, True
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -199,13 +199,11 @@ class FullNodeAPI:
|
|||||||
if task_id in full_node.full_node_store.tx_fetch_tasks:
|
if task_id in full_node.full_node_store.tx_fetch_tasks:
|
||||||
full_node.full_node_store.tx_fetch_tasks.pop(task_id)
|
full_node.full_node_store.tx_fetch_tasks.pop(task_id)
|
||||||
|
|
||||||
task_id = token_bytes()
|
task_id: bytes32 = bytes32(token_bytes(32))
|
||||||
fetch_task = asyncio.create_task(
|
fetch_task = asyncio.create_task(
|
||||||
tx_request_and_timeout(self.full_node, transaction.transaction_id, task_id)
|
tx_request_and_timeout(self.full_node, transaction.transaction_id, task_id)
|
||||||
)
|
)
|
||||||
# TODO: address hint error and remove ignore
|
self.full_node.full_node_store.tx_fetch_tasks[task_id] = fetch_task
|
||||||
# error: Invalid index type "bytes" for "Dict[bytes32, Task[Any]]"; expected type "bytes32" [index]
|
|
||||||
self.full_node.full_node_store.tx_fetch_tasks[task_id] = fetch_task # type: ignore[index]
|
|
||||||
return None
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -311,18 +309,16 @@ class FullNodeAPI:
|
|||||||
reject = RejectBlock(request.height)
|
reject = RejectBlock(request.height)
|
||||||
msg = make_msg(ProtocolMessageTypes.reject_block, reject)
|
msg = make_msg(ProtocolMessageTypes.reject_block, reject)
|
||||||
return msg
|
return msg
|
||||||
header_hash = self.full_node.blockchain.height_to_hash(request.height)
|
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(request.height)
|
||||||
# TODO: address hint error and remove ignore
|
if header_hash is None:
|
||||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
|
||||||
# expected "bytes32" [arg-type]
|
|
||||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash) # type: ignore[arg-type] # noqa: E501
|
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash)
|
||||||
if block is not None:
|
if block is not None:
|
||||||
if not request.include_transaction_block and block.transactions_generator is not None:
|
if not request.include_transaction_block and block.transactions_generator is not None:
|
||||||
block = dataclasses.replace(block, transactions_generator=None)
|
block = dataclasses.replace(block, transactions_generator=None)
|
||||||
return make_msg(ProtocolMessageTypes.respond_block, full_node_protocol.RespondBlock(block))
|
return make_msg(ProtocolMessageTypes.respond_block, full_node_protocol.RespondBlock(block))
|
||||||
reject = RejectBlock(request.height)
|
return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
|
||||||
msg = make_msg(ProtocolMessageTypes.reject_block, reject)
|
|
||||||
return msg
|
|
||||||
|
|
||||||
@api_request
|
@api_request
|
||||||
@reply_type([ProtocolMessageTypes.respond_blocks, ProtocolMessageTypes.reject_blocks])
|
@reply_type([ProtocolMessageTypes.respond_blocks, ProtocolMessageTypes.reject_blocks])
|
||||||
@@ -340,16 +336,15 @@ class FullNodeAPI:
|
|||||||
if not request.include_transaction_block:
|
if not request.include_transaction_block:
|
||||||
blocks: List[FullBlock] = []
|
blocks: List[FullBlock] = []
|
||||||
for i in range(request.start_height, request.end_height + 1):
|
for i in range(request.start_height, request.end_height + 1):
|
||||||
# TODO: address hint error and remove ignore
|
header_hash_i: Optional[bytes32] = self.full_node.blockchain.height_to_hash(uint32(i))
|
||||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
if header_hash_i is None:
|
||||||
# expected "bytes32" [arg-type]
|
reject = RejectBlocks(request.start_height, request.end_height)
|
||||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(
|
return make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||||
self.full_node.blockchain.height_to_hash(uint32(i)) # type: ignore[arg-type]
|
|
||||||
)
|
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash_i)
|
||||||
if block is None:
|
if block is None:
|
||||||
reject = RejectBlocks(request.start_height, request.end_height)
|
reject = RejectBlocks(request.start_height, request.end_height)
|
||||||
msg = make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
return make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||||
return msg
|
|
||||||
block = dataclasses.replace(block, transactions_generator=None)
|
block = dataclasses.replace(block, transactions_generator=None)
|
||||||
blocks.append(block)
|
blocks.append(block)
|
||||||
msg = make_msg(
|
msg = make_msg(
|
||||||
@@ -359,12 +354,11 @@ class FullNodeAPI:
|
|||||||
else:
|
else:
|
||||||
blocks_bytes: List[bytes] = []
|
blocks_bytes: List[bytes] = []
|
||||||
for i in range(request.start_height, request.end_height + 1):
|
for i in range(request.start_height, request.end_height + 1):
|
||||||
# TODO: address hint error and remove ignore
|
header_hash_i = self.full_node.blockchain.height_to_hash(uint32(i))
|
||||||
# error: Argument 1 to "get_full_block_bytes" of "BlockStore" has incompatible type
|
if header_hash_i is None:
|
||||||
# "Optional[bytes32]"; expected "bytes32" [arg-type]
|
reject = RejectBlocks(request.start_height, request.end_height)
|
||||||
block_bytes: Optional[bytes] = await self.full_node.block_store.get_full_block_bytes(
|
return make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||||
self.full_node.blockchain.height_to_hash(uint32(i)) # type: ignore[arg-type]
|
block_bytes: Optional[bytes] = await self.full_node.block_store.get_full_block_bytes(header_hash_i)
|
||||||
)
|
|
||||||
if block_bytes is None:
|
if block_bytes is None:
|
||||||
reject = RejectBlocks(request.start_height, request.end_height)
|
reject = RejectBlocks(request.start_height, request.end_height)
|
||||||
msg = make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
msg = make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||||
@@ -898,9 +892,6 @@ class FullNodeAPI:
|
|||||||
timestamp = uint64(int(curr.timestamp + 1))
|
timestamp = uint64(int(curr.timestamp + 1))
|
||||||
|
|
||||||
self.log.info("Starting to make the unfinished block")
|
self.log.info("Starting to make the unfinished block")
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Argument 16 to "create_unfinished_block" has incompatible type "bytes"; expected "bytes32"
|
|
||||||
# [arg-type]
|
|
||||||
unfinished_block: UnfinishedBlock = create_unfinished_block(
|
unfinished_block: UnfinishedBlock = create_unfinished_block(
|
||||||
self.full_node.constants,
|
self.full_node.constants,
|
||||||
total_iters_pos_slot,
|
total_iters_pos_slot,
|
||||||
@@ -917,7 +908,7 @@ class FullNodeAPI:
|
|||||||
sp_vdfs,
|
sp_vdfs,
|
||||||
timestamp,
|
timestamp,
|
||||||
self.full_node.blockchain,
|
self.full_node.blockchain,
|
||||||
b"", # type: ignore[arg-type]
|
b"",
|
||||||
block_generator,
|
block_generator,
|
||||||
aggregate_signature,
|
aggregate_signature,
|
||||||
additions,
|
additions,
|
||||||
@@ -937,22 +928,17 @@ class FullNodeAPI:
|
|||||||
foliage_transaction_block_hash = unfinished_block.foliage.foliage_transaction_block_hash
|
foliage_transaction_block_hash = unfinished_block.foliage.foliage_transaction_block_hash
|
||||||
else:
|
else:
|
||||||
foliage_transaction_block_hash = bytes32([0] * 32)
|
foliage_transaction_block_hash = bytes32([0] * 32)
|
||||||
|
assert foliage_transaction_block_hash is not None
|
||||||
|
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Argument 3 to "RequestSignedValues" has incompatible type "Optional[bytes32]"; expected
|
|
||||||
# "bytes32" [arg-type]
|
|
||||||
message = farmer_protocol.RequestSignedValues(
|
message = farmer_protocol.RequestSignedValues(
|
||||||
quality_string,
|
quality_string,
|
||||||
foliage_sb_data_hash,
|
foliage_sb_data_hash,
|
||||||
foliage_transaction_block_hash, # type: ignore[arg-type]
|
foliage_transaction_block_hash,
|
||||||
)
|
)
|
||||||
await peer.send_message(make_msg(ProtocolMessageTypes.request_signed_values, message))
|
await peer.send_message(make_msg(ProtocolMessageTypes.request_signed_values, message))
|
||||||
|
|
||||||
# Adds backup in case the first one fails
|
# Adds backup in case the first one fails
|
||||||
if unfinished_block.is_transaction_block() and unfinished_block.transactions_generator is not None:
|
if unfinished_block.is_transaction_block() and unfinished_block.transactions_generator is not None:
|
||||||
# TODO: address hint error and remove ignore
|
|
||||||
# error: Argument 16 to "create_unfinished_block" has incompatible type "bytes"; expected
|
|
||||||
# "bytes32" [arg-type]
|
|
||||||
unfinished_block_backup = create_unfinished_block(
|
unfinished_block_backup = create_unfinished_block(
|
||||||
self.full_node.constants,
|
self.full_node.constants,
|
||||||
total_iters_pos_slot,
|
total_iters_pos_slot,
|
||||||
@@ -969,7 +955,7 @@ class FullNodeAPI:
|
|||||||
sp_vdfs,
|
sp_vdfs,
|
||||||
timestamp,
|
timestamp,
|
||||||
self.full_node.blockchain,
|
self.full_node.blockchain,
|
||||||
b"", # type: ignore[arg-type]
|
b"",
|
||||||
None,
|
None,
|
||||||
G2Element(),
|
G2Element(),
|
||||||
None,
|
None,
|
||||||
@@ -1039,13 +1025,12 @@ class FullNodeAPI:
|
|||||||
self.full_node.full_node_store.add_candidate_block(
|
self.full_node.full_node_store.add_candidate_block(
|
||||||
farmer_request.quality_string, height, unfinished_block, False
|
farmer_request.quality_string, height, unfinished_block, False
|
||||||
)
|
)
|
||||||
# TODO: address hint error and remove ignore
|
# All unfinished blocks that we create will have the foliage transaction block and hash
|
||||||
# error: Argument 3 to "RequestSignedValues" has incompatible type "Optional[bytes32]"; expected
|
assert unfinished_block.foliage.foliage_transaction_block_hash is not None
|
||||||
# "bytes32" [arg-type]
|
|
||||||
message = farmer_protocol.RequestSignedValues(
|
message = farmer_protocol.RequestSignedValues(
|
||||||
farmer_request.quality_string,
|
farmer_request.quality_string,
|
||||||
unfinished_block.foliage.foliage_block_data.get_hash(),
|
unfinished_block.foliage.foliage_block_data.get_hash(),
|
||||||
unfinished_block.foliage.foliage_transaction_block_hash, # type: ignore[arg-type]
|
unfinished_block.foliage.foliage_transaction_block_hash,
|
||||||
)
|
)
|
||||||
await peer.send_message(make_msg(ProtocolMessageTypes.request_signed_values, message))
|
await peer.send_message(make_msg(ProtocolMessageTypes.request_signed_values, message))
|
||||||
return None
|
return None
|
||||||
@@ -1124,10 +1109,14 @@ class FullNodeAPI:
|
|||||||
|
|
||||||
@api_request
|
@api_request
|
||||||
async def request_additions(self, request: wallet_protocol.RequestAdditions) -> Optional[Message]:
|
async def request_additions(self, request: wallet_protocol.RequestAdditions) -> Optional[Message]:
|
||||||
# TODO: address hint error and remove ignore
|
if request.header_hash is None:
|
||||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(request.height)
|
||||||
# expected "bytes32" [arg-type]
|
else:
|
||||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(request.header_hash) # type: ignore[arg-type] # noqa: E501
|
header_hash = request.header_hash
|
||||||
|
if header_hash is None:
|
||||||
|
raise ValueError(f"Block at height {request.height} not found")
|
||||||
|
|
||||||
|
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash)
|
||||||
|
|
||||||
# We lock so that the coin store does not get modified
|
# We lock so that the coin store does not get modified
|
||||||
if (
|
if (
|
||||||
@@ -1135,10 +1124,7 @@ class FullNodeAPI:
|
|||||||
or block.is_transaction_block() is False
|
or block.is_transaction_block() is False
|
||||||
or self.full_node.blockchain.height_to_hash(block.height) != request.header_hash
|
or self.full_node.blockchain.height_to_hash(block.height) != request.header_hash
|
||||||
):
|
):
|
||||||
# TODO: address hint error and remove ignore
|
reject = wallet_protocol.RejectAdditionsRequest(request.height, header_hash)
|
||||||
# error: Argument 2 to "RejectAdditionsRequest" has incompatible type "Optional[bytes32]"; expected
|
|
||||||
# "bytes32" [arg-type]
|
|
||||||
reject = wallet_protocol.RejectAdditionsRequest(request.height, request.header_hash) # type: ignore[arg-type] # noqa: E501
|
|
||||||
|
|
||||||
msg = make_msg(ProtocolMessageTypes.reject_additions_request, reject)
|
msg = make_msg(ProtocolMessageTypes.reject_additions_request, reject)
|
||||||
return msg
|
return msg
|
||||||
@@ -1264,8 +1250,9 @@ class FullNodeAPI:
|
|||||||
)
|
)
|
||||||
# Waits for the transaction to go into the mempool, times out after 45 seconds.
|
# Waits for the transaction to go into the mempool, times out after 45 seconds.
|
||||||
status, error = None, None
|
status, error = None, None
|
||||||
for i in range(450):
|
sleep_time = 0.01
|
||||||
await asyncio.sleep(0.1)
|
for i in range(int(45 / sleep_time)):
|
||||||
|
await asyncio.sleep(sleep_time)
|
||||||
for potential_name, potential_status, potential_error in self.full_node.transaction_responses:
|
for potential_name, potential_status, potential_error in self.full_node.transaction_responses:
|
||||||
if spend_name == potential_name:
|
if spend_name == potential_name:
|
||||||
status = potential_status
|
status = potential_status
|
||||||
@@ -1300,11 +1287,11 @@ class FullNodeAPI:
|
|||||||
if coin_record is None or coin_record.spent_block_index != height:
|
if coin_record is None or coin_record.spent_block_index != height:
|
||||||
return reject_msg
|
return reject_msg
|
||||||
|
|
||||||
header_hash = self.full_node.blockchain.height_to_hash(height)
|
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(height)
|
||||||
# TODO: address hint error and remove ignore
|
if header_hash is None:
|
||||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
return reject_msg
|
||||||
# expected "bytes32" [arg-type]
|
|
||||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash) # type: ignore[arg-type] # noqa: E501
|
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash)
|
||||||
|
|
||||||
if block is None or block.transactions_generator is None:
|
if block is None or block.transactions_generator is None:
|
||||||
return reject_msg
|
return reject_msg
|
||||||
@@ -1331,18 +1318,16 @@ class FullNodeAPI:
|
|||||||
if request.end_height < request.start_height or request.end_height - request.start_height > 32:
|
if request.end_height < request.start_height or request.end_height - request.start_height > 32:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
header_hashes = []
|
header_hashes: List[bytes32] = []
|
||||||
for i in range(request.start_height, request.end_height + 1):
|
for i in range(request.start_height, request.end_height + 1):
|
||||||
if not self.full_node.blockchain.contains_height(uint32(i)):
|
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(uint32(i))
|
||||||
|
if header_hash is None:
|
||||||
reject = RejectHeaderBlocks(request.start_height, request.end_height)
|
reject = RejectHeaderBlocks(request.start_height, request.end_height)
|
||||||
msg = make_msg(ProtocolMessageTypes.reject_header_blocks, reject)
|
msg = make_msg(ProtocolMessageTypes.reject_header_blocks, reject)
|
||||||
return msg
|
return msg
|
||||||
header_hashes.append(self.full_node.blockchain.height_to_hash(uint32(i)))
|
header_hashes.append(header_hash)
|
||||||
|
|
||||||
# TODO: address hint error and remove ignore
|
blocks: List[FullBlock] = await self.full_node.block_store.get_blocks_by_hash(header_hashes)
|
||||||
# error: Argument 1 to "get_blocks_by_hash" of "BlockStore" has incompatible type
|
|
||||||
# "List[Optional[bytes32]]"; expected "List[bytes32]" [arg-type]
|
|
||||||
blocks: List[FullBlock] = await self.full_node.block_store.get_blocks_by_hash(header_hashes) # type: ignore[arg-type] # noqa: E501
|
|
||||||
header_blocks = []
|
header_blocks = []
|
||||||
for block in blocks:
|
for block in blocks:
|
||||||
added_coins_records = await self.full_node.coin_store.get_coins_added_at_height(block.height)
|
added_coins_records = await self.full_node.coin_store.get_coins_added_at_height(block.height)
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ from chia.util.streamable import Streamable, streamable
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
|
||||||
@streamable
|
@streamable
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
class FullNodeStorePeakResult(Streamable):
|
class FullNodeStorePeakResult(Streamable):
|
||||||
added_eos: Optional[EndOfSubSlotBundle]
|
added_eos: Optional[EndOfSubSlotBundle]
|
||||||
new_signage_points: List[Tuple[uint8, SignagePoint]]
|
new_signage_points: List[Tuple[uint8, SignagePoint]]
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import logging
|
import logging
|
||||||
import time
|
from typing import Dict, Optional
|
||||||
from typing import Dict, List, Optional
|
from chia_rs import MEMPOOL_MODE, COND_CANON_INTS, NO_NEG_DIV, STRICT_ARGS_COUNT
|
||||||
from clvm_rs import MEMPOOL_MODE, COND_CANON_INTS, NO_NEG_DIV
|
|
||||||
|
|
||||||
from clvm.casts import int_from_bytes, int_to_bytes
|
|
||||||
from chia.consensus.cost_calculator import NPCResult
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
|
from chia.consensus.cost_calculator import NPCResult
|
||||||
|
from chia.types.spend_bundle_conditions import SpendBundleConditions
|
||||||
from chia.full_node.generator import create_generator_args, setup_generator_args
|
from chia.full_node.generator import create_generator_args, setup_generator_args
|
||||||
from chia.types.coin_record import CoinRecord
|
from chia.types.coin_record import CoinRecord
|
||||||
from chia.types.condition_opcodes import ConditionOpcode
|
|
||||||
from chia.types.condition_with_args import ConditionWithArgs
|
|
||||||
from chia.types.generator_types import BlockGenerator
|
from chia.types.generator_types import BlockGenerator
|
||||||
from chia.types.name_puzzle_condition import NPC
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
from chia.util.errors import Err
|
from chia.util.errors import Err
|
||||||
from chia.util.ints import uint32, uint64, uint16
|
from chia.util.ints import uint32, uint64, uint16
|
||||||
from chia.wallet.puzzles.generator_loader import GENERATOR_FOR_SINGLE_COIN_MOD
|
from chia.wallet.puzzles.generator_loader import GENERATOR_FOR_SINGLE_COIN_MOD
|
||||||
@@ -22,91 +19,6 @@ GENERATOR_MOD = get_generator()
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def mempool_assert_absolute_block_height_exceeds(
|
|
||||||
condition: ConditionWithArgs, prev_transaction_block_height: uint32
|
|
||||||
) -> Optional[Err]:
|
|
||||||
"""
|
|
||||||
Checks if the next block index exceeds the block index from the condition
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
block_index_exceeds_this = int_from_bytes(condition.vars[0])
|
|
||||||
except ValueError:
|
|
||||||
return Err.INVALID_CONDITION
|
|
||||||
if prev_transaction_block_height < block_index_exceeds_this:
|
|
||||||
return Err.ASSERT_HEIGHT_ABSOLUTE_FAILED
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def mempool_assert_relative_block_height_exceeds(
|
|
||||||
condition: ConditionWithArgs, unspent: CoinRecord, prev_transaction_block_height: uint32
|
|
||||||
) -> Optional[Err]:
|
|
||||||
"""
|
|
||||||
Checks if the coin age exceeds the age from the condition
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
expected_block_age = int_from_bytes(condition.vars[0])
|
|
||||||
block_index_exceeds_this = expected_block_age + unspent.confirmed_block_index
|
|
||||||
except ValueError:
|
|
||||||
return Err.INVALID_CONDITION
|
|
||||||
if prev_transaction_block_height < block_index_exceeds_this:
|
|
||||||
return Err.ASSERT_HEIGHT_RELATIVE_FAILED
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def mempool_assert_absolute_time_exceeds(condition: ConditionWithArgs, timestamp: uint64) -> Optional[Err]:
|
|
||||||
"""
|
|
||||||
Check if the current time in seconds exceeds the time specified by condition
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
expected_seconds = int_from_bytes(condition.vars[0])
|
|
||||||
except ValueError:
|
|
||||||
return Err.INVALID_CONDITION
|
|
||||||
|
|
||||||
if timestamp is None:
|
|
||||||
timestamp = uint64(int(time.time()))
|
|
||||||
if timestamp < expected_seconds:
|
|
||||||
return Err.ASSERT_SECONDS_ABSOLUTE_FAILED
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def mempool_assert_relative_time_exceeds(
|
|
||||||
condition: ConditionWithArgs, unspent: CoinRecord, timestamp: uint64
|
|
||||||
) -> Optional[Err]:
|
|
||||||
"""
|
|
||||||
Check if the current time in seconds exceeds the time specified by condition
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
expected_seconds = int_from_bytes(condition.vars[0])
|
|
||||||
except ValueError:
|
|
||||||
return Err.INVALID_CONDITION
|
|
||||||
|
|
||||||
if timestamp is None:
|
|
||||||
timestamp = uint64(int(time.time()))
|
|
||||||
if timestamp < expected_seconds + unspent.timestamp:
|
|
||||||
return Err.ASSERT_SECONDS_RELATIVE_FAILED
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def add_int_cond(
|
|
||||||
conds: Dict[ConditionOpcode, List[ConditionWithArgs]],
|
|
||||||
op: ConditionOpcode,
|
|
||||||
arg: int,
|
|
||||||
):
|
|
||||||
if op not in conds:
|
|
||||||
conds[op] = []
|
|
||||||
conds[op].append(ConditionWithArgs(op, [int_to_bytes(arg)]))
|
|
||||||
|
|
||||||
|
|
||||||
def add_cond(
|
|
||||||
conds: Dict[ConditionOpcode, List[ConditionWithArgs]],
|
|
||||||
op: ConditionOpcode,
|
|
||||||
args: List[bytes],
|
|
||||||
):
|
|
||||||
if op not in conds:
|
|
||||||
conds[op] = []
|
|
||||||
conds[op].append(ConditionWithArgs(op, args))
|
|
||||||
|
|
||||||
|
|
||||||
def unwrap(x: Optional[uint32]) -> uint32:
|
def unwrap(x: Optional[uint32]) -> uint32:
|
||||||
assert x is not None
|
assert x is not None
|
||||||
return x
|
return x
|
||||||
@@ -119,7 +31,7 @@ def get_name_puzzle_conditions(
|
|||||||
size_cost = len(bytes(generator.program)) * cost_per_byte
|
size_cost = len(bytes(generator.program)) * cost_per_byte
|
||||||
max_cost -= size_cost
|
max_cost -= size_cost
|
||||||
if max_cost < 0:
|
if max_cost < 0:
|
||||||
return NPCResult(uint16(Err.INVALID_BLOCK_COST.value), [], uint64(0))
|
return NPCResult(uint16(Err.INVALID_BLOCK_COST.value), None, uint64(0))
|
||||||
|
|
||||||
# in mempool mode, the height doesn't matter, because it's always strict.
|
# in mempool mode, the height doesn't matter, because it's always strict.
|
||||||
# But otherwise, height must be specified to know which rules to apply
|
# But otherwise, height must be specified to know which rules to apply
|
||||||
@@ -130,7 +42,8 @@ def get_name_puzzle_conditions(
|
|||||||
assert (MEMPOOL_MODE & NO_NEG_DIV) != 0
|
assert (MEMPOOL_MODE & NO_NEG_DIV) != 0
|
||||||
|
|
||||||
if mempool_mode:
|
if mempool_mode:
|
||||||
flags = MEMPOOL_MODE
|
# Don't apply the strict args count rule yet
|
||||||
|
flags = MEMPOOL_MODE & (~STRICT_ARGS_COUNT)
|
||||||
elif unwrap(height) >= DEFAULT_CONSTANTS.SOFT_FORK_HEIGHT:
|
elif unwrap(height) >= DEFAULT_CONSTANTS.SOFT_FORK_HEIGHT:
|
||||||
# conditions must use integers in canonical encoding (i.e. no redundant
|
# conditions must use integers in canonical encoding (i.e. no redundant
|
||||||
# leading zeros)
|
# leading zeros)
|
||||||
@@ -141,46 +54,14 @@ def get_name_puzzle_conditions(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
err, result = GENERATOR_MOD.run_as_generator(max_cost, flags, block_program, block_program_args)
|
err, result = GENERATOR_MOD.run_as_generator(max_cost, flags, block_program, block_program_args)
|
||||||
|
assert (err is None) != (result is None)
|
||||||
if err is not None:
|
if err is not None:
|
||||||
assert err != 0
|
return NPCResult(uint16(err), None, uint64(0))
|
||||||
return NPCResult(uint16(err), [], uint64(0))
|
else:
|
||||||
|
return NPCResult(None, result, uint64(result.cost + size_cost))
|
||||||
first = True
|
|
||||||
npc_list = []
|
|
||||||
for r in result.spends:
|
|
||||||
conditions: Dict[ConditionOpcode, List[ConditionWithArgs]] = {}
|
|
||||||
if r.height_relative is not None:
|
|
||||||
add_int_cond(conditions, ConditionOpcode.ASSERT_HEIGHT_RELATIVE, r.height_relative)
|
|
||||||
if r.seconds_relative > 0:
|
|
||||||
add_int_cond(conditions, ConditionOpcode.ASSERT_SECONDS_RELATIVE, r.seconds_relative)
|
|
||||||
for cc in r.create_coin:
|
|
||||||
if cc[2] == b"":
|
|
||||||
add_cond(conditions, ConditionOpcode.CREATE_COIN, [cc[0], int_to_bytes(cc[1])])
|
|
||||||
else:
|
|
||||||
add_cond(conditions, ConditionOpcode.CREATE_COIN, [cc[0], int_to_bytes(cc[1]), cc[2]])
|
|
||||||
for sig in r.agg_sig_me:
|
|
||||||
add_cond(conditions, ConditionOpcode.AGG_SIG_ME, [sig[0], sig[1]])
|
|
||||||
|
|
||||||
# all conditions that aren't tied to a specific spent coin, we roll into the first one
|
|
||||||
if first:
|
|
||||||
first = False
|
|
||||||
if result.reserve_fee > 0:
|
|
||||||
add_int_cond(conditions, ConditionOpcode.RESERVE_FEE, result.reserve_fee)
|
|
||||||
if result.height_absolute > 0:
|
|
||||||
add_int_cond(conditions, ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, result.height_absolute)
|
|
||||||
if result.seconds_absolute > 0:
|
|
||||||
add_int_cond(conditions, ConditionOpcode.ASSERT_SECONDS_ABSOLUTE, result.seconds_absolute)
|
|
||||||
for sig in result.agg_sig_unsafe:
|
|
||||||
add_cond(conditions, ConditionOpcode.AGG_SIG_UNSAFE, [sig[0], sig[1]])
|
|
||||||
|
|
||||||
npc_list.append(NPC(r.coin_id, r.puzzle_hash, [(op, cond) for op, cond in conditions.items()]))
|
|
||||||
|
|
||||||
return NPCResult(None, npc_list, uint64(result.cost + size_cost))
|
|
||||||
|
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
log.debug(f"get_name_puzzle_condition failed: {e}")
|
log.debug(f"get_name_puzzle_condition failed: {e}")
|
||||||
return NPCResult(uint16(Err.GENERATOR_RUNTIME_ERROR.value), [], uint64(0))
|
return NPCResult(uint16(Err.GENERATOR_RUNTIME_ERROR.value), None, uint64(0))
|
||||||
|
|
||||||
|
|
||||||
def get_puzzle_and_solution_for_coin(generator: BlockGenerator, coin_name: bytes, max_cost: int):
|
def get_puzzle_and_solution_for_coin(generator: BlockGenerator, coin_name: bytes, max_cost: int):
|
||||||
@@ -198,40 +79,26 @@ def get_puzzle_and_solution_for_coin(generator: BlockGenerator, coin_name: bytes
|
|||||||
return e, None, None
|
return e, None, None
|
||||||
|
|
||||||
|
|
||||||
def mempool_check_conditions_dict(
|
def mempool_check_time_locks(
|
||||||
unspent: CoinRecord,
|
removal_coin_records: Dict[bytes32, CoinRecord],
|
||||||
conditions_dict: Dict[ConditionOpcode, List[ConditionWithArgs]],
|
bundle_conds: SpendBundleConditions,
|
||||||
prev_transaction_block_height: uint32,
|
prev_transaction_block_height: uint32,
|
||||||
timestamp: uint64,
|
timestamp: uint64,
|
||||||
) -> Optional[Err]:
|
) -> Optional[Err]:
|
||||||
"""
|
"""
|
||||||
Check all conditions against current state.
|
Check all time and height conditions against current state.
|
||||||
"""
|
"""
|
||||||
for con_list in conditions_dict.values():
|
|
||||||
cvp: ConditionWithArgs
|
|
||||||
for cvp in con_list:
|
|
||||||
error: Optional[Err] = None
|
|
||||||
if cvp.opcode is ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE:
|
|
||||||
error = mempool_assert_absolute_block_height_exceeds(cvp, prev_transaction_block_height)
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_HEIGHT_RELATIVE:
|
|
||||||
error = mempool_assert_relative_block_height_exceeds(cvp, unspent, prev_transaction_block_height)
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_SECONDS_ABSOLUTE:
|
|
||||||
error = mempool_assert_absolute_time_exceeds(cvp, timestamp)
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_SECONDS_RELATIVE:
|
|
||||||
error = mempool_assert_relative_time_exceeds(cvp, unspent, timestamp)
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_MY_COIN_ID:
|
|
||||||
assert False
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT:
|
|
||||||
assert False
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT:
|
|
||||||
assert False
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_MY_PARENT_ID:
|
|
||||||
assert False
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_MY_PUZZLEHASH:
|
|
||||||
assert False
|
|
||||||
elif cvp.opcode is ConditionOpcode.ASSERT_MY_AMOUNT:
|
|
||||||
assert False
|
|
||||||
if error:
|
|
||||||
return error
|
|
||||||
|
|
||||||
|
if prev_transaction_block_height < bundle_conds.height_absolute:
|
||||||
|
return Err.ASSERT_HEIGHT_ABSOLUTE_FAILED
|
||||||
|
if timestamp < bundle_conds.seconds_absolute:
|
||||||
|
return Err.ASSERT_SECONDS_ABSOLUTE_FAILED
|
||||||
|
|
||||||
|
for spend in bundle_conds.spends:
|
||||||
|
unspent = removal_coin_records[spend.coin_id]
|
||||||
|
if spend.height_relative is not None:
|
||||||
|
if prev_transaction_block_height < unspent.confirmed_block_index + spend.height_relative:
|
||||||
|
return Err.ASSERT_HEIGHT_RELATIVE_FAILED
|
||||||
|
if timestamp < unspent.timestamp + spend.seconds_relative:
|
||||||
|
return Err.ASSERT_SECONDS_RELATIVE_FAILED
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
import collections
|
||||||
import dataclasses
|
|
||||||
import logging
|
import logging
|
||||||
from concurrent.futures import Executor
|
from concurrent.futures import Executor
|
||||||
from multiprocessing.context import BaseContext
|
from multiprocessing.context import BaseContext
|
||||||
@@ -10,7 +9,6 @@ from chia.util.inline_executor import InlineExecutor
|
|||||||
from typing import Dict, List, Optional, Set, Tuple
|
from typing import Dict, List, Optional, Set, Tuple
|
||||||
from blspy import GTElement
|
from blspy import GTElement
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
from clvm.casts import int_from_bytes
|
|
||||||
|
|
||||||
from chia.util import cached_bls
|
from chia.util import cached_bls
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
@@ -19,14 +17,12 @@ from chia.consensus.cost_calculator import NPCResult
|
|||||||
from chia.full_node.bundle_tools import simple_solution_generator
|
from chia.full_node.bundle_tools import simple_solution_generator
|
||||||
from chia.full_node.coin_store import CoinStore
|
from chia.full_node.coin_store import CoinStore
|
||||||
from chia.full_node.mempool import Mempool
|
from chia.full_node.mempool import Mempool
|
||||||
from chia.full_node.mempool_check_conditions import mempool_check_conditions_dict, get_name_puzzle_conditions
|
from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions
|
||||||
from chia.full_node.pending_tx_cache import PendingTxCache
|
from chia.full_node.pending_tx_cache import PendingTxCache
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.program import SerializedProgram
|
from chia.types.blockchain_format.program import SerializedProgram
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
|
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
|
||||||
from chia.types.coin_record import CoinRecord
|
from chia.types.coin_record import CoinRecord
|
||||||
from chia.types.condition_opcodes import ConditionOpcode
|
|
||||||
from chia.types.condition_with_args import ConditionWithArgs
|
|
||||||
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
||||||
from chia.types.mempool_item import MempoolItem
|
from chia.types.mempool_item import MempoolItem
|
||||||
from chia.types.spend_bundle import SpendBundle
|
from chia.types.spend_bundle import SpendBundle
|
||||||
@@ -37,7 +33,7 @@ from chia.util.generator_tools import additions_for_npc
|
|||||||
from chia.util.ints import uint32, uint64
|
from chia.util.ints import uint32, uint64
|
||||||
from chia.util.lru_cache import LRUCache
|
from chia.util.lru_cache import LRUCache
|
||||||
from chia.util.setproctitle import getproctitle, setproctitle
|
from chia.util.setproctitle import getproctitle, setproctitle
|
||||||
from chia.util.streamable import recurse_jsonify
|
from chia.full_node.mempool_check_conditions import mempool_check_time_locks
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -61,9 +57,10 @@ def validate_clvm_and_signature(
|
|||||||
if result.error is not None:
|
if result.error is not None:
|
||||||
return Err(result.error), b"", {}
|
return Err(result.error), b"", {}
|
||||||
|
|
||||||
pks: List[bytes48]
|
pks: List[bytes48] = []
|
||||||
msgs: List[bytes]
|
msgs: List[bytes] = []
|
||||||
pks, msgs = pkm_pairs(result.npc_list, additional_data)
|
assert result.conds is not None
|
||||||
|
pks, msgs = pkm_pairs(result.conds, additional_data)
|
||||||
|
|
||||||
# Verify aggregated signature
|
# Verify aggregated signature
|
||||||
cache: LRUCache = LRUCache(10000)
|
cache: LRUCache = LRUCache(10000)
|
||||||
@@ -92,7 +89,6 @@ class MempoolManager:
|
|||||||
single_threaded: bool = False,
|
single_threaded: bool = False,
|
||||||
):
|
):
|
||||||
self.constants: ConsensusConstants = consensus_constants
|
self.constants: ConsensusConstants = consensus_constants
|
||||||
self.constants_json = recurse_jsonify(dataclasses.asdict(self.constants))
|
|
||||||
|
|
||||||
# Keep track of seen spend_bundles
|
# Keep track of seen spend_bundles
|
||||||
self.seen_bundle_hashes: Dict[bytes32, bytes32] = {}
|
self.seen_bundle_hashes: Dict[bytes32, bytes32] = {}
|
||||||
@@ -301,8 +297,10 @@ class MempoolManager:
|
|||||||
if self.peak is None:
|
if self.peak is None:
|
||||||
return None, MempoolInclusionStatus.FAILED, Err.MEMPOOL_NOT_INITIALIZED
|
return None, MempoolInclusionStatus.FAILED, Err.MEMPOOL_NOT_INITIALIZED
|
||||||
|
|
||||||
npc_list = npc_result.npc_list
|
|
||||||
assert npc_result.error is None
|
assert npc_result.error is None
|
||||||
|
if npc_result.error is not None:
|
||||||
|
return None, MempoolInclusionStatus.FAILED, Err(npc_result.error)
|
||||||
|
|
||||||
if program is None:
|
if program is None:
|
||||||
program = simple_solution_generator(new_spend).program
|
program = simple_solution_generator(new_spend).program
|
||||||
cost = npc_result.cost
|
cost = npc_result.cost
|
||||||
@@ -314,12 +312,13 @@ class MempoolManager:
|
|||||||
# execute the CLVM program.
|
# execute the CLVM program.
|
||||||
return None, MempoolInclusionStatus.FAILED, Err.BLOCK_COST_EXCEEDS_MAX
|
return None, MempoolInclusionStatus.FAILED, Err.BLOCK_COST_EXCEEDS_MAX
|
||||||
|
|
||||||
|
assert npc_result.conds is not None
|
||||||
# build removal list
|
# build removal list
|
||||||
removal_names: List[bytes32] = [npc.coin_name for npc in npc_list]
|
removal_names: List[bytes32] = [spend.coin_id for spend in npc_result.conds.spends]
|
||||||
if set(removal_names) != set([s.name() for s in new_spend.removals()]):
|
if set(removal_names) != set([s.name() for s in new_spend.removals()]):
|
||||||
return None, MempoolInclusionStatus.FAILED, Err.INVALID_SPEND_BUNDLE
|
return None, MempoolInclusionStatus.FAILED, Err.INVALID_SPEND_BUNDLE
|
||||||
|
|
||||||
additions = additions_for_npc(npc_list)
|
additions = additions_for_npc(npc_result)
|
||||||
|
|
||||||
additions_dict: Dict[bytes32, Coin] = {}
|
additions_dict: Dict[bytes32, Coin] = {}
|
||||||
for add in additions:
|
for add in additions:
|
||||||
@@ -372,7 +371,7 @@ class MempoolManager:
|
|||||||
assert self.peak.timestamp is not None
|
assert self.peak.timestamp is not None
|
||||||
removal_record = CoinRecord(
|
removal_record = CoinRecord(
|
||||||
removal_coin,
|
removal_coin,
|
||||||
uint32(self.peak.height + 1), # In mempool, so will be included in next height
|
uint32(self.peak.height + 1),
|
||||||
uint32(0),
|
uint32(0),
|
||||||
False,
|
False,
|
||||||
self.peak.timestamp,
|
self.peak.timestamp,
|
||||||
@@ -388,16 +387,8 @@ class MempoolManager:
|
|||||||
return None, MempoolInclusionStatus.FAILED, Err.MINTING_COIN
|
return None, MempoolInclusionStatus.FAILED, Err.MINTING_COIN
|
||||||
|
|
||||||
fees = uint64(removal_amount - addition_amount)
|
fees = uint64(removal_amount - addition_amount)
|
||||||
assert_fee_sum: uint64 = uint64(0)
|
assert_fee_sum: uint64 = uint64(npc_result.conds.reserve_fee)
|
||||||
|
|
||||||
for npc in npc_list:
|
|
||||||
if ConditionOpcode.RESERVE_FEE in npc.condition_dict:
|
|
||||||
fee_list: List[ConditionWithArgs] = npc.condition_dict[ConditionOpcode.RESERVE_FEE]
|
|
||||||
for cvp in fee_list:
|
|
||||||
fee = int_from_bytes(cvp.vars[0])
|
|
||||||
if fee < 0:
|
|
||||||
return None, MempoolInclusionStatus.FAILED, Err.RESERVE_FEE_CONDITION_FAILED
|
|
||||||
assert_fee_sum = assert_fee_sum + fee
|
|
||||||
if fees < assert_fee_sum:
|
if fees < assert_fee_sum:
|
||||||
return (
|
return (
|
||||||
None,
|
None,
|
||||||
@@ -439,37 +430,35 @@ class MempoolManager:
|
|||||||
return None, MempoolInclusionStatus.FAILED, fail_reason
|
return None, MempoolInclusionStatus.FAILED, fail_reason
|
||||||
|
|
||||||
# Verify conditions, create hash_key list for aggsig check
|
# Verify conditions, create hash_key list for aggsig check
|
||||||
error: Optional[Err] = None
|
for spend in npc_result.conds.spends:
|
||||||
for npc in npc_list:
|
coin_record: CoinRecord = removal_record_dict[spend.coin_id]
|
||||||
coin_record: CoinRecord = removal_record_dict[npc.coin_name]
|
|
||||||
# Check that the revealed removal puzzles actually match the puzzle hash
|
# Check that the revealed removal puzzles actually match the puzzle hash
|
||||||
if npc.puzzle_hash != coin_record.coin.puzzle_hash:
|
if spend.puzzle_hash != coin_record.coin.puzzle_hash:
|
||||||
log.warning("Mempool rejecting transaction because of wrong puzzle_hash")
|
log.warning("Mempool rejecting transaction because of wrong puzzle_hash")
|
||||||
log.warning(f"{npc.puzzle_hash} != {coin_record.coin.puzzle_hash}")
|
log.warning(f"{spend.puzzle_hash} != {coin_record.coin.puzzle_hash}")
|
||||||
return None, MempoolInclusionStatus.FAILED, Err.WRONG_PUZZLE_HASH
|
return None, MempoolInclusionStatus.FAILED, Err.WRONG_PUZZLE_HASH
|
||||||
|
|
||||||
chialisp_height = (
|
chialisp_height = (
|
||||||
self.peak.prev_transaction_block_height if not self.peak.is_transaction_block else self.peak.height
|
self.peak.prev_transaction_block_height if not self.peak.is_transaction_block else self.peak.height
|
||||||
)
|
)
|
||||||
assert self.peak.timestamp is not None
|
|
||||||
error = mempool_check_conditions_dict(
|
|
||||||
coin_record,
|
|
||||||
npc.condition_dict,
|
|
||||||
uint32(chialisp_height),
|
|
||||||
self.peak.timestamp,
|
|
||||||
)
|
|
||||||
|
|
||||||
if error:
|
assert self.peak.timestamp is not None
|
||||||
if error is Err.ASSERT_HEIGHT_ABSOLUTE_FAILED or error is Err.ASSERT_HEIGHT_RELATIVE_FAILED:
|
error: Optional[Err] = mempool_check_time_locks(
|
||||||
potential = MempoolItem(
|
removal_record_dict,
|
||||||
new_spend, uint64(fees), npc_result, cost, spend_name, additions, removals, program
|
npc_result.conds,
|
||||||
)
|
uint32(chialisp_height),
|
||||||
self.potential_cache.add(potential)
|
self.peak.timestamp,
|
||||||
return uint64(cost), MempoolInclusionStatus.PENDING, error
|
)
|
||||||
break
|
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
return None, MempoolInclusionStatus.FAILED, error
|
if error is Err.ASSERT_HEIGHT_ABSOLUTE_FAILED or error is Err.ASSERT_HEIGHT_RELATIVE_FAILED:
|
||||||
|
potential = MempoolItem(
|
||||||
|
new_spend, uint64(fees), npc_result, cost, spend_name, additions, removals, program
|
||||||
|
)
|
||||||
|
self.potential_cache.add(potential)
|
||||||
|
return uint64(cost), MempoolInclusionStatus.PENDING, error
|
||||||
|
else:
|
||||||
|
return None, MempoolInclusionStatus.FAILED, error
|
||||||
|
|
||||||
# Remove all conflicting Coins and SpendBundles
|
# Remove all conflicting Coins and SpendBundles
|
||||||
if fail_reason:
|
if fail_reason:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user