Commit Graph

186 Commits

Author SHA1 Message Date
Kyle Altendorf
ff5ef6e073
remove leading newlines from indented code blocks (#14653)
* remove leading newlines from indented code blocks

* catch another one
2023-02-23 21:53:48 -06:00
Adam Kelly
db19671827
Check Wallet DB integrity (#14401)
* Check Wallet DB integrity

* Update command line help

* Improve duplicate DerivationPath index error message

* Move tests to chia/tests

* lint

* py init file

* Print WalletType names

* Don't complain about wallets not having derivation entries that don't need them

* Validate addresses used in order

* Update tests with new error output

* Fix check_addresses_used_contiguous in the case when the last address of the previous wallet was unused
2023-02-21 18:35:15 -06:00
Kyle Altendorf
6e70868888
move wallet_is_synced/wallets_are_synced to FullNodeSimulator methods (#14403)
* move wallet_is_synced/wallets_are_synced to FullNodeSimulator methods

* black

* gotta catch 'em all
2023-02-10 15:13:23 -06:00
Arvid Norberg
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
Adam Kelly
9f0220771f
Limit rate of log messages when farmer is disconnected from pool (#14344)
* Limit rate of spammy log messages when farmer is disconnected from pool

* Remove typo

* Use reliably increasing clock

* Make test faster, more reliable
2023-01-23 16:43:42 -06:00
Arvid Norberg
0f9e4ee41a
infrastructure for upcoming soft-fork (#14302)
soft-fork infrastructure
2023-01-12 03:08:59 -06:00
dustinface
e2e103241a
Wrap Union[IPv4Address, IPv6Address] in the class IPAddress (#14136) 2022-12-14 17:11:08 -06:00
dustinface
fbc3127bd5
util: Rework get_host_addr (#14068)
* util: Rework `get_host_addr`

* Require `prefer_ipv6` to be named

* Remove outdated comment

* Improve result selection
2022-12-13 09:48:41 -06:00
xdustinface
0cdce83b57
isort: Remove all tests exceptions and sort the related files 2022-12-05 02:06:00 +01: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
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
Kyle Altendorf
7abc062d0d
test service shutdown response to signals (#13576)
* 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
2022-10-20 16:08:49 -04:00
Adam Kelly
73e9d15cf7
Fee estimation. (#13645) 2022-10-18 09:12:22 -05:00
Kyle Altendorf
5b39550f73
convert datalayer to DBWrapper2 (#13582)
* 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()`
2022-10-03 17:50:12 -05:00
Kyle Altendorf
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
Kyle Altendorf
bbd032e1c9
embrace click 8 (#13559)
* click==8.1.3, black==22.8.0

* black

* click option creator hinting

* ignores for to-be-resolved issue

* remove unused import
2022-09-29 11:24:36 -05:00
Kyle Altendorf
8436e6a17a
Confirm equality of client and server RPC routes (#11765)
* Confirm equality of client and server RPC routes

* Update rpc.py

* hints

* Update rpc.py

* Update mypy.ini

* Update rpc_server.py

* Update tests/util/rpc.py

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

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-09-26 11:18:46 -05:00
Kyle Altendorf
8ed283a821
make DBWrapper2 handle more connection setup (#13510)
* make DBWrapper2 handle more connection setup

* fixup

* make create_connection() both await'able and async with'able

* recover logging
2022-09-26 11:17:20 -05:00
dustinface
70fe981fb3
cmds: Implement chia beta (#12389)
* 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
2022-09-12 16:57:31 -05:00
Mariano Sorgente
87a3e93cc4
Ms.mypy enable (#13320)
* 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>
2022-09-08 12:57:15 -05:00
Arvid Norberg
0d78058daa
optimize get_block_store (#13263)
* optimize the block_store for the get_puzzle_and_solution_for_coin to not parse the full block. We just need the block generator and generator regs.

* optimize analyze-block

* address review comments
2022-09-03 01:34:05 -05:00
Amine Khaldi
eeb2277955
Merge commit '12fcaf0e982590efcf26a954c67cd760035d9e6e' into checkpoint/main_from_release_1.6.0_12fcaf0e982590efcf26a954c67cd760035d9e6e 2022-08-29 17:45:49 +01:00
Arvid Norberg
5cd9bbbc14
Revert "now that all uses of DBWrapper have been updated to DBWrapper2, remove the old one" (#13145)
This reverts commit 2d9672c4e7.
2022-08-25 02:05:16 -05:00
Mariano Sorgente
dc5c44accd
Fix several bugs with untrusted sync, and correct sync status (#13133)
* Hopefully fix bug with untrusted sync

* Try removing the cache

* Add cache back, and don't rollback

* Compare to finished_sync_up_to

* Fix plotnfts, and tests

* Async function

* fix wallet blockchain tests

* Fix test, and improve detection of synced

* Correct sync status

* Fix more tests

* Fix more tests

* Fix NFT tests
2022-08-24 15:29:51 -05:00
Arvid Norberg
2276284c8e
now that all uses of DBWrapper have been updated to DBWrapper2, remove the old one (#13116) 2022-08-24 01:36:25 -05:00
Arvid Norberg
4959331cd1
Disable some tests (#13089)
* disable the merkle_root regression test. It's expensive and we're already convinced there are no discrepancies between the old and the new implementation

* disable the exhaustive full block parser test
2022-08-22 22:19:57 -05:00
Amine Khaldi
fc06a196ec
Merge commit 'c9bebc6c405e6896e9ec3b34cdedc2bb1739c748' into checkpoint/long_lived_atari_from_main_c9bebc6c405e6896e9ec3b34cdedc2bb1739c748 2022-08-19 15:55:14 +01:00
Arvid Norberg
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
Amine Khaldi
f72cd80971
Merge commit '92a5f38a86763d57a6881eb578458783c13600c3' into checkpoint/long_lived_atari_from_main_92a5f38a86763d57a6881eb578458783c13600c3 2022-08-18 12:56:21 +01:00
Amine Khaldi
3371c1607c
Merge commit 'f318f98fc794b8b1513721454730ada70fb048b7' into checkpoint/long_lived_atari_from_main_f318f98fc794b8b1513721454730ada70fb048b7 2022-08-16 13:39:08 +01:00
Amine Khaldi
cc5ff6c3ae
Merge commit '0142129112e85360f5008b84a0cb84afd0215ba5' into checkpoint/long_lived_atari_from_main_0142129112e85360f5008b84a0cb84afd0215ba5 2022-08-15 16:14:21 +01:00
Amine Khaldi
34d6197890
Merge commit '0bc54ae08b6655ec5242a8b21460d34b5e4a38c6' into checkpoint/long_lived_atari_from_main_0bc54ae08b6655ec5242a8b21460d34b5e4a38c6 2022-08-15 13:55:39 +01:00
Amine Khaldi
7582b863a4
Merge commit 'edd60a105468012f59db5bfb60fc8627c611e43e' into checkpoint/long_lived_atari_from_main_edd60a105468012f59db5bfb60fc8627c611e43e 2022-08-14 13:35:04 +01:00
Amine Khaldi
22038d4614
Merge commit '13558fdb75213c9b591b8b54062cbb796ece37ac' into checkpoint/long_lived_atari_from_main_13558fdb75213c9b591b8b54062cbb796ece37ac 2022-08-13 20:43:34 +01:00
dustinface
aa0e996ac5
util: Drop partially implemented BIP39 passphrase support (#12748) 2022-08-06 09:50:33 -05:00
Mariano Sorgente
c9bebc6c40
Fix more flaky tests, and optimize test_pool_rpc and NFT tests (signed) (#12761)
* Fix asyncio lock created outside async function

* Increase wallet sync timeouts

* Attempt to fix flaky pool tests, remove sleeps

* Remove accidental change

* Completely remove sleeps and optimize

* Remove asyncio import

* More flaky fixes

* Large speed improvements, and test Untrusted also

* Improve perf

* Move wallet_is_synced

* try not starting RPC in setup

* Revert "try not starting RPC in setup"

This reverts commit e8de70e73a2d4b10e0df4a2158e8e9acd9c3afd3.

* Revert accidental changes

* Revert more accidental changes

* Revert cbgui update
2022-08-03 02:28:32 -05:00
Arvid Norberg
92a5f38a86
remove soft fork logic at height 2300000 (#12563)
* remove soft fork logic at height 2300000. The whole chain can be validated with the post-soft-fork rules. Remove testing of pre-soft-fork rules

* fix test_full_sync
2022-08-01 17:32:53 -05:00
Arvid Norberg
f318f98fc7
update protocol message checks (#12608) 2022-07-29 17:23:46 -05:00
dustinface
0142129112
util: Free all non-class related functions in FileKeyring (#12655) 2022-07-29 11:35:08 -05:00
Amine Khaldi
5a9764df09
Merge commit '2d812c50024a2c0147427d4feb1341a66ac56362' into checkpoint/long_lived_atari_from_main_2d812c50024a2c0147427d4feb1341a66ac56362 2022-07-27 16:34:28 +01:00
Jack Nelson
0bc54ae08b
Move simulator test requirements over to new module (#12521)
* create new test.simulator module

to allow other packages to use the simulator without it crashing.
also tiny QOL fixes

* change user mode sim plot filter

Now only plots matching the user set fingerprint are loaded, this decreases the chance of user error.

* fix small oops in configure

* oops

* fix lint

* isort, who dis

* move folder over to chia/simulator

also change mypy settings again
2022-07-25 14:07:38 -05:00
dustinface
edd60a1054
keychain: Drop supports_keyring_passphrase (#12479)
* keychain: Drop `supports_keyring_passphrase`

* Drop `PASSPHRASE_CLI_OPTION_NAMES`
2022-07-22 11:15:00 -05:00
dustinface
13558fdb75
util: Make FileKeyring a dataclass (#12515) 2022-07-21 14:03:29 -05:00
Amine Khaldi
a9976eca8f
Merge commit 'ab53d489955863e7fc03caef69b29b09b0184784' into checkpoint/long_lived_atari_from_main_ab53d489955863e7fc03caef69b29b09b0184784 2022-07-17 17:21:19 +01:00
Amine Khaldi
18313573d3
Merge commit '90516263aa19afbfc4ef62947c8ac7e8c2889e32' into checkpoint/long_lived_atari_from_main_90516263aa19afbfc4ef62947c8ac7e8c2889e32 2022-07-16 17:12:58 +01:00
Amine Khaldi
4764b71dcd
Merge commit 'a87e8e34aceb477741ca0384efdd1fe874d14c45' into checkpoint/long_lived_atari_from_main_a87e8e34aceb477741ca0384efdd1fe874d14c45 2022-07-16 17:02:55 +01:00
Amine Khaldi
0fbc05afc2
Merge commit '3c203e335c8bb8f32cbc39fa46e8a6ad42bdd9fa' into checkpoint/long_lived_atari_from_main_3c203e335c8bb8f32cbc39fa46e8a6ad42bdd9fa 2022-07-15 18:44:38 +01:00
Amine Khaldi
28c76fbd96
Merge commit 'db1cc4d32acdfc7089e3d88235b6c838e99cc36e' into checkpoint/long_lived_atari_from_main_db1cc4d32acdfc7089e3d88235b6c838e99cc36e 2022-07-15 16:53:05 +01:00
Amine Khaldi
67675686e9
Merge commit 'd08d1b0a11d795d763fbf7bf359eca696f3a4c4e' into checkpoint/long_lived_atari_from_main_d08d1b0a11d795d763fbf7bf359eca696f3a4c4e 2022-07-15 16:51:01 +01:00
Amine Khaldi
a22e2e1625
Merge commit '8b2f7ec24cdf22be2d5150f92b9f2c928b08120d' into checkpoint/long_lived_atari_from_main_8b2f7ec24cdf22be2d5150f92b9f2c928b08120d 2022-07-14 14:15:59 +01:00