Without this the representation of the resulting methods look like `<function api_request.<locals>.inner.<locals>.wrapper at 0x7ff7ff655990>`. With, they are identifiable as to the method they wrap such as `<function FullNodeAPI.request_peers at 0x7fcc85d0d990>`.
* make daemon heartbeat configurable and increase default
* Fix up daemon rpc test
* Fix dumb error with parameters
* Restore formatting
* Various updates from feedback
* Update tests/core/test_daemon_rpc.py
use config value for heartbeat
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* black fixes
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* 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
* util: `message_class: Optional[Any]` -> `message_class: Any`
Im working towards more strict mypy in `chia.server.ws_connection` and
this change helps there while (i think) it still retains the same
behaviour.
* Make it `Optional[Type[Streamable]]`
* Make `CallInfo` and `Frame` a `dataclass` and move them to the top level
* Use `click` in `memory_profiler.py`
* Move `mem_profile_task` into `chia.util.profiler`
* Move `chia.util.memory_profiler.py` to `tools/analyze_memory_profile.py`
* Implement `Frame.add`
* treat Semaphore._waiters as length zero when it is None
We access the `._waiters` private attribute of the Python asyncio
`Semaphore` class. This was changed in Python 3.10.8 (and other versions)
to be initialized to `None` instead of an empty deque. Our existing
unconditional length checks failed on the new `None` default. This seems
to block syncing.
https://github.com/python/cpython/pull/97020https://github.com/python/cpython/compare/v3.10.7..v3.10.8#diff-0fee1befb15023abc0dad2623effa93a304946796929f6cb445d11a57821e737
Reported traceback:
```python-traceback
2022-10-12T20:03:59.367 full_node full_node_server : INFO Connected with full_node {'host': '65.34.144.6', 'port': 8444}
2022-10-12T20:03:59.370 full_node full_node_server : ERROR Exception: object of type 'NoneType' has no len(), {'host': '65.34.144.6', 'port': 8444}. Traceback (most recent call last):
File "/home/summa/chia-blockchain/chia/server/server.py", line 598, in wrapped_coroutine
result = await coroutine
File "/home/summa/chia-blockchain/chia/full_node/full_node_api.py", line 114, in new_peak
waiter_count = len(self.full_node.new_peak_sem._waiters)
TypeError: object of type 'NoneType' has no len()
2022-10-12T20:03:59.371 full_node full_node_server : ERROR Exception: object of type 'NoneType' has no len() <class 'TypeError'>, closing connection {'host': '65.34.144.6', 'port': 8444}. Traceback (most recent call last):
File "/home/summa/chia-blockchain/chia/server/server.py", line 608, in api_call
response: Optional[Message] = await asyncio.wait_for(wrapped_coroutine(), timeout=timeout)
File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
return await fut
File "/home/summa/chia-blockchain/chia/server/server.py", line 605, in wrapped_coroutine
raise e
File "/home/summa/chia-blockchain/chia/server/server.py", line 598, in wrapped_coroutine
result = await coroutine
File "/home/summa/chia-blockchain/chia/full_node/full_node_api.py", line 114, in new_peak
waiter_count = len(self.full_node.new_peak_sem._waiters)
TypeError: object of type 'NoneType' has no len()
2022-10-12T20:03:59.487 full_node full_node_server : INFO Connection closed: 65.34.144.6, node id: 506fe4c05ce6b72bb707471842e552307c7a547aa9ba981175db5c08fa3e47e6
```
* add LimitedSemaphore
Issue: #13282 Optional[Credential] = keyring.get_credential(keychain_service, current_user) -> AttributeError: 'NoneType' object has no attribute 'get_credential'
Freebsd platform fails to migrate in previous releases or in 1.5.1+ versions it fails to start farmer because there is a NoneType object from keyring.get_credential. This just checks for that when trying to set the legacy_keyring.
* 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
* minimal fixup for daemon signal handling regression
* test daemon shutdown response to signals
* positional
* test datalayer shutdown response to signals
* one parametrized test for the services
* colocate the daemon test
* drop sig
* add sendable_termination_signals
* oops, it was SIGTERM
* wait for the daemon
* convert datalayer to DBWrapper2 (all write)
* more read, less write
* remove unneeded connection managers
* and... close it
* data store now creates its own wrapper
* Drop unused hint DataLayer.batch_update_db_wrapper
* require named arguments for most of `DBWrapper2.create()`
* util: Set log levels per handler / Fix the log level in beta mode
Prior to this PR the log level from the beta config (`DEBUG`) wasn't
used. So the beta mode still was depending on the config level of the
service being `DEBUG`.
This PR refactors the logging setup a bit to make it even possible to
set a specific log level for each handler which is what we need to make
the `beta.log` level independent from the normal `debug.log` level.
* Add the error to the log
* Compare to `DEBUG`
* Log the handler also
* 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
* add a transactional reader as `DBWrapper2.reader()`
* contextlib.AbstractAsyncContextManager
* try a minimal test
* rework test to allow the read to finish so the write can finish the commit after that
* pylint disable
* WAL!!!
* more tests
* if TYPE_CHECKING for typing variable assignments
* future
* cover some more test cases
* 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
* cmds: Implement `chia beta` for the beta test program
* Unhide and document all `beta` subcommands
* Refactor all subcommands
* Introduce `chia beta configure`
* Introduce `chia beta status`
* Test all `chia beta` commands
* Use a separate file logger for beta logs
* Write the plotting call args to the log file
* Sort potential submissions
* Some refactoring around log file log handler creation
* JSON dump the plotting args
* Remove mempool.additions
* Don't re run the program, and remove program from mempool item
* Removals only stores item ids, and stores a list
* Move pending cache down to prevent cache dos
* Separate validation from adding to pool, and remove mypy exceptions
* Fix bug with replacing
* Add to mypy
* Revert cbgui
* precommit fail
* Properly update the seen dict
* lint error
* Fix mempool bug
* Enable mypy for a bunch of files
* Update after merge with main
* 99/260 remaining
* Address comments
* Enable more mypy
* Merge conflict mypy file
* More fixes
* pytest.ini and cb-gui
* One more flake8 fix
* Flake8 and tests
* More test fixes
* isort
* Make LGTM happy
* Update chia/full_node/block_store.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Update chia/full_node/full_node_store.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Update chia/wallet/util/peer_request_cache.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
* Apply all suggestions from PR comments
* Revert cb-gui
* 100 back to 1000, minor tweaks
Co-authored-by: Kyle Altendorf <sda@fstab.net>