* 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
* Extract `respond_signatures` logic
* Add `call_api_of_specific` method to `ChiaServer`
* Fix typehint for test fixture `farmer_one_harvester`
* Make test helper `add_dummy_connection` work with any node type
* Add `reply_types` to `request_signatures` of harvester
* Fix duplicate SP processing with multiple nodes
* Handle state in `request_signed_values`
* Add set typehint
* Add comment re `_process_respond_signatures()` usage
* Fix imports
* Fix wording to not confuse with SignedValues message
* 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>
* 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>
* Limit rate of spammy log messages when farmer is disconnected from pool
* Remove typo
* Use reliably increasing clock
* Make test faster, more reliable
* more explicit and complete handling of api decorator data
* fix
* .message_class
* actually, those are different types...
* tweak
* simplify
* learn that functools.wraps copies random attributes
* hack the ~planet~ `@api_request` decorator
* R not T
* more future
* implementation detail renames
* 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
* provide a skeleton hint protocol for rpc apis
* more
* more self.custom_get_connections = None
* fix RpcApiProtocol.service hinting
* catch up with RpcApiProtocol._state_changed()
* FullNode.server is now non-optional. 'ish
* drop another todo
* custom_get_connections -> get_connections
* just make get_connections() a mandatory method with a helper provided
* lots
* try again
* ._start_with_fingerprint()
* fill out the Service generic parameter in start scripts
* ... instead of pass
* add docstrings to the protocols
* remove no longer needed hasattr/not None checks
* remove outdated comment
* refactor Harvester._is_shutdown to ._shut_down
* No network type
* Use selected network
* remove NETWORK_TYPE
* Don't warn on invalid key, and remove from config
* Remove bytes32
* Put back the warning log
* farmer: Adjust notifications from the farmer to the UI
- Only send the data for the harvester which actually sent an update
- Notify for each loaded batch during initial loading
* Enable improved farmer/harvester GUI
* farmer|rpc|tests: Implement paginated harvester plot endpoints
* Simplify filtering
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Let the API handle the exceptions
* Simplify the other filtering too
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Simplify count assertions
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Refactor `is_filter_match` to `plot_matches_filter`
And just convert to `Plot` in tests.
* Move `chia.util.misc.KeyValue` to `chia.rpc.farmer_rpc_api.FilterItem`
* Rename `peer_id` to `node_id` to be match `get_harvesters_{summary}`
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Remove _set_state_changed_callback from harvester_api.py as its never actually called
In rpc/rpc_server.py:318, what is actually called is rpc_server.rpc_api.service._set_state_changed_callback, so the version of this in harvester.py is what is actually used
* Remove duplicate initial value for state_changed_callback in init
* _state_changed -> state_changed so it can be called from harvester_api as well
* Add farming info state_changed event from harvester
* Add time to farming_info event
* Add [pre_]validation_time to block event
* Remove unused set_state_changed_callback on full_node_api. This is actually called on full_node_rpc_api.service
* Remove unused set_state_changed_callback on crawler_api. This is actually called on crawler_rpc_api.service (crawler)
* Remove unused set_state_changed_callback on farmer_api. This is actually called on farmer_rpc_api.service (farmer), not the api itself
* Add state changed event for submitting a partial
* Lint fixes
* protocols|server: Define new harvester plot refreshing protocol messages
* protocols: Bump `protocol_version` to `0.0.34`
* tests: Introduce `setup_farmer_multi_harvester`
Allows to run a test setup with 1 farmer and mutiple harvesters.
* plotting: Add an initial plot loading indication to `PlotManager`
* plotting|tests: Don't add removed duplicates to `total_result.removed`
`PlotRefreshResult.removed` should only contain plots that were loaded
properly before they were removed. It shouldn't contain e.g. removed
duplicates or invalid plots since those are synced in an extra sync step
and not as diff but as whole list every time.
* harvester: Reset `PlotManager` on shutdown
* plot_sync: Implement plot sync protocol
* farmer|harvester: Integrate and enable plot sync
* tests: Implement tests for the plot sync protocol
* farmer|tests: Drop obsolete harvester caching code
* setup: Add `chia.plot_sync` to packages
* plot_sync: Type hints in `DeltaType`
* plot_sync: Drop parameters in `super()` calls
* plot_sync: Introduce `send_response` helper in `Receiver._process`
* plot_sync: Add some parentheses
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* plot_sync: Additional hint for a `Receiver.process_path_list` parameter
* plot_sync: Force named parameters in `Receiver.process_path_list`
* test: Fix fixtures after rebase
* tests: Fix sorting after rebase
* tests: Return type hint for `plot_sync_setup`
* tests: Rename `WSChiaConnection` and move it in the outer scope
* tests|plot_sync: More type hints
* tests: Rework some delta tests
* tests: Drop a `range` and iterate over the list directly
* tests: Use the proper flags to overwrite
* test: More missing duplicates tests
* tests: Drop `ExpectedResult.reset`
* tests: Reduce some asserts
* tests: Add messages to some `assert False` statements
* tests: Introduce `ErrorSimulation` enum in `test_sync_simulated.py`
* tests: Use `secrects` instead of `Crypto.Random`
* Fixes after rebase
* Import from `typing_extensions` to support python 3.7
* Drop task name to support python 3.7
* Introduce `Sender.syncing`, `Sender.connected` and a log about the task
* Add `tests/plot_sync/config.py`
* Align the multi harvester fixture with what we do in other places
* Update the workflows
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Set keychain_proxy to None in await_closed() to support reinitialization.
* Added `shutting_down` param to _await_closed() to control whether the keychain_proxy is closed.
* minor lock scope reduction
* use the lock in tests
* Use the passed root_path in configure CLI command
* switch to lock_and_load_config()
* oops
* cleanup
* make _load_config_maybe_locked() private
* black
* Remove future improvement opportunity TODO comment
* Add configuration locking
Extracted from https://github.com/Chia-Network/chia-blockchain/pull/10631
* note that fasteners will likely be replaced by filelock
* Fix test_multiple_writers on macOS
* create_all_ssl() doesn't need to be inside the config access lock
* add warnings about not using async within get_config_lock() get lock contexts
* no need to pre-touch the lock file
* .yaml.lock instead of just .lock
* test_multiple_writers() is sync
* Revert "add warnings about not using async within get_config_lock() get lock contexts"
This reverts commit 681af3835b.
* reduce lock context size in chia_init()
* use an exit stack in load_config()
* avoid config existence precheck
* only lock around the read in load_config()
* do not raise e, just raise
* tidy new imports
* fix queue empty check in test_config.py
* remove commented out code in test_config.py
* remove unused import
Co-authored-by: Jeff Cruikshank <jeff@chia.net>
* farmer: Bump next update times regardless of the request results
* farmer: Drop additional "success/failure" log logic
We already print the PUT response in `_pool_put_farmer` the other parts
just lead to confusion if the pool didn't implement the PUT correct.
* farmer: Print error responses from the pool with `WARNING` log level
Due to the bug which was fixed in #9922 some pools obviously still have
incorrect authentication public keys from their farmers. This PR is to
make sure that the farmers update their authentication public key on the
pool if they get an `INVALID_SIGNATURE` response error from a `GET
/farmer`.
* pool_wallet: Deterministic derivation of auth key, and only count poolWallets for indeces
* cli: Use the same limit for cli creation
* farmer: no more auth keys in config
* farmer: handle case of no authentication sk
* farmer: remove async, and fix test
* lint
* test: Add a test for many pool wallets, and user store
* test: Wait for wallet to be synced in test
* wallet: fix startup (no dns servers) and change to server checking of plotnfts
* cli: change to server checking
* tests: fix user store test
* Improve caching
* PR comments
* Remove useless class
* Try to fix test again