Commit Graph

928 Commits

Author SHA1 Message Date
Matt Hauff
79ddd63ac8
fix documentation 2022-05-19 15:48:40 +01:00
Matt Hauff
67d49c265f
Add support for multiple of the same CAT in aggregate offers 2022-05-19 15:48:39 +01:00
Amine Khaldi
6b70a303c3
Apply Quexington's suggested type annotation. 2022-05-19 15:45:02 +01:00
Matt Hauff
c8a4f6e617
Better autodetection of drivers on offer creation 2022-05-19 11:09:43 +01:00
Matt Hauff
251a94fc92
Include drivers in offer summary 2022-05-19 11:09:43 +01:00
Matt Hauff
3a67499ec6
More linting 2022-05-19 11:09:42 +01:00
Matt Hauff
90ed42d5d8
isort and flake8 2022-05-19 11:08:04 +01:00
Matt Hauff
9c9514d8cc
Minor fixes 2022-05-19 11:08:04 +01:00
Matt Hauff
e09098a7cf
Add comments explaining the changes 2022-05-19 11:08:03 +01:00
Matt Hauff
049e5049f1
Remove some CAT specific stuff from tm 2022-05-19 11:08:03 +01:00
Matt Hauff
2d8d5c785d
add test coverage for driver dict in RPC 2022-05-19 11:08:02 +01:00
Matt Hauff
20aa9b3476
pivot from string to clvm for dict entries 2022-05-19 11:01:35 +01:00
Matt Hauff
ca57b578f5
Move outer_puzzles.py 2022-05-19 11:01:35 +01:00
Matt Hauff
1334862938
Fix offer RPC again 2022-05-19 10:58:27 +01:00
Matt Hauff
d1c7c7823b
Update trade manager with new generalizations 2022-05-19 10:58:25 +01:00
Matt Hauff
feaf21ba5b
Further generalize the Offer drivers 2022-05-19 10:58:23 +01:00
Matt Hauff
39b23987f3
isort 2022-05-19 10:58:22 +01:00
Matt Hauff
c9f4eeadb1
Fix offer RPC 2022-05-19 10:58:20 +01:00
Matt Hauff
79e88675a6
Remove CAT dependencies from trade_manager 2022-05-19 10:58:18 +01:00
Matt Hauff
3b59b25460
Generalize the Offer class to more than CATs 2022-05-19 10:58:17 +01:00
Arvid Norberg
afae2ad5fe
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()
2022-05-18 09:15:03 -07:00
Kyle Altendorf
cb5470b806
hints and strict type checking for test_wallet (#11541)
* hints and strict type checking for test_wallet

* fixup

* flip flop
2022-05-18 09:12:39 -07:00
Mariano Sorgente
31ed32628f
Optimize code to not perform useless subgroup checks (#11546)
* Optimize code to not perform useless subgroup checks

* Revert less important optimizations
2022-05-18 09:09:56 -07:00
Jeff
99275e6e37
Support searching derived addresses on testnet. (#11449)
* Support searching derived addresses on testnet.

* Added tests
2022-05-16 13:29:33 -07:00
Jeff
34e2dde8db
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.
2022-05-16 13:29:10 -07:00
Arvid Norberg
51fc5f6e88
remove the cache from CoinStore. It appears the cost of maintaining the cache outweighs the gains. (#11540) 2022-05-16 13:28:42 -07:00
Jack Nelson
ecada58d36
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>
2022-05-16 10:42:46 -07:00
Mariano Sorgente
56e6e68eb3
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
2022-05-16 09:49:50 -07:00
Arvid Norberg
e74ff02b09
reduce the redundant computations of coin_ids in block_body_validation (#11530) 2022-05-15 15:46:44 -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
7c91f470f4
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>
2022-05-14 02:05:27 -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
Adam Kelly
298ea9ea20
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>
2022-05-14 02:03:10 -07:00
Mariano Sorgente
d1e445fac2
Ms.mypy consensus (#11403)
* Mypy for consensus dir (Except blockchain.py)

* Finish up consensus folder mypy

* Lint

* isort

* lint

* awaitable over coroutine

* less Any

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-05-12 15:21:47 -07:00
Arvid Norberg
3795a52152
fix some LGTM issues (#11453) 2022-05-12 15:17:24 -07:00
dustinface
fc2d6d3db0
harvester: Fix deadlock on disconnect after a repeated plot sync start (#11481)
* Test plot sync start and disconnect while a sync is in progress

* Drop `Receiver._lock`, instead wait for `Receiver.sync_active` to clear

* Properly stop the sender and plot manager refreshing on disconnect

* Poll faster, drop the log

* Reset `_sync_id` at the very end of `_finalize_sync`
2022-05-12 15:16:22 -07:00
Mariano Sorgente
ce92f36055
Fix Newer block issue (#11486)
* Fix Newer block issue

* Fallback to checking memory
2022-05-12 15:15:36 -07:00
Arvid Norberg
a4ec7e7cb8
Replace MerkleSet with the rust implementation of computing the merkle root. This saves about 20% of the CPU work in the main thread when validating blocks. (#11432) 2022-05-10 04:42:45 -07:00
Kyle Altendorf
6788c0a5ef
Use context manager for locking clvm files (#11467) 2022-05-10 04:41:57 -07:00
dustinface
541b99e311
harvester: Introduce recursive_plot_scan (#11468)
* harvester: Introduce `recursive_plot_scan`

* Change log and merge boths lookups

* Drop redundant assignments
2022-05-09 16:43:53 -07:00
dustinface
d4c2f0c14a
tests: Improve test_wallet_rpc.py (#11148)
* Move wallet RPC test setup into a fixture

* Fix `mypy` issues

* Enable  `isort`

* Move `tx_in_mempool` out and reuse it instead of `tx_in_mempool_2`

* Introduce `get_confirmed_balance` and `get_unconfirmed_balance`

* Use `pytest.raises`

* Only test with an untrusted full node

* Introduce `generate_funds`

* Drop sleeps and create less blocks

* Recover trusted/untrusted sync parameterization
2022-05-05 08:22:02 -07:00
Mariano Sorgente
e0df18f85d
Ms.hint refactor (#11222)
* Some work on hints

* More cleanup and test_generator_tools

* Change relevant calls

* More refactor and cleanup

* More refactor

* Small fix

* Create wrapper object PeakPostProcessingResult

* Lint and small fix

* Fix a hint bug

* Fix hint update_wallets

* Fix test_full_sync

* pre-commit

* Start with PR review comments

* More efficient iteration

* Remove tx_removals_additions_and_hints

* Revert mozilla ca

* Fix issue with startup
2022-05-05 08:19:57 -07:00
Zachary Brown
a1db012b7a
Add libgmp-dev to Bladebit installation (#11406) 2022-05-05 08:17:14 -07:00
dustinface
629c303077
cmds: Use the new plot_count of get_pool_state in plotnft cmds (#11414) 2022-05-05 08:16:10 -07:00
Arvid Norberg
1b2d119cc3
optimize hash_coin_list() by sorting pure coin_ids, rather than Coins that need to compute its name multiple times during sorting, and also by sorting the actual binary coin names, not hexadecimal strings (#11421) 2022-05-04 07:24:55 -07:00
dustinface
0d5251c3a7
farmer|gui: Enable paginated plot loading and improved state reporting (#11367)
* farmer: Adjust notifications from the farmer to the UI

- Only send the data for the harvester which actually sent an update
- Notify for each loaded batch during initial loading

* Enable improved farmer/harvester GUI
2022-05-03 15:33:38 -07:00
wjblanke
0156d3471b
readd ping_task as keepalive for daemon (#11356)
* readd ping_task as keepalive for daemon

* raised and lowered logging levels

* flake
2022-05-03 10:36:43 -07:00
dustinface
d00d045d9c
farmer|rpc|tests: Implement paginated harvester plot endpoints (#11365)
* farmer|rpc|tests: Implement paginated harvester plot endpoints

* Simplify filtering

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

* Let the API handle the exceptions

* Simplify the other filtering too

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

* Simplify count assertions

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

* Refactor `is_filter_match` to `plot_matches_filter`

And just convert to `Plot` in tests.

* Move `chia.util.misc.KeyValue` to `chia.rpc.farmer_rpc_api.FilterItem`

* Rename `peer_id` to `node_id` to be match `get_harvesters_{summary}`

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-05-03 09:17:05 -07:00
Arvid Norberg
340e26e154
simplify merkle set (#11416)
* _make_middle doesn't need to be a member function

* add some unit tests
2022-05-03 07:49:29 -07:00
Zachary Brown
3767fed513
update plotters installation to include an apt update before the apt install (#11400) 2022-05-02 15:56:49 -07:00