Commit Graph
66 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
Arvid NorbergandGitHub b1c9beed3f improve v2-plot support in plot-sync (#20238) 2025-11-18 10:05:50 -08:00
Arvid NorbergandGitHub 5664516dda Bump chia rs 0.34.0 (#20226)
bump chia_rs to 0.34.0
2025-11-10 17:02:10 -07:00
Arvid NorbergandGitHub 794cce7826 PoS2-prover (#20159)
* bump chia_rs to 0.31.0

* integrate new pos2 API from chia_rs into V2Prover

* fixup test_harvester_api mocking of Prover

* review-comments: rename get_quality() to get_string() on Quality protocol

* reivew comments

* fixup bump chia_rs

* restore quality string to bytes32
2025-10-22 15:40:25 -07:00
Amine Khaldi a662d559e2 Merge commit 'ecb54a5874681326b9ba0d0f33e68c8d718c8639' into checkpoint/main_from_release_2.5.6_ecb54a5874681326b9ba0d0f33e68c8d718c8639 2025-08-29 20:46:54 +01:00
ecb54a5874 support previous harvester protocol (#19994)
* support previous harvester protocol

* Update chia/protocols/harvester_protocol.py

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

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2025-08-28 12:25:38 -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
Kyle AltendorfandGitHub 7a26610e8f less pre-inting for ints (#19853) 2025-07-23 13:18:04 -07:00
Arvid NorbergandGitHub 8a874623ec compute plot filter on the harvester (#19765)
compute plot filter on the harvester instead of passing it in the NewSignagePointHarvester protocol message. With v2 plots the plot filter will differ, so it depends on which plot we find a proof in
2025-06-26 11:16:06 -07:00
Richard KissandGitHub cbfd5a53a2 Move chia.consensus.fee_estimate_store to chia.full_node (#19705)
The `chia.protocols` module no longer depends upon `chia.full_node`
2025-06-12 11:13:53 -07:00
9289a05f12 New pos format (#19616)
* bump chia_rs

* update db_graftroot test

* refactor new pos format

* fix merge

* fix import

* fix missing param in test

* merge fixes/review fixes

* test prev_tx_block

* ermove double line

* # TODO: todo_v2_plots

* fix conftests monkeypatch

* fix spelling

* remove redundant merge code

* move prev_tx test

* add not impemented test to proof of space v2

* merge duplication fix

* fix typo, raise dont assert

* bump protocol, phase out test

* integer math

* add overflow case to test

---------

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>
2025-06-10 11:27:17 -07:00
Richard KissandGitHub 5617026604 The chia.protocols module no longer depends upon chia.full_node. (#19661) 2025-06-02 10:38:17 -05: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
Kyle AltendorfandGitHub fcd20ce543 more chia_rs directly (#19520)
* more `chia_rs` directly

* maybe

* undo, kinda
2025-04-21 14:05:05 -05:00
Kyle AltendorfandGitHub 1911044e97 use chia_rs directly for more types (#19475)
* use chia_rs directly for more types

* more more

* undo submodule change...
2025-04-18 11:45:44 -05:00
Kyle AltendorfandGitHub bdcac366df use chia_rs directly for slots (#19468) 2025-04-04 07:35:06 -05:00
Kyle AltendorfandGitHub c57dea6512 use chia_rs directly for reward chain block (#19336) 2025-03-04 09:04:38 -08:00
Kyle AltendorfandGitHub dd01af2c2b use chia_rs directly for pool target (#19332) 2025-03-03 09:34:02 -08:00
Kyle AltendorfandGitHub d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -08:00
Kyle AltendorfandGitHub fb6b78ef07 use chia_rs directly for foliage (#19308) 2025-02-25 11:33: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
RigidityandGitHub 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
Arvid NorbergandGitHub 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 AltendorfandGitHub 2588600d1c more lowercase types such as in comments (#18737) 2024-10-24 11:52:10 -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
RigidityandGitHub 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
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
wersfedsandGitHub 6b678168bf chore: fix two typos (#17860)
* chore: fix typo

* chore: fix typo
2024-05-07 23:01:33 -05:00
RigidityandGitHub 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
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
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
0ae3b2823f Support for third-party, farmer-rewarded, Harvesters (#16717)
* Begin add to support for third-party fee-based harvesters

Signed-off-by: Harold Brenes <h.brenes@chia.net>

* Return FoliageBlockData back to Farmer from FullNode

* Send FoliageBlockData all the way to the harvester, if requested

* Preparing tests for 3rd party  harvester support

* Continue writing tests for 3rd party harvester

* Some cleanup. Drafting

* Test full message chain of third-party Harvester reward overwrite.

Added test that validates messages between Farmer, Harvester and FullNode
to ensure that the correct data is used when an overwritten farmer reward
address is given by a third-party Harvester service.

* Changing Harvester signature request flow
to include original data, if requested.

This makes it so that NewSignagePoint unconditionally
always includes the source of the SP hashes.

* Fix incorrect field name

* Harvester can ask for original signing data without
 overwriting the reward address also.

* Update test_farmer_handles_farmer_reward_address_override to reflect changes.

- Correct farmer API get the correct data source for the signage point signature request.
- Trivial fixes

* Removing some obsolete stuff

* Trivial

* Fix tests in updated harvester protocol

- Fix including source data when
include_source_signature_data is set.

- Set source data fields optional.

- Update test so that a timelord is started and we get proper signage points
instead of aritficial ones. This helps us
make sure we test for all the source data
cases needed from the full node.

* Refactor harvester source signing data test

- Remove older harvester signing data test
 (had missing coverage for data)

- Add harvester fee convention logging

- Begin fee convention logging test

- Refactor fixtures for harvester enhancement protocol tests

Start harvester

* Complete test for harvester fee convention

* Update SignatureRequestSourceData message

- SignatureRequestSourceData is now serialized as enum + bytes.

- Update usage locations for SignatureRequestSourceData.

- Update tests to reflect this

* Missing test from last commit

* Revert to explicit None checks, instead of relying on truthiness

Revert scratch work

* Linting

* adjust for anyio

* Moe linting

* mypy fixes

* Documentation comments

* Move third-party harvester protocol tests

Moved to own directory in order to enable `install_timelord = True`

* mypy fixes

* checkout_blocks_and_plots = True

* Update some log messages, syntax and docs

* Bump timeout in tests

* Update protocol message types for
harvester and farmer for test_missing_messages`

* Regenerate protocol message data for protocol tests

* Remove timelord requirement for tests.

Inject pre-generated signage points and blocks instead.

* Linting

* More linting

* More linting

* Merge from main and lint again

* Remove customized test plots requirements

* Rebase fix

* Coverage update

- Update valid fee quality test to be unit, instead of pseudo-integration.
- New test for invalid fee quality.
- More explicit messaging for invalid fee qualities.
- Explicitly comment out uncovered case in test.
- Update types for mypy.

* Lint

* Lint

* Lint, better logs

* add protocol file tests

* coverage

* Update formatting in fee quality logging

* Rebase fix

* Regenerate protocol_message_bytes-v1.0

---------

Signed-off-by: Harold Brenes <h.brenes@chia.net>
Co-authored-by: Harold Brenes <h.brenes@chia.net>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: Harold Brenes <152330941+haorldbchi@users.noreply.github.com>
Co-authored-by: arvidn <arvid@libtorrent.org>
2024-01-26 15:07:30 -08:00
Arvid NorbergandGitHub 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
Arvid NorbergandGitHub 95e5b97557 Use bls from chia rs (#16715)
* replace blspy imports with chia_rs imports for BLS types

* remove blspy-stubs, since we're dropping the blspy dependency. chia_rs has type stubs already
2023-11-07 09:06:52 -08:00
Arvid NorbergandGitHub 540747fae1 ban peers for 10 minutes when violating consensus rules (#16323) 2023-09-14 14:08:18 -05:00
Izumi HoshinoandGitHub 85d14f561a Added compression level and harvesting mode to harvester protocol/mes… (#15776)
* Added compression level and harvesting mode to harvester protocol/messages

* Added test

* Fixed lint error
2023-07-18 16:24:56 -05:00
Izumi HoshinoandGitHub 15fa5f3764 Added quality lookup time info to FarmingInfo (#15775) 2023-07-14 14:23:34 -05:00
dustinfaceandGitHub ede354c58f protocols: Introduce error protocol message (#15493)
* protocols: Introduce `error` protocol message

* Add `Optional` extra data `Error.data`

* Test `Err` entries
2023-07-13 13:46:20 -05:00
cecda28e84 Plot filter hard fork (#15336)
* update passed_plot_filter() to take the filter size rather than consensus constants. This allows the filter size to change by block height. make verify_and_get_quality_string() take either the height or filter size

* Add some filter_prefix_bits tests on test blocks.

* Add some filter_prefix_bits tests on simulated farmer and harvester.

* Cache filter prefix bits by challenge chain signage point hash and use that for the the lookups. This allows us to perform plot filter validation.

* Add more cases to verify_and_get_quality_string() unit tests.

* Add some tests for Farmer's respond_signatures.

* Apply Kevin's suggestion to simplify the check for passing plot filter.

* Apply Kevin's suggestions to simplify some test checks and fix a couple typos.

* Apply Kevin's suggestion to send peak height instead of filter prefix bits as part of NewSignagePoint.

* Remove no longer needed filter prefix bit related logic and make height non optional in verify_and_get_quality_string().

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2023-07-12 10:26:23 -05:00
dustinfaceandGitHub 9a81cb36b6 protocols: Give rust wallet types an alias, don't use __all__ (#15186)
* protocols: Give rust wallet types an alias, don't use `__all__`

* Refactor `types_in_module` in `test_network_protocol_test.py`
2023-05-04 13:16:33 -05:00
Kyle AltendorfandGitHub 377e95319a hint chia.protocols.pool_protocol (#14695) 2023-02-28 11:42:00 -06:00
Arvid NorbergandGitHub 68c9aafc0a move SerializedProgram to its own file (#14391)
* move SerializedProgram into its own file (to fixup type annotations)

* fix type annotations for SerializedProgram

* fixup import statements for new SerializedProgram module
2023-01-27 17:20:23 -06:00
Almog De PazandGitHub 3f97435159 dont announce none response capability to peers (#14386)
* dont announce none response capability to peers

* comment out none response handling

* skip test instead of comment out
2023-01-25 13:53:38 -06:00
dustinfaceandGitHub 42f6a883ae isort: Remove the remaining exceptions and sort the related files (#14124) 2022-12-13 17:10:55 -06:00
Almog De PazandGitHub 4d068f284a dont wait for timeout on None response (#13967)
* dont wait for timeout on None response

* handle return msg by type

* remove empty line

* isort

* improve reply check

* use map to check reply, add has_capability helper

* fix has_capability

* unused import
2022-12-07 20:47:21 -06:00
Adam KellyandGitHub 73e9d15cf7 Fee estimation. (#13645) 2022-10-18 09:12:22 -05:00
Kyle AltendorfandGitHub 3b084a165b configure isort to add the future annotations import (#13327)
* configure isort to add the future annotations import

* apply the new isort setting

* remove type ignores for new mypy (#13539)

https://pypi.org/project/mypy/0.981/

* another
2022-09-30 03:40:22 -05:00
Gene HoffmanandGitHub 1224ef924f Use codespell to catch some typos (#13557) 2022-09-28 04:27:34 -05:00
Arvid NorbergandGitHub af255a0dbf Rust coin state (#12934)
* use rust types for CoinState and RespondToPhUpdates

* improve test_network_protocol_test to support native types
2022-08-18 12:20:09 -05:00
Mariano SorgenteandGitHub 51df412652 Ms.wlt node unsynced (#12875)
* Allow different reject message

* Sync correctly when localhost is not synced

* Remove logs

* Fix getting timestamp when local node is not synced

* Precommit

* Mypy

* Debug logging

* Is trusted

* revert gui

* Remove debug logging

* Remove more debug logs
2022-08-11 13:34:23 -05:00