Commit Graph
53 Commits
Author SHA1 Message Date
Matt HauffandGitHub 40db4635a8 [LABS-245] Enable PEP604 Ruff rules (#20269)
* Enable PEP604 Ruff rules

* Fix harcoded signature in test

* Hack CLVMStreamable test with note to fast follow
2025-11-18 12:34:00 -08:00
Almog De PazandGitHub 4c1e3a2204 dont add solver peer (#20234)
* dont add solver peer

* pass solver peer in tests
2025-11-07 17:55:15 -07:00
Almog De PazandGitHub 6bd9360f5e Farmer solver networking (#20019)
* farmer connects to solver

* default solver peer

* configure solver peer

* solver trusted peers

* minor fixes

* connect to solver cli

* fix and rename fixture

* pr fixes

* load new service config if missing

* fix failling test

* fix test
2025-09-29 09:39:10 -07:00
52cd1086a7 [CHIA-3593] New solver service (#19938)
* add solver service

* lint

* wire service evrywhear

* prover protocol and v2Prover

* format name

* format

* refactor filename

* tests/raise unimplemented

* add get_filename_str to mock

* rename methods

* rename

* refactor

* improve coverage

* test from bytes

* harvester and farmer v2 support

* solver service, api, rpc

* clenup, add config to tests

* pre-commit

* remove mocks from test

* aync solver, fixtures, tests

* naming

* remove redundant farmer message

* solver fixtures and tests

* change quality_string to quality_chain

* fix service tests, cleanup

* name change, fix comments

* lint

* rename to partial proof

* network protocol test, use ThreadPoolExecutor

* naming and types

* check filter for both plot versions

* update network protocol tests

* more pr comments addressed

* fix rename

* fix network formatting error

* change to Assertion errors

* add todo

* remove strength from SolverInfo

* more pr comments, fix test to catch assertion

* revert strength

* test and comments

* rename to partial proof

---------

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>
2025-08-22 15:26:09 -07:00
Richard KissandGitHub 4e6038ba3b Simplify dependencies wrt chia.server (#19895)
Remove some dependencies in `chia.server`.
2025-08-06 12:03:47 -07:00
6050235bdb [CHIA-3043] Add (hopefully) non-controversial ruff rules (#19684)
* Add (hopefully) non-controversial ruff rules

* mypy-exclusions.txt

* PIE

* Fix pre-commit?

* PYI

* RSE

* S + ignores

* Whitespace fix

* Re-add build-init-files.py

* Add comment about security ignores

* Update mypy-exclusions.txt

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* Fix the executable status of build-init-files.py

* Set executable bit for tools/run_block.py and readd shebang

* Fix new errors

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-06-11 08:36:08 -07:00
Richard KissandGitHub a803d18c3b The chia.protocols module no longer depends upon chia.server. (#19636)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->

The modules `chia.protocols` and `chia.server` form a dependency loop.
This change at least removes the direct dependency of `chia.protocols`
on `chia.server`.

### Purpose:

<!-- Does this PR introduce a breaking change? -->

### Current Behavior:

### New Behavior:

<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->

### Testing Notes:

<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2025-05-29 09:24:29 -07:00
Richard KissandGitHub e4ccb8024f Fix chia.util <= chia.server dependency (#19629)
Move `get_unresolved_peer_infos` and `set_peer_info` from
`chia.util.config` to `chia.server.resolve_peer_info.py` so that
`chia.util` no longer depends upon `chia.server`.
2025-05-23 09:06:11 -05:00
Kyle AltendorfandGitHub a90f04ff48 move chia.types.aliases to chia.server.aliases (#19535)
* move `chia.types.aliases` to `chia.server.aliases`

* touchup
2025-04-25 13:15:04 -05:00
Kyle AltendorfandGitHub d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -08:00
Kyle AltendorfandGitHub e446d6b726 use chia_rs directly for sized ints (#19303)
* use chia_rs directly for sized ints

* Update data_layer_rpc_api.py
2025-02-24 14:33:09 -08:00
Kyle AltendorfandGitHub 30c4ef2689 use chia_rs directly for consensus constants (#19301) 2025-02-21 10:03:17 -08:00
Kyle AltendorfandGitHub 1ffa73e99e task referencer (#18914)
* put otherwise unheld tasks into the pit

* and the rest too

* cull less often

* task referencer

* private

* report unexpectedly unreferenced tasks

* also warn for automated catching in tests

* reporting task

* undo some

* fixup for 3.9

* ban asyncio.create_task

* oof

* simplify including using `Task.add_done_callback()` for culling
2025-01-02 10:13:51 -07:00
Kyle AltendorfandGitHub dd028574bb enable ruff flake8 async (#18899) 2024-11-20 09:00:14 -07:00
Kyle AltendorfandGitHub 9c8557a1f8 Remove Python 3.8 support and update source to 3.9 standards (#18687)
* manual python 3.8 removals

* poetry

* pyupgrade

* black

* isort

* manually tidy imports

* work around shadowed type

* catch up build network protocol files for pyupgrade changes

* placate pylint

* re-enable 20.04

* placate flake8
2024-10-16 14:21:15 -07:00
Chris MarslenderandGitHub b14d912d3c Crawler Loop Fix + Test Improvements (#18329)
* Change a bunch of info logs back to warning in crawler, since crawlers are typically run in warning mode, to avoid the info log connection spam

* Ensure that the crawler loop ONLY doesn't start when in tests

* Rename the crawler service to crawler_service_no_loop, so defaults can also be tested WITH a loop

* Test crawler loop modes

* Add message when we received state chaged callback

* Add log to indicate crawling has started and how many peers we're crawling
2024-07-17 12:17:42 -07:00
Matt HauffandGitHub 3637bd33c6 Delete chia.util.misc (#18170)
* Move VersionedBlob to chia.util.streamable

* Move format_bytes to chia.cmds.cmds_util

* Move format_minutes to chia.cmds.cmds_util

* Move prompt_yes_no to chia.cmds.cmds_util

* Move get_list_or_len to from chia.plot_sync.receiver

* Move validate_directory_writable to chia.cmds.cmds_util

* Move *termination_signals to test_services

* Move UInt*Range to chia.util.streamable

* Create chia.util.batches

* Create chia.server.signal_handlers

* Create chia._tests.util.split_managers

* Move ValuedEvent to chia.types.transaction_queue_entry

* Move available_logical_cores to chia.util.cpu

* Move caller_file_and_line to chia._tests.util.misc

* Move satisfies_hint to chia._tests.wallet.test_singleton_lifecycle_fast
2024-06-18 08:27:17 -05:00
RigidityandGitHub a9e8e4b91a CHIA-623: Split capabilities for each service (#18096)
* Move capabilities underneath Capability

* Split default capabilities for each service

* Make get_capabilities take in node_type

* Remove optionality

* Refactor get_capability_overrides
2024-06-04 17:01:59 +01:00
Matt HauffandGitHub aefe7fdf28 Observer Mode (#17792)
* Observer Mode

* Address comments by @altendky

* Change RPC default and fix test coverage

* Add test coverage for rpc marshaller

* Fix @marshal util to return proper transactions
2024-05-07 13:39:25 -07:00
8eb41c59d7 bump chia_rs to 0.7.0 (#17909)
* bump chia_rs to 0.7.0 and transition using sized ints and sized bytes from chia_rs

* transition StructStream to use the version from chia_rs

* Initial port of ConsensusConstants to Rust

* Revert max cost calculation to use int for now

* Remove SizedBytes, since it was moved to chia_rs

* Remove test_struct_stream, since it was moved to chia_rs

* use [0] * 100 instead of bytes(100)

* restore wallet_rpc_api, and make type hints match JsonDict (Any)

* fixup ConsensusConstants; restore return value of calculate_prefix_bits()

* fixup ConsensusConstants; construct int for intermedate cost values

* fixup ConsensusConstants; construct int for intermedate cost values

* fixup: transition StructStream to use the version from chia_rs

* revert changing type annotations for json dict

---------

Co-authored-by: Rigidity <me@rigidnetwork.com>
2024-04-26 08:06:25 -07:00
Amine KhaldiandGitHub 960274899e Move SimulatorFullNodeService type alias to start_simulator (#17875)
Move SimulatorFullNodeService type alias to start_simulator.
2024-04-18 14:26:36 -07:00
Kyle AltendorfandGitHub 65dfbbb6aa add Service type variables for each combination (#16970) 2023-11-30 13:38:38 -06:00
Kyle AltendorfandGitHub fbdb27bef1 managers for services (#16670) 2023-11-16 19:21:12 -06:00
Amine KhaldiandGitHub d054314a18 Move generate_in_memory_db_uri to the chia/util to avoid importing tests from the chia package (#16752)
Move generate_in_memory_db_uri to the chia/util to avoid importing tests from the chia package.
2023-11-09 09:04:03 -08:00
Amine KhaldiandGitHub 97fb769755 Speed up test runs by leveraging in-memory databases within reason (#16637) 2023-11-01 10:56:40 -05:00
ef98949a30 Add support for lists of peers in the config (#16376)
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-10-24 12:33:19 -05:00
Earle LoweandGitHub 5ea14326c9 Refactor daemon simulation test (#16081) 2023-10-04 12:16:13 -05:00
Kyle AltendorfandGitHub f1059bcb44 @dataclass FullNode to avoid risks of instances without attributes set (#1332) 2023-10-03 14:33:19 -05:00
Kyle Altendorf b0491678c9 Merge commit '07e2a0b8bb75d72a4db689289109c69eb8e81234' into checkpoint/main_from_release_2.1.0_07e2a0b8bb75d72a4db689289109c69eb8e81234 2023-09-30 21:04:23 -04:00
Kyle AltendorfandGitHub f75001789d add try/finally to setup_services context managers (#16407) 2023-09-26 14:51:12 -05:00
Kyle AltendorfandGitHub 185240d15c hint chia.simulator.setup_services/start_simulator (#16412) 2023-09-26 14:49:53 -05:00
wjblankeandGitHub 07e2a0b8bb Wallet workaround for python issue 97641 and update anyio for issue 589 (#16408)
* add arvid's fix to wallet as well

* update anyio to 4.0.0
2023-09-25 20:36:44 -05:00
Kyle AltendorfandGitHub cd9d6eff33 add SizedBytes.random()/.secret(), replace token_bytes() usage (#16276) 2023-09-14 14:08:01 -05:00
Matt HauffandGitHub 13eaf1fd10 Refactor simulator setups from async generators to context managers (#16126) 2023-09-12 10:01:28 -05:00
Kyle AltendorfandGitHub 353f12d5a3 commonize signal setup (#13568)
* commonize signal setup

* add signal setup for async handlers

* future

* Update misc.py

* catch up

* logging

* missed one

* context manager and waiting for signal handlers to complete

* correct logging

* fixup

* fixup
2023-09-06 13:01:11 -05:00
Almog De PazandGitHub 67b3cec8a9 Timelord peak change (#15856)
* skip if known heavier unfinished block

* change comment

* None check

* None check

* None check

* test known heavier block skip

* rename

* tests

* lint

* fix test

* ccomment out lower weight case

* fix rc_hash check

* refactor check

* add init file

* fix setup_timelord call

* use class for tests

* add config to tests

* more lint

* more lint
2023-09-01 13:13:22 -05:00
Arvid NorbergandGitHub ccd715119e try again a few times if the temporary DB file can't be removed (#16108)
try again a few times if the temporary DB file can't be removed, during simulation shutdown
2023-08-23 23:02:52 -05:00
Jack NelsonandGitHub 0d36874caa Refactor Seeder & Crawler code + add tests (#15781)
* Cleanup seeder & mypy all files

holy crap mother of all tech debt this was horrid

* Make UDP Protocol class a dataclass & separate out functions.

* add TCP protocol class to DNS server

* Fix mypy types & other cleanup

also fix a couple bugs

* Add seeder and crawler tests

* change log levels

* re add db lock timeout

oops

* add edns & edns tests

* fix repeated shutdown on close signal

* fix binding to use both ipv6 and ipv4

whyyyyyyy

* add ipv6 and ipv4 tests + add ipv4 if windows
2023-08-11 05:25:19 -05:00
f96690bdc5 Renaming instances of 'decompresser' to 'decompressor' (#15751)
* Renaming instances of 'decompresser' to 'decompressor'

* Making 'parallel_decompressors_count' singular

* Using chiapos version that has matching spelling

* Putting the clsp file back where I found it

* fix ver

---------

Co-authored-by: Jack Nelson <j.nelson@chia.net>
2023-07-13 09:59:51 -05:00
7b67fe0a4a compressed plot support (#15702)
* Compression branch.

* disable GPU farming in tests

---------

Co-authored-by: Florin Chirica <fchirica96@gmail.com>
2023-07-12 16:49:15 -05:00
49140b2b3c server: Introduce ApiProtocol (#15466)
* server: Introduce `ApiProtocol`

* genericize (#5)

* `ApiProtocol.api_ready` -> `ApiProtocol.ready()`

* Add `ApiProtocol.log` and give APIs separate loggers

* Fix `CrawlerAPI`

* Drop some unrelated removals

* Fix some of the generic hinting

* Revert some changes in `timelord_api.py`

* Fix `CawlerAPI` readiness

* Fix hinting

* Get some `CrawlerAPI` coverage

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-06-13 20:12:25 -05:00
dustinfaceandGitHub d6a2a9aa5d seeder: Drop CrawlerAPI.__getattr__ (#15489)
* Test sending unknown messages to the crawler

* Drop `CrawlerAPI.__getattr__`

* Use a real crawler service for the test
2023-06-13 15:25:39 -05:00
Kyle AltendorfandGitHub 5d14f0a208 add test coverage for starting a node with an existing db (#15338)
* add test coverage for starting a node with an existing db

* Update chia/simulator/setup_services.py
2023-05-23 14:27:10 -05:00
dustinfaceandGitHub a7e7b9a290 server: Rework config peer resolving and connection handling (#14997)
merging as the snyk issue is confirmed a false positive
2023-04-14 15:22:24 -06:00
dustinfaceandGitHub fe321ea488 daemon: Fix server shutdown / wait for it (#14674)
* Create the shutdown event inside `WebSocketServer.__init__`

* Rename `WebSocketServer.start` to `run` and make it a contextmanager
2023-02-28 11:43:24 -06:00
Kyle AltendorfandGitHub 12ddc928c2 gc.collect() before unlinking the db in some tests (more) (#14702)
https://github.com/Chia-Network/chia-blockchain/pull/14491
https://github.com/python/cpython/issues/97641
2023-02-28 11:40:17 -06:00
dustinfaceandGitHub 5d55cd6a22 simulator: Replace localhost -> 127.0.0.1 in farmer/harvester config (#14165)
We create new configs in `setup_farmer` and `setup_harvester` and they 
contain `localhost` defaults. Replace it here also like we do it in 
`BlockTools` to consistently use `127.0.0.1` instead of `localhost` in 
tests.
2023-02-05 22:16:18 -06:00
Kyle AltendorfandGitHub 649e5ac4b0 gc.collect() before unlinking the db in some tests (#14491)
https://github.com/python/cpython/issues/97641
2023-02-04 15:05:26 -06:00
Almog De PazandGitHub 18c95da752 add local max subscription config (#14188)
* add local max subscription config

* add and use trusted wallet config
tests

* lint

* unused import

* break early

* dont break because we need to iterate for hints

* fix off by one

* lint
2023-01-02 21:38:38 -06:00
dustinfaceandGitHub fbc3127bd5 util: Rework get_host_addr (#14068)
* util: Rework `get_host_addr`

* Require `prefer_ipv6` to be named

* Remove outdated comment

* Improve result selection
2022-12-13 09:48:41 -06:00