394 Commits
Author SHA1 Message Date
Florin Chirica 3a1f70a9b4 Add fallback for introducer. (#19333)
* Add fallback for introducer.

* Lint.

* Lint.

* Lint.

* Fix test.

* Add test.

* Lint.:
2025-03-07 08:10:27 -08:00
Kyle Altendorf d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -08:00
d7e2358a32 build(deps): bump ruff from 0.8.5 to 0.9.6 (#19260)
* build(deps): bump ruff from 0.8.5 to 0.9.6

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.8.5 to 0.9.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.8.5...0.9.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update source to ruff 0.9.6

* Apply suggestions from code review

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
Co-authored-by: Earle Lowe <30607889+emlowe@users.noreply.github.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-02-27 09:53:34 -08:00
Kyle Altendorf 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 Altendorf 30c4ef2689 use chia_rs directly for consensus constants (#19301) 2025-02-21 10:03:17 -08:00
Rigidity 8f484e6bc9 Name wallet protocol subscription messages consistently (#19132)
* Name wallet protocol subscription messages consistently

* fix changelog

* fix name in full_node_api

* missed a spot
2025-01-14 10:12:09 -07:00
Kyle Altendorf 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
Arvid Norberg c4e714eeab [CHIA-1829] don't drop outgoing response messages (#18990)
never rate limit outgoing response messages (RespondBlock, RespondBlocks, RejectBlock, RejectBlocks). Instead, disconnect any peer sending unsolicited response blocks
2024-12-11 09:09:09 -07:00
Kyle Altendorf e7d12c7cb1 add root_path parameter to initialize_service_logging() (#18961) 2024-12-03 14:32:34 -07:00
Kyle Altendorf d1596d4386 enable flake8-tidy-imports (#18913) 2024-11-21 14:57:15 -07:00
Arvid Norberg e17e65707d improve logging of rate limits (#18907)
* improve logging of rate limits

* fix rate limiting of logs
2024-11-21 14:56:59 -07:00
Kyle Altendorf 29da4a3b57 put None at the end in Unions - incoming RUF036 (#18905) 2024-11-21 14:56:39 -07:00
Kyle Altendorf dd028574bb enable ruff flake8 async (#18899) 2024-11-20 09:00:14 -07:00
Kyle Altendorf 748c8cec8e # TODO: stop dropping tasks on the floor (#18866)
* # TODO: stop dropping tasks on the floor

* Update chia/_tests/core/data_layer/test_data_rpc.py

* no really, stop
2024-11-18 12:32:52 -07:00
Matt Hauff 604fc1feb0 [CHIA-1732] Add Ruff specific linting rules (#18845)
* Add Ruff specific linting rules

* Further tighten ignore list

* Address comments by @altendky

* One more comment @altendky
2024-11-14 15:58:12 -07:00
Kyle Altendorf f5235c2b5e add /get_log_level, /reset_log_level, and /set_log_level to all rpcs (#18843)
* add `/get_log_level` and `/set_log_level` to all rpcs

* tidy

* for py <3.11

* fixup

* add tests

* a few no covers

* add `RpcClient.reset_log_level()`

* tidy

* fixup
2024-11-14 15:57:18 -07:00
Kyle Altendorf ed74439d73 check network errors and their .__cause__ for expected error types (#18849) 2024-11-14 08:15:56 -07:00
thesemaphoreslim 075adb251e Logging changes for feeler connections (#18784)
* Check if connections are classified as feelers and log connection successes/failures to debug level only. Continue logging warnings/errors as before, just specify if they are associated with feeler connections.

* Reformatted for CI

* Flake8 formatting

* Simplified logging into one-liners where possible.
2024-11-13 09:08:08 -07:00
Matt HauffandKyle Altendorf 6c90a76b56 Tighten up ruff ignore list (#18837)
* Tighten up ruff ignore list

* Okay that fix was indeed unsafe

* enable type-name-incorrect-variance

* enable literal-membership

* enable non-augmented-assignment

* enable useless-return

* enable global-variable-not-assigned

* -

* fixup

* Clean up roff.toml from annotations

* use ignore instead of explicit re-export

* use more descriptive names

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-11-12 12:19:31 -07:00
Kyle AltendorfandAmine Khaldi ff3cf282c2 explicitly collect api methods instead of later using getattr (#18800)
* explicitly collect api methods instead of later using getattr

* api as a class itself

* tidy

* fixup

* tidier

* and...

* fixup

* oops

* mm

* hum

* fixup

* monkey patching helper

* ...

* tidy

* back to instances

* fix

* self-patch

* duplicate original request attributes

* Update chia/_tests/wallet/sync/test_wallet_sync.py

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>

* test that `@metadata.request()` fails on repeated request type

* ...

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2024-11-08 08:58:15 -07:00
Kyle Altendorf 3f6977fe65 more start_* service starting consistency (#18775)
* more `start_*` service starting consistency

* fixup

* Update start_full_node.py
2024-11-05 08:40:47 -07:00
Richard KissandKyle Altendorf 4910323dbc Replace class_for_type function with a dict (#18773)
* Pass down `class_for_type` dict instead of global function.

* Simplify

* Update chia/apis.py

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

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-11-01 09:54:10 -07:00
Matt Hauff 6084112d48 [CHIA-1553] Replace pylint with ruff (#18759)
* Replace pylint with ruff

* poetry

* remove pylint

* Address comments by @altendky

* Undo formatting

* actually undo formatting
2024-10-25 15:55:37 -07:00
Amine Khaldi f4ff9d621e CHIA-1664 Deduplicate cancel_task_safe (#18745)
Deduplicate cancel_task_safe.
2024-10-24 11:52:22 -07:00
Richard Kiss f69233aa08 Move some files closer to where they should live. (#18465)
* Move to `chia.full_node.util.safe_cancel_task`

* Move to `chia/wallet/util/pprint.py`

* Separate out `IPAddress` into `ip_address.py`
2024-10-17 14:25:05 -07:00
Kyle Altendorf 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
wjblanke 74536ba781 CHIA-1568: fix object has no attribute code errors (#18665)
* fix object has no attribute code errors

* fix
2024-10-04 09:00:29 -07:00
pengbanban 3d916bd25d chore: fix some comments (#18485)
Signed-off-by: pengbanban <pengbanban@aliyun.com>
2024-09-13 10:52:32 -05:00
Michael TaylorandKyle Altendorf a4da91a86d Changed: Enhance DataLayer Plugin Registration System for Improved Third-Party Integration (#17711)
* feat: load plugins from file

* feat: add tests

* feat: add file based datalayr plugin support

* fix: isort

* match mozilla-ca repo with main

* chore: fix linting

* add additional test coverage

* Update chia/util/misc.py

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

* move utility to datalayer folder

* fix lint

* use PluginRemote schema

* remove check

* remove check

* Update chia/data_layer/util/plugin.py

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

* load plugin using yaml.safe_load instead of json.load

* add default value to headers if doesnt exist

* fix: syntax error

* add log exception

* Update chia/data_layer/util/plugin.py

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

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-07-16 11:05:11 -07:00
Florin Chirica 25154a1045 [CHIA-883] Fix duplicate connection log spam. (#18268)
* [CHIA-883] Fix duplicate connection log spam.

* Add old condition too as a safety margin.
2024-07-05 09:50:17 -07:00
Kyle Altendorf 3061cd83d7 remove some pylint ignores (#18140) 2024-06-18 14:24:30 -05:00
Matt Hauff 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
Rigidity de75f058dd CHIA-194: CHIP-0026 Mempool Updates (#17980)
* Initial draft of mempool updates [skip ci]

* More implementation work, but capability issue [skip ci]

* Temp (will probably revert)

* Get first test passing

* Setup spent coin tests

* Add unrelated test data to make tests better

* Refactor test

* Finish testing

* Update tests

* Include removal reason and block inclusion tests

* Remove unnecessary dict

* Add missing message to test

* Fix after rebase

* Broadcast support from node for mempool updates

* Remove redundant code

* Use new_block

* Filter and early return suggestions

* Reword comments on PeakPostProcessingResult

* Improve mempool fn name and doc comment

* Bump wallet protocol version

* Add ratelimits

* Add tests for querying mempool items

* Asserts and more tests

* Add peers for spend bundle tests
2024-06-06 10:59:44 +01:00
Rigidity 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
Chris Marslender dafd8b41d9 Add optional trusted CIDR list (#18094)
* trusted_cidr list

* Tests for trusted cidrs

* only check IPs

* Fixing lint
2024-05-29 13:45:59 -05:00
Arvid NorbergandRigidity 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
Arvid Norberg 23288e78b9 only print warnings about protocol mismatches for farmer and harvester (#17801)
only print warnings about protocol mismatches for farmer and harvester. In the future, maybe this should also include trusted wallets
2024-03-29 16:06:05 -07:00
Rigidity 23e88632d5 New subscription and wallet sync protocol (#17340)
* New wallet sync protocol

* New updates to protocol and initial tests

* Bump new message ids

* Bump protocol version

* Update existing messages

* Implementation of TransactionAddedUpdate

* Improve unit tests

* Update protocol and tests to use previous height

* Testing tweaks

* Remove transaction subscriptions

* Update protocol tests

* Fix request_coin_state test

* Improve test suite, add min_amount, fix bugs

* Update protocol message serialization tests

* Resolve conflicting file

* Remove old hint store code

* Remove transaction added protocol type

* Make height optional for genesis challenge

* Test subscribe after initial state and dedupe ids in that case

* Forcing an empty commit.

* Fix new protocol tests

* Improve performance of clearing subscriptions

* Add more amounts to coin store test

* Lower max items for coin store test

* Fix test coverage, set lower max response items

* Remove add_puzzle_subscriptions and remove_puzzle_subscriptions from protocol

* Update protocol message list test

* Fix valid reply len

* Fix performance issue in query and add error codes

* Add missing message to regression tes

* Add rate limits

* Add test for hint store get_coin_ids_multi

* Increase max puzzle hash batch size and make it a constant

* Use actual params on to_bytes

* Fix test

* Actually check output of no puzzle hash coin state test
2024-03-29 12:56:20 -07:00
Arvid NorbergandHarold Brenes f200fcf16b Separate protocol versions (#17791)
* use separate protocol versions for the different services

* Validate protocol version on handshake

* simplify checking protocol version for incoming connections

---------

Co-authored-by: Harold Brenes <h.brenes@chia.net>
2024-03-29 07:40:06 -07:00
Felix Brucker d09b61b72d Pass full version in Handshake (#15679)
* Pass full version in Handshake

* Move chia version conversion into crawler

* Rename to overloaded `chia_short_version` and always return str

* Ensure we extract major.minor.patch from invalid pep440 if available
2024-03-27 10:40:47 -07:00
Kyle Altendorf 6b42878ca2 update to aiohttp 3.9.2 (#17726)
* update to aiohttp 3.9.2

* correct testing of bans

* fixup

* again

* again (again)

* 🍌 ooh-ooh-aah-aah 🐒

* add back a test that banned host can not connect
2024-03-25 11:58:16 -07:00
Earle Lowe 48e4039e58 Update black to 24.1.1 and update source as needed (#17499)
* Update source to black 24 spec

* update black to 24.1.1

* update pylint to ignore multiple-statements

* update test file

* black updates

* format updates

* Update test_network_protocol_files.py

* Update test_network_protocol_files.py
2024-03-13 11:08:19 -07:00
Amine Khaldi a38d24ebcf Merge commit '320d8815911ca136807bb36493b567ce7e0deee1' into checkpoint/main_from_release_2.2.0_320d8815911ca136807bb36493b567ce7e0deee1 2024-03-01 19:32:13 +01:00
Arvid Norberg 036313fc7e remove support for migrating peers from legacy file format (#17517) 2024-02-20 13:11:00 -08:00
320d881591 Send RewardChainBlockUnfinished to third-party harvesters (#17435)
* Send RewardChainBlockUnfinished to the harvester

- Simplify data pasing in request_signed_values

* Fix instances where the rc_block_unfinished must be sent

* Lint, fix test, generate protocol messages

* Rate Limit Adjustment for RequestSignedValues (#17481)

* Further bump request_signed_values rate limit

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
Co-authored-by: Luna <96448399+DaOneLuna@users.noreply.github.com>
2024-02-14 11:09:58 -08:00
Arvid Norberg bdfffca5ab improve handling of UnfinishedBlocks (#17247)
* update full_node_store to support multiple UnfinishedBlocks with the same reward hash

* extend full node store to support recording outstanding requests for v2 unfinished blocks

* add test for full_node_store

* simplify creation of UnfinishedBlock in test_full_node.py

* extend UnfinishedBlock protocol to support distinguishing between unfinished blocks with the same partial hash but different foliage

* add test for NewUnfinishedBlock and NewUnfinishedBlock2

* when asking the full_node_store for an unfinished block, only by its partial hash; return the highest ranking (lowest foliage tx block hash)
2024-01-26 13:20:03 -08:00
Felix Brucker 82f3b06051 Add support for defining a list of full node peers to connect to (#17369) 2024-01-23 10:00:54 -08:00
wjblanke 4ec439f789 measured new_signage_point_harvester size with 100 pools for limit (#17350) 2024-01-19 20:51:23 -06:00
Amine Khaldi 3a2be22c44 Merge commit 'a4cab829edd4f16dd89b29c7234ed39c23c5dcaa' into checkpoint/main_from_release_2.1.4_a4cab829edd4f16dd89b29c7234ed39c23c5dcaa 2023-12-22 23:29:59 +01:00
wjblanke a4cab829ed Performance tweaks (#17155)
* changed default peers from 80 to 40. switched auto db_sync default to NORMAL instead of FULL

* fixed default

* add defaults to config query
2023-12-22 16:28:31 -06:00