Commit graph

3244 commits

Author SHA1 Message Date
dustinface
d9c97e15e4
isort: Remove all chia.util exceptions and sort the related files (#13939) 2022-11-17 15:32:18 -06:00
dustinface
977d2e97cd
isort: Remove all chia.cmds exceptions and sort the related files (#13940) 2022-11-17 15:32:03 -06:00
Kronus91
cf944f0260
Return minted NFT ID & Allow transfer NFT with NFT ID (#13928) 2022-11-17 13:51:02 -06:00
Arvid Norberg
27cbd08229
Factor out member functions of ProofOfSpace to be free functions (#13930) 2022-11-17 13:46:22 -06:00
Almog De Paz
f85bc15d4b
setup services refactor (#13905)
* always return service

* adjust setup_simulators_and_wallets

* adjust setup_simulators_and_wallets

* refactor setup_simulators_and_wallets
add setup_simulators_and_wallets_service

* revert unneeded change

* fix broken fixtures

* lint, fix data_rpc init_wallet_and_node

* fix two_wallet_nodes fixture

* fix two_nodes_sim_and_wallets_services fixture

* fix one_wallet_node_and_rpc fixture

* lint
2022-11-16 20:40:03 -06:00
dustinface
e24263e21c
Reuse outbound_handshake (#13895) 2022-11-16 13:58:40 -06:00
dustinface
2ff987573d
Simplify ChiaServer.close_all_connections (#13916) 2022-11-16 13:57:30 -06:00
dustinface
5c861db42f
Make WSChiaConnection a dataclass (#13906)
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-16 13:38:28 -06:00
dustinface
643b29e636
Drop broken message types logging (#13914)
Seems like the idea was to log an overview of message types for the 
currently active api calls whenever we have multiples of 100 running. 
This currently isn't working at all because `len(message_types) % 100 == 
0` will only trigger if there are 100 different message types in the 
counter (we don't even have that much different messages). A fix would 
be to check `message_types.total() % 100 == 0`. But then, if we hover 
around 100 active messages this will repeatedly trigger logs since we 
decrement for each processed message, im not sure this all makes much 
sense and we anyway log all received message types with `DEBUG` logs so 
i decided to just drop this. If someone thinks we should keep it with 
the fix or has ideas to make this a more reasonable log instead of 
dropping it, let me know :)
2022-11-16 10:44:48 -06:00
Almog De Paz
ac2203eda8
Refactor test utils for import availability outside of repo (#13880)
* refactor for import availability outside of repo

* refactor for import availability outside of repo

* small revert

* newline

* fix imports

* fix pre-commit issues

* types issort, adapt mypy ignore

* redundant imports

* move files from util to simulator

* run pre_commit

* remove setup_nodes/keyring from isort.cfg

* fix asyncio import
2022-11-15 18:51:05 -06:00
Almog De Paz
ce94f85fa3
Don't validate weight proof on log_in (#13775)
* dont validate on log_in

* data integrity
2022-11-15 18:50:07 -06:00
Kyle Altendorf
a531580868
rework around tx records and offer takes (#13603)
* mixed rework around tx records and offer takes

* more

* wait for wallets

* process_transaction_records() -> process_transactions()

* correct to use new bundles= parameter a couple spots

* .process_transaction_records()

* .process_spend_bundles()
2022-11-15 18:42:45 -06:00
dustinface
8e2e51a8c8
Add optional outbound parameter to get_connections (#13879) 2022-11-15 17:40:16 -06:00
Earle Lowe
f30f0b3512
Call close callback for already closed connections (#13727)
* always call close callback

* Some further explorations

* some more explorations

* Add delay while connections are closed in test

* Add a delay to make sure connections drain

* Update chia/server/server.py

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

* Update tests/connection_utils.py

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

* use log_exceptions context manager

* set close flag correctly

* Added callback type and other changes

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-15 16:23:06 -06:00
Kronus91
3879cea12e
Delete DID wallet after transfer (#13389)
* Delete DID wallet after transfer

* Adjust tests

* Fix merge

* Remove rl_wallet

* Fix tests

* Fix DID bugs

* Add tests

* Add additional spend for DID update

* Fix unit test

* Handle bugged DID

* Cover empty hint case

* Fix unnecessary DID deletion
2022-11-14 11:12:28 -06:00
dustinface
2706f5995b
server: Enable and fix mypy in ws_connection.py (#13878)
* server: Enable and fix `mypy` in `ws_connection.py`

* Apply suggestions from code review

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

* Tweak error message

* Tweak formatting

* Make `WSChiaConnection.close_callback` optional

* Tweak assert message

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

* Don't provide a default for `close_callback`

* Adjust assertion

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-12 14:18:11 -06:00
Kronus91
df519c8a5d
Add did_message_spend API (#13890)
* Add did_message_spend API

* Add get DID info API

* Resolve comments

* Add hints
2022-11-12 14:15:44 -06:00
Kyle Altendorf
5cf8a291f7
adjust approach to optionality around ApiMetadata (#13888) 2022-11-10 19:58:12 -06:00
dustinface
978c3708aa
Catch exceptions raised when resolving plot directories (#13786)
* plotting: Catch exceptions raised when resolving plot directories

* `try/except/else` -> `try/except/continue`
2022-11-10 19:49:31 -06:00
Kyle Altendorf
09f89c0257
create tasks for stopping services (#13848)
(cherry picked from commit 3384714f2e3e0bdc8c3d3741027e9e4fb69a6002)
(cherry picked from commit 855b5d1a96)
2022-11-10 14:03:42 -06:00
Matt Hauff
a29ab7dbd1
Fix trades between fungible assets <-> fungible assets + nfts (#13825)
* Fix fungible <-> fungible + royalties

* lint
2022-11-10 14:00:33 -06:00
Matt Hauff
ba6a5a3b63
Create royalty payments in fewer coins (#13858)
* Create royalty payments in fewer coins

* flake8

* mypy
2022-11-10 03:04:52 -06:00
Jack Nelson
72e83181cb
add target_coin amount to coin selection cli (chia wallet coins) (#13716)
* add target_coin ammt to wallet coin combine func

* fix slight bugs
2022-11-10 03:03:59 -06:00
dustinface
0befdec071
server: Introduce WSChiaConnection._get_extra_info (#13876) 2022-11-09 17:41:50 -06:00
dustinface
50b630aee9
server: Don't pass the queue into WSChiaConnection._wait_and_retry (#13877) 2022-11-09 14:57:59 -06:00
dustinface
8394857ca2
server: Return earlier in WSChiaConnection.__getattr__ (#13875)
* server: Return earlier in `WSChiaConnection.__getattr__`

* Tweak message names
2022-11-09 14:19:43 -06:00
dustinface
0e5168b3cf
util: Hint ApiMetadata.message_class with Optional[Type[Streamable]] (#13870)
* 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]]`
2022-11-09 14:19:06 -06:00
Adam Kelly
ecb413d888
Remove incorrect log warning message. (#13857)
Remove incorrect log warning message. The Bitcoin fee estimator is designed to ignore calling remove_tx multiple times for the same tx.
2022-11-09 14:18:38 -06:00
dustinface
d3e1698cc8
util: Some cleanups for the memory profiler (#13809)
* 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`
2022-11-09 14:17:43 -06:00
wjblanke
5c38a39077
upped the number of file handles for madmax (#13856)
* upped the number of file handles. this won't affect the hard limit but only soft limits set previously

* Set soft limit to max (hard limit)
2022-11-09 03:31:51 -06:00
Sebastjan Trepca
962ad8abeb
[#13737] added total balance check, updated error messages (#13866)
added total balance check, updated messages
2022-11-08 21:52:32 -06:00
dustinface
24961dd02c
server: Drop some unused code (#13867)
* Drop unused `Delivery` enum

* Drop unused `get_outgoing_connections`

* Drop `connection_utils.py`
2022-11-08 18:04:56 -06:00
Kronus91
35d5858a06
Add verify signature API (#13732)
* Add verify signature API

* Refine response

* Resolve comment

* fix pre-commit
2022-11-08 10:23:06 -06:00
dustinface
50d148eadd
Cleanup WSChiaConnection imports/usage (#13868) 2022-11-08 10:10:59 -06:00
Matt Hauff
e5f7232098
Search for launcher with correct spent_height (#13827)
* Search for launcher with correct spent_height

* Remove unecessary assert

* Add a PRIMARY KEY to the retry store
2022-11-08 00:04:18 -06:00
Kyle Altendorf
095b9c337e
adjustments for new mypy (#13859)
* adjustments for new mypy

* assert something
2022-11-07 17:38:40 -06:00
Kyle Altendorf
cff8efff2b
SQLite log the full node db version check (#13755)
* SQLite log the full node db version check

* Update full_node.py
2022-11-07 09:07:32 -06:00
Kyle Altendorf
8ff73e961a
add LimitedSemaphore (#13642)
* 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/97020

https://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
2022-11-06 11:38:25 -06:00
Chida82
bc6371aa83
add strem like procedure and log progress (#13828) 2022-11-05 17:51:17 -05:00
Arvid Norberg
985f170383
remove unused unwrap() function (#13818) 2022-11-05 17:50:56 -05:00
Jeff
7b781cbf12
add_private_key now returns the fingerprint of the added key (#13814)
* add_private_key now returns the fingerprint of the added key
Updated tests

* Addressed feedback

* Update tests/core/daemon/test_daemon.py

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-11-05 17:49:29 -05:00
hugepants
1220fcfd69
Revert rate limiting messages from warning back to debug (#13758)
In 1.5.1 this was changed from `debug` to `warning` causing a lot of excess noise in default logging as reported in https://github.com/Chia-Network/chia-blockchain/issues/13132
2022-11-05 17:48:07 -05:00
Kyle Altendorf
cb0fbe3208
switch to context manager for task timing (#13473) 2022-11-05 17:46:40 -05:00
Amine Khaldi
5dbc4aaa54
Merge commit '1bfe826e57215066c88dc8e953fc3930aa61a8ae' into checkpoint/main_from_release_1.6.1_1bfe826e57215066c88dc8e953fc3930aa61a8ae 2022-11-04 21:00:58 +01:00
Amine Khaldi
22be547df7
Merge commit '0be5eccffa9c0fc5807aa03ac382893811d84105' into checkpoint/main_from_release_1.6.1_0be5eccffa9c0fc5807aa03ac382893811d84105 2022-11-04 17:00:41 +01:00
Kyle Altendorf
806499cb3f
add task_instrumentation fixture (#13176)
* add task_instrumentation fixture

* fixup

* Update conftest.py
2022-11-03 23:14:21 -05:00
William Allen
2b15e8e062
Merge pull request #13807 from Chia-Network/checkpoint/main_from_release_1.6.1_bfc35b796f16fe1af6ff322fc602b47ea016dffb
checkpoint: into main from release/1.6.1  @ bfc35b796f
2022-11-03 20:50:54 -05:00
dustinface
cf77f58bf2
server: Make ChiaServer a dataclass (#13574)
* server: Make `ChiaServer` a `dataclass`

* Use existing logger

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

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-03 11:28:23 -05:00
Amine Khaldi
b502f24357
Merge commit 'bfc35b796f16fe1af6ff322fc602b47ea016dffb' into checkpoint/main_from_release_1.6.1_bfc35b796f16fe1af6ff322fc602b47ea016dffb 2022-11-03 14:21:51 +01:00
Amine Khaldi
54ce10522b
Merge commit '00aac17996bc0c451133ab45d5f1641f368af959' into checkpoint/main_from_release_1.6.1_00aac17996bc0c451133ab45d5f1641f368af959 2022-11-02 19:07:34 +01:00