Commit Graph

275 Commits

Author SHA1 Message Date
Kyle Altendorf
73204950dd
catch up data layer to match other service starts 2022-08-03 10:44:36 -07:00
Amine Khaldi
be6a9ebc7d
Merge commit '1205418f224db9f48830d1c6ca7a8cad89fb213b' into checkpoint/long_lived_atari_from_main_1205418f224db9f48830d1c6ca7a8cad89fb213b 2022-08-03 17:09:59 +01:00
Amine Khaldi
33957f4cbb
Merge commit 'ac1bee09e45ae7ecac129e83e8e420bdae1d6cb7' into checkpoint/long_lived_atari_from_main_ac1bee09e45ae7ecac129e83e8e420bdae1d6cb7 2022-08-02 11:07:51 +01:00
Amine Khaldi
ecc2ec535e
Merge commit '6923ad8e12a376e7f5fa428a0cea0de70ce53e7f' into checkpoint/long_lived_atari_from_main_6923ad8e12a376e7f5fa428a0cea0de70ce53e7f 2022-08-01 16:29:47 +01:00
Kyle Altendorf
86ae361a2f
apply isort to atari 2022-07-31 21:10:56 -07:00
Amine Khaldi
6305ab770b
Merge commit 'e569817ac750d6271ed0c03e4c817156a92372a0' into checkpoint/long_lived_atari_from_main_e569817ac750d6271ed0c03e4c817156a92372a0 2022-07-29 20:20:36 +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
Amine Khaldi
69af010f0d
Merge commit '75115f2475e1e5f2421bccb8fbb80f7bafe93740' into checkpoint/long_lived_atari_from_main_75115f2475e1e5f2421bccb8fbb80f7bafe93740 2022-07-19 17:02:17 +01:00
Amine Khaldi
361b27becb
Merge commit 'a221726770a736f87b34136d6456e063a985aa5d' into checkpoint/long_lived_atari_from_main_a221726770a736f87b34136d6456e063a985aa5d 2022-07-18 21:37:34 +01: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
c254289e20
Merge commit '890da94024b4742bbbb93e47f72113e8344a20b3' into checkpoint/long_lived_atari_from_main_890da94024b4742bbbb93e47f72113e8344a20b3 2022-07-16 21:27:18 +01:00
Amine Khaldi
18313573d3
Merge commit '90516263aa19afbfc4ef62947c8ac7e8c2889e32' into checkpoint/long_lived_atari_from_main_90516263aa19afbfc4ef62947c8ac7e8c2889e32 2022-07-16 17:12:58 +01:00
dustinface
f0a0f07116
daemon|server: Log chia_full_version_str in daemon and all services (#12356) 2022-07-15 21:08:30 -05:00
Kyle Altendorf
11b210809b
run pre-commit across platforms in ci (#12287)
* run pre-commit across platforms in ci

why?  because we have developers working on multiple platforms.

* pre-clean for pre-commit in ci

* chia setup python action

* fixup

* fix windows specific hinting

* no TypeAlias yet

* debug

* debug

* adjust activated.ps1

* verbose pre-commit

* exit better

* Revert "debug"

This reverts commit 93a100afc7.

* less debug

* less `|`

* Update .pre-commit-config.yaml

* Update activated.ps1
2022-07-15 21:08:07 -05:00
Kyle Altendorf
f2061d86d6
rework service creation to be hint checkable (#12153)
* rework service creation to be hint checkable

* fixup config vs. service_config

* more fixup

* service start cleanup

* Update nft_metadata_updater_default.clvm.hex

* reorder advertised_port= parameter

* undo unrelated tweaks

* Optional[RpcInfo]

* undo unrelated whitespace change
2022-07-13 11:43:48 -05:00
Kyle Altendorf
9a4316f96e
fixup (#12292)
* fixup

* add automated option to install action, default true

* try again

* make Install.ps1 accept -a

* oof

* again

* backup
2022-07-07 23:43:22 -05:00
Kyle Altendorf
1205418f22
Simplify service start configuration loading (#12204)
* Simplify service start configuration loading

* oops

* more oops

* rename `config` to `service_config` as appropriate

* rename `full_config` to `config`
2022-07-07 19:57:08 -05:00
Kyle Altendorf
ac1bee09e4
Initialize logging before Service instantiation (#12253) 2022-07-07 06:00:54 -05:00
Kyle Altendorf
6923ad8e12
Removing logging.basicConfig() from ChiaServer.__init__() (#12252) 2022-07-06 21:02:47 -05:00
Kyle Altendorf
e569817ac7
replace service running_new_process= parameter by .setup_process_global_state() method (#12172) 2022-07-01 13:47:01 -05:00
Kyle Altendorf
9d466f5c6e
Merge commit '61717035f2b8dc3e3ce74ec468187de709008d44' into checkpoint/datalayer-sim_from_release_1.4.0_61717035f2b8dc3e3ce74ec468187de709008d44 2022-06-24 08:40:32 -04:00
Kyle Altendorf
75115f2475
dataclass WalletNode (#11925)
* dataclass WalletNode

* all private at the end
2022-06-16 17:50:29 +01:00
dustinface
a221726770
server: Hint data parameter of make_msg (#11876) 2022-06-13 11:41:22 -05:00
Mariano Sorgente
ab53d48995
Request header blocks, and new rate limits (#11636)
* new blob block api method integrated into wallet

* direct msg streaming of headers, rename, tests

* perform_handshake call fix

* updated trusted sync with new block header calls

* add max blocks limit to fetch

* added tests for rejected block header msgs

* avoid parsing transactions info if not required

* avoid looking up capabilities setting

* move block tests out of a class

* test fix

* Merge changes

* added docs and increased rate limits

* increased block header request interval from 32 to 128

* remove fetching hashes and use height range

* fetching by height in db v2

* update capabilities, other fixes

* fixed range block header call

* Add type hints

* Start work on optimizing fetch_last_tx_from_peer

* Huge speedup in trusted wallet sync

* Revert unintentional changes

* Fix trade issue

* Improve the code

* Str format

* Optimize handling of farming rewards

* Fix bug

* Performance fixes

* Optimizations to wallet syncing

* Don't return all coins in respond_additions

* Revert concurrency numbers

* More optimization of the caches

* Small optimization in coin_added

* Optimize request_additions significantly by using a cache

* fixes from feedback

* capabilities check fixes

* Increase rate limits to allow 250tps in verification requests

* Start work on rate limits

* New rate limit versioning support

* Revert unrelated changes

* revert return False

* Lint

* Revert cbi

* try tests with trusted peer

* Revert unrelated wallet changes

* Revert more debug changes

* Add test and throw on an error if not found

* Reject invalid requests

* Revert bad change with uint32, and change warning to info

* Parametrize wallet sync test

* Merge and LGTM

* More clean way to choose peers

* Fix lint

* add the new RejectBlockHeaders, RequestBlockHeaders and RespondBlockHeaders to the network protocol regression test and regenerate test files

* Rate limit diffs only

* Improve performance

* Simpler

* Lint

Co-authored-by: Sebastjan <trepca@gmail.com>
Co-authored-by: arvidn <arvid@libtorrent.org>
2022-06-11 01:35:41 -05:00
Amine Khaldi
11b68de354
Merge release/1.4.0's 6171703 into main 2022-06-08 21:16:10 +01:00
Kyle Altendorf
890da94024
Hint and lightly refactor chia.server.upnp.UPnP (#11816)
* Hint and lightly refactor chia.server.upnp.UPnP

* Remove chia.server.upnp from mypy.ini lax rules

* black

* Revert the pointless int for shutdown

* isort

* from __future__ import annotations
2022-06-08 10:25:42 -05:00
Kyle Altendorf
90516263aa
remove chia.util.path.mkdir() (#10842)
* remove chia.util.path.mkdir()

* remove submodule change

* less tmpdir, more tmp_path
2022-06-08 10:24:40 -05:00
Earle Lowe
f9fe04767e
Added utility function and code cleanup 2022-06-03 09:09:18 -07:00
Earle Lowe
bf6da8ee52
Fix LGTM double import 2022-06-02 16:27:03 -07:00
Earle Lowe
0b7295c25e
Handle ephemeral ports and dual stack (ipv4 & ipv6) 2022-06-02 15:51:23 -07:00
Kyle Altendorf
7e3e18bdfd
Catchup/long lived atari from release 1.4.0 46ebed37d8 (#11648)
* Resend transactions (#11167)

* Resend transactions

* Don't recheck transactions more frequently than timeout

* Add wallet resend parameter to config, move timeout code out of tx store, but close to call site

* Add a test for wallet transaction resend

* Add test for wallet retry

* isort new files for precommit and update workflows

* Use correct fixture name

* LGTM - remove unused import

Co-authored-by: Earle Lowe <e.lowe@chia.net>

* less except -> false (#10219)

* less except -> false

* establish_connection() and .perform_handshake() can just return None

* remove more pointless, and no wrong, assertions

* Write python version error to stderr (#11239)

Co-authored-by: wjblanke <wjb98672@gmail.com>

* simplify SizedBytes and StructStream (#11429)

* simplify SizedBytes and StructStream

* lint

* super()  !!!

* do not pass parameter up to super().__init__()

* Update chia/util/struct_stream.py

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>

* parse fixed-width int data from class name

* add int512 and uint128 .from_bytes(), test .parse() failures

* test serialization against struct.pack()

* use typing_extensions for final

* override ignore

* stop using struct for StructStream

oh the irony

* fixup .to_bytes() to accept parameters again for where we use that

* bring back signed parameter

* format

* adjust tests for new exception

* eliminate custom coding for uint128 and int512

* tidy

* remove unused StructStream.PACK attribute

* add direct tests for parse_metadata_from_name()

* stricter hinting

* remove no-longer-needed typeshed work-around

* apply strict type checking to all touched files

* remove StructStream override of .to_bytes()

* tidy

* types touchup

* add unused parameter comments

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>
Co-authored-by: wjblanke <wjb98672@gmail.com>

* Allow services to set a non-default max request body size limit (#11516)

* updated bls to 13 (#11529)

* reduce the redundant computations of coin_ids in block_body_validation (#11530)

* add test for streamable -> json conversion (#11527)

* add test for streamable -> json conversion

* fixup test

* Uses the new `from_bytes_unchecked` method in blspy, to improve perfo… (#11463)

* Uses the new `from_bytes_unchecked` method in blspy, to improve performance

* Update test

* Fix merge conflict

* Use from_bytes_unchecked in post_init and from_json

* More uniform code

* rename test files that are missing test_ prefix (#10712)

* rename test files that are missing test_ prefix

* update mypy and isort excludes

* skip test_get_host_addr6() in GitHub Actions under macOS

* rebuild workflows

* Coin Selection Refactor With CAT Coin Selection Refactor  (#9975)

* add exact match and best exact match algorithms

* optimize algorithm further

this might be good.

* lint

* fix bad logic

* add final algorithms

* delete lint

* oops

* Update coin_selection.py

* simplify and fix knapsack algoritm

* simplify code and correct logic

* make it way better.

* clarify comments and check for edge cases.

* add comments and stuff

* improve coin selection

addressed comments
Thanks!

* add coin_selection rpc tests.

* clean up and add new unit tests

* undo test changes

* add extra test cases

* move coin_selection to its own function and switch to it for cat and main wallet.

* add cat tests

* lint

* make function align with standards

also removed test

* make test better

* add proper types

* Improve code clarity

* wallet: fix coin selection bugs

* wallet: add an assert just in case

* tests: add some sleeps to reduce flakiness

* Isort

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

* fix bad merge

* lint

* fix tests

* address aforementioned changes.

* remove wallet test

* isort

* more tests and fixes

* lint

* rename to amount for coin selection rpc

* fix incase we have no smaller coins

* fix tests + lint

* re add asserts

* oops

missed me.

* lint

* fix test

* Squashed commit of the following:

commit 34a2235de5
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Apr 13 10:09:42 2022 -0400

    clarify comment

commit adbf7f4f94
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Tue Apr 12 20:27:05 2022 -0400

    linty lint

commit 5ebc1ac9fd
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Tue Apr 12 20:17:19 2022 -0400

    add failure test and final changes

commit 7e5a21b4c2
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Tue Apr 12 19:35:18 2022 -0400

    add descriptions and slim down code

commit 31c95b916d
Merge: d7b91295b d9b0ef5f3
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Mon Apr 11 10:12:05 2022 -0400

    Merge branch 'jack-cat-coinselection' into jn_coinselection_dust

commit d7b91295b5
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Sun Apr 10 20:31:09 2022 -0400

    lint

commit 30dc7c0ab4
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Sun Apr 10 20:25:52 2022 -0400

    fix tests

commit 6c8c2e4874
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Thu Mar 31 15:06:00 2022 -0400

    remove duplicate code.

commit 9f79b6f304
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Thu Mar 31 15:01:10 2022 -0400

    address more concerns

commit 67c1b3929f
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Thu Mar 31 12:59:05 2022 -0400

    fix logic error

commit 2d19a53245
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Thu Mar 31 11:47:52 2022 -0400

    simplify and de duplicate code

commit 6ab1cc79bb
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 21:34:50 2022 -0400

    add function and select individual coin

commit 582c17aa8d
Merge: ce2165942 618fbaeba
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 21:14:37 2022 -0400

    Merge branch 'jack-cat-coinselection' into jn_coinselection_dust

commit ce21659429
Merge: 16aabb3fd 6daba28db
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 20:53:21 2022 -0400

    Merge branch 'jack-cat-coinselection' into jn_coinselection_dust

commit 16aabb3fd5
Merge: 0b9fc2845 2286fe426
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 20:49:02 2022 -0400

    Merge branch 'jack-cat-coinselection' into jn_coinselection_dust

commit 0b9fc28455
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 20:38:12 2022 -0400

    lint

commit 62e74c72f4
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 20:34:22 2022 -0400

    fix logic and tests

commit e738f44320
Author: Jack Nelson <jack@jacknelson.xyz>
Date:   Wed Mar 30 18:52:05 2022 -0400

    deal with dust and add tests

* make sure that we do not use any dust

* minor change

* address concerns

* adjust comments

* adjust comment

Co-authored-by: Mariano Sorgente <sorgente711@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>

* rebuild workflows (#11543)

* remove the cache from CoinStore. It appears the cost of maintaining the cache outweighs the gains. (#11540)

* Keep daemon websocket alive during keyring unlock (#11371)

* When prompting to unlock the keyring during daemon launch, it's possible
that the daemon websocket connection will timeout before the user has
entered their passphrase. We can't quickly detect that the connection
has timed-out, so instead we now reconnect after collecting the
passphrase, unlock the keyring, and then close the old connection.

* mypy fix

* Switch to using asyncio.loop.run_in_executor to collect the passphrase on its own thread.

* Use a new ThreadPoolExecutor configured with 1 worker thread.

* Support searching derived addresses on testnet. (#11449)

* Support searching derived addresses on testnet.

* Added tests

* Optimize code to not perform useless subgroup checks (#11546)

* Optimize code to not perform useless subgroup checks

* Revert less important optimizations

* hints and strict type checking for test_wallet (#11541)

* hints and strict type checking for test_wallet

* fixup

* flip flop

* disable pytest-monitor by default (#11507)

* disable pytest-monitor by default

* take 2

* make recurse_jsonify() work directly on types (#11537)

* make recurse_jsonify() work directly on types, circumventing the dataclasses.asdict() step. This enables simpler integration of non dataclasses into the Streamable and JSON protocols

* add benchmark for Streamable.to_json_dict()

* tests: Split up and improve `test_wallet_rpc.py` (#11552)

This breaks up the one big test into 

```
test_send_transaction
test_create_signed_transaction
test_create_signed_transaction_with_coin_announcement
test_create_signed_transaction_with_puzzle_announcement
test_send_transaction_multi
test_get_transactions
test_get_transaction_count
test_cat_endpoints
test_offer_endpoints
test_key_and_address_endpoints
```

Note that there is still much more room for improvements. Also the 
following tests can still be split up more:

```
test_get_transactions
test_cat_endpoints
test_offer_endpoints
test_key_and_address_endpoints
```

* Remove unneeded uint64() intermediate in CAT wallet (#11575)

* Get get_args() and get_origin() from typing_extensions (#11571)

* Get get_args() and get_origin() from typing_extensions

* Update streamable.py

* cleanup

* Fix several flaky tests (#11576)

* Increase some of the timeouts to reduce flakiness

* Experiment with CI for flakiness

* Force more runs

* Add argument name

* Fix flaky mempool test

* Attempt to fix another flaky test

* Fix wallet retry test

* Missing arg

* Lint

* Increase benchmark test time

* Debug

* Debug

* Simplify retry test

* Lint

* More lint

* Return false instead of assert

* No need to check disconnect twice (since we don't break, this was flaky)

* Remove useless changes

* Accidental changes revert

* Accidental changes revert 2

* Accidental changes revert 3

* Revert fixture

* Fix a few additional flaky tests (#11597)

* Fix a few additional flaky tests

* Lint

* Update tests/core/full_node/stores/test_full_node_store.py

Co-authored-by: Jeff <jeff@chia.net>

* Fix merge conflict

* Remove unnecessary function

Co-authored-by: Jeff <jeff@chia.net>

* Bind port 0 to fix race condition when grabbing available ports (#11578)

* port 0 to fix flakiness

* Try fixing setup_full_system

* Try fixing setup_full_system, and lint

* More attempts to fix

* No more calls to get random ports in setup_nodes

* Revert accidental changes

* Timelord extra arg

* Try with port 0

* Fix daemon test, and lint

* Try without 0.0.0.0

* Back to 0.0.0.0

* Try a few timelord changes to get test running

* Increase timeout again

* Use the correct interface to get the port

* INFO logging to debug issue

* Revert "INFO logging to debug issue"

This reverts commit 7c379e5cca.

* Fix advertised port log

* Add extra log

* Logging back

* Rollback the timelord changes

* Try port 0 timelord

* Revert "Try port 0 timelord"

This reverts commit 4997faf3b2.

* Try full green, change ordering

* Remove unused var

* speed up simulation and cleanup

* Now try without the port config

* Fix a flaky call to get_event_loop

* Try getting the port dynamically

* No dynamic port

* Try changing the ordering

* Try adding a sleep

* Back to what works

* Timelord before vdf clients

* Dynamic port for 1st timelord

* Revert "Dynamic port for 1st timelord"

This reverts commit 0f322a15b7.

* Revert "Timelord before vdf clients"

This reverts commit 3286c34696.

* Revert "Back to what works"

This reverts commit 30380dffb7.

* Revert "Try adding a sleep"

This reverts commit 9212b665a6.

* Revert "Try changing the ordering"

This reverts commit a62597d70d.

* Revert "No dynamic port"

This reverts commit 5d2e15749b.

* Revert "Try getting the port dynamically"

This reverts commit ef9cd75679.

* Revert "Fix a flaky call to get_event_loop"

This reverts commit 01a000fdfb.

* Try one to 0

* Just not 0

* Don't get port dynamically

* Cleanup a bit

* Fix

* Some cleanup work

* Some cleanup work

* Fix daemon test

* Cleanup

* Remove arguments

* restore missing hints being stored as None (instead of 0-length bytes) (#11568)

* Coin simplification (#11567)

* factor out as_list() from Coin into free function. Remove unused name_str() from Coin. Minor optimization of hash_coin_ids() for common case.

* extend Coin unit test

* test installer on fedora:36, drop 33

* add tests.util.misc.assert_maximum_duration for benchmark assertions (#11589)

* add tests.util.misc.assert_maximum_duration for benchmark assertions

* fix some imports

* more

* lint

* correct duration

* hint fixup

* rename to caller_file_and_line()

* set default timer to thread_time()

* extract gc manager and default to disabling

* self calibrate overhead

* wrap none-ness behind .results() method

* add messages

* from __future__ import annotations

* yield out self

* final from typing_extensions

* split it

* just use Future

* tweak

* tweak

* correction in loosely hint checked file

* all future indexing in hints

* union for the hints

* rename

* assert_runtime()

* another rename...

* message -> label

* label all results with test names

* oops

* early return from _set_spent function (#11594)

* check for removals before calling function

* move condition to function

* remove redundant condition (#11582)

* fix built-in profiler to work for mac (#11590)

* Bump actions/setup-python from 2 to 3 (#10949)

* Bump actions/setup-python from 2 to 3

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fixup templates for python@v3

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gene Hoffman <hoffmang@hoffmang.com>

* avoid cancelling release/** and long_lived/** (#11519)

* tests: Some adjustments in `test_offer_endpoints` (#11558)

This is a follow up after #11552 which basically used the initial parts 
of `test_cat_endpoints` to make `test_offer_endpoints` working. Now this 
PR drops a lot of the stuff we can assume to be not needed in this test 
because its tested in `test_cat_endpoints` and it adds some general 
improvments to it.

* async sleep and require connection reset error for DoS test (#11612)

* fix jsonify bool

* Remove is not None and length assertion in select_coins() (#11569)

* Remove is not None and length assertion in select_coins()

The `coins is not None` check seems unneeded since `select_coins()` is hinted to return `Set[Coin]`.  The length requirement needlessly restricts from being able to request a zero amount.  Either situation would either trigger an exception in the next assert, or trigger the assert itself for non-zero amounts requested.

* also remove from cat_wallet.py

* new port 0 stuff

Co-authored-by: Adam Kelly <338792+aqk@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
Co-authored-by: Evan Graham <me@luakt.net>
Co-authored-by: wjblanke <wjb98672@gmail.com>
Co-authored-by: Arvid Norberg <arvid@libtorrent.org>
Co-authored-by: Mariano Sorgente <3069354+mariano54@users.noreply.github.com>
Co-authored-by: Jack Nelson <jack@jacknelson.xyz>
Co-authored-by: Mariano Sorgente <sorgente711@gmail.com>
Co-authored-by: Jeff <jeff@chia.net>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: neurosis69 <83925572+neurosis69@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gene Hoffman <hoffmang@hoffmang.com>
Co-authored-by: William Allen <wallentx@users.noreply.github.com>
2022-05-26 18:11:21 -07:00
Mariano Sorgente
817baa3096
Bind port 0 to fix race condition when grabbing available ports (#11578)
* port 0 to fix flakiness

* Try fixing setup_full_system

* Try fixing setup_full_system, and lint

* More attempts to fix

* No more calls to get random ports in setup_nodes

* Revert accidental changes

* Timelord extra arg

* Try with port 0

* Fix daemon test, and lint

* Try without 0.0.0.0

* Back to 0.0.0.0

* Try a few timelord changes to get test running

* Increase timeout again

* Use the correct interface to get the port

* INFO logging to debug issue

* Revert "INFO logging to debug issue"

This reverts commit 7c379e5cca.

* Fix advertised port log

* Add extra log

* Logging back

* Rollback the timelord changes

* Try port 0 timelord

* Revert "Try port 0 timelord"

This reverts commit 4997faf3b2.

* Try full green, change ordering

* Remove unused var

* speed up simulation and cleanup

* Now try without the port config

* Fix a flaky call to get_event_loop

* Try getting the port dynamically

* No dynamic port

* Try changing the ordering

* Try adding a sleep

* Back to what works

* Timelord before vdf clients

* Dynamic port for 1st timelord

* Revert "Dynamic port for 1st timelord"

This reverts commit 0f322a15b7.

* Revert "Timelord before vdf clients"

This reverts commit 3286c34696.

* Revert "Back to what works"

This reverts commit 30380dffb7.

* Revert "Try adding a sleep"

This reverts commit 9212b665a6.

* Revert "Try changing the ordering"

This reverts commit a62597d70d.

* Revert "No dynamic port"

This reverts commit 5d2e15749b.

* Revert "Try getting the port dynamically"

This reverts commit ef9cd75679.

* Revert "Fix a flaky call to get_event_loop"

This reverts commit 01a000fdfb.

* Try one to 0

* Just not 0

* Don't get port dynamically

* Cleanup a bit

* Fix

* Some cleanup work

* Some cleanup work

* Fix daemon test

* Cleanup

* Remove arguments
2022-05-23 08:13:49 -07:00
Kyle Altendorf
0e419822e0
Allow services to set a non-default max request body size limit (#11516) 2022-05-14 02:08:10 -07:00
Kyle Altendorf
d1e4a38462
less except -> false (#10219)
* less except -> false

* establish_connection() and .perform_handshake() can just return None

* remove more pointless, and no wrong, assertions
2022-05-14 02:03:56 -07:00
Kyle Altendorf
a03d1670f8
Merge tag '1.3.5' into atari-merge_release_1.3.5_0f5a6df4ffcd7b1d5b950b9f40c15b4e6045ee1b 2022-05-12 10:20:11 -04:00
Kyle Altendorf
c56ef66aaa
Merge branch 'datalayer-sim' into atari-merge_datalayer_sim_779e5fd690cb6bcd3936b348708ea72a6fa236b4 2022-05-02 16:51:54 -04:00
Kyle Altendorf
649a79c931
Merge branch 'datalayer-sim' into datalayer-sim-configurable_request_size_limit 2022-04-29 06:05:52 -07:00
Kyle Altendorf
a663ece4c3
fix ssl context creation for server vs. client side (#11134) 2022-04-20 11:05:52 -07:00
Kyle Altendorf
b6c5babba3
Merge commit 'd154105a6b35f94649f15bca4e3fb8a11a39e70e' into atari-merge_main_d154105a6b35f94649f15bca4e3fb8a11a39e70e 2022-04-19 22:44:02 -04:00
dustinface
a48fd43100
streamable: Simplify and force correct usage (#10509)
* streamable: Merge `strictdataclass` into `Streamable` class

* tests: Test not supported streamable types

* streamable: Reorder decorators

* streamable: Simplify streamable decorator and force correct usage/syntax

* streamable: Just move some stuff around in the file

* streamable: Improve syntax error messages

* mypy: Drop `type_checking.py` and `test_type_checking.py` from exclusion

* streamable: Use cached fields instead of `__annotations__`

This is now possible after merging `__post_init__` into `Streamable`

* Introduce `DefinitionError` as `StreamableError`

* `/t` -> `    `
2022-04-08 18:29:32 -07:00
dustinface
ded9f68583
chia|tests|github: Implement, integrate and test plot sync protocol (#9695)
* 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>
2022-04-07 17:10:44 -07:00
Jack Nelson
9b7d7d2555
Remove websockets dependency & do some refactoring (#10611)
* remove old ws
2022-04-05 10:19:09 -07:00
Mariano Sorgente
890c7d3754
Fix remaining linting issues (#10962)
* FIx remaining linting issues

* Revert type:ignore

* Revert token_bytes change
2022-04-02 13:22:55 -07:00
Arvid Norberg
9db85f3284
when running multiple services in the same process (in tests), don't initialize logging for all of them, and don't set the proctitle of the test (#10686) 2022-03-17 14:58:30 -07:00
Kyle Altendorf
aead84a346
less optional around ssl (#10558)
* less optional

* clean up cruft

* more

* more

* just a little less optional
2022-03-17 09:06:22 -07:00
Kyle Altendorf
6e93b5a225
Merge commit '05f96670181654415b1ad219d38463228f30b0ce' into atari-merge_main_05f96670181654415b1ad219d38463228f30b0ce 2022-03-16 15:45:37 -04:00
Kyle Altendorf
91f7edc15d
remove unused import 2022-03-16 09:16:51 -04:00
Kyle Altendorf
951d01975f
tidy from review recommendations 2022-03-16 09:05:45 -04:00
Kyle Altendorf
5f5b0fd7fa
actually use find_available_listen_port() 2022-03-15 19:14:13 -04:00
Kyle Altendorf
0650052603
Merge commit '8a5c12541809526ef55995674595ed6485c6c330' into atari-merge_main_8a5c12541809526ef55995674595ed6485c6c330 2022-03-14 21:04:05 -04:00
Kyle Altendorf
d4ccfa1a9b
Merge commit 'ce533879e25a536b6414307c4e6d850c1da06d4f' into atari-merge_main_ce533879e25a536b6414307c4e6d850c1da06d4f 2022-03-14 19:03:45 -04:00
Kyle Altendorf
b81518e4a7
Provide default for when rpc_server_max_request_body_size is not specified 2022-03-14 14:45:42 -04:00
Kyle Altendorf
e79768ede6
Merge commit '98971de9d525e1de323ecb09f0777cca6286f932' into atari-merge_main_98971de9d525e1de323ecb09f0777cca6286f932 2022-03-10 21:26:45 -05:00
Kyle Altendorf
c065420042
black 2022-03-06 09:32:23 -05:00
Kyle Altendorf
4d5858a2af
Add configurable request size limit for data layer service 2022-03-06 08:53:06 -05:00
Kyle Altendorf
af163a1c5b
Merge commit '87aeadc34310eb86aa0bd56f4eb00f84cc9563b2' into atari-merge_main_87aeadc34310eb86aa0bd56f4eb00f84cc9563b2 2022-03-01 17:59:11 -05:00
Kyle Altendorf
95c5213fbb
Merge commit 'ca84fa9f8d332687534399fc824d6017effaed2e' into atari-merge_main_ca84fa9f8d332687534399fc824d6017effaed2e 2022-03-01 15:27:25 -05:00
Mariano Sorgente
e8475fb194
GC connections in wallet (#10450) 2022-02-26 18:31:10 -05:00
Mariano Sorgente
c844016019
Improve trusted sync performance (#10377)
* Improve trusted sync performance

* Fix broken CLI

* Decrease timestamp cache size

* Add all valid states at the right time
2022-02-22 18:37:51 -08:00
Arvid Norberg
29bd136238
name processes we spawn in tests with a test_ prefix, to make it easier and find and kill them in case they're left running (#10318) 2022-02-19 12:39:17 -08:00
Kyle Altendorf
9a3194599d
do not enable signals on services in tests (#10290) 2022-02-18 07:49:19 -08:00
Chris Marslender
5e4c1a1f62
Timelord RPC + Misc Metrics Updates/Fixes (#10255)
* Add mempool_max_total_cost to RPC

* Add signage_point event

* Fix incorrect crawler RPC port lookup

* Set up initial timelord RPC server + finished_pot_challenge event

* Add new compact proof event

* Add skipping/new_peak to track when fastest or not

* Check for None on change_data

* Add skipping_peak + new_peak to changes for metrics

* Convert chain to value

* Rename iters

* Timelord RPC to 8557 - 8556 is used in simulation tests

* Make tests work with RPC server on timelord

* Change event name to finished_pot

* Use broadcast_farmer object

* Move state changed for `finished_pot` after proofs_finished.append

* Fix type on ips var + add vdf_info and vdf_proof

* fix event name on the state_changed function
2022-02-18 07:43:52 -08:00
Mariano Sorgente
52e439ccbe
Ms.sync cancel (#10244)
* Start fixing other issues

* Fork point, sync cancelling, random peer

* Reduce logging

* Improve performance and have a fallback peer for fetching

* Disconnect not synced peers

* Make sure try catch doesn't fail

* Fix lint

* Update chia/wallet/wallet_node.py

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

* Pylint has a bug so ignore pylint for this line

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-02-17 13:35:41 -08:00
Kyle Altendorf
767974cb93
reinstate pre-existing signal configuration on windows for services (#10263) 2022-02-16 15:26:03 -08:00
Kyle Altendorf
220e845d51
shutdown the weight proof process pool (#10163)
* shutdown the weight proof process pool

* use a context manager for the weight proof process pool executor

* record of the debug code

* mostly cleaned up

* suppress sync task cancellation propagation when awaited while closing

* breakup multi-second WeightProofHandler.validate_weight_proof with async sleeps

* move awaiting of sync task until after existing cancellation

* properly handle shutdown file with a new instance each time and a context manager

* cleanup
2022-02-15 12:22:23 -08:00
Chris Marslender
eb3ed142e0
Crawler RPC (#10141)
* Add crawler RPC server

* Generate private keypair for crawler

* Bring over cleanup changes from the last closed PR

* Update the crawler RPC information to be its own subsection within seeder

* Add sleep before crawling to let the daemon connection get set up

* Wait for the actual callback to not be None, instead of just a random sleep interval

* Rework crawler/dns seeder to use the daemon + normal chia start process rather than the old system intended for the standalone repo

* Update configure testnet to work with seeder config

* Add back the crawler/seeder options from the standalone version

* Remove the check for none/sleep. Not needed when this is started by the daemon

* Add real data to the get_peer_counts endpoint

* Lint

* Fix calls to configure from init

* Turns out we still might sometimes move too quick before daemon/state changed callback is ready

* Add peer counts in the state_changed callback method

* Add a setting for peer_connect_timeout in the seeder: section so we can control it just for crawler

* start_seeder

* Pass config/root_path to the DNSServer so it can also use the configured crawler DB Path

* change in () instead of if/or

* Remove unnecessary return
2022-02-14 11:48:35 -08:00
Kyle Altendorf
5b7f46fca7
simplify new peak timeout (#10053)
* simplify new peak timeout

* correct to asyncio.TimeoutError
2022-02-02 17:13:06 -08:00
Yostra
ca84fa9f8d
Sync improvements (#9974)
* stash

* change log level

* stash changes

* cat tests

* add node id chia show

* make max sibscribe items configurable

* lint

* add logs for limits

* paralelize incluzion valdiation, don't diconnet from remote peers until local peer in synced

* wallet rate limit

* test log lvl, trusted, black

* only validation under semaphore

* flake mypy trade test

* reduce flakyness

* merge fix

* rename

* linting

* validate parallel, apply serial

* reduce falkyness

* lint

* Fix CAT tests

* black

* flaky test, total amount

* fix cat test

* skip existing state

* skip existing

* try other caches

* flake8

Co-authored-by: Matt Hauff <quexington@gmail.com>
Co-authored-by: William Blanke <wjb98672@gmail.com>
2022-01-28 19:16:47 -08:00
almog
7379a2f0ac
fix get roots test
lint
2022-01-21 14:35:41 +02:00
almog
a866fa62ec
use bt in dl rpc tests 2022-01-20 21:18:35 +02:00
almog
2914bcdd97
lint 2022-01-20 19:47:13 +02:00
almog
57cc29ea73
init wallet rpc in data service test 2022-01-20 18:11:17 +02:00
almog
f2fe296ace
init wallet rpc in data service 2022-01-20 15:15:59 +02:00
almog
cebcb6a4ca
use wallet rpc inside data_layer 2022-01-20 15:08:36 +02:00
Kyle Altendorf
4453f32363
Merge commit '2acf03e850fb883dc6ca5a554f5f827097157ac1' (latest main) into atari-merge_main_2acf03e850fb883dc6ca5a554f5f827097157ac1 2022-01-19 10:37:04 -05:00
Matt Hauff
6e899f5992
Merge commit '89f15f591cc3cc3e8ae40e95ffc802f7f2561ece' into atari-merge_main_89f15f591cc3cc3e8ae40e95ffc802f7f2561ece 2022-01-14 20:11:22 -07:00
Kyle Altendorf
2a79868a61
Merge commit '0ba838b7a8ea2b5410d438ac70295df699a30dae' (main) into atari-merge_main_0ba838b7a8ea2b5410d438ac70295df699a30dae 2022-01-14 19:21:13 -05:00
Chris Marslender
516f5639db
Add testnet10 config (#9805)
* Add testnet10 config

* Add testnet10 to missed files

Co-authored-by: Jack Nelson <jack@jacknelson.xyz>
2022-01-13 13:13:05 -08:00
Yostra
89f15f591c
Merge standalone wallet into main (#9793)
* wallet changes from pac

* cat changes

* pool tests

* pooling tests passing

* offers

* lint

* mempool_mode

* black

* linting

* workflow files

* flake8

* more cleanup

* renamed

* remove obsolete test, don't cast announcement

* memos are not only bytes32

* trade renames

* fix rpcs, block_record

* wallet rpc, recompile settlement clvm

* key derivation

* clvm tests

* lgtm issues and wallet peers

* stash

* rename

* mypy linting

* flake8

* bad initializer

* flaky tests

* Make CAT wallets only create on verified hints (#9651)

* fix clvm tests

* return to log lvl warn

* check puzzle unhardened

* public key, not bytes. api caching change

* precommit changes

* remove unused import

* mypy ci file, tests

* ensure balance before creating a tx

* Remove CAT logic from full node test (#9741)

* Add confirmations and sleeps for wallet (#9742)

* use pool executor

* rever merge mistakes/cleanup

* Fix trade test flakiness (#9751)

* remove precommit

* older version of black

* lint only in super linter

* Make announcements in RPC be objects instead of bytes (#9752)

* Make announcements in RPC be objects instead of bytes

* Lint

* misc hint'ish cleanup (#9753)

* misc hint'ish cleanup

* unremove some ci bits

* Use main cached_bls.py

* Fix bad merge in main_pac (#9774)

* Fix bad merge at 71da0487b9

* Remove unused ignores

* more unused ignores

* Fix bad merge at 3b143e7050

* One more byte32.from_hexstr

* Remove obsolete test

* remove commented out

* remove duplicate payment object

* remove long sync

* remove unused test, noise

* memos type

* bytes32

* make it clear it's a single state at a time

* copy over asset ids from pacr

* file endl linter

* Update chia/server/ws_connection.py

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

Co-authored-by: Matt Hauff <quexington@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-01-13 12:08:32 -08:00
Earle Lowe
34d44c1324
Limit server to TLS 1.2 and set cipher list (#9195)
* Limit server to TLS 1.3 (also ran isort)

* Set minimum to TLS1.2 and add warning
2022-01-10 21:02:23 -08:00
dustinface
b76b75f317
farmer|server|tests: Fix for farmer service crash if the keychain is empty (#9515)
* farmer: Run a start background task to wait if there are no keys yet

* farmer: Run the handshake in a background task if there are no keys yet

* tests: Yield the service in farmer/harvester setups

* tests: Introduce `start_service` in farmer/harvester setups

* server: Make `ChiaServer` and `Service` restartable

* tests: Test the delayed start/handshake in `test_farmer_harvester.py`

* tests: Move `test_farmer_harvester.py` to `tests/core/farmer_harvester`

Attempt to avoid issues due to the global block tools / shared keychain 
between tests

* farmer: Return `bool` in `Farmer.setup_keys`

* tests: Add `__init__.py` to `tests/farmer_harvester`
2021-12-14 18:03:59 -08:00
Kyle Altendorf
bd0ecc1646
Merge branch 'main' into atari-merge_main_a3c79c939da2f65ec1fc5a6c9423ffae1e63cccd 2021-12-14 11:14:10 -05:00
Earle Lowe
7d801144ea
Add TLS version to collected crawler stats (#9534) 2021-12-13 08:40:22 -08:00
Kyle Altendorf
759b173e7d
stricter hints 2021-12-09 12:13:48 -05:00
Kyle Altendorf
d17ce9efab
Merge branch 'main' into atari 2021-12-07 21:39:10 -05:00
Kyle Altendorf
8291f0221a
Make the sized bytes types hint compatible (#9369)
* Rework sized bytes for type hinting compatibility

* add a bunch of type: ignores

* this will be handled elsewhere

* noqa E501 instead of changing code

* normalize comment plurality

* @classmethod

* Revert "@classmethod"

This reverts commit 95db80e339.

* add ignore in benchmarks

* just E501 again...

* add some new type: ignores
2021-12-02 09:43:39 -08:00
Gregory
025c45f0b5
Chia Seeder (#8991)
* initial hack

* crawler

* add pytz

* Checkpoint.

* Catch some bugs.

* Localhost dig working.

* Checkpoint: return only high quality nodes.

* Statistics.

* Try improving finding reliable nodes.

* Bug.

* Move db to memory.

* Timestamp in the last 5 days.

* Increase crawl parameters, 180+ connections per sec.

* Bug.

* Optimize for DNS traffic.

* Prepare for hosting.

* Minimum height.

* Typo.

* Try catch everything.

* dnslib.

* Add db, format code.

* nits.

* No connections for the dns server.

* Rename src -> chia

* Fix some issues with v1.1

* Crawler task pool.

* Optimize closing connections.

* Split crawler and dns server.

* Install instructions.

* Catch startup bug.

* Try a big timeout for lock aquire.

* lint.

* Lint.

* Initial commit extended stats.

* Simplify code.

* Config.

* Correct stats.

* Be more restrictive in crawling.

* Attempt to fix stats bug.

* Add other peers port to config.

* Update README for the config.

* Simplify crawl task.

* Fix bug on restarts.

* Prevent log spamming.

* More spam prevention.

* Fix bug.

* Ipv6 (#1)

* Enable ipv6.

* Fix bug.

* Use numeric codes for QTYPE.

* ANY working.

* More spam prevention.

* Try to improve IPv6 selection.

* Log IPv6 available.

* Try to crawl more aggresive for v6.

* rename dns.py to crawler_dns.py so it doesn't conflict with imported package names

* Remove pytz package off dependencies

* Tidy-up ws_connection.py

* Fix spelling

* Reinstate chia-blockchain readme, with additional lines pertaining to the DNS introducer & crawler

* More detailed info in the README wrt Chia Seeder

* Nit

* More memetic naming of Chia Seeder

* Nit

* Add entry points

* Add entry in packages

* Patch some methods on the upstream server

* Update peer record fields

* Standard library imports first

* Crawler API check

* Reconcile crawl store

* Account for crawler_db_path in config

* Await crawl store load DB and load reliable peers

* Updates to crawler

* Rename to dns_server

* Crawler-specific overrides for the chia server

* Edit comment

* Undo changes to ChiaServer in view of crawler-specific overrides introduced in previous commit

* Nit

* Update service groups

* Expand name maps, mostly

* Fix the init config

* Remove unused import

* total_records unused at this stage

* Remove ios_reliable in peer_reliability table

* Remove row[20] entry

* Split overly long line

* Fix

* Type hint for ns_records

* Reconcile mismatch btw type int and uint64

* Type annotations in crawler

* Check whether crawl store is set

* Remove upnp_list

* Lint

* Chia Seeder CLI

* Lint

* Two white spaces

* 3rd party package import

* Cleaner way to handle overrides for ChiaServer method

* Address linter warnings

* Rename

* Nits

* Fix

* Change port #

* Most chia_seeder commands up and running

* Rename

* Progress of sorts

* Fix

* Improve legibility

* Fix naming

* Fix setup.py

* Lint

* None -> ''

* Remove whitespace

* Rename

* Log ipv6 better. (#9227)

* Log ipv6 better.

* Lint.

* -

* Undo GUI changes

* Another attempt

* GUI changes

Co-authored-by: Yostra <straya@chia.net>
Co-authored-by: Florin Chirica <fchirica96@gmail.com>
Co-authored-by: Chris Marslender <chrismarslender@gmail.com>
2021-11-27 18:30:25 -08:00
Kyle Altendorf
b1abc3df26
Merge branch 'main' into atari 2021-11-27 19:43:42 -05:00
dustinface
b89d958108
server: Drop reply_to_request and use send_message instead (#9327)
It's doing the same thing.
2021-11-24 11:28:24 -08:00
Kyle Altendorf
1073f9d5dd
mypy: warn_unused_ignores = true (and remove some) (#9085)
* mypy: warn_unused_ignores = true (and remove some)

* catch up

* type checking tweaks

* precommit uses mypy --no-warn-unused-ignores

* revert a bit

* precommit explanatory comment

* Update .pre-commit-config.yaml

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

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-11-23 12:44:53 -08:00
Kyle Altendorf
04969f1a71
Merge branch 'main' into atari 2021-11-22 22:04:41 -05:00
Chris Ross
2c4aaa1ec9
Resolve v6 addresses (#8861)
* Address deficiency discussed in #8552, add ability to resolve to IPv6
addresses for hostnames.

* If there is no prefer_ipv6 in the config, set it True (per @hoffmang9)
and write it back to config.yaml

* Pass prefer_ipv6 flag to get_host_addr, which required a little digging
for it in a few places that call get_host_addr.

* Update a couple things for consistency

* Move the load_config into Wallet's __init__ so it doesn't get called so
many times as it would in has_full_node.

* Pass None into get_host_addr if there's no preference in config, so we have only that one place where the coded default lives.  also fix an oversight where we were building a PeerInfo from a PeerInfo in some cases.

* Change the default here to match the default coded into util/network.py.  It seems that github testers can't handle trying to use IPv6 and this may be easier for average users (sadly)

* A test to see if manually creating the server on :: (IP6_ANY) lets tests connect to localhost with IPv6 on

* Revert back to IPv4 default and remove the override inserted into
TCPSite for testing.

* Don't test for ip6-localhost, as it's not on all systems.

* Bah.  Forced formatting of commented code...

* Add a type annotation for the addrset variable

* If we don't quote the socket enums, pylint gets upset because it has issues figuring out where/how they're defined.  So, quote them here.

Co-authored-by: Chris Ross <cross+chia@distal.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2021-11-22 14:34:03 -08:00
Kyle Altendorf
a6e58c9855
Merge branch 'main' into atari 2021-11-22 14:24:00 -05:00
dustinface
f8e8edc567
server: Refine return value of WSChiaConnection.send_message (#9305) 2021-11-19 11:13:50 -08:00
Jeff
c4e14f5c78
Peer db new serialization (#9079)
* Serialize/deserialize peer data alongside existing sqlite implementation (to be removed)

* Simplified AddressManagerStore. No longer uses sqlite and is no longer async.

* Removed aiosqlite usage from AddressManagerStore.
Added PeerStoreResolver class to determine the appropriate location for "peers.dat"
Updated initial-config.yaml to include "peers_file_path" default, replacing "peer_db_path" (similar change for "wallet_peers_path")

* Minor comment changes/additions

* Added migration from sqlite peer db.
Made AddressManagerStore's serialization async as it was right at the edge of blocking for too long.

* Minor tweaks to checking for migration

* Removed AddressManagerSQLiteStore class scaffolding

* makePeerDataSerialization now returns bytes instead of a PeerDataSerialization object

* Async file I/O for write_file_async using aiofiles
Added more tests

* Separate out the synchronous part of move_file

* Renamed write_file to files since we're opening up the capabilities a bit

* Update references to write_file

* Renamed test_write_file to test_files

* Tests covering move_file and move_file_async

* Minor refinements to behavior and tests

* Use aiofiles for reading peers.dat

* Added missing mypy typing info for aiofiles. Also added types-PyYAML to dev_dependencies so that `mypy chia tests` doesn't require running with --install-types

* Add types-aiofiles to the linting workflow

* Directory perms can now be passed into write_file_async.
Added an explicit f.flush() followed by os.fsync() after writing the temp file contents.
2021-11-19 11:12:58 -08:00
Kyle Altendorf
f2c5ed3b4a
lint 2021-11-19 09:37:11 -05:00
Kyle Altendorf
5bd8b3dbaa
Merge branch 'main' into atari 2021-11-11 08:57:35 -05:00
Florin Chirica
13a49c7a2e
Fix wallet gossip. (#8709)
* Increase wallet sleep.

* Fix wallet gossip.

* Type checking.

* Add callable.

* Address comment.

* Remove Callable.
2021-11-10 10:39:56 -08:00
almog
4f8e407279
try init wallet_manager with datalayer service, cli broken 2021-11-08 17:57:31 +02:00
Mariano Sorgente
8a028c3594
Ms.mempool locking (#9050)
* Prority locking to consensus

* Remove pstats

* Linting

* Do some stuff outside of lock

* Fix startup

* Add log timings

* Try some different locking

* Add limit

* catch excp

* CLVM inside lock

* Try using a semaphore instead

* use events for lock queue

* test

* Add logging for message types

* type

* remove seed

* check new peak waiters

* correct FullNodeAPI self.full_node.new_peak._waiters typo

* correct logging string typos

* only warn about new_peak Waiters if there is at least 1

* remove no-longer-accepted parameter to FullNode.peak_post_processing()

* only warn about respond_transaction Waiters if there is at least 1

* lint

* Change some constants

* Small fix and logging changes

* Put message types outside

* Change some log levels so we can test with info

* More logging

* Increase rate limits but decrease paralelism

* tweaks

* Log dropped tx

* Fix pool rpc test

* Test fixes

* Mempool optimization

* Remove from seen if fails

* Increase queue sizes

* Message types info

* More test and logging

* Small changes to networking just in case

* Decrease logging

* Decrease logging even further

* Decrease logging even further even further

* Decrease logging 3

* Transaction queue

* Don't cancel tasks or close connection

* Cancel tasks on disconnect (for shutdown purposed)

* Fix typo

* Catch cancelled

* Do multiple at a time

* More accurate farmer response time

* More efficiently create tasks

* Increase queue size and priority by fee

* Revert priority

* Don't re-request too many times for dropped TX

* Handle cancelled error so we don't go into a bad state

* Catch cancelled in syncing tasks

* Reduce new_peak_sem to improve performance

* Less bytes conversion

* Missing file, and 2 workers for CLVM

* Validate BLS in a new thread

* tests

* Change semaphore constants

* correct a cancellation triggered exception and assertion

* Fix send_transaction, dont use BaseException, fix tests

* Fix more tests

* only log transaction handler cancellation in debug

* typing in log

* move unfinished validation to diff proc

* it is asyncio.CancelledError

* Add a test for bad signature

* Fix more tests, reduce logging, lint

* One more lint

* blockchain tests, pass bytes directly, single call

* Try to fix rl_wallet failures

* Fix mempool test

* catch everything

* Don't test RL wallet

* Fix more tests and return error code

* Improve error handling in multiprocess

* Add pre-validation time

* Add pre-validation time in logs, and revert pytest.ini changes

* Add log correctly

* Ms.bls cache experiment (#9115)

* Logging for cache

* Less logging

* Return to original plan

* Clean up

* Remove coment

* Remove log

* formalize LockQueue shutdown

* Comments

* Fix blockchain test

* Improve cache

* Remove logs

* Fix sign_coin_spends

* Fix pool wallet

Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: Yostra <straya@chia.net>
2021-11-04 09:29:05 -07:00
Mariano Sorgente
55406d729b
Rate limits for new protocol (#8977) 2021-10-27 08:35:41 -07:00
Kyle Altendorf
fe83bebf7f
Merge branch 'main' into altendky-data_layer_exploration 2021-10-12 21:11:23 -04:00
Jeff Cruikshank
ab7d07ad30
Renamed chia.util.ssl to avoid conflicting with aiohttp's ssl import. (#8805)
Removed hacky sys.path reordering in dump_keyring.py
2021-10-12 13:59:29 -07:00
Chris Ross
0a2294841d
Before calling gethostbyname(); check if host is an address (#8765)
* Before calling gethostbyname(), check to see if we already have an address.
That prevents an unnecessary call, and also allows for specifying IPv6
addresses which otherwise cause exceptions here.

* Also recognize addresses when passed to timelord spawn_process, so that
IPv6 addresses can be used.

* Missed importing PeerInfo

* Adjust style to match requirements and existing code

* Cast PeerInfo port to uint16
2021-10-07 16:56:34 -07:00
Kyle Altendorf
0cdcb14749
preliminary data layer cli 2021-09-28 20:57:12 -04:00
Kyle Altendorf
97d94d9569 Merge branch 'main' into altendky-data_layer_exploration 2021-09-22 17:39:48 -04:00
Arvid Norberg
600a5f90a0
CoinStore benchmark and performance improvements (#8514)
* add coin_store benchmark

* optimize _set_spent in CoinStore

* simplify _add_coin_record, since we won't use it to replace an entry anymore

* use executemany in add_coin_record and set_spent

* disable sqlite sync
2021-09-21 10:43:43 -07:00
Kyle Altendorf
c969e63188 Merge branch 'main' into altendky-data_layer_exploration 2021-09-20 21:49:46 -04:00
Adam Kelly
e9bf0ec12b
Reply type decorator (#8276)
* Check types of messages returned from other peers

* Check message type data structures at startup, check that no peeer messages that expect replies are broadcast, and dynamically check return types of messages that do expect replies.

* Type hint protocol message type check functions

* lint

* typo

* add replay_type decorator

* add api reply decorations

* typo

* Don't check non full-node broadcast messages

* Distinguish internal vs peer protocol error
Added Changelog
Moved static check to import time
Moved protocol timeouts to chia/protocols/protocol_timing.py
Comment typos
Rename create_request -> send_request
Comment that INVALID_PROTOCOL_MESSAGE is bannable, not temporary

* Call static check at module import time

* Rename message_response_ok

* Improve protocol checking for outgoing message validation

* Type-o

* reset submodule

Co-authored-by: almog <almogdepaz@gmail.com>
2021-09-20 11:31:15 -07:00
Yostra
5766a8d367
Fullnode related changes from wallet protocol and unharded derivation (#8522)
* fullnode related changes from wallet protocol and unharded derivation

* limit total subscriptions per peer

* reset counter on disconnect

* dict not a set

* check membership

* remove unused tests, lint
2021-09-18 10:27:34 -07:00
Chris Marslender
4d3823bb70
Add a config option for peer_connect_timeout (#8516)
* Add a config option for peer_connect_timeout

* Add configure option for peer connect timeout

* Fix linter complaints
2021-09-17 18:35:06 -07:00
Chris Marslender
c7255a78a9
Move software_version to after the error checking in ws_connection (#8518) 2021-09-17 13:57:30 -07:00
Chris Marslender
9359adbbe2
Add version to ws_connection for crawler (#8512) 2021-09-17 10:59:32 -07:00
Arvid Norberg
b748bb1356
Disable sqlite sync (#8319)
* change sqlite pragma synchronous=FULL to pragma synchronous=NORMAL to improve disk I/O performance. In the case of catastrophic (hardware, power or kernel) failure, our database can be rebuilt

* removed redundant database pragmas in wallet
2021-09-17 10:47:34 -07:00
Kyle Altendorf
e708a3685c black and flake8 2021-09-17 08:31:28 -04:00
Kyle Altendorf
0df73425e6 Preliminary exploration of a data layer skeleton 2021-09-15 21:31:41 -04:00
Arvid Norberg
e4b9db08cd
execute the sqlite pragmas only once, at the lever where the database is opened. Also, say FULL instead of 2, to make it clearer what the pragma is doing (#5993) 2021-09-15 10:57:13 -07:00
dustinface
4130551b23
cmds|server|util: Fix, refactor and improve SSL permission checks (#8211)
* server|util: Refactor `verify_ssl_certs_and_keys`

Let it take two lists instead of one with an tuple holding optional
paths.

* util: Introduce `get_ssl_perm_warning`

* util: Drop some redundant brackets

* util: Introduce `get_all_ssl_file_paths`

* util: Print warnings for CLI only

* cmds|util: Call `check_ssl` for all CLI commands
2021-08-25 15:32:17 -07:00
wjblanke
a2de2d8f30
up request block rate limit for faster sync (#8204) 2021-08-25 10:25:40 -07:00
Earle Lowe
da5df49f39
New call for logging peer_host (#8108) 2021-08-18 13:02:30 -07:00
Florin Chirica
2ce7c5950c
Use ip.chia.net (#8039)
* Use ip.chia.net

* oops...
2021-08-16 14:12:43 -07:00
Florin Chirica
639d5ee1f6
Enable querying AAAA records for DNS Introducer. (#8008)
* Initial commit DNS ipv6.

* Fix pyblack.

* nit.
2021-08-16 11:35:37 -07:00
Jeff Cruikshank
39fbe2aa17
Create SSL keys/certs with proper permissions, also verify/fix existing installs (#7972)
* Create directories with 755 permissions, SSL certs with 644, and keys with 600.

* Check SSL file permissions during chia_init(). Exits if permissions are incorrect.

* Overwrite certs/keys instead of failing to write

* Skip SSL file permission checks on Windows (requires checking ACLs)

* Check SSL file permissions when creating an ssl_context

* Skip check_ssl on Windows.
Handle some SSLInvalidPermissions exceptions.

* Added a few comments

* Added chia init --fix-ssl-permissions option to attempt to fix SSL file permission issues.
Update imported cert permissions when using chia init -c.
Code cleanup/restructuring.

* Return a tuple instead of a list

* LGTM and other minor fixes

* Fixed SSL test breakage when calling ssl_context_for_client. The ca_crt param was being passed in as both the cert and private key, triggering the permission check failure.

* Don't exit if SSL file permissions issues are found

* Tweak the exception types that are raised from traverse_dict
2021-08-15 15:53:54 -07:00
Jeff Cruikshank
325d7f8245
Keyring passphrase protection (#7249)
* Moved keyring handling into a KeyringWrapper class

* Update click to 8.0.x for prompt_required support

* Renamed KeyringWrapper to _KeyringWrapper

* Expose password management options on Linux

* CLI support for setting/removing a password

* Global option for specifying the master password

* Cache the password instead of setting on the context

* Password bootstrapping during chia init

* Tidying up _KeyringWraper's interface

* Initial pass migrating the legacy keyring contents

* Encryption/decryption of keyring.yaml contents

* FileKeyring backend encrypts with ChaCha20Poly1305

* Tightened up keyring migration and initialization

* Fixed issues identified by linters

* Remove root_path from Keychain

* Prevent double-migration if setting master passwd

* KeyringWrapper tests are mostly complete

* FileKeyring will now honor the service param

* Tests for get/set/delete password

* Formatting/commenting updates

* Writer lock support with tests - WIP

* keyring.yaml is now watched for modifications

* Reader/Writer lock for get/delete password

* Fixed linter issues

* Reader lock tests

* Formatting update

* Hook up CHIA_ROOT support for KeychainWrapper

* Quick fix to address test failures

* Fixed failures when existing legacy keyring exists

* Fixed test failures caused by reusing the same temp dir

* keyring.yaml now lives in ~/.chia_keys by default. Can be overridden with CHIA_KEYS_ROOT or --keys-root-path

* Fixed migration failure when setting a password (not using the default)

* KeyringWrapper now uses supports_keyring_password to determine if a FileKeyring should be used. Patched tests to work regardless of whether supports_keyring_password return False

* The daemon now takes a --have-gui option that will prevent calling check_keys() during startup. If the keyring is locked, we want the GUI to prompt for the password.

* Added is_keyring_locked RPC call

* Added 'unlock_keyring' RPC command

* Added KeychainProxy and KeychainServer to handle RPC messages related to keyring operations. WalletNode no longer directly accesses the Keychain class.

* Turn on macOS support for testing keyring passwords

* Fixed get_key_for_fingerprint to use the ocal keychain if the platform doesn't need to remotely access the daemon's keychain.

Fixed key reconstruction when sent over RPC.

* Farmer now accesses the keychain over RPC

* Fixes for linter issues and some restructuring to support tests that use setup_nodes.py

* Couple of fixes to unblock the GUI from launching when a keyring password is set

* Added a keychain RPC call for add_private_key()

* Added remaining keychain proxy RPC calls for delete_key_by_fingerprint and delete_all_keys

* Check for None when inspecting request arguments

* Run check_keys after unlocking the keyring when the daemon is launched via GUI

* Added check_keys RPC method.
Fixed deserialization of key entropy in get_all_private_keys. This was preventing the GUI from being able to show key details.

* Added get_first_private_key to keychain_server/proxy.
create_plots now uses the keychain proxy when launched from the daemon.

* Added a comment about KeychainProxy in chia plots check

* Workaround import conflict  when importing from 'tests.*' due to fasteners name conflict

* Simulator now uses KeychainProxy if launched by the daemon.
KeychainServer/Proxy now takes keychain user/testing params for testing scenarios.

* Added "set_keyring_passphrase" RPC message

* Reworking KeychainProxy usage to handle local keychain tests and RPC keychain tests.

* Replace my prior usage of asyncio.run() with asyncio.get_event_loop().run_until_complete()

* Silencing file_keyring logging for the moment.

* Updated tests to use test keychains and appropriate BlockTools construction

BlockTools should now be created with create_block_tools(_async) to handle async scenarios.

Updated block_tools to be async compatible

Updated fasteners to fix installation of top-level 'tests' in site-packages

* Added 'remove_keyring_passphrase' RPC message to the daemon

Minor tweak to TempKeyring to default to some test params

* Fixed linter issues

* Remove flake8 ignore statement now that the fasteners module has been updated

* Some initial renaming changes: password -> passphrase

* Fixed wallet RPC issue where get_key_for_fingerprint wasn't awaited-upon.

Fixed legacy keyring initialization (for migration scenarios)

* Fixed improperly merged file

* Fixed linter issues.
More renaming.

* Updated spots that were still using an incorrect keychain call

* Renamed use_password_cache, obtain_current_password

* Renamed supports_keyring_password

* Renamed has_master_password

* Renamed has_cached_password, get_cached_master_password

* Linter fixes

* Renamed master_password_is_valid

* Renamed set_cached_master_password

* Renamed set_master_password

* Renamed remove_master_password

* Renamed has_cached_master_password

* Renaming in file_keyring and keyring_wrapper

Updated default keyring payload used for tests

* Renamed get_password
Other renaming updates

* Renamed set_password
Other renaming updates

* Renamed remaining password occurrences (where appropriate)

* password -> passphrase

* Added tests for setting an emoji and Japanese master passphrase

* Attempt to notify the daemon when a keyring passphrase is set/updated/removed

* Missed one password -> passphrase replacement.

* Fixed some file synchronization issues found when running tests on macOS

* Adjusted timeout values for test_writer_lock_reacquisition_failure for macOS.

* Removed logging statements previously added for debugging

* Prompt for keyring passphrase up-front when launching a service.

Changed --have-gui flag to --wait-for-unlock

* Updated set_keyring_passphrase RPC message to fix optional current_passphrase param when the keyring is using the default passphrase.

* Minor test cleanup to deduplicate some code.

* Fixed regression when setting a new master passphrase

* Minor refactoring and docs/commenting updates

* Renaming password -> passphrase went too far. Keyring backends use password terminology for compatibility with third party backends.

* Disabling macOS support (previously added for testing only)

* Disabling passphrase support in preparation for sending out the PR

* Fixed improper merge (vscode didn't save changes during rebase)

* Update chia/cmds/init_funcs.py

Co-authored-by: Adam Kelly <338792+aqk@users.noreply.github.com>

* skip_check_keys -> should_check_keys

* Shuffling some imports around to break cycles reported by LGTM

* Handle unlocking the daemon if it's already launched and waiting for unlock.

* Replaced uses_keychain_proxy decorator in farmer.py. Fixed async usage of get_reward_targets.

Linter/reformatting fixes

* Replaced uses_keychain_proxy decorator with a clearer method.

* Cleanup the temp keyring dir using shutil.rmtree()

* Restored self._root_path (had been changed to self.root_path)

* Minor cleanup

* ensure_keychain_proxy() now throws if connect_to_keychain_and_validate() fails

* Plot key resolution now yields a PlotKeys object which can be passed into create_plots.

De-indented test_invalid_icc_sub_slot_vdf to keep git blame tidy.

* Added 'keyring_status' daemon RPC message to support the GUI

* Minor changes relating to PR feedback

* Addressed more PR feedback (mostly type annotations)

* Commented-out macOS file keyring usage. This can be re-enabled for testing purposes.

* Addressed test failures that require multiple keyrings in the same process. Each TempKeyring will now set a custom KeyringWrapper instance.

* Fixed logic for communicating user_passphrase_is_set in the keyring_status RPC response.

* Updated type annotations and method signature for set_passphrase to expect a string instead of bytes.

* Fixed Wallet RPC tests

* Fixed full_node_store tests. BlockTools should be created using the create_block_tools(_async) function(s)

* Fixed test failures in test_pool_rpc

* Fixed test_daemon. After BlockTools.setup_plots is run, the config file needs to be re-read to refresh stale plot_directories.

* Suppressing LGTM false positives regarding passphrase leakage in CLI error output. Seems that LGTM sees MIN_PASSPHRASE_LEN as sensitive data.

* Second attempt at suppressing LGTM false positives

* Third attempt at addressing LGTM false positives

* Removed test_keyring_wrapper param from Keychain ctor. Test setup now sets the keyring_wrapper property directly.

* Reformatting

* More targeted update of the test config to refresh just the "plot_directories" value

* More LGTM suppressions

Co-authored-by: Adam Kelly <338792+aqk@users.noreply.github.com>
Co-authored-by: wjblanke <wjb98672@gmail.com>
2021-08-04 12:46:55 -07:00
Earle Lowe
18708e2bb8
More friendly error reporting for peername errors (#7716) 2021-07-22 09:05:31 -07:00
dustinface
1b196e6bd8
chia|tests: Add node_type parameter to get_connections RPC (#7492)
* rpc|server: Add Optional `node_type` paramter to `get_connections`

* farmer: Query `HARVESTER` connections only

* tests: Basic test for `node_type` parameter
2021-07-15 07:42:06 -07:00
dustinface
de1a6c6463
farmer|harvester|server: Fix harvester cache updates, bump message size, increase timeout (#7244)
* farmer: Increase timeout for `HarvesterAPI.request_plots` requests

Set it to `UPDATE_HARVESTER_CACHE_INTERVAL`.

* farmer|harvester: Add some debug logs around `get_harvester` stuff

* server: Bump size limit for `respond_plots` from 10MB/msg to 100MB/msg

Those messages can become pretty big now for large farms.

* farmer: Keep also track of failed cache update attempts

Prior to this commit the farmer called the `request_plots` every second 
for each harvester as long as they failed to respond properly. Since the 
rate limit was 10/minute this lead to hitting the rate limit if the 
harvester didn't responds for 10 tries in a row for whatever reason.

This commit changes the behaviour to always keep track of request 
attempts even if they end up in a timeout to really only re-try every 
60s no matter what.

* farmer: Introduce and use `HarvesterCacheEntry`
2021-07-09 09:32:05 -07:00
Earle Lowe
46395374ae
Improves error handling for unknown protocol types (#7073)
* Improves error handling for unknown protocol types

* Add test for invalid protocol
2021-07-01 21:20:21 -07:00
Adam Kelly
89f7a4b3d6
Pools mainnet (#7047)
* added clarifying comments

* WIP test

* added WIP test

* Refine genesis challenge. Remove unnecessary pool_puzzle function

* Sign spend. Remove create_member_spend. Rename state transition function to create_travel_spend

* Rename create_member_spend to create_travel_spend

* Add singleton id logging

* Enhance logging for debugging

* renaming

* rephrase inside the puzzle

* fixed signing and added some support functions

* Fix issue with announcement

* Progress spending the singleton

* Fix arguments to pool_state_to_inner_puzzle call

* Fix arguments to pool_state_to_inner_puzzle

* Improve error message when wallet is not running

* Remove misleading message about missing wallet process, when problem is the farmer by making poolnft command error out earlier

* Fix parent coin info bug

* Multiple state transitions in one block

* Lint

* Remove assert

* Fix incorrect p2_singleton_ph calculation (thanks nil00)

* Update waiting room puzzle to accept genesis_challenge

* Update calls to create_waiting

* Go to waiting state from committed state

* Augment debug_spend_bundle

* fix 2 bugs in wallet

* Fix lint

* fix bad_agg_sig bug

* Tests and lint

* remove breakpoint

* fix clvm tests for new hexs and hashs

* Fixed a bug in the coin store that was probably from merging. (#6577)

* Fixed a bug in the coin store that was probably from merging.

* The exception doesn't need to be there

* CI Lint fix

* Added lifecycle tests for pooling drivers (#6610)

* Ms.poolabsorb (#6615)

* Support for absorbing rewards in pools (untested)

* Style improvements

* More work on absorb

* Revert default root and remove log

* Revert small plots

* Use real sub slot iters

* Update types

* debug1

* Fix bugs

* fix output of agg sig log messages

* Make fewer calls to pw_status in test

* remove old comment

* logging and state management

* logging

* small bug fix & rename for accuracy

* format

* Fix types for uncurry function

* lint

* Update test to use exceptions

* Change assumptions about self-pooling in lifecycle test

* Install types for mypy

* Revert "Install types for mypy"

This reverts commit a82dcb712a.

* install types for mypy

* install types for mypy

* More keys

* Remove flags requiring interactive prompts

* Change initial spend to waiting room if self-pooling

* lint

* lint

* linting

* Refactor test

* Use correct value in log message

* update p2_singleton_or_delated_puzhash

* initial version of pool wallet with p2_singleton_or_delay

* run black formatting

* fix rebase wonkiness

* fix announcement code in p2_singleton_or_delayed

* removed redundant defaulting
standardised hexstr handling

* lint fixes

* Fixed pool lifecycle tests to current standards, but discovered tests are not validating signatures

* Signatures validate on this test now although the test still does not check it.

* Lint fix

* Fixed plotnft show and linting errors

* fixed failing farmer/harvester rpc test

* lint fix

* Commenting out some outdated tests

* Updated test coverage

* lint fix

* Some minor P2singleton improvements (#6325)

* Improve some debugging tools.

* Tidy pool clvm.

* Use `SINGLETON_STRUCT`. Remove unused `and` macro.

* Use better name `SINGLETON_MOD_HASH`.

* Finish lifecycle test suite.

* Fixing for merge with chia-blockchain/pools_delayed_puzzle (#72)

Co-authored-by: Matt Hauff <quexington@gmail.com>

* Default delay time was being set incorrectly

* Extracted get_delayed_puz_info_from_launcher_spend to driver code

* Ms.taproot plot2 (#6692)

* Start work on adding taproot to new plots

* Fix issue in block_tools

* new test-cache

* Lint

* DID fixexs

* Fix other tests

* Python black

* Fix full node store test

* Ensure block index <= 128 bits.

* fix test_pool_config test

* fix comments in pool_config and in chialisp files

* self_pool -> pool -> self_pool

* Implement leaving pools

* Fix conflicts with main via mini-rebase

* Fixup rebase mistakes

* Bring in Mariano's node discovery chagnes from pools.dev

* Fix adapters - Thanks Richard

* build tests

* Add pools tests

* Disable DID tests

* farmer|protocol: Some renaming related to the pool protocol

* farmer: Use `None` instead of `{}` and add local `pool_state`

* protocol|farmer: Introduce and use `PoolErrorCode`

* rename: `pool_payout_instructions` -> `payout_instructions`

* refactor: `AuthenticationKeyInfo` -> `authentication_key`

* refactor: Move `launcher_id` up

* rename: Some variable name changes

* rename: `points_balance` -> `points`

* format: Squash aggregation into one line

* farmer: Make `update_pool_state` public

* farmer: Print traceback if `update_pool_state` fails

* farmer: Periodically call `GET /pool_info`, add `_pool_get_pool_info`

* farmer: Add `authentication_token_timeout` to `pool_state`

Fetch it from `GET /pool_info`

* protocol|farmer: Implement support for `GET|POST|PUT /farmer`

* farmer: Make use of `GET|POST /farmer`

- To make the farmer known by the pool
- To update local balance/difficulty from the pool periodically

* farmer|protocol: Adjust `POST /partial` to match the latest spec

* farmer: Hash messages before signing

* pools: Drop unused code

* farmer: Fix aggregation of partial signatures

* farmer: support self pooling, don't pool if url==""

* wallet: return uint64 for delay time, instead of bytes

* pool: add error code for delay time too short

* farmer: cleaner logging when no connection to pool

* farmer: add harvester node id to pool protocol

* Rename method (test fix) and lint fix

* Change errors to warnings (pool communication)

* Remove pool callbacks on a reorg

* farmer: Continue earlier when no pool URL is provided

* farmer: Print method in log

* farmer: Handle exceptions for all pool endpoint calls

* farmer|protocol: Keep track of failed requests to the pool

* farmer: Fix typo which caused issue with pooling

* wallet: simplify solution_to_extra_data

* tests: Comment out DID tests which are not working yet

* Remove DID Wallet test workflows

* Return launcher_id when creating Pool Wallet

* Name p2_singleton_puzzle_hash correctly

* Improve 'test_singleton_lifecycle_fast.py'.

* Make test more robust in the face of asynchronous adversity

* Add commandline cmds for joining and leaving pools

* Fix poolnft leave params

* Remove redundant assignment brought in from main

* Remove unneeded code

* Style and parsimony

* pool_puzzles: Check was wrong, and bad naming

* format: Fix linting

* format: Remove log and rename variable

* pool-wallet: Fix self pooling with multiple pool wallets. Don't remove interested puzzle_hash

* gui: Use pools branch

* format: fix lint

* Remove ununsed code, improve initial_pool_state_from_dict

* farmer: Instantly update the config, when config file changes

* format: Speed up loading of the authentication key

* logging: less annoying logging

* Test pool NFT creation directly to pool

* Test switching pools without self-farming in between

* lint

* pooling: Use integer for protocol version (#6797)

* pooling: Use integer for protocol version

* pooling: Fix import

* Update GUI commit

* Ms.login2 (#6804)

* pooling: Login WIP

* pooling: add RPC for get_link

* dont use timeout

* pooling: rename to get_login_link

* format: remove logging

* Fix SES test

* Required cli argument

Co-authored-by: almog <almogdepaz@gmail.com>

* farmer|protocols: Rename `current_difficulty` for `POST /partial` (#6807)

* Fix to farm summary

* Use target_puzzlehash param name in RPC call

* Pool test coverage (#6782)

* Improvement in test coverage and typing

* Added an extra absorb to the pool lifecycle test (only works when merged with https://github.com/Chia-Network/chia-blockchain/pull/6733)

* Added new drivers for the p2_singleton puzzles

* Added new tests and test coverage for singletons

* organize pools testing directory

* black formatting

* black formatting in venv

* lint fix

* Update CI tests

* Fixing tests post rebase

* lint fix

* Minor readability fix

Co-authored-by: matt <matt@chia.net>

* farmer: Drop `target_puzzle_hash` from `GET /farmer` and `GET /login` (#6816)

* Allow creation of PlotNFTs in self-farming state

* gui: Fix install with more RAM (#6821)

* Allow implicit payout_address in self-pool state, improve error messages and param ergonomics

* print units in non-standard wallets correctly

* Fix farmer import

* Make syncing message in CLI more intuitive like the GUI

* Fix linting and show header hash instead of height

* gui: Update to 725071236eff8c81d5b267dc8eb69d7e03f3df8c

* Revert "Merge"

This reverts commit 23a1e688c5, reversing
changes made to a850246c6f.

* Revert "Revert "Merge""

This reverts commit 680331859f.

* Treat tx_record as Dict. Refactor tx submission

* Also add passed-in coin spends when processing new blocks in reconsider_peak

* Test utilities had moved

* Fix import of moved block_tools

* Potentially fix yaml

* Previously didn't take the right part of this change

* Add -y flag, improve commandline plotnft handling

* Fix typo

* Add -y flag to plotnft create

* pool_wallet: Restore from DB properly

* wallet: ignore bad pool configs

* Reduce memory

* pool_wallet: Add claim command

* pool_wallet: Set transaction records to confirmed

* wallet: Fix bug in transaction cache

* Formatting and remove log

* pool_wallet: CLI balance and improvements to plotnft_funcs.py

* pool_wallet: Simplify, and fix issue with double submission

* pool_wallet: Fix tests

* pool_wallet: Don't allow switching before relative lock height

* update gui

* change to 3000 mem

* Correct sense of -y flag for self-pooling

* cli: Display payout instructions for pool

* pool_wallet: Don't create massive transactions

* cli: Improvements to plotnft

* pool_wallet: Get correct pool state

* pool_wallet: Use last transaction block to prevent condition failure

* Add block height for current state

* Add outstanding unconfirmed transactions to pw_status

* Refine command line plotnft show pending transactions

* Fix tests by using the correct output from pw_status

* Try to fix windows build

* Print expected leave height

* label pool urls

* pool_wallet: Don't include pool 1.75 rewards in total

* wallet: Add RPC and CLI for deleting unconfirmed transactions for a wallet

* pool_wallet: If farming to a pool, show 0 balance in wallet

* pool_wallet: Show error message if invalid state, in CLI

* pool_wallet: Don't allow switching if there are pending unconfirmed transactions

* tests: Clean up pool test logging

* tests: Fix lint

* Changed the pool innerpuzzes (#6802)

* overload solutions for pool_innerpuz parameters

* Fix tests for reduced size puzzles

* deleted messy deprecated test

* Fix lint.

* fix bug where spend types were the wrong way around

* merge with richard's lint fix

* fix wallet bug
remove unnecessary signature
add defun-inline for clarity

* Swap to defun for absorb case
Use cons box for member innerpuz solution

* fix if statement for cons box p1

* remove unnecessary solution arg

* quick innerpuz fix to make tests pass

* Switch to key-value pairs
Undo cons box solution in pool_member inner puzzle

* fix singleton lifecycle test

* added some comments to calrify the meaning on "ps"

* lint fix

* reduce label size, search for label when reconstructing from solution

* no need to keep looping if `p` found

* lint fix

* Removed unecessary defun-inline and changed hyphens to underscores

* Changed created_coin_value_or_0 to an inline function

* Changed morph_condition to an inline function

* Added a comment for odd_cons_m113

* Rename output_odd and odd_output_found

* Add inline functions to document the lineage proof values

* Stager two rewrite

* Added an ASSER_MY_AMOUNT to p2_singleton_or_delayed

* Extract truth functionality to singleton_truths.clib

* Fix tree hashes

* Changed truths to a struct rather than a list.

* fix test_singletons
update did_innerpuz

* recompile did_innerpuz

* fix a log error

* Renamed variable and factored out code per @richardkiss

* lint fix

* switch launcher extra_data to key_value pairs

* fix parsing of new format of extra_data in launcher solution

* fix broken test for new launcher solution format

* remove bare raise

Co-authored-by: Richard Kiss <him@richardkiss.com>
Co-authored-by: Matt Hauff <quexington@gmail.com>

* Also add passed-in coin spends when processing new blocks in reconsider_peak (#6898)

Co-authored-by: Adam Kelly <aqk>

* Moved debug_spend_bundle and added it to the SpendBundle object (#6840)

* Moved debug_spend_bundle and added it to the SpendBundle object

* Remove problematic typing

* Add testnet config

* wallet: Memory would get corrupted if there was an error (#6902)

* wallet: Memory would get corrupted if there was an error

* wallet: Use block_record

* wallet: Add records in a full fork too

* wallet: remove unnecessary arguments in CC and DID

* add to cache, revert if transaction fails

Co-authored-by: Yostra <straya@chia.net>

* Improve comment

* pool_wallet: Fix driver bug

* wallet: Fix memory corruption

* gui: Update to latest

* Increase memory size

* tests: Add test for absorbing from pool

* small fix in solution_to_extra_data

* Fixed incorrect function name

* pooling: Fix EOS handling in full node

* [pools.testnet9]add post /partial and /farmer header (#6957)

* Update farmer.py

add post header

* Update farmer_api.py

add post header

* Update chia/farmer/farmer.py

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

* Update chia/farmer/farmer_api.py

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

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

* Fix lint and cleanup farmer.py

* farmer: Fix linting issues (#7010)

* Handle the case of incorrectly formatted PoolState data returned from inner singleton

* wallet: Resubmit transaction if not successful, rename to new_transaction_block_callback (#7008)

* Fix lint in pool_puzzles

* pooling: Fix owner private key lookup, and remove unnecessary argument

* pooling: Clear target state on `delete_unconfirmed_transactions`

* Lint

* Fix non-deterministic test

* Slight cleanup clvm driver code (#7028)

* Return None when a deserialized CLVM structure does not fit the expected format of var-value pair for singleton data

* lint

Co-authored-by: Adam Kelly <aqk>

* Revert "Add testnet config"

This reverts commit 9812442724.

Co-authored-by: matt <matt@chia.net>
Co-authored-by: Adam Kelly <aqk@aqk.im>
Co-authored-by: Mariano Sorgente <sorgente711@gmail.com>
Co-authored-by: Matt Hauff <quexington@gmail.com>
Co-authored-by: Mariano Sorgente <3069354+mariano54@users.noreply.github.com>
Co-authored-by: Adam <aqk@Adams-MacBook-Pro.local>
Co-authored-by: Adam Kelly <aqk>
Co-authored-by: Richard Kiss <him@richardkiss.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: almog <almogdepaz@gmail.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
Co-authored-by: arvidn <arvid@libtorrent.org>
Co-authored-by: willi123yao <willi123yao@gmail.com>
Co-authored-by: arty <art.yerkes@gmail.com>
Co-authored-by: William Blanke <wjb98672@gmail.com>
Co-authored-by: matt-o-how <48453825+matt-o-how@users.noreply.github.com>
Co-authored-by: Chris Marslender <chrismarslender@gmail.com>
Co-authored-by: Yostra <straya@chia.net>
Co-authored-by: DouCrazy <43004977+lpf763827726@users.noreply.github.com>
2021-06-29 14:21:25 -07:00
Almog De Paz
e5eff54149
wallet short batch sync (#6112)
* short batch sync

* switch log for fixing ci

* switch log level back

* increase test time

* new line

* test fix

* change sem to lock

* change sem to lock

* refactor

* move weight check under lock

* short sync tests

* lint

* remove duplicate code

* remove duplicate code

* add await

* fix
2021-06-29 11:25:54 -07:00
Yostra
ab4f44175b
service singleton (#6735) 2021-06-24 11:10:46 -07:00
Arvid Norberg
375ec8f69d
fix mypy warning (#6910) 2021-06-22 11:46:23 -07:00
Arvid Norberg
42fde9a8d4
move chia.util.block_tools and chia.util.wallet_tools into tests (#6799)
* move chia.util.block_tools and chia.util.wallet_tools into tests

* only depend on block_tools when we actually run the wallet in test mode
2021-06-16 11:12:26 -07:00
Nikolaj Kuntner
07f64d2190
Less log getter setup calls (#6123)
* init

* remove whitespace

* docs

* rem double colon

* more type annotation

* retrigger timed out test

Co-authored-by: wjblanke
2021-06-14 09:13:41 -07:00
wjblanke
d2cc4fdf0d
Fix broken UPnP in upnp.py (#6690)
* Contributed by phoyd: 39ef696 introduced deleteportmapping to cleanup previous mappings. deleteportmapping might throw an error from a upnp server reply when the port mapping to delete does not exist (see rfc6970, section-5.8 NoSuchEntryInArray). This prevents the subsequent addportmapping() and hence opening upnp does not work anymore (For example, issue #6250)

* added f

* lint
2021-06-11 16:10:58 -07:00
Florin Chirica
d13840ff3b
Catch exception in dns resolver. (#6613) 2021-06-10 08:55:21 -07:00
Arvid Norberg
9239ee5c9e
ClientSession lifetime simplification (#6114)
* properly initialize field of FullNodePeers in node_discovery

* clean up handling of closing the ClientSession() when we fail
2021-06-08 10:49:13 -07:00
Florin Chirica
06a23d7769
Add full node ports for testnet dns. (#6369)
* Add full node ports for testnet dns.

* Lint.
2021-06-08 09:45:53 -07:00
Florin Chirica
59d415fd71
Rename testnet peer dbs. (#6353)
* Rename testnet peer dbs.

* Add selected_network to all constructors.
2021-06-02 15:19:58 -07:00
Arvid Norberg
7800dbb58c
Cleanup shutdown (#6011)
* ignore signals in subprocesses

The sub-processes started by ProcessPoolExecutor will also receive SIGINT when the main process receives it. This results in the signal handler running in every subprocess and fail to create the task to close all connections. They print this error to stdout

* cleanup UPnP shutdown

make an explicit call to UPnP shutdown() (which joins the thread). Improve logging a bit

* wait for initialize_weight_proof task when shutting down
2021-05-26 12:18:12 -07:00
Arvid Norberg
ee35d85ad8
store tasks used to initiate peer connections (#5557)
to ensure they are kept alive and to be able to wait for them if we hit the upper limit on number of pending outgoing connections
2021-05-26 11:06:55 -07:00
Arvid Norberg
78f73b3d55
demote DNS failure log to a warning (#5771) 2021-05-24 11:53:31 -07:00
Florin Chirica
bf3ffa6eeb
Initial commit. (#5627) 2021-05-20 15:03:59 -07:00
Florin Chirica
4ad8d9dcef
Speedup connections 2. (#5421)
* Decrease sleeps.

* Wait 30 minutes before retrying address.

* Address comments.

* Address comments.

* Sleep in node discovery if we don't need connections.

* Rename sleeps.

* Lint.

* Refactor sleeps.

* Don't query introducers at startup.
2021-05-20 10:38:35 -07:00
Mariano Sorgente
5ce56bce6d
Don't use a global (#5553)
* Don't use a global

* Only construct once
2021-05-19 17:41:53 -07:00
Mariano Sorgente
1c808b6c29
Ms.spikes4 (Fix duplicate signage points) (#4844)
* Fix duplicate signage point spikes

* Block record not hash

* Fix bugs in signage point cache

* Fix test, and log in debug level

* Change transaction logging to info

* More logging improvements
2021-05-16 11:33:47 -07:00
Florin Chirica
7012ca9e07
Speedup outbound connections. (#5124)
* Initial commit.

* Fix typo.

* Retry each node once every 30 mins.

* Flake8.

* mypy.

* Bound number of concurrent outbound connections.

* Blank line.
2021-05-15 23:07:39 -07:00
Will Bendick
39ef69643b
release upnp ports on shutdown (#4024)
* release upnp ports on shutdown

* lint

* explicitly removes port mapping first to handle possible unclean shutdowns

* catches exception

* moves upnp setup to thread

* lint

* moves upnp logic to a message queue on a worker thread

* lint
2021-05-14 14:11:19 -07:00
Florin Chirica
bb662f27dc Address review comments. 2021-05-14 14:05:12 -06:00
Florin Chirica
3cbb5dc4d5 Fix bug. 2021-05-14 14:05:12 -06:00