mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 02:24:23 -05:00
Merge branch 'main' into jack-cat-coinselection
This commit is contained in:
@@ -5,7 +5,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '**'
|
||||
- '**'
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
@@ -25,45 +25,51 @@ jobs:
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
python-version: [ 3.9 ]
|
||||
env:
|
||||
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Clean workspace
|
||||
uses: Chia-Network/actions/clean-workspace@main
|
||||
|
||||
- name: Setup Python environment
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get pip cache dir
|
||||
id: pip-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
- name: Setup Python environment
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- 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: Get pip cache dir
|
||||
id: pip-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
|
||||
- name: Install ubuntu dependencies
|
||||
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: 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: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
run: |
|
||||
sh install.sh -d
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.29.0'
|
||||
fetch-depth: 1
|
||||
|
||||
- name: pytest
|
||||
run: |
|
||||
. ./activate
|
||||
./venv/bin/py.test -n 0 -m benchmark tests
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
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
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: |
|
||||
sh install.sh
|
||||
|
||||
- name: Build arm64 .deb package
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
run: |
|
||||
. ./activate
|
||||
ldd --version
|
||||
cd ./chia-blockchain-gui
|
||||
git status
|
||||
cd ../build_scripts
|
||||
git -C ./chia-blockchain-gui status
|
||||
. ./activate
|
||||
cd ./build_scripts
|
||||
sh build_linux_deb.sh arm64
|
||||
|
||||
- name: Upload Linux artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Linux-ARM-64-Installer
|
||||
name: chia-installers-linux-deb-arm64
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
|
||||
@@ -139,7 +139,6 @@ jobs:
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: |
|
||||
sh install.sh
|
||||
|
||||
@@ -153,18 +152,19 @@ jobs:
|
||||
sudo apt-get install -y jq
|
||||
|
||||
- name: Build .deb package
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
run: |
|
||||
. ./activate
|
||||
ldd --version
|
||||
cd ./chia-blockchain-gui
|
||||
git status
|
||||
cd ../build_scripts
|
||||
git -C ./chia-blockchain-gui status
|
||||
. ./activate
|
||||
cd ./build_scripts
|
||||
sh build_linux_deb.sh amd64
|
||||
|
||||
- name: Upload Linux artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Linux-Installers
|
||||
name: chia-installers-linux-deb-intel
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
|
||||
@@ -108,23 +108,23 @@ jobs:
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: |
|
||||
sh install.sh
|
||||
|
||||
- name: Build .rpm package
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
run: |
|
||||
. ./activate
|
||||
ldd --version
|
||||
cd ./chia-blockchain-gui
|
||||
git status
|
||||
cd ../build_scripts
|
||||
git -C ./chia-blockchain-gui status
|
||||
. ./activate
|
||||
cd ./build_scripts
|
||||
sh build_linux_rpm.sh amd64
|
||||
|
||||
- name: Upload Linux artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Linux-Installers
|
||||
name: chia-installers-linux-rpm-intel
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
|
||||
@@ -127,7 +127,6 @@ jobs:
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: |
|
||||
sh install.sh
|
||||
|
||||
@@ -138,20 +137,20 @@ jobs:
|
||||
|
||||
- name: Build MacOS DMG
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
|
||||
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
|
||||
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
|
||||
run: |
|
||||
git -C ./chia-blockchain-gui status
|
||||
. ./activate
|
||||
cd ./chia-blockchain-gui
|
||||
git status
|
||||
cd ../build_scripts
|
||||
cd ./build_scripts
|
||||
sh build_macos.sh
|
||||
|
||||
- name: Upload MacOS artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Chia-Installer-MacOS-intel-dmg
|
||||
name: chia-installers-macos-dmg-intel
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Create Checksums
|
||||
|
||||
@@ -101,7 +101,6 @@ jobs:
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: |
|
||||
arch -arm64 sh install.sh
|
||||
|
||||
@@ -111,21 +110,21 @@ jobs:
|
||||
|
||||
- name: Build MacOS DMG
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }}
|
||||
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
|
||||
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
|
||||
run: |
|
||||
export PATH=$(brew --prefix node@16)/bin:$PATH
|
||||
git -C ./chia-blockchain-gui status
|
||||
. ./activate
|
||||
cd ./chia-blockchain-gui
|
||||
arch -arm64 git status
|
||||
cd ../build_scripts
|
||||
cd ./build_scripts
|
||||
arch -arm64 sh build_macos_m1.sh
|
||||
|
||||
- name: Upload MacOS artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Chia-Installer-MacOS-arm64-dmg
|
||||
name: chia-installers-macos-dmg-arm64
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Install AWS CLI
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test blockchain code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
- name: Test clvm code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test core-cmds code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test core-consensus code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test core-custom_types code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -80,24 +88,16 @@ jobs:
|
||||
brew install boost
|
||||
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
|
||||
run: |
|
||||
. ./activate
|
||||
sh install-timelord.sh
|
||||
sh install-timelord.sh -n
|
||||
./vdf_bench square_asm 400000
|
||||
|
||||
- name: Test core-daemon code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core-full_node-full_sync code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core-full_node-stores code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core-full_node code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core-server code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core-ssl code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core-util code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test core code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test farmer_harvester code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test generator code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
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: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test plotting code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test pools code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -80,24 +88,16 @@ jobs:
|
||||
brew install boost
|
||||
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
|
||||
run: |
|
||||
. ./activate
|
||||
sh install-timelord.sh
|
||||
sh install-timelord.sh -n
|
||||
./vdf_bench square_asm 400000
|
||||
|
||||
- name: Test simulation code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test tools code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test util code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test wallet-cat_wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test wallet-did_wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -85,7 +79,7 @@ jobs:
|
||||
- name: Test wallet-rl_wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test wallet-rpc code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test wallet-simple_sync code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test wallet-sync code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -85,7 +93,7 @@ jobs:
|
||||
- name: Test weight_proof code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test blockchain code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
- name: Test clvm code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test core-cmds code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test core-consensus code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test core-custom_types code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -79,24 +87,16 @@ jobs:
|
||||
run: |
|
||||
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
|
||||
run: |
|
||||
. ./activate
|
||||
sh install-timelord.sh
|
||||
sh install-timelord.sh -n
|
||||
./vdf_bench square_asm 400000
|
||||
|
||||
- name: Test core-daemon code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core-full_node-full_sync code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core-full_node-stores code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core-full_node code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core-server code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core-ssl code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core-util code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test core code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test farmer_harvester code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test generator code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
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: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test plotting code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test pools code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -79,24 +87,16 @@ jobs:
|
||||
run: |
|
||||
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
|
||||
run: |
|
||||
. ./activate
|
||||
sh install-timelord.sh
|
||||
sh install-timelord.sh -n
|
||||
./vdf_bench square_asm 400000
|
||||
|
||||
- name: Test simulation code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test tools code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test util code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test wallet-cat_wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test wallet-did_wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
# Omitted checking out blocks and plots repo Chia-Network/test-cache
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
@@ -84,7 +78,7 @@ jobs:
|
||||
- name: Test wallet-rl_wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test wallet-rpc code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test wallet-simple_sync code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test wallet-sync code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test wallet code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -65,13 +65,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Checkout test blocks and plots
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache test blocks and plots
|
||||
uses: actions/cache@v2
|
||||
id: test-blocks-plots
|
||||
with:
|
||||
repository: 'Chia-Network/test-cache'
|
||||
path: '.chia'
|
||||
ref: '0.28.0'
|
||||
fetch-depth: 1
|
||||
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:
|
||||
@@ -84,7 +92,7 @@ jobs:
|
||||
- name: Test weight_proof code with pytest
|
||||
run: |
|
||||
. ./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
|
||||
run: |
|
||||
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
- uses: actions/setup-python@v2
|
||||
name: Install Python 3.9
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.9.11"
|
||||
|
||||
- name: Setup Node 16.x
|
||||
uses: actions/setup-node@v3
|
||||
@@ -145,17 +145,19 @@ jobs:
|
||||
|
||||
- name: Build Windows installer with build_scripts\build_windows.ps1
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
WIN_CODE_SIGN_PASS: ${{ secrets.WIN_CODE_SIGN_PASS }}
|
||||
HAS_SECRET: ${{ steps.check_secrets.outputs.HAS_SIGNING_SECRET }}
|
||||
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)\Windows` Kits\10\App` Certification` Kit;$env:path"
|
||||
git -C .\chia-blockchain-gui status
|
||||
.\build_scripts\build_windows.ps1
|
||||
|
||||
- name: Upload Windows exe's to artifacts
|
||||
uses: actions/upload-artifact@v2.2.2
|
||||
with:
|
||||
name: Windows-Exe
|
||||
name: chia-installers-windows-exe-intel
|
||||
path: ${{ github.workspace }}\chia-blockchain-gui\Chia-win32-x64\
|
||||
|
||||
- name: Upload Installer to artifacts
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
cd ./mozilla-ca
|
||||
git pull origin main
|
||||
- name: "Create Pull Request"
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
base: main
|
||||
body: "Newest Mozilla CA cert"
|
||||
@@ -28,5 +28,6 @@ jobs:
|
||||
commit-message: "adding ca updates"
|
||||
delete-branch: true
|
||||
reviewers: "wjblanke,emlowe"
|
||||
assignees: "wallentx"
|
||||
title: "CA Cert updates"
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
# Run Linter against 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
|
||||
env:
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
|
||||
@@ -40,7 +40,6 @@ jobs:
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: sh install.sh
|
||||
|
||||
- name: Run install-gui script
|
||||
@@ -188,7 +187,6 @@ jobs:
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
BUILD_VDF_CLIENT: "N"
|
||||
run: sh install.sh -a
|
||||
|
||||
- name: Run chia --help
|
||||
|
||||
@@ -120,7 +120,6 @@ extend_skip=
|
||||
chia/wallet/did_wallet/did_wallet.py
|
||||
chia/wallet/lineage_proof.py
|
||||
chia/wallet/payment.py
|
||||
chia/wallet/puzzles/genesis_checkers.py
|
||||
chia/wallet/puzzles/load_clvm.py
|
||||
chia/wallet/puzzles/prefarm/make_prefarm_ph.py
|
||||
chia/wallet/puzzles/prefarm/spend_prefarm.py
|
||||
|
||||
@@ -8,6 +8,19 @@ for setuptools_scm/PEP 440 reasons.
|
||||
|
||||
## [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
|
||||
|
||||
|
||||
+67
-8
@@ -1,5 +1,16 @@
|
||||
param(
|
||||
[Parameter(HelpMessage="install development dependencies")]
|
||||
[switch]$d = $False
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$extras = @()
|
||||
if ($d)
|
||||
{
|
||||
$extras += "dev"
|
||||
}
|
||||
|
||||
if ([Environment]::Is64BitOperatingSystem -eq $false)
|
||||
{
|
||||
Write-Output "Chia requires a 64-bit Windows installation"
|
||||
@@ -32,20 +43,68 @@ if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
|
||||
Exit 1
|
||||
}
|
||||
|
||||
$pythonVersion = (py --version).split(" ")[1]
|
||||
if ([version]$pythonVersion -lt [version]"3.7.0")
|
||||
$supportedPythonVersions = "3.9", "3.8", "3.7"
|
||||
if (Test-Path env:INSTALL_PYTHON_VERSION)
|
||||
{
|
||||
Write-Output "Found Python version:" $pythonVersion
|
||||
Write-Output "Installation requires Python 3.7 or later"
|
||||
Exit 1
|
||||
$pythonVersion = $env:INSTALL_PYTHON_VERSION
|
||||
}
|
||||
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\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 "Chia blockchain .\Install.ps1 complete."
|
||||
|
||||
@@ -17,14 +17,14 @@ from chia.util.streamable import Streamable, streamable
|
||||
_version = 1
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class BenchmarkInner(Streamable):
|
||||
a: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class BenchmarkMiddle(Streamable):
|
||||
a: uint64
|
||||
b: List[bytes32]
|
||||
@@ -33,8 +33,8 @@ class BenchmarkMiddle(Streamable):
|
||||
e: BenchmarkInner
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class BenchmarkClass(Streamable):
|
||||
a: 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.types.blockchain_format.classgroup import ClassgroupElement
|
||||
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.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo
|
||||
from chia.types.blockchain_format.pool_target import PoolTarget
|
||||
@@ -56,9 +56,7 @@ def rand_bytes(num) -> bytes:
|
||||
|
||||
|
||||
def rand_hash() -> bytes32:
|
||||
# TODO: address hint errors and remove ignores
|
||||
# error: Incompatible return value type (got "bytes", expected "bytes32") [return-value]
|
||||
return rand_bytes(32) # type: ignore[return-value]
|
||||
return bytes32(rand_bytes(32))
|
||||
|
||||
|
||||
def rand_g1() -> G1Element:
|
||||
@@ -72,9 +70,7 @@ def rand_g2() -> G2Element:
|
||||
|
||||
|
||||
def rand_class_group_element() -> ClassgroupElement:
|
||||
# TODO: address hint errors and remove ignores
|
||||
# error: Argument 1 to "ClassgroupElement" has incompatible type "bytes"; expected "bytes100" [arg-type]
|
||||
return ClassgroupElement(rand_bytes(100)) # type: ignore[arg-type]
|
||||
return ClassgroupElement(bytes100(rand_bytes(100)))
|
||||
|
||||
|
||||
def rand_vdf() -> VDFInfo:
|
||||
|
||||
@@ -13,11 +13,8 @@ else
|
||||
DIR_NAME="chia-blockchain-linux-arm64"
|
||||
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
|
||||
# set, this will attempt to Notarize the signed DMG
|
||||
CHIA_INSTALLER_VERSION=$(python installer-version.py)
|
||||
|
||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||
|
||||
@@ -14,11 +14,8 @@ else
|
||||
DIR_NAME="chia-blockchain-linux-arm64"
|
||||
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
|
||||
# set, this will attempt to Notarize the signed DMG
|
||||
CHIA_INSTALLER_VERSION=$(python installer-version.py)
|
||||
|
||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
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
|
||||
# set, this will attempt to Notarize the signed DMG.
|
||||
CHIA_INSTALLER_VERSION=$(python installer-version.py)
|
||||
|
||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
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
|
||||
# set, this will attempt to Notarize the signed DMG.
|
||||
CHIA_INSTALLER_VERSION=$(python installer-version.py)
|
||||
|
||||
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
|
||||
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 pywin32
|
||||
pip install pyinstaller==4.9
|
||||
pip install setuptools_scm
|
||||
|
||||
Write-Output " ---"
|
||||
Write-Output "Get CHIA_INSTALLER_VERSION"
|
||||
# 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)) {
|
||||
$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
|
||||
@dataclass(frozen=True)
|
||||
class SimFullBlock(Streamable):
|
||||
transactions_generator: Optional[BlockGenerator]
|
||||
height: uint32 # Note that height is not on a regular FullBlock
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class SimBlockRecord(Streamable):
|
||||
reward_claims_incorporated: List[Coin]
|
||||
height: uint32
|
||||
@@ -69,8 +69,8 @@ class SimBlockRecord(Streamable):
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class SimStore(Streamable):
|
||||
timestamp: uint64
|
||||
block_height: uint32
|
||||
|
||||
@@ -502,6 +502,7 @@ def chia_init(
|
||||
db_path_replaced = new_db_path.replace("CHALLENGE", config["selected_network"])
|
||||
db_path = path_from_root(root_path, db_path_replaced)
|
||||
|
||||
mkdir(db_path.parent)
|
||||
with sqlite3.connect(db_path) as connection:
|
||||
set_db_version(connection, 1)
|
||||
|
||||
|
||||
+54
-26
@@ -4,7 +4,7 @@ import sys
|
||||
import time
|
||||
from datetime import datetime
|
||||
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
|
||||
|
||||
@@ -24,6 +24,8 @@ from chia.wallet.trading.trade_status import TradeStatus
|
||||
from chia.wallet.transaction_record import TransactionRecord
|
||||
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:
|
||||
if verbose:
|
||||
@@ -308,21 +310,37 @@ def timestamp_to_time(timestamp):
|
||||
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():
|
||||
if asset_id == "xch":
|
||||
wid: str = "1"
|
||||
name: str = "XCH"
|
||||
unit: int = units["chia"]
|
||||
else:
|
||||
result = await wallet_client.cat_asset_id_to_name(bytes32.from_hexstr(asset_id))
|
||||
wid = "Unknown"
|
||||
description: str = ""
|
||||
unit: int = units["chia"]
|
||||
wid: str = "1" if asset_id == "xch" else ""
|
||||
mojo_amount: int = int(Decimal(amount))
|
||||
name: str = "XCH"
|
||||
if asset_id != "xch":
|
||||
name = asset_id
|
||||
unit = units["cat"]
|
||||
if result is not None:
|
||||
wid = str(result[0])
|
||||
name = result[1]
|
||||
print(f" - {name} (Wallet ID: {wid}): {Decimal(int(amount)) / unit} ({int(Decimal(amount))} mojos)")
|
||||
if asset_id == "unknown":
|
||||
name = "Unknown"
|
||||
unit = units["mojo"]
|
||||
if has_fee:
|
||||
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:
|
||||
@@ -337,13 +355,16 @@ async def print_trade_record(record, wallet_client: WalletRpcClient, summaries:
|
||||
print("Summary:")
|
||||
offer = Offer.from_bytes(record.offer)
|
||||
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:")
|
||||
await print_offer_summary(wallet_client, offered)
|
||||
await print_offer_summary(cat_name_resolver, offered)
|
||||
print(" REQUESTED:")
|
||||
await print_offer_summary(wallet_client, requested)
|
||||
print("Pending Balances:")
|
||||
await print_offer_summary(wallet_client, offer.get_pending_amounts())
|
||||
print(f"Fees: {Decimal(offer.bundle.fees()) / units['chia']}")
|
||||
await print_offer_summary(cat_name_resolver, requested)
|
||||
print("Pending Outbound Balances:")
|
||||
await print_offer_summary(cat_name_resolver, outbound_balances, has_fee=(fees > 0))
|
||||
print(f"Included Fees: {fees / units['chia']}")
|
||||
print("---------------")
|
||||
|
||||
|
||||
@@ -411,12 +432,13 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in
|
||||
return
|
||||
|
||||
offered, requested = offer.summary()
|
||||
cat_name_resolver = wallet_client.cat_asset_id_to_name
|
||||
print("Summary:")
|
||||
print(" OFFERED:")
|
||||
await print_offer_summary(wallet_client, offered)
|
||||
await print_offer_summary(cat_name_resolver, offered)
|
||||
print(" REQUESTED:")
|
||||
await print_offer_summary(wallet_client, requested)
|
||||
print(f"Fees: {Decimal(offer.bundle.fees()) / units['chia']}")
|
||||
await print_offer_summary(cat_name_resolver, requested)
|
||||
print(f"Included Fees: {Decimal(offer.bundle.fees()) / units['chia']}")
|
||||
|
||||
if not examine_only:
|
||||
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"
|
||||
else:
|
||||
current_sync_status = "Not Synced"
|
||||
print("Choose wallet key:")
|
||||
print("Wallet keys:")
|
||||
for i, fp in enumerate(fingerprints):
|
||||
row: str = f"{i+1}) "
|
||||
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})"
|
||||
print(row)
|
||||
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:
|
||||
val = input("Enter a number to pick or q to quit: ")
|
||||
val = input(prompt)
|
||||
if val == "q":
|
||||
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
|
||||
else:
|
||||
index = int(val) - 1
|
||||
if index >= len(fingerprints):
|
||||
if index < 0 or index >= len(fingerprints):
|
||||
print("Invalid value")
|
||||
val = None
|
||||
continue
|
||||
|
||||
@@ -3,7 +3,6 @@ import logging
|
||||
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, Union
|
||||
|
||||
from chiabip158 import PyBIP158
|
||||
from clvm.casts import int_from_bytes
|
||||
|
||||
from chia.consensus.block_record import BlockRecord
|
||||
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.full_node.block_store import BlockStore
|
||||
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.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.condition_opcodes import ConditionOpcode
|
||||
from chia.types.condition_with_args import ConditionWithArgs
|
||||
from chia.types.full_block import FullBlock
|
||||
from chia.types.generator_types import BlockGenerator
|
||||
from chia.types.name_puzzle_condition import NPC
|
||||
from chia.types.unfinished_block import UnfinishedBlock
|
||||
from chia.util import cached_bls
|
||||
from chia.util.condition_tools import pkm_pairs
|
||||
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.ints import uint32, uint64, uint128
|
||||
from chia.util.ints import uint32, uint64
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -153,7 +149,6 @@ async def validate_block_body(
|
||||
removals: List[bytes32] = []
|
||||
coinbase_additions: List[Coin] = list(expected_reward_coins)
|
||||
additions: List[Coin] = []
|
||||
npc_list: List[NPC] = []
|
||||
removals_puzzle_dic: Dict[bytes32, bytes32] = {}
|
||||
cost: uint64 = uint64(0)
|
||||
|
||||
@@ -196,7 +191,6 @@ async def validate_block_body(
|
||||
|
||||
assert npc_result is not None
|
||||
cost = npc_result.cost
|
||||
npc_list = npc_result.npc_list
|
||||
|
||||
# 7. Check that cost <= MAX_BLOCK_COST_CLVM
|
||||
log.debug(
|
||||
@@ -210,11 +204,13 @@ async def validate_block_body(
|
||||
if npc_result.error is not None:
|
||||
return Err(npc_result.error), None
|
||||
|
||||
for npc in npc_list:
|
||||
removals.append(npc.coin_name)
|
||||
removals_puzzle_dic[npc.coin_name] = npc.puzzle_hash
|
||||
assert npc_result.conds is not None
|
||||
|
||||
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:
|
||||
assert npc_result is None
|
||||
|
||||
@@ -245,18 +241,12 @@ async def validate_block_body(
|
||||
return root_error, None
|
||||
|
||||
# 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:
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
byte_array_tx.append(bytearray(coin.puzzle_hash))
|
||||
for coin_name in removals:
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
byte_array_tx.append(bytearray(coin_name))
|
||||
|
||||
bip158: PyBIP158 = PyBIP158(byte_array_tx)
|
||||
encoded_filter = bytes(bip158.GetEncoded())
|
||||
@@ -323,7 +313,7 @@ async def validate_block_body(
|
||||
mempool_mode=False,
|
||||
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:
|
||||
removals_in_curr = []
|
||||
additions_in_curr = []
|
||||
@@ -407,16 +397,13 @@ async def validate_block_body(
|
||||
|
||||
fees = removed - added
|
||||
assert fees >= 0
|
||||
assert_fee_sum: uint128 = uint128(0)
|
||||
|
||||
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 Err.RESERVE_FEE_CONDITION_FAILED, None
|
||||
assert_fee_sum = uint128(assert_fee_sum + fee)
|
||||
# reserve fee cannot be greater than UINT64_MAX per consensus rule.
|
||||
# run_generator() would fail
|
||||
assert_fee_sum: uint64 = uint64(0)
|
||||
if npc_result:
|
||||
assert npc_result.conds is not None
|
||||
assert_fee_sum = npc_result.conds.reserve_fee
|
||||
|
||||
# 17. Check that the assert fee sum <= fees, and that each reserved fee is non-negative
|
||||
if fees < assert_fee_sum:
|
||||
@@ -436,12 +423,12 @@ async def validate_block_body(
|
||||
return Err.WRONG_PUZZLE_HASH, None
|
||||
|
||||
# 21. Verify conditions
|
||||
for npc in npc_list:
|
||||
assert height is not None
|
||||
unspent = removal_coin_records[npc.coin_name]
|
||||
error = mempool_check_conditions_dict(
|
||||
unspent,
|
||||
npc.condition_dict,
|
||||
# verify absolute/relative height/time conditions
|
||||
if npc_result is not None:
|
||||
assert npc_result.conds is not None
|
||||
error = mempool_check_time_locks(
|
||||
removal_coin_records,
|
||||
npc_result.conds,
|
||||
prev_transaction_block_height,
|
||||
block.foliage_transaction_block.timestamp,
|
||||
)
|
||||
@@ -449,7 +436,11 @@ async def validate_block_body(
|
||||
return error, None
|
||||
|
||||
# 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
|
||||
# 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__)
|
||||
|
||||
|
||||
# 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(
|
||||
constants: ConsensusConstants,
|
||||
reward_block_unfinished: RewardChainBlockUnfinished,
|
||||
@@ -53,7 +50,7 @@ def create_foliage(
|
||||
pool_target: PoolTarget,
|
||||
get_plot_signature: Callable[[bytes32, G1Element], 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]]:
|
||||
"""
|
||||
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)
|
||||
|
||||
# Create filter
|
||||
byte_array_tx: List[bytes32] = []
|
||||
byte_array_tx: List[bytearray] = []
|
||||
tx_additions: List[Coin] = []
|
||||
tx_removals: List[bytes32] = []
|
||||
|
||||
@@ -192,16 +189,10 @@ def create_foliage(
|
||||
additions.extend(reward_claims_incorporated.copy())
|
||||
for coin in additions:
|
||||
tx_additions.append(coin)
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
byte_array_tx.append(bytearray(coin.puzzle_hash))
|
||||
for coin in removals:
|
||||
tx_removals.append(coin.name())
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
byte_array_tx.append(bytearray(coin.name()))
|
||||
|
||||
bip158: PyBIP158 = PyBIP158(byte_array_tx)
|
||||
encoded = bytes(bip158.GetEncoded())
|
||||
@@ -289,9 +280,6 @@ def create_foliage(
|
||||
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(
|
||||
constants: ConsensusConstants,
|
||||
sub_slot_start_total_iters: uint128,
|
||||
@@ -308,7 +296,7 @@ def create_unfinished_block(
|
||||
signage_point: SignagePoint,
|
||||
timestamp: uint64,
|
||||
blocks: BlockchainInterface,
|
||||
seed: bytes32 = b"", # type: ignore[assignment]
|
||||
seed: bytes = b"",
|
||||
block_generator: Optional[BlockGenerator] = None,
|
||||
aggregate_sig: G2Element = G2Element(),
|
||||
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
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class BlockRecord(Streamable):
|
||||
"""
|
||||
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 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_header_validation import validate_unfinished_header_block
|
||||
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.vdf import VDFInfo
|
||||
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.full_block import FullBlock
|
||||
from chia.types.generator_types import BlockGenerator
|
||||
@@ -182,10 +179,9 @@ class Blockchain(BlockchainInterface):
|
||||
if self._peak_height is None:
|
||||
return None
|
||||
""" Return list of FullBlocks that are peaks"""
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
||||
# expected "bytes32" [arg-type]
|
||||
block = await self.block_store.get_full_block(self.height_to_hash(self._peak_height)) # type: ignore[arg-type]
|
||||
peak_hash: Optional[bytes32] = self.height_to_hash(self._peak_height)
|
||||
assert peak_hash is not None # Since we must have the peak block
|
||||
block = await self.block_store.get_full_block(peak_hash)
|
||||
assert block is not None
|
||||
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
|
||||
self.add_block_record(block_record)
|
||||
if fork_height is not None:
|
||||
self.__height_map.rollback(fork_height)
|
||||
for fetched_block_record in records:
|
||||
self.__height_map.update_height(
|
||||
fetched_block_record.height,
|
||||
@@ -300,19 +298,14 @@ class Blockchain(BlockchainInterface):
|
||||
return ReceiveBlockResult.ADDED_AS_ORPHAN, None, None, ([], {})
|
||||
|
||||
def get_hint_list(self, npc_result: NPCResult) -> List[Tuple[bytes32, bytes]]:
|
||||
if npc_result.conds is None:
|
||||
return []
|
||||
h_list = []
|
||||
for npc in npc_result.npc_list:
|
||||
for opcode, conditions in npc.conditions:
|
||||
if opcode == ConditionOpcode.CREATE_COIN:
|
||||
for condition in conditions:
|
||||
if len(condition.vars) > 2 and condition.vars[2] != b"":
|
||||
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]))
|
||||
for spend in npc_result.conds.spends:
|
||||
for puzzle_hash, amount, hint in spend.create_coin:
|
||||
if hint != b"":
|
||||
coin_id = Coin(spend.coin_id, puzzle_hash, amount).name()
|
||||
h_list.append((coin_id, hint))
|
||||
return h_list
|
||||
|
||||
async def _reconsider_peak(
|
||||
@@ -343,7 +336,7 @@ class Blockchain(BlockchainInterface):
|
||||
assert block 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:
|
||||
tx_removals, tx_additions = [], []
|
||||
if block.is_transaction_block():
|
||||
@@ -381,10 +374,6 @@ class Blockchain(BlockchainInterface):
|
||||
for coin_record in roll_changes:
|
||||
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
|
||||
blocks_to_add: List[Tuple[FullBlock, BlockRecord]] = []
|
||||
curr = block_record.header_hash
|
||||
@@ -445,6 +434,9 @@ class Blockchain(BlockchainInterface):
|
||||
hint_coin_state[key] = {}
|
||||
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])
|
||||
|
||||
# Changes the peak to be the new peak
|
||||
@@ -476,7 +468,7 @@ class Blockchain(BlockchainInterface):
|
||||
mempool_mode=False,
|
||||
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
|
||||
|
||||
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]
|
||||
|
||||
def height_to_block_record(self, height: uint32) -> BlockRecord:
|
||||
header_hash = self.height_to_hash(height)
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "block_record" of "Blockchain" has incompatible type "Optional[bytes32]"; expected
|
||||
# "bytes32" [arg-type]
|
||||
return self.block_record(header_hash) # type: ignore[arg-type]
|
||||
# Precondition: height is in the blockchain
|
||||
header_hash: Optional[bytes32] = self.height_to_hash(height)
|
||||
if header_hash is None:
|
||||
raise ValueError(f"Height is not in blockchain: {height}")
|
||||
return self.block_record(header_hash)
|
||||
|
||||
def get_ses_heights(self) -> List[uint32]:
|
||||
return self.__height_map.get_ses_heights()
|
||||
@@ -760,11 +752,8 @@ class Blockchain(BlockchainInterface):
|
||||
) -> Dict[bytes32, HeaderBlock]:
|
||||
hashes = []
|
||||
for height in range(start, stop + 1):
|
||||
if self.contains_height(uint32(height)):
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
header_hash: Optional[bytes32] = self.height_to_hash(uint32(height))
|
||||
if header_hash is not None:
|
||||
hashes.append(header_hash)
|
||||
|
||||
blocks: List[FullBlock] = []
|
||||
@@ -809,23 +798,20 @@ class Blockchain(BlockchainInterface):
|
||||
gets block records by height (only blocks that are part of the chain)
|
||||
"""
|
||||
records: List[BlockRecord] = []
|
||||
hashes = []
|
||||
hashes: List[bytes32] = []
|
||||
assert batch_size < 999 # sqlite in python 3.7 has a limit on 999 variables in queries
|
||||
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:
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
res = await self.block_store.get_block_records_by_hash(hashes)
|
||||
records.extend(res)
|
||||
hashes = []
|
||||
|
||||
if len(hashes) > 0:
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
res = await self.block_store.get_block_records_by_hash(hashes)
|
||||
records.extend(res)
|
||||
return records
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
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.streamable import Streamable, streamable
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class NPCResult(Streamable):
|
||||
error: Optional[uint16]
|
||||
npc_list: List[NPC]
|
||||
conds: Optional[SpendBundleConditions]
|
||||
cost: uint64 # The total cost of the block, including CLVM cost, cost of
|
||||
# conditions and cost of bytes
|
||||
|
||||
@@ -35,8 +35,8 @@ from chia.util.streamable import Streamable, dataclass_from_dict, streamable
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class PreValidationResult(Streamable):
|
||||
error: Optional[uint16]
|
||||
required_iters: Optional[uint64] # Iff error is None
|
||||
@@ -56,9 +56,9 @@ def batch_pre_validate_blocks(
|
||||
expected_sub_slot_iters: List[uint64],
|
||||
validate_signatures: bool,
|
||||
) -> List[bytes]:
|
||||
blocks: Dict[bytes, BlockRecord] = {}
|
||||
blocks: Dict[bytes32, BlockRecord] = {}
|
||||
for k, v in blocks_pickled.items():
|
||||
blocks[k] = BlockRecord.from_bytes(v)
|
||||
blocks[bytes32(k)] = BlockRecord.from_bytes(v)
|
||||
results: List[PreValidationResult] = []
|
||||
constants: ConsensusConstants = dataclass_from_dict(ConsensusConstants, constants_dict)
|
||||
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:
|
||||
npc_result = NPCResult.from_bytes(npc_results[block.height])
|
||||
assert npc_result is not None
|
||||
if npc_result.npc_list is not None:
|
||||
removals, tx_additions = tx_removals_and_additions(npc_result.npc_list)
|
||||
if npc_result.conds is not None:
|
||||
removals, tx_additions = tx_removals_and_additions(npc_result.conds)
|
||||
else:
|
||||
removals, tx_additions = [], []
|
||||
|
||||
@@ -93,18 +93,15 @@ def batch_pre_validate_blocks(
|
||||
mempool_mode=False,
|
||||
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:
|
||||
results.append(PreValidationResult(uint16(npc_result.error), None, npc_result, False))
|
||||
continue
|
||||
|
||||
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(
|
||||
constants,
|
||||
BlockCache(blocks), # type: ignore[arg-type]
|
||||
BlockCache(blocks),
|
||||
header_block,
|
||||
check_filter,
|
||||
expected_difficulty[i],
|
||||
@@ -123,7 +120,8 @@ def batch_pre_validate_blocks(
|
||||
# validate it later. receive_block will attempt to validate the signature later.
|
||||
if validate_signatures:
|
||||
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]
|
||||
if not AugSchemeMPL.aggregate_verify(
|
||||
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)):
|
||||
try:
|
||||
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(
|
||||
constants,
|
||||
BlockCache(blocks), # type: ignore[arg-type]
|
||||
BlockCache(blocks),
|
||||
header_block,
|
||||
check_filter,
|
||||
expected_difficulty[i],
|
||||
@@ -393,6 +388,6 @@ def _run_generator(
|
||||
)
|
||||
return bytes(npc_result)
|
||||
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:
|
||||
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 typing import Any, Dict, Optional
|
||||
|
||||
import websockets
|
||||
import aiohttp
|
||||
|
||||
from chia.util.config import load_config
|
||||
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:
|
||||
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._request_dict: Dict[str, asyncio.Event] = {}
|
||||
self.response_dict: Dict[str, Any] = {}
|
||||
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:
|
||||
request = create_payload_dict(command, data, "client", "daemon")
|
||||
return request
|
||||
|
||||
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():
|
||||
while True:
|
||||
try:
|
||||
message = await self.websocket.recv()
|
||||
except websockets.exceptions.ConnectionClosedOK:
|
||||
return None
|
||||
decoded = json.loads(message)
|
||||
id = decoded["request_id"]
|
||||
message = await self.websocket.receive()
|
||||
if message.type == aiohttp.WSMsgType.TEXT:
|
||||
decoded = json.loads(message.data)
|
||||
request_id = decoded["request_id"]
|
||||
|
||||
if id in self._request_dict:
|
||||
self.response_dict[id] = decoded
|
||||
self._request_dict[id].set()
|
||||
if request_id in self._request_dict:
|
||||
self.response_dict[request_id] = decoded
|
||||
self._request_dict[request_id].set()
|
||||
else:
|
||||
await self.close()
|
||||
return None
|
||||
|
||||
asyncio.create_task(listener())
|
||||
await asyncio.sleep(1)
|
||||
@@ -46,7 +67,9 @@ class DaemonProxy:
|
||||
request_id = request["request_id"]
|
||||
self._request_dict[request_id] = asyncio.Event()
|
||||
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():
|
||||
await asyncio.sleep(30)
|
||||
@@ -117,19 +140,24 @@ class DaemonProxy:
|
||||
return response
|
||||
|
||||
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:
|
||||
request = self.format_request("exit", {})
|
||||
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.
|
||||
"""
|
||||
|
||||
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()
|
||||
return client
|
||||
|
||||
@@ -143,12 +171,15 @@ async def connect_to_daemon_and_validate(root_path: Path, quiet: bool = False) -
|
||||
|
||||
try:
|
||||
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"]
|
||||
key_path = root_path / net_config["daemon_ssl"]["private_key"]
|
||||
ca_crt_path = root_path / net_config["private_ssl_ca"]["crt"]
|
||||
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)
|
||||
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()
|
||||
|
||||
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
|
||||
closed.
|
||||
"""
|
||||
from chia.daemon.client import connect_to_daemon_and_validate
|
||||
|
||||
daemon: Optional[DaemonProxy] = None
|
||||
try:
|
||||
|
||||
+69
-151
@@ -14,8 +14,7 @@ from enum import Enum
|
||||
from pathlib import Path
|
||||
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.passphrase_funcs import default_passphrase, using_default_passphrase
|
||||
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.setproctitle import setproctitle
|
||||
from chia.util.ws_message import WsRpcMessage, create_payload, format_response
|
||||
from chia import __version__
|
||||
|
||||
io_pool_exc = ThreadPoolExecutor()
|
||||
|
||||
try:
|
||||
from aiohttp import ClientSession, web
|
||||
from aiohttp import ClientSession, WSMsgType, web
|
||||
from aiohttp.web_ws import WebSocketResponse
|
||||
except ModuleNotFoundError:
|
||||
print("Error: Make sure to run . ./activate from the project folder before starting Chia.")
|
||||
quit()
|
||||
@@ -134,24 +133,24 @@ class WebSocketServer:
|
||||
ca_key_path: Path,
|
||||
crt_path: Path,
|
||||
key_path: Path,
|
||||
shutdown_event: asyncio.Event,
|
||||
run_check_keys_on_unlock: bool = False,
|
||||
):
|
||||
self.root_path = root_path
|
||||
self.log = log
|
||||
self.services: Dict = dict()
|
||||
self.plots_queue: List[Dict] = []
|
||||
self.connections: Dict[str, List[WebSocketServerProtocol]] = dict() # service_name : [WebSocket]
|
||||
self.remote_address_map: Dict[WebSocketServerProtocol, str] = dict() # socket: service_name
|
||||
self.ping_job: Optional[asyncio.Task] = None
|
||||
self.connections: Dict[str, List[WebSocketResponse]] = dict() # service_name : [WebSocket]
|
||||
self.remote_address_map: Dict[WebSocketResponse, str] = dict() # socket: service_name
|
||||
self.net_config = load_config(root_path, "config.yaml")
|
||||
self.self_hostname = self.net_config["self_hostname"]
|
||||
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.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.shut_down = False
|
||||
self.keychain_server = KeychainServer()
|
||||
self.run_check_keys_on_unlock = run_check_keys_on_unlock
|
||||
self.shutdown_event = shutdown_event
|
||||
|
||||
async def start(self):
|
||||
self.log.info("Starting Daemon Server")
|
||||
@@ -184,16 +183,19 @@ class WebSocketServer:
|
||||
except NotImplementedError:
|
||||
self.log.info("Not implemented")
|
||||
|
||||
self.websocket_server = await serve(
|
||||
self.safe_handle,
|
||||
self.self_hostname,
|
||||
self.daemon_port,
|
||||
max_size=self.daemon_max_message_size,
|
||||
ping_interval=500,
|
||||
ping_timeout=300,
|
||||
ssl=self.ssl_context,
|
||||
app = web.Application(client_max_size=self.daemon_max_message_size)
|
||||
app.add_routes([web.get("/", self.incoming_connection)])
|
||||
self.websocket_runner = web.AppRunner(app, access_log=None, logger=self.log, keepalive_timeout=300)
|
||||
await self.websocket_runner.setup()
|
||||
|
||||
site = web.TCPSite(
|
||||
self.websocket_runner,
|
||||
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]):
|
||||
if task is not None:
|
||||
@@ -203,22 +205,28 @@ class WebSocketServer:
|
||||
self.log.error(f"Error while canceling task.{e} {task}")
|
||||
|
||||
async def stop(self) -> Dict[str, Any]:
|
||||
self.shut_down = True
|
||||
self.cancel_task_safe(self.ping_job)
|
||||
await self.exit()
|
||||
if self.websocket_server is not None:
|
||||
self.websocket_server.close()
|
||||
jobs = []
|
||||
for service_name in self.services.keys():
|
||||
jobs.append(kill_service(self.root_path, self.services, service_name))
|
||||
if jobs:
|
||||
await asyncio.wait(jobs)
|
||||
self.services.clear()
|
||||
asyncio.create_task(self.exit())
|
||||
return {"success": True}
|
||||
|
||||
async def safe_handle(self, websocket: WebSocketServerProtocol, path: str):
|
||||
service_name = ""
|
||||
try:
|
||||
async for message in websocket:
|
||||
async def incoming_connection(self, request):
|
||||
ws: WebSocketResponse = web.WebSocketResponse(max_msg_size=self.daemon_max_message_size, heartbeat=30)
|
||||
await ws.prepare(request)
|
||||
|
||||
while True:
|
||||
msg = await ws.receive()
|
||||
self.log.debug(f"Received message: {msg}")
|
||||
if msg.type == WSMsgType.TEXT:
|
||||
try:
|
||||
decoded = json.loads(message)
|
||||
decoded = json.loads(msg.data)
|
||||
if "data" not in decoded:
|
||||
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:
|
||||
tb = traceback.format_exc()
|
||||
self.log.error(f"Error while handling message: {tb}")
|
||||
@@ -228,28 +236,27 @@ class WebSocketServer:
|
||||
if len(sockets_to_use) > 0:
|
||||
for socket in sockets_to_use:
|
||||
try:
|
||||
await socket.send(response)
|
||||
await socket.send_str(response)
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
||||
self.remove_connection(socket)
|
||||
await socket.close()
|
||||
except Exception as e:
|
||||
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}")
|
||||
break
|
||||
else:
|
||||
self.log.error(f"Unexpected exception in websocket: {e} {tb}")
|
||||
finally:
|
||||
self.remove_connection(websocket)
|
||||
await websocket.close()
|
||||
service_name = "Unknown"
|
||||
if ws in self.remote_address_map:
|
||||
service_name = self.remote_address_map[ws]
|
||||
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
|
||||
if websocket in self.remote_address_map:
|
||||
service_name = self.remote_address_map[websocket]
|
||||
@@ -263,31 +270,8 @@ class WebSocketServer:
|
||||
after_removal.append(connection)
|
||||
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(
|
||||
self, websocket: WebSocketServerProtocol, message: WsRpcMessage
|
||||
self, websocket: WebSocketResponse, message: WsRpcMessage
|
||||
) -> Tuple[Optional[str], List[Any]]:
|
||||
"""
|
||||
This function gets called when new message is received via websocket.
|
||||
@@ -631,7 +615,7 @@ class WebSocketServer:
|
||||
|
||||
for websocket in websockets:
|
||||
try:
|
||||
await websocket.send(response)
|
||||
await websocket.send_str(response)
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
||||
@@ -690,7 +674,7 @@ class WebSocketServer:
|
||||
|
||||
for websocket in websockets:
|
||||
try:
|
||||
await websocket.send(response)
|
||||
await websocket.send_str(response)
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
self.log.error(f"Unexpected exception trying to send to websocket: {e} {tb}")
|
||||
@@ -1150,20 +1134,13 @@ class WebSocketServer:
|
||||
|
||||
return response
|
||||
|
||||
async def exit(self) -> Dict[str, Any]:
|
||||
jobs = []
|
||||
for k in self.services.keys():
|
||||
jobs.append(kill_service(self.root_path, self.services, k))
|
||||
if jobs:
|
||||
await asyncio.wait(jobs)
|
||||
self.services.clear()
|
||||
|
||||
async def exit(self) -> None:
|
||||
if self.websocket_runner is not None:
|
||||
await self.websocket_runner.cleanup()
|
||||
self.shutdown_event.set()
|
||||
log.info("chia daemon exiting")
|
||||
|
||||
response = {"success": True}
|
||||
return response
|
||||
|
||||
async def register_service(self, websocket: WebSocketServerProtocol, request: Dict[str, Any]) -> Dict[str, Any]:
|
||||
async def register_service(self, websocket: WebSocketResponse, request: Dict[str, Any]) -> Dict[str, Any]:
|
||||
self.log.info(f"Register service {request}")
|
||||
service = request["service"]
|
||||
if service not in self.connections:
|
||||
@@ -1179,8 +1156,6 @@ class WebSocketServer:
|
||||
}
|
||||
else:
|
||||
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}")
|
||||
log.info(f"{response}")
|
||||
return response
|
||||
@@ -1351,7 +1326,6 @@ async def kill_service(
|
||||
if process is None:
|
||||
return False
|
||||
del services[service_name]
|
||||
|
||||
result = await kill_process(process, root_path, service_name, "", delay_before_kill)
|
||||
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
|
||||
|
||||
|
||||
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]:
|
||||
"""
|
||||
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")
|
||||
return 2
|
||||
|
||||
shutdown_event = asyncio.Event()
|
||||
|
||||
# TODO: clean this up, ensuring lockfile isn't removed until the listen port is open
|
||||
create_server_for_daemon(root_path)
|
||||
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()
|
||||
assert ws_server.websocket_server is not None
|
||||
await ws_server.websocket_server.wait_closed()
|
||||
await shutdown_event.wait()
|
||||
log.info("Daemon WebSocketServer closed")
|
||||
# sys.stdout.close()
|
||||
return 0
|
||||
|
||||
+24
-98
@@ -18,6 +18,8 @@ from chia.daemon.keychain_proxy import (
|
||||
connect_to_keychain_and_validate,
|
||||
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.protocols import farmer_protocol, harvester_protocol
|
||||
from chia.protocols.pool_protocol import (
|
||||
@@ -59,32 +61,12 @@ log = logging.getLogger(__name__)
|
||||
|
||||
UPDATE_POOL_INFO_INTERVAL: int = 3600
|
||||
UPDATE_POOL_FARMER_INFO_INTERVAL: int = 300
|
||||
UPDATE_HARVESTER_CACHE_INTERVAL: int = 90
|
||||
|
||||
"""
|
||||
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:
|
||||
def __init__(
|
||||
self,
|
||||
@@ -115,8 +97,7 @@ class Farmer:
|
||||
# to periodically clear the memory
|
||||
self.cache_add_time: Dict[bytes32, uint64] = {}
|
||||
|
||||
# Interval to request plots from connected harvesters
|
||||
self.update_harvester_cache_interval = UPDATE_HARVESTER_CACHE_INTERVAL
|
||||
self.plot_sync_receivers: Dict[bytes32, Receiver] = {}
|
||||
|
||||
self.cache_clear_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
|
||||
self.last_config_access_time: uint64 = uint64(0)
|
||||
|
||||
self.harvester_cache: Dict[str, Dict[str, HarvesterCacheEntry]] = {}
|
||||
|
||||
async def ensure_keychain_proxy(self) -> KeychainProxy:
|
||||
if not self.keychain_proxy:
|
||||
if self.keychain_proxy is None:
|
||||
if self.local_keychain:
|
||||
self.keychain_proxy = wrap_local_keychain(self.local_keychain, log=self.log)
|
||||
else:
|
||||
@@ -212,11 +191,16 @@ class Farmer:
|
||||
def _close(self):
|
||||
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:
|
||||
await self.cache_clear_task
|
||||
if self.update_pool_state_task is not None:
|
||||
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
|
||||
|
||||
def _set_state_changed_callback(self, callback: Callable):
|
||||
@@ -251,6 +235,7 @@ class Farmer:
|
||||
self.harvester_handshake_task = None
|
||||
|
||||
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())
|
||||
|
||||
def set_server(self, server):
|
||||
@@ -269,6 +254,13 @@ class Farmer:
|
||||
def on_disconnect(self, connection: ws.WSChiaConnection):
|
||||
self.log.info(f"peer disconnected {connection.get_peer_logging()}")
|
||||
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]:
|
||||
try:
|
||||
@@ -637,80 +629,17 @@ class Farmer:
|
||||
|
||||
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:
|
||||
harvesters: List = []
|
||||
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}")
|
||||
cache_entry = await self.get_cached_harvesters(connection)
|
||||
if cache_entry.data is not None:
|
||||
harvester_object: dict = dict(cache_entry.data)
|
||||
harvester_object["connection"] = {
|
||||
"node_id": connection.peer_node_id.hex(),
|
||||
"host": connection.peer_host,
|
||||
"port": connection.peer_port,
|
||||
}
|
||||
harvesters.append(harvester_object)
|
||||
receiver = self.plot_sync_receivers.get(connection.peer_node_id)
|
||||
if receiver is not None:
|
||||
harvesters.append(receiver.to_dict())
|
||||
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}
|
||||
|
||||
@@ -761,9 +690,6 @@ class Farmer:
|
||||
self.state_changed("add_connection", {})
|
||||
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:
|
||||
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.farmer.farmer import Farmer
|
||||
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 (
|
||||
get_current_authentication_token,
|
||||
PoolErrorCode,
|
||||
@@ -518,3 +524,38 @@ class FarmerAPI:
|
||||
@peer_required
|
||||
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()}")
|
||||
|
||||
@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__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclass(frozen=True)
|
||||
class SesCache(Streamable):
|
||||
content: List[Tuple[uint32, bytes]]
|
||||
|
||||
@@ -184,6 +184,10 @@ class BlockHeightMap:
|
||||
ordered[bytes32.fromhex(r[0])] = (r[2], bytes32.fromhex(r[1]), r[3])
|
||||
|
||||
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]
|
||||
assert height == entry[0] + 1
|
||||
height = entry[0]
|
||||
@@ -226,6 +230,7 @@ class BlockHeightMap:
|
||||
heights_to_delete.append(ses_included_height)
|
||||
for height in heights_to_delete:
|
||||
del self.__sub_epoch_summaries[height]
|
||||
del self.__height_to_hash[(fork_height + 1) * 32 :]
|
||||
|
||||
def get_ses(self, height: uint32) -> SubEpochSummary:
|
||||
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 conn.execute(formatted_str, header_hashes_db) as cursor:
|
||||
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])
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Invalid index type "bytes" for "Dict[bytes32, FullBlock]";
|
||||
# expected type "bytes32" [index]
|
||||
all_blocks[header_hash] = full_block # type: ignore[index]
|
||||
all_blocks[header_hash] = full_block
|
||||
self.block_cache.put(header_hash, full_block)
|
||||
ret: List[FullBlock] = []
|
||||
for hh in header_hashes:
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
from typing import List, Optional, Set, Dict, Any, Tuple
|
||||
|
||||
from aiosqlite import Cursor
|
||||
|
||||
from chia.protocols.wallet_protocol import CoinState
|
||||
from chia.types.blockchain_format.coin import Coin
|
||||
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 conn.execute(
|
||||
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"{'' if include_spent_coins else 'AND spent_index=0'}",
|
||||
names_db + (start_height, end_height),
|
||||
@@ -515,16 +519,27 @@ class CoinStore:
|
||||
for coin_name in coin_names:
|
||||
r = self.coin_record_cache.get(coin_name)
|
||||
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(
|
||||
r.name, CoinRecord(r.coin, r.confirmed_block_index, index, r.coinbase, r.timestamp)
|
||||
)
|
||||
updates.append((index, self.maybe_to_hex(coin_name)))
|
||||
|
||||
if updates != []:
|
||||
async with self.db_wrapper.write_db() as conn:
|
||||
if self.db_wrapper.db_version == 2:
|
||||
await conn.executemany("UPDATE OR FAIL coin_record SET spent_index=? WHERE coin_name=?", updates)
|
||||
else:
|
||||
await conn.executemany(
|
||||
"UPDATE OR FAIL coin_record SET spent=1,spent_index=? WHERE coin_name=?", updates
|
||||
)
|
||||
assert len(updates) == len(coin_names)
|
||||
async with self.db_wrapper.write_db() as conn:
|
||||
if self.db_wrapper.db_version == 2:
|
||||
ret: Cursor = await conn.executemany(
|
||||
"UPDATE OR FAIL coin_record SET spent_index=? WHERE coin_name=? AND spent_index=0", 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
|
||||
if fork_height != block.height - 1 and block.height != 0:
|
||||
# This is a reorg
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "block_record" of "Blockchain" has incompatible type "Optional[bytes32]";
|
||||
# expected "bytes32" [arg-type]
|
||||
fork_block = self.blockchain.block_record(self.blockchain.height_to_hash(fork_height)) # type: ignore[arg-type] # noqa: E501
|
||||
fork_hash: Optional[bytes32] = self.blockchain.height_to_hash(fork_height)
|
||||
assert fork_hash is not None
|
||||
fork_block = self.blockchain.block_record(fork_hash)
|
||||
|
||||
fns_peak_result: FullNodeStorePeakResult = self.full_node_store.new_peak(
|
||||
record,
|
||||
@@ -1737,7 +1736,10 @@ class FullNode:
|
||||
npc_result = await self.blockchain.run_generator(block_bytes, block_generator, height)
|
||||
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(
|
||||
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:
|
||||
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(
|
||||
tx_request_and_timeout(self.full_node, transaction.transaction_id, task_id)
|
||||
)
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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]
|
||||
self.full_node.full_node_store.tx_fetch_tasks[task_id] = fetch_task
|
||||
return None
|
||||
return None
|
||||
|
||||
@@ -311,18 +309,16 @@ class FullNodeAPI:
|
||||
reject = RejectBlock(request.height)
|
||||
msg = make_msg(ProtocolMessageTypes.reject_block, reject)
|
||||
return msg
|
||||
header_hash = self.full_node.blockchain.height_to_hash(request.height)
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
||||
# expected "bytes32" [arg-type]
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash) # type: ignore[arg-type] # noqa: E501
|
||||
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(request.height)
|
||||
if header_hash is None:
|
||||
return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
|
||||
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash)
|
||||
if block is not None:
|
||||
if not request.include_transaction_block and block.transactions_generator is not None:
|
||||
block = dataclasses.replace(block, transactions_generator=None)
|
||||
return make_msg(ProtocolMessageTypes.respond_block, full_node_protocol.RespondBlock(block))
|
||||
reject = RejectBlock(request.height)
|
||||
msg = make_msg(ProtocolMessageTypes.reject_block, reject)
|
||||
return msg
|
||||
return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
|
||||
|
||||
@api_request
|
||||
@reply_type([ProtocolMessageTypes.respond_blocks, ProtocolMessageTypes.reject_blocks])
|
||||
@@ -340,16 +336,15 @@ class FullNodeAPI:
|
||||
if not request.include_transaction_block:
|
||||
blocks: List[FullBlock] = []
|
||||
for i in range(request.start_height, request.end_height + 1):
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
||||
# expected "bytes32" [arg-type]
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(
|
||||
self.full_node.blockchain.height_to_hash(uint32(i)) # type: ignore[arg-type]
|
||||
)
|
||||
header_hash_i: Optional[bytes32] = self.full_node.blockchain.height_to_hash(uint32(i))
|
||||
if header_hash_i is None:
|
||||
reject = RejectBlocks(request.start_height, request.end_height)
|
||||
return make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash_i)
|
||||
if block is None:
|
||||
reject = RejectBlocks(request.start_height, request.end_height)
|
||||
msg = make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||
return msg
|
||||
return make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||
block = dataclasses.replace(block, transactions_generator=None)
|
||||
blocks.append(block)
|
||||
msg = make_msg(
|
||||
@@ -359,12 +354,11 @@ class FullNodeAPI:
|
||||
else:
|
||||
blocks_bytes: List[bytes] = []
|
||||
for i in range(request.start_height, request.end_height + 1):
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "get_full_block_bytes" of "BlockStore" has incompatible type
|
||||
# "Optional[bytes32]"; expected "bytes32" [arg-type]
|
||||
block_bytes: Optional[bytes] = await self.full_node.block_store.get_full_block_bytes(
|
||||
self.full_node.blockchain.height_to_hash(uint32(i)) # type: ignore[arg-type]
|
||||
)
|
||||
header_hash_i = self.full_node.blockchain.height_to_hash(uint32(i))
|
||||
if header_hash_i is None:
|
||||
reject = RejectBlocks(request.start_height, request.end_height)
|
||||
return make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||
block_bytes: Optional[bytes] = await self.full_node.block_store.get_full_block_bytes(header_hash_i)
|
||||
if block_bytes is None:
|
||||
reject = RejectBlocks(request.start_height, request.end_height)
|
||||
msg = make_msg(ProtocolMessageTypes.reject_blocks, reject)
|
||||
@@ -898,9 +892,6 @@ class FullNodeAPI:
|
||||
timestamp = uint64(int(curr.timestamp + 1))
|
||||
|
||||
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(
|
||||
self.full_node.constants,
|
||||
total_iters_pos_slot,
|
||||
@@ -917,7 +908,7 @@ class FullNodeAPI:
|
||||
sp_vdfs,
|
||||
timestamp,
|
||||
self.full_node.blockchain,
|
||||
b"", # type: ignore[arg-type]
|
||||
b"",
|
||||
block_generator,
|
||||
aggregate_signature,
|
||||
additions,
|
||||
@@ -937,22 +928,17 @@ class FullNodeAPI:
|
||||
foliage_transaction_block_hash = unfinished_block.foliage.foliage_transaction_block_hash
|
||||
else:
|
||||
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(
|
||||
quality_string,
|
||||
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))
|
||||
|
||||
# Adds backup in case the first one fails
|
||||
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(
|
||||
self.full_node.constants,
|
||||
total_iters_pos_slot,
|
||||
@@ -969,7 +955,7 @@ class FullNodeAPI:
|
||||
sp_vdfs,
|
||||
timestamp,
|
||||
self.full_node.blockchain,
|
||||
b"", # type: ignore[arg-type]
|
||||
b"",
|
||||
None,
|
||||
G2Element(),
|
||||
None,
|
||||
@@ -1039,13 +1025,12 @@ class FullNodeAPI:
|
||||
self.full_node.full_node_store.add_candidate_block(
|
||||
farmer_request.quality_string, height, unfinished_block, False
|
||||
)
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 3 to "RequestSignedValues" has incompatible type "Optional[bytes32]"; expected
|
||||
# "bytes32" [arg-type]
|
||||
# All unfinished blocks that we create will have the foliage transaction block and hash
|
||||
assert unfinished_block.foliage.foliage_transaction_block_hash is not None
|
||||
message = farmer_protocol.RequestSignedValues(
|
||||
farmer_request.quality_string,
|
||||
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))
|
||||
return None
|
||||
@@ -1124,10 +1109,14 @@ class FullNodeAPI:
|
||||
|
||||
@api_request
|
||||
async def request_additions(self, request: wallet_protocol.RequestAdditions) -> Optional[Message]:
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
||||
# expected "bytes32" [arg-type]
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(request.header_hash) # type: ignore[arg-type] # noqa: E501
|
||||
if request.header_hash is None:
|
||||
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(request.height)
|
||||
else:
|
||||
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
|
||||
if (
|
||||
@@ -1135,10 +1124,7 @@ class FullNodeAPI:
|
||||
or block.is_transaction_block() is False
|
||||
or self.full_node.blockchain.height_to_hash(block.height) != request.header_hash
|
||||
):
|
||||
# TODO: address hint error and remove ignore
|
||||
# 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
|
||||
reject = wallet_protocol.RejectAdditionsRequest(request.height, header_hash)
|
||||
|
||||
msg = make_msg(ProtocolMessageTypes.reject_additions_request, reject)
|
||||
return msg
|
||||
@@ -1264,8 +1250,9 @@ class FullNodeAPI:
|
||||
)
|
||||
# Waits for the transaction to go into the mempool, times out after 45 seconds.
|
||||
status, error = None, None
|
||||
for i in range(450):
|
||||
await asyncio.sleep(0.1)
|
||||
sleep_time = 0.01
|
||||
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:
|
||||
if spend_name == potential_name:
|
||||
status = potential_status
|
||||
@@ -1300,11 +1287,11 @@ class FullNodeAPI:
|
||||
if coin_record is None or coin_record.spent_block_index != height:
|
||||
return reject_msg
|
||||
|
||||
header_hash = self.full_node.blockchain.height_to_hash(height)
|
||||
# TODO: address hint error and remove ignore
|
||||
# error: Argument 1 to "get_full_block" of "BlockStore" has incompatible type "Optional[bytes32]";
|
||||
# expected "bytes32" [arg-type]
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash) # type: ignore[arg-type] # noqa: E501
|
||||
header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(height)
|
||||
if header_hash is None:
|
||||
return reject_msg
|
||||
|
||||
block: Optional[FullBlock] = await self.full_node.block_store.get_full_block(header_hash)
|
||||
|
||||
if block is None or block.transactions_generator is None:
|
||||
return reject_msg
|
||||
@@ -1331,18 +1318,16 @@ class FullNodeAPI:
|
||||
if request.end_height < request.start_height or request.end_height - request.start_height > 32:
|
||||
return None
|
||||
|
||||
header_hashes = []
|
||||
header_hashes: List[bytes32] = []
|
||||
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)
|
||||
msg = make_msg(ProtocolMessageTypes.reject_header_blocks, reject)
|
||||
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
|
||||
# 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
|
||||
blocks: List[FullBlock] = await self.full_node.block_store.get_blocks_by_hash(header_hashes)
|
||||
header_blocks = []
|
||||
for block in blocks:
|
||||
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__)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@streamable
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class FullNodeStorePeakResult(Streamable):
|
||||
added_eos: Optional[EndOfSubSlotBundle]
|
||||
new_signage_points: List[Tuple[uint8, SignagePoint]]
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import logging
|
||||
import time
|
||||
from typing import Dict, List, Optional
|
||||
from clvm_rs import MEMPOOL_MODE, COND_CANON_INTS, NO_NEG_DIV
|
||||
from typing import Dict, Optional
|
||||
from chia_rs import MEMPOOL_MODE, COND_CANON_INTS, NO_NEG_DIV, STRICT_ARGS_COUNT
|
||||
|
||||
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.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.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.name_puzzle_condition import NPC
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.util.errors import Err
|
||||
from chia.util.ints import uint32, uint64, uint16
|
||||
from chia.wallet.puzzles.generator_loader import GENERATOR_FOR_SINGLE_COIN_MOD
|
||||
@@ -22,91 +19,6 @@ GENERATOR_MOD = get_generator()
|
||||
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:
|
||||
assert x is not None
|
||||
return x
|
||||
@@ -119,7 +31,7 @@ def get_name_puzzle_conditions(
|
||||
size_cost = len(bytes(generator.program)) * cost_per_byte
|
||||
max_cost -= size_cost
|
||||
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.
|
||||
# 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
|
||||
|
||||
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:
|
||||
# conditions must use integers in canonical encoding (i.e. no redundant
|
||||
# leading zeros)
|
||||
@@ -141,46 +54,14 @@ def get_name_puzzle_conditions(
|
||||
|
||||
try:
|
||||
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:
|
||||
assert err != 0
|
||||
return NPCResult(uint16(err), [], uint64(0))
|
||||
|
||||
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))
|
||||
|
||||
return NPCResult(uint16(err), None, uint64(0))
|
||||
else:
|
||||
return NPCResult(None, result, uint64(result.cost + size_cost))
|
||||
except BaseException as 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):
|
||||
@@ -198,40 +79,26 @@ def get_puzzle_and_solution_for_coin(generator: BlockGenerator, coin_name: bytes
|
||||
return e, None, None
|
||||
|
||||
|
||||
def mempool_check_conditions_dict(
|
||||
unspent: CoinRecord,
|
||||
conditions_dict: Dict[ConditionOpcode, List[ConditionWithArgs]],
|
||||
def mempool_check_time_locks(
|
||||
removal_coin_records: Dict[bytes32, CoinRecord],
|
||||
bundle_conds: SpendBundleConditions,
|
||||
prev_transaction_block_height: uint32,
|
||||
timestamp: uint64,
|
||||
) -> 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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import asyncio
|
||||
import collections
|
||||
import dataclasses
|
||||
import logging
|
||||
from concurrent.futures import Executor
|
||||
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 blspy import GTElement
|
||||
from chiabip158 import PyBIP158
|
||||
from clvm.casts import int_from_bytes
|
||||
|
||||
from chia.util import cached_bls
|
||||
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.coin_store import CoinStore
|
||||
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.types.blockchain_format.coin import Coin
|
||||
from chia.types.blockchain_format.program import SerializedProgram
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
|
||||
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_item import MempoolItem
|
||||
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.lru_cache import LRUCache
|
||||
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__)
|
||||
|
||||
@@ -61,9 +57,10 @@ def validate_clvm_and_signature(
|
||||
if result.error is not None:
|
||||
return Err(result.error), b"", {}
|
||||
|
||||
pks: List[bytes48]
|
||||
msgs: List[bytes]
|
||||
pks, msgs = pkm_pairs(result.npc_list, additional_data)
|
||||
pks: List[bytes48] = []
|
||||
msgs: List[bytes] = []
|
||||
assert result.conds is not None
|
||||
pks, msgs = pkm_pairs(result.conds, additional_data)
|
||||
|
||||
# Verify aggregated signature
|
||||
cache: LRUCache = LRUCache(10000)
|
||||
@@ -92,7 +89,6 @@ class MempoolManager:
|
||||
single_threaded: bool = False,
|
||||
):
|
||||
self.constants: ConsensusConstants = consensus_constants
|
||||
self.constants_json = recurse_jsonify(dataclasses.asdict(self.constants))
|
||||
|
||||
# Keep track of seen spend_bundles
|
||||
self.seen_bundle_hashes: Dict[bytes32, bytes32] = {}
|
||||
@@ -301,8 +297,10 @@ class MempoolManager:
|
||||
if self.peak is None:
|
||||
return None, MempoolInclusionStatus.FAILED, Err.MEMPOOL_NOT_INITIALIZED
|
||||
|
||||
npc_list = npc_result.npc_list
|
||||
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:
|
||||
program = simple_solution_generator(new_spend).program
|
||||
cost = npc_result.cost
|
||||
@@ -314,12 +312,13 @@ class MempoolManager:
|
||||
# execute the CLVM program.
|
||||
return None, MempoolInclusionStatus.FAILED, Err.BLOCK_COST_EXCEEDS_MAX
|
||||
|
||||
assert npc_result.conds is not None
|
||||
# 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()]):
|
||||
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] = {}
|
||||
for add in additions:
|
||||
@@ -372,7 +371,7 @@ class MempoolManager:
|
||||
assert self.peak.timestamp is not None
|
||||
removal_record = CoinRecord(
|
||||
removal_coin,
|
||||
uint32(self.peak.height + 1), # In mempool, so will be included in next height
|
||||
uint32(self.peak.height + 1),
|
||||
uint32(0),
|
||||
False,
|
||||
self.peak.timestamp,
|
||||
@@ -388,16 +387,8 @@ class MempoolManager:
|
||||
return None, MempoolInclusionStatus.FAILED, Err.MINTING_COIN
|
||||
|
||||
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:
|
||||
return (
|
||||
None,
|
||||
@@ -439,37 +430,35 @@ class MempoolManager:
|
||||
return None, MempoolInclusionStatus.FAILED, fail_reason
|
||||
|
||||
# Verify conditions, create hash_key list for aggsig check
|
||||
error: Optional[Err] = None
|
||||
for npc in npc_list:
|
||||
coin_record: CoinRecord = removal_record_dict[npc.coin_name]
|
||||
for spend in npc_result.conds.spends:
|
||||
coin_record: CoinRecord = removal_record_dict[spend.coin_id]
|
||||
# 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(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
|
||||
|
||||
chialisp_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,
|
||||
)
|
||||
chialisp_height = (
|
||||
self.peak.prev_transaction_block_height if not self.peak.is_transaction_block else self.peak.height
|
||||
)
|
||||
|
||||
if 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
|
||||
break
|
||||
assert self.peak.timestamp is not None
|
||||
error: Optional[Err] = mempool_check_time_locks(
|
||||
removal_record_dict,
|
||||
npc_result.conds,
|
||||
uint32(chialisp_height),
|
||||
self.peak.timestamp,
|
||||
)
|
||||
|
||||
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
|
||||
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