Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHIA-1736] catchup: long_lived/vault from main @ 08730a266b201e487ca1d361e108491f7862d81b #18852

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2808ee2
[CHIA-1681] Replace black with Ruff (#18813)
Quexington Nov 4, 2024
e07d1eb
Use #!/usr/bin/env bash (#18762)
emlowe Nov 4, 2024
3f6977f
more `start_*` service starting consistency (#18775)
altendky Nov 5, 2024
0d8920a
CHIA-1684 Move obtain_current_passphrase next to KeyringWrapper (#18787)
AmineKhaldi Nov 5, 2024
da607b2
CHIA-1692 Annotate chia/rpc/util.py (#18798)
AmineKhaldi Nov 5, 2024
42541ae
[CHIA-1689] Miscellaneous ruff cleanups (#18817)
Quexington Nov 5, 2024
15079c6
Fix pre-commit in chia/rpc/util.py (#18823)
Quexington Nov 5, 2024
816462d
CHIA-1716 Speedup get_header_blocks_in_range w.r.t. blocks with no tr…
AmineKhaldi Nov 6, 2024
7dd1324
Await self_is_synced() (#18772)
emlowe Nov 6, 2024
315f4bf
Update Managed Files (#18821)
ChiaAutomation Nov 6, 2024
61cf266
CHIA-1697: Add new flag to support recursively scanning and following…
emlowe Nov 6, 2024
c7a7d4e
Fix incorrect comment about default hidden puzzle (#18820)
emlowe Nov 6, 2024
6ceaec4
[CHIA-1562] move signature validation into `run_block_generator()` (#…
arvidn Nov 6, 2024
3d5752e
build(deps): bump keyring from 25.2.1 to 25.5.0 (#18794)
dependabot[bot] Nov 6, 2024
9eb1d5a
build(deps): bump clvm from 0.9.10 to 0.9.11 (#18827)
dependabot[bot] Nov 7, 2024
ff3cf28
explicitly collect api methods instead of later using getattr (#18800)
altendky Nov 8, 2024
569a47c
CHIA-1717 Handle index error on empty peers with peak in request_vali…
AmineKhaldi Nov 8, 2024
80911d4
[CHIA-1703] ignore ephemeral spends in mempool superset rule (#18834)
arvidn Nov 8, 2024
c4ac6c7
the mempool thread pool should not set the process name (#18842)
arvidn Nov 8, 2024
08730a2
build(deps): bump pyyaml from 6.0.1 to 6.0.2 (#18793)
dependabot[bot] Nov 8, 2024
3388690
Merge commit '08730a266b201e487ca1d361e108491f7862d81b' into catchup/…
Quexington Nov 12, 2024
e235ed5
Ruff format
Quexington Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
- name: "Dependency Review"
uses: actions/dependency-review-action@v4
with:
allow-dependencies-licenses: pkg:pypi/pylint, pkg:pypi/pyinstaller
allow-dependencies-licenses: pkg:pypi/pyinstaller
deny-licenses: AGPL-1.0-only, AGPL-1.0-or-later, AGPL-1.0-or-later, AGPL-3.0-or-later, GPL-1.0-only, GPL-1.0-or-later, GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later
4 changes: 2 additions & 2 deletions .github/workflows/upload-pypi-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ jobs:
python:
- major_dot_minor: "3.10"
check:
- name: black
command: black --check --diff .
- name: ruff
command: ruff format --check --diff .
- name: generated protocol tests
command: |
python3 -m chia._tests.util.build_network_protocol_files
Expand Down
5 changes: 0 additions & 5 deletions .isort.cfg

This file was deleted.

20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ repos:
pass_filenames: false
- repo: local
hooks:
- id: black
name: black
entry: ./activated.py black
- id: ruff_format
name: ruff format
entry: ./activated.py ruff format
language: system
require_serial: true
types_or: [python, pyi]
Expand Down Expand Up @@ -71,6 +71,13 @@ repos:
entry: ./activated.py python chia/util/virtual_project_analysis.py print_cycles --directory chia --config virtual_project.yaml
language: system
pass_filenames: false
- repo: local
hooks:
- id: ruff
name: Ruff
entry: ./activated.py ruff check --fix
language: system
types: [python]
- repo: local
hooks:
- id: build mypy.ini
Expand All @@ -85,10 +92,3 @@ repos:
entry: ./activated.py mypy
language: system
pass_filenames: false
- repo: local
hooks:
- id: ruff
name: Ruff
entry: ./activated.py ruff check --fix
language: system
types: [python]
28 changes: 3 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ to configure how the tests are run. For example, for more logging: change the lo
```bash
sh install.sh -d
. ./activate
black . && ruff check --fix && mypy && pylint benchmarks build_scripts chia tests tools *.py
py.test tests -v --durations 0
ruff format && ruff check --fix && mypy
pytest tests -v --durations 0
```

The [black library](https://black.readthedocs.io/en/stable/) is used as an automatic style formatter to make things easier.
The [Mypy library](https://mypy.readthedocs.io/en/stable/) is very useful for ensuring objects are of the correct type, so try to always add the type of the return value, and the type of local variables.
The [Ruff library](https://docs.astral.sh) is used to sort, group, validate imports, ensure consistent style, and further lint all of the python files
The [Ruff library](https://docs.astral.sh) is used to format, sort, group, validate imports, ensure consistent style, and further lint all of the python files

If you want verbose logging for tests, edit the `tests/pytest.ini` file.

Expand All @@ -77,27 +76,6 @@ To install pre-commit on your system see https://pre-commit.com/#installation. A
with `pre-commit run` or let it trigger the hooks automatically before each commit by installing the
provided configuration with `pre-commit install`.

## Configure VS code

1. Install python extension
2. Set the environment to `./venv/bin/python`
3. Install mypy plugin
4. Preferences > Settings > Python > Linting > mypy enabled
5. Preferences > Settings > Formatting > Python > Provider > black
6. Preferences > Settings > mypy > Targets: set to `./chia`

## Configure Pycharm

Pycharm is an amazing and beautiful python IDE that some of us use to work on this project.
If you combine it with python black and formatting on save, you will get a very efficient
workflow. It's also especially efficient for git branching, cherry-picking, committing and pushing.

1. Run blackd in a terminal
2. Install BlackConnect plugin
3. Set to run python black on save
4. Set line length to 120
5. Install the linters in the root directory

## Testnets and review environments

The current official testnet is testnet10. Look at `chia/util/initial_config.yaml` to see the configuration parameters
Expand Down
2 changes: 1 addition & 1 deletion activated.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

set -o errexit

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_license_directory.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# PULL IN LICENSES USING NPM - LICENSE CHECKER
npm install -g license-checker
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_linux_deb-1-gui.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o errexit

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_linux_deb-2-installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o errexit

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_linux_rpm-1-gui.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o errexit

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_linux_rpm-2-installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o errexit

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_macos-1-gui.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o errexit -o nounset

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_macos-2-installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o errexit -o nounset

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_win_license_dir.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# PULL IN LICENSES USING NPM - LICENSE CHECKER
npm install -g license-checker
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/clean-runner.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Cleans up files/directories that may be left over from previous runs for a clean slate before starting a new build

set -o errexit
Expand Down
20 changes: 9 additions & 11 deletions chia/_tests/blockchain/blockchain_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
from typing import Optional

from chia_rs import BLSCache
from chia_rs import SpendBundleConditions

from chia.consensus.block_body_validation import ForkInfo
from chia.consensus.blockchain import AddBlockResult, Blockchain
Expand Down Expand Up @@ -52,7 +52,6 @@ async def _validate_and_add_block(
expected_error: Optional[Err] = None,
skip_prevalidation: bool = False,
fork_info: Optional[ForkInfo] = None,
use_bls_cache: bool = False,
) -> None:
# Tries to validate and add the block, and checks that there are no errors in the process and that the
# block is added to the peak.
Expand All @@ -73,19 +72,22 @@ async def _validate_and_add_block(
new_slot = len(block.finished_sub_slots) > 0
ssi, diff = get_next_sub_slot_iters_and_difficulty(blockchain.constants, new_slot, prev_b, blockchain)
await check_block_store_invariant(blockchain)

if skip_prevalidation:
results = PreValidationResult(None, uint64(1), None, False, uint32(0))
if block.transactions_generator is None:
conds = None
else:
# fake the signature validation. Just say True here.
conds = SpendBundleConditions([], 0, 0, 0, None, None, [], 0, 0, 0, True)
results = PreValidationResult(None, uint64(1), conds, uint32(0))
else:
# validate_signatures must be False in order to trigger add_block() to
# validate the signature.
futures = await pre_validate_blocks_multiprocessing(
blockchain.constants,
AugmentedBlockchain(blockchain),
[block],
blockchain.pool,
{},
ValidationState(ssi, diff, prev_ses_block),
validate_signatures=False,
)
pre_validation_results: list[PreValidationResult] = list(await asyncio.gather(*futures))
assert pre_validation_results is not None
Expand All @@ -105,16 +107,12 @@ async def _validate_and_add_block(
return None
if fork_info is None:
fork_info = ForkInfo(block.height - 1, block.height - 1, block.prev_header_hash)
if use_bls_cache:
bls_cache = BLSCache(100)
else:
bls_cache = None

(
result,
err,
_,
) = await blockchain.add_block(block, results, bls_cache, ssi, fork_info=fork_info)
) = await blockchain.add_block(block, results, ssi, fork_info=fork_info)
await check_block_store_invariant(blockchain)

if expected_error is None and expected_result != AddBlockResult.INVALID_BLOCK:
Expand Down
2 changes: 0 additions & 2 deletions chia/_tests/blockchain/test_augmented_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@dataclass
class NullBlockchain:

if TYPE_CHECKING:
from chia.consensus.blockchain_interface import BlocksProtocol

Expand Down Expand Up @@ -72,7 +71,6 @@ def BR(b: FullBlock) -> BlockRecord:
@pytest.mark.anyio
@pytest.mark.limit_consensus_modes(reason="save time")
async def test_augmented_chain(default_10000_blocks: list[FullBlock]) -> None:

blocks = default_10000_blocks
# this test blockchain is expected to have block generators at these
# heights:
Expand Down
Loading
Loading