Commit Graph

3838 Commits

Author SHA1 Message Date
Kyle Altendorf
cf6a529265
use type name in Pulled from queue: log messages (#15003) 2023-05-03 00:29:52 -05:00
Kyle Altendorf
1228892c43
force \n/lf line endings in pre-commit (#15036)
* force \n/lf line endings in pre-commit

* more

* set -o pipefail

* Revert "set -o pipefail"

This reverts commit b359ec806b.
2023-05-03 00:29:31 -05:00
Kyle Altendorf
7f7bce8677
help= not short_help= (#15076)
* help= not short_help=

* oops

* more

* more
2023-05-03 00:29:13 -05:00
Amine Khaldi
fc1e734b92
Merge commit '4e71529422039ff76d6b3af064f8d7653ccead5f' into checkpoint/main_from_release_1.8.0_4e71529422039ff76d6b3af064f8d7653ccead5f 2023-05-02 19:22:13 +01:00
Arvid Norberg
7dc99095d0
add generator2 to the repository (#15152)
add generator2 to the repository. This is intended to be used in the 2.0 hard fork
2023-05-02 12:14:44 -05:00
dustinface
138154d5cd
wallet: List the columns for INSERT into coin_record (#15159) 2023-05-01 14:09:28 -05:00
dustinface
96cacc8a24
wallet: Revert "Add new coin_type & metadata to coin_records (#15013)" (#15154)
Revert "Add new coin_type & metadata to coin_records (#15013)"

This reverts commit a998ea48d8.
2023-05-01 09:56:48 -05:00
dustinface
b0cc1bebdb
wallet: Lock WalletStateManager.lock while populating balances initially (#15149)
Lock `WalletStateManager.lock` while populating balances initially
2023-04-28 14:55:15 -05:00
dustinface
ae5f23e51c
wallet: Move assignments of WalletStateManager._sync_target (#15148) 2023-04-28 14:34:44 -05:00
dustinface
1f8fc6410c
util: Async DNS lookups (#14999)
* Rename `get_host_addr` to `resolve`

* Async DNS lookups in `resolve`

* Drop not needed `str` conversions
2023-04-28 13:37:28 -05:00
Kyle Altendorf
322c54f6e3
rework class protocol check pattern (#15134) 2023-04-27 09:56:37 -05:00
Amine Khaldi
808514a80b
Simplify handling additions and removals in validate_spend_bundle() (#15131)
Simplify handling additions and removals in validate_spend_bundle().
2023-04-27 09:56:14 -05:00
dustinface
f902655efc
wallet: Implement WalletNFTStore.delete_wallet (#15128) 2023-04-27 09:55:53 -05:00
Amine Khaldi
de6fb526b5
Implement get_items_by_coin_ids() for the mempool (#15069)
Implement get_items_by_coin_ids() for the mempool.
2023-04-27 09:55:01 -05:00
Amine Khaldi
1748e35526
Simplify MempoolItem's cost property (#15058)
Simplify MempoolItem cost property.
2023-04-27 09:54:40 -05:00
dustinface
aa40fa7f21
wallet: Drop AmountWithPuzzlehHash, use Payment instead (#15019) 2023-04-27 09:52:27 -05:00
dustinface
6883218ce0
wallet: Enable and fix more mypy for wallet_state_manager.py (#14900)
mypy: Hint `WalletStateManager`
2023-04-27 09:51:50 -05:00
Kyle Altendorf
2ed75d47f3
more mypy platforms in ci (#12299)
* more mypy platforms in ci

* check not checks

* oh yeah, activate...

* add 3.11

* adjust job names

* actually use the right python version for install

* adjust for 3.7 hinting support

* exclude macos 3.7 and macos arm 3.8

* back to 3.8 for now

* major_dot_minor

* oops

* move ignore comments for 3.7

* and more
2023-04-27 09:51:18 -05:00
dustinface
4c7f7e7d23
wallet: Implement WalletCoinRecord.to_json_dict_parsed_metadata (#15108) 2023-04-25 11:21:10 -06:00
Arvid Norberg
4e71529422
lower MAX_FUTURE_TIME to 2 minutes with the 1.8.0 soft-fork activation (#15035) 2023-04-24 12:52:38 -06:00
Kyle Altendorf
2e9647e32a
extract wallet specific behavior from get any service client (#15086)
* extract wallet behavior from get_any_service_client()

* another

* style
2023-04-24 12:50:40 -06:00
Kyle Altendorf
264941eddf
hint chia.rpc.full_node_rpc_client (#14705)
hint chia.rpc.rull_node_rpc_client
2023-04-24 12:45:57 -06:00
Amine Khaldi
cf44101bc6
Use "item" instead of "spend" in mempool's items functions names (#15103)
Use "item" instead of "spend" in mempool's items functions names.

With this we're consistent with mempool's internal items map (_items) and _row_to_item as well as the return types.
2023-04-24 12:45:37 -06:00
Kronus91
24019e35bb
Add DID CLI (#15065)
* Add DID CLI

* minor fixes

* build fix

* resolving comments

---------

Co-authored-by: Sebastjan Trepca <trepca@gmail.com>
2023-04-24 12:44:43 -06:00
dustinface
d2997820b3
server: Resolve introducer right before the connection attempt (#14998) 2023-04-19 19:55:42 -05:00
Jack Nelson
872f939132
Add Chia Simulator tools directly Into Chia Blockchain (#15005)
* add simulator tool + tests into chia blockchain

add chia dev ...

* isort

* make sim chia root use normal chia root as a part of it

* fix starting path for tests

* cleanup start and stop + cli

* add extra env message

* fix cmds

* update test

* add existing_plots arg

* change to consume_errors

* fix tests

* cleanup cmds_util.py

* cleanup click

* clean up block_tools

dataclass + logic cleanup & tests

* isort block_tools.py
2023-04-19 19:48:21 -05:00
Earle Lowe
75caa352a7
New S3 plugin endpoints for add_store_id and remove_store_id (#15030)
* add_store_id and remove_store_id endpoints

* handle bucket info during add/remove

* Updated add and remove store id endpoints

* fix typo
2023-04-19 14:22:54 -05:00
Earle Lowe
7f0c338a27
Add timestamp and formatting to S3 plugin log (#15083)
* add date/time to log output

* minor comment fix

* configurable log_level
2023-04-19 14:03:37 -05:00
Earle Lowe
70112169d8
Removed "failed to write files" log spam from data layer (#15082)
remove log spam for datalayer
2023-04-19 12:01:58 -05:00
Matt Hauff
e5dfac4708
Check for directory existence before creating offer (#14990)
Check for dir existence before creating offer
2023-04-19 10:55:17 -05:00
Arvid Norberg
4ebd9498d1
activate the soft-fork and soft-fork2 earlier on testnet10 (#14921) 2023-04-19 10:54:30 -05:00
Almog De Paz
a34a7dbb2a
DL plugin Add missing files (#15062)
* add_missing_files

* lint

* dont error on fail to write

* use resource

* remove prints

* use dl folder and file names

* rearrange loop

* remove redundant str conversion

* dont break on failed upload
2023-04-19 10:48:06 -05:00
Earle Lowe
433a414496
Add plugin_info and healthz endpoints to s3 plugin service, add chia data plugins check cli (#15028)
* Add plugin_id and healthz endpoints to s3 plugin service

* Add `chia data plugins check` cli

* plugin_id -> plugin_info

* updates based on reviews

* Use gather to run the lookups

* Update chia/data_layer/data_layer.py

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

* Fix typo

* short_help -> help

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-04-18 18:45:35 -05:00
Arvid Norberg
536830b09b
Generator mod cleanup and simplification (#15055)
* remove unused run_generator_mempool() function

* move run_generator_unsafe() into the tests, which is the only place it's used

* remove (somewhat meaningless) setup_generator_args() and create_generator_args()

* remove unused GENERATOR_MOD in mempool_check_conditions.py

* remove redundant get_generator() function

* transition analyze-chain.py to use run_block_generator() and drop dependency on GENERATOR_MOD

* fixup type hints in test_rom.py

* fixup type hints in test_compression.py

* fixup type hints in test_generator_types.py
2023-04-18 16:30:10 -05:00
dustinface
04abd86555
wallet: Fix, simplify and test TransactionRecord.is_valid (#15048)
* Add `minimum_send_attempts`

* Fix `MempoolInclusionStatus` check

* Fix error access

* Fix error check

* Simplify

* Test `TransactionRecord.is_valid`
2023-04-18 11:28:50 -05:00
dustinface
58302968d9
server: Try to convert in known_active_capabilities (#15046) 2023-04-18 11:28:00 -05:00
Matt Hauff
e5b94d34a0
Chialisp file extensions (#14996)
* Rename chialisp file extensions

* Add pre-commit check for .clvm files

* Delete sha256tree files

* remove hash files in favor of central dictionary

* Add check for missing files like hex and hash entries

* Enhance clsp pre-commit check

* Actually check hash matches

* Update tools/manage_clvm.py

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

* Update tools/manage_clvm.py

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

* Fix Windows file writing

* Fix setup.py package_data fields

* Load hash dict at runtime

* Move away from exception pattern

* Bad equality check

* Minor fixes

* remove trailing whitespace fix

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-04-18 11:27:17 -05:00
dustinface
d9be2004c7
wallet: Some cleanup of WalletNode.fetch_puzzle_solution (#14896)
* wallet: Introduce `WalletNode.get_coin_spend_for_coin_state`

* Rename `fetch_puzzle_solution` and `get_coin_spend_for_coin_state`

* Free `fetch_coin_spend` and `fetch_coin_spend_for_coin_state`
2023-04-18 11:26:52 -05:00
Earle Lowe
7c719c35c7
Added some sanity checks to upload and download for S3 plugin (#15057)
* Added some sanity checks to upload and download

* Add server files path to config

* small fix

* send filenames and not paths now

* minor tweaks

* Update chia/data_layer/s3_plugin_service.py

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

* use bytes32.fromhex and other fixes

* set host to "localhost"

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-04-17 22:18:56 -05:00
Amine Khaldi
f278d9ccf8
Simplify create_bundle_from_mempool's handling of removals (#15056)
Simplify create_bundle_from_mempool's handling of removals.

They're already taken care of by aggregation.
2023-04-17 16:34:22 -05:00
dustinface
c9f9dbd4f9
wallet: Select enough XCH to cover the fee when creating an offer (#15051)
* Partially revert 6d09a06

* Include fee amount when selecting XCH coins for offers

* Rename `get_coin_amount` -> `amount_to_select`

* Adjust comment

* No need to create a list first
2023-04-17 15:42:27 -05:00
Earle Lowe
2faa72a50a
Add very basic logging support to S3 plugin (#15031)
* Add very basic logging support to plugin

* Address review comments
2023-04-17 11:16:23 -05:00
Adam Kelly
317c6461de
Return fee estimates as integer mojos (#15020) 2023-04-17 01:31:20 -05:00
Earle Lowe
28a5d75506
S3 plugin config and endpoint updates (#15037)
* Addition logging for datalayer wrt plugins

* some plugin modifications to config and endpoints

* Add entry point and some minor config checking

* Improved config file reading for store_ids

* Changed to upload_bucket and download_url

* Apply suggestions from code review

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

* Code review suggestions

* uploaders and downloaders are now URLs and this was missed earlier

* Update pyinstaller.spec to include plugin binary

* updates based on code review

* Update chia/data_layer/s3_plugin_service.py

Co-authored-by: Almog De Paz <almogdepaz@gmail.com>

* minor updates

* Add boto3 to setup for s3 plugin

* Add None check

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: Almog De Paz <almogdepaz@gmail.com>
2023-04-14 18:07:00 -06:00
Arvid Norberg
9b8cdd36da
limit expiring transactions (#14993)
limit the mempool size used for transactions with short expiration times. This makes it so transactions that expire in the next 15 minutes may not take more than one block worth of cost in the mempool
2023-04-14 15:23:24 -06:00
dustinface
d128c44079
wallet: Drop unused Wallet.create_spend_bundle_relative_chia (#15017) 2023-04-14 15:22:43 -06:00
dustinface
a7e7b9a290
server: Rework config peer resolving and connection handling (#14997)
merging as the snyk issue is confirmed a false positive
2023-04-14 15:22:24 -06:00
dustinface
4f7e2ff8c3
util: Cleanup Tuple[Optional[Err], ..] returns in condition_tools.py (#15009) 2023-04-14 15:20:36 -06:00
dustinface
20f10b4655
wallet: Reduce DB lookups in handle_did and handle_nft (#14969)
* Use the cached wallets in `handle_did`

* Use the cached wallets in `handle_nft`
2023-04-14 15:20:16 -06:00
Kyle Altendorf
0832f211b7
cleanup connection removal from ChiaServer.all_connections (#15026) 2023-04-14 15:19:17 -06:00
dustinface
3cd782be36
wallet: Some rework/cleanup of weight proof validation (#14572)
* Drop unused `List[SubEpochSummary]` return

* Drop unused `SubEpochSummary` return

* Raise in `WalletWeightProofHandler.validate_weight_proof`

* Move validation logs

* Set the new weight proof inside `fetch_and_update_weight_proof`

Which was `fetch_and_validate_the_weight_proof` before.

* Drop `WalletWeightProofHandler._weight_proof_tasks`, just await them

Doesn't seem to make a lot sense to have a list of tasks where we always 
just add a task, await it and remove it after. This happens in the long 
sync so to parent task will cancel the awaited task anyway.
2023-04-14 15:18:25 -06:00
Adam Kelly
4b594637c0
Rename singleton helper functions (#14983)
* Rename singleton helper functions

* Amend abbreviation in Singleton Puzzle creation functions
2023-04-12 11:34:08 -06:00
Almog De Paz
5b39e71842
Dl plugin service (#14883)
* generic downloader

* add s3 Downloader

* tests

* pre commit

* create uploader protocol, factor out upload code

* fix pre commit

* add s3 uploader

* add add helper for testing with real bucket

* typing

* lint

* logs

* start service separation

* working aiohttp s3 service

* lint

* multiple instances config

* break if failed to write

* better error handling

* update from conf before checking

* lint

* redundant config

* also update bucket

* improve exception handling

* remove old tests

* uae multiple uploaders

* Update chia/data_layer/data_layer.py

pr comments

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

* pr comments

* Apply typos fixes from code review

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

* Update chia/data_layer/s3_plugin_service.py

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

* scheme in conf

* use byte32 for store_ids list

* use dataclass instead of tuple for return value

* initial config handling for uploaders and downloaders

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
Co-authored-by: Earle Lowe <30607889+emlowe@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
2023-04-12 11:33:41 -06:00
Kronus91
a998ea48d8
Add new coin_type & metadata to coin_records (#15013)
* Add new coin_type & metadata to coin_records

* Remove unrelated changes

* Fix pre-commit

* Remove unrelated changes

* Fix pre-commit

* Add get_coin_records_between

* Fix field data type

* Resolve comments

* Fix unit test

* Remove unrelated changes

* Remove unrelated changes
2023-04-12 11:30:08 -06:00
dustinface
f0006b5353
server: peer_host + peer_port -> peer_info in WSChiaConnection (#14151) 2023-04-12 11:14:38 -06:00
Justin England
1360383db9
more passing arguments by name in ChiaServer (#14937)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:



<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:55:37 -06:00
Justin England
9f0a2ece07
remove unused Service(server_listen_ports=) parameter (#14928)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

remove dead code so the remaining code is more comprehensible

<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:55:19 -06:00
Justin England
4976017853
change self peer connection error to info, remove traceback (#14884)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

Self connection errors don't need to be `ERROR` level in the log nor do
they need to have tracebacks. This will mostly happen when a node is
unaware of one or more of its own public IPs being used by the network.
Could be IPv4 vs. IPv6, or multiple IPs, or just being behind a NAT.

<!-- Does this PR introduce a breaking change? -->
### Current Behavior:

```python-traceback
2023-03-22T14:00:46.076 full_node full_node_server        : ERROR    Exception Trying to connect to a peer (PeerInfo(_ip=IPv4Address('<REDACTED>'), _port=58445)) with the same peer_id: <REDACTED>, exception Stack: Traceback (most recent call last):
  File "/home/ubuntu/chia-blockchain/chia/server/server.py", line 525, in start_client
    raise RuntimeError(f"Trying to connect to a peer ({target_node}) with the same peer_id: {peer_id}")
RuntimeError: Trying to connect to a peer (PeerInfo(_ip=IPv4Address('<REDACTED>'), _port=58445)) with the same peer_id: <REDACTED>
```

### New Behavior:

`INFO` level logging without a traceback

<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:51:46 -06:00
Justin England
72697119b8
close daemon client even for a BaseException in acquire_connection_to_daemon() (#14867)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

As is this would not close the daemon if a BaseException were raised.
For example `KeyboardInterrupt` or `asyncio.CancelledError` (on 3.8+).

<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:50:45 -06:00
Justin England
a1567febeb
avoid FullNode.fetch_block_batches() from putting two Nones into the batch queue (#14804)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

Please weigh in on whether this should be applied to the release or
retargeted to main.

The `finally:` clause will already result in `None` being put into the
queue. I expect that the other `None` pushed before the `return` is
unnecessarily doubling this up. I don't know if the double `None` has
any negative effect.


<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:42:52 -06:00
Justin England
b8fa374150
make python -m chia work (#14785)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

Make it so `python -m chia` works. This makes it easier to subprocess
such as `subprocess.run([sys.executable, "-m", "chia"], check=True)`
when we need to.

<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:41:33 -06:00
Justin England
3d8f7d3ba1
Changed: remove unused self.new_subslot_end (#14781)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

self.new_subslot_end is not currently used. clean up to make code
cleaner

<!-- Does this PR introduce a breaking change? -->
### Current Behavior:

Same behavior

### New Behavior:

Same behavior

<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:

No change in behavior. Code is the same.

<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:37:38 -06:00
Justin England
0022ce797d
Small improvements to trusted peer check to include IPv6 addresses and add tests (#14626)
Refactor function `is_trusted_peer` to a standalone easily testable
function. Leverage the existing `is_localhost` function to extend
coverage to IPv6 local address for the trusted peer check

Added tests for the new standalone function
2023-04-11 14:36:37 -06:00
Justin England
93ba5127ba
hint chia.cmds.passphrase, passphrase_funcs (#14736)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:



<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:32:41 -06:00
Justin England
c0621737c8
mypy chia.util.files (#14541)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:

Code cleanup

<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:29:42 -06:00
Justin England
f02a8ed82c
Clean create tandem xch tx (#15012)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:
It's unnecessary to have the same create_tandem_xch_tx method in
different wallets.


<!-- Does this PR introduce a breaking change? -->
### Current Behavior:
Each wallet its own create_tandem_xch_tx


### New Behavior:
Share the create_tandem_xch_tx in the standard wallet, unless the wallet
needs to override, like CAT wallet.


<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:26:14 -06:00
Justin England
6d9b65a3e1
add explicit listen option for Service() and ChiaServer.start_server() (#14932)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->
### Purpose:



<!-- Does this PR introduce a breaking change? -->
### Current Behavior:



### New Behavior:



<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->
### Testing Notes:



<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2023-04-11 14:24:44 -06:00
Kyle Altendorf
16835f3eb1
add new peak and tidy new compact vdf limited semaphore full logging (#14831)
* add new peak and tidy new compact vdf limited semaphore full logging

* log the peer as well

* delayed formatting for debug logging

* -f
2023-04-11 14:23:30 -06:00
ytx1991
31c1ae7324
Fix conflicts 2023-04-10 14:37:36 -07:00
ytx1991
634d19a396
Remove redundant create_tandem_xch_tx 2023-04-10 14:33:57 -07:00
Kyle Altendorf
90d0641a9f
Merge branch 'main' into ak.lint-files 2023-04-10 08:59:14 -04:00
Arvid Norberg
00a3647643
optimize Mempool.add_to_pool() (#14988)
* optimize at-capacity check in mempool.add_to_pool() by only computing the total cost once and remove all items in a single call

* use sqlite logic

* add test for Mempool.add_to_pool() when it's full
2023-04-07 12:09:46 -05:00
dustinface
f3e165fc21
wallet: Enable and fix more mypy in wallet_node.py (#14913) 2023-04-07 05:16:12 -05:00
dustinface
bd571de422
wallet: Handle some peer closed cases better (#14642)
* Move some logs to `DEBUG` for disconnected peers

* Introduce `_add_coin_states` to log and cleanup cache in one place only

* Bail out early for disconnected peers in some places

* Consider renaming from #14460
2023-04-06 14:48:19 -05:00
dustinface
d819d8ffc5
wallet: Drop chia.wallet.user_settings (#14899) 2023-04-06 14:47:28 -05:00
Adam Kelly
2c25a79612
Update Wallet command line help for key fingerprints (#14982) 2023-04-05 15:09:54 -05:00
Arvid Norberg
44cdd921e4
windows fix of memory profiler (#14987)
when enabling memory profiler, use a directory name compatible with windows' filesystems
2023-04-05 12:57:17 -05:00
Amine Khaldi
e1064fac05
Simplify creating a spend bundle from mempool items and move this logic to the mempool (#14934)
Simplify creating a spend bundle from mempool items and move this logic to the mempool.
2023-04-05 12:56:57 -05:00
dustinface
a0659e923e
data_layer: Simplify wallet get and create code (#14878)
* Apply `final` decorator to `DataLayerWallet`

* Simplify `DataLayerWallet.create_new_dl_wallet`

* Simplify `DataLayerWallet.create`

* Improve `WalletStateManager.get_dl_wallet`

* More use of `WalletStateManager.get_dl_wallet`

* Only try `get_dl_wallet`
2023-04-05 12:56:39 -05:00
dustinface
c63b0020fc
wallet: Drop leaking weight proof validation cache (#14574)
* Make `wp_valid_cache` a LRU cache

* Drop `wp_valid_cache`
2023-04-05 12:55:37 -05:00
Arvid Norberg
624b24560a
Mempool insertion order (#14971)
* prepare mempool spends_by_feerate test for more test cases, move it to test_mempool.py (since it's testing the Mempool class)

* use insertion order as tie-breaker in mempool
2023-04-04 12:51:26 -05:00
Kyle Altendorf
b839dfa0c1
update black to 23.3.0 (#14537)
* unpin black

* Update setup.py

* Update .pre-commit-config.yaml

* black

* black

* 23.3.0

* cleanup
2023-04-04 12:50:58 -05:00
dustinface
cc6ff836cf
wallet: Introduce WalletIdentifier (#14964) 2023-04-04 00:08:10 -05:00
Matt Hauff
e5d87f39f2
Check hint length in notficication manager to avoid raise (#14972) 2023-04-03 15:05:30 -05:00
Jeff
db844b5bfb
expose NFT coin info's latest_height to RPCs requesting NFT info (#14954) 2023-04-03 15:01:39 -05:00
Kyle Altendorf
d78b905152
remove synced status check from wallet rpc /push_transactions endpoint (#14974)
This is causing trouble around creating transactions and then submitting them as the creation triggers the wallet to consider itself unsynced when creating a new address for change while building a transaction.  This creates a race between syncing and the calling code submitting the generated transaction.
2023-04-03 14:00:51 -05:00
François Deppierraz
b594f8915b
seeder: case-insensitive DNS label matching to support bit 0x20 use (#14933)
Some DNS resolvers (notably 8.8.8.8) have implemented the use of bit 0x20 in
DNS labels to make cache poisoning attacks more difficult.

See https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00 for
more details.

Without this patch, resolution though Google public DNS fails:

$ dig dns-introducer.chia.net @8.8.8.8 +short | wc -l
       0

Whereas it works as expected on a seeder which already deployed this patch:

$ dig chia.ctrlaltdel.ch @8.8.8.8 +short | wc -l
      32
2023-04-03 13:33:32 -05:00
Kyle Altendorf
7c9b3a25c1
Correct SQLite logging when using db_wrapper.manage_connection() (#14866)
* Correct SQLite log file handling in db_wrapper.manage_connection()

* simplify and fixup

* black

* fix/simplify

* just try/finally
2023-04-03 13:33:04 -05:00
dustinface
f90de71c9a
wallet: Raise in WalletNode.get_full_node_peer and move some of its calls (#14842)
wallet: Raise in `WalletNode.get_full_node_peer` + move some calls of it
2023-04-03 11:27:38 -05:00
dustinface
4dcbbda01e
wallet: Rename add block/state methods (#14460)
* `WalletBlockchain.receive_block` -> `WalletBlockchain.add_block`

* `receive_state_from_peer` -> `add_states_from_peer`

* `receive_and_validate` -> `validate_and_add`
2023-04-03 09:52:35 -05:00
dustinface
5e3bf65abb
wallet: Improve balance caching (#14631)
* wallet: Improve balance caching

* Fix missing entries in `get_balance` RPC and add a test for it

* Fix comment
2023-04-03 09:52:11 -05:00
dustinface
e8e8e0d709
wallet: Improve coin state retry wait logic and retry store test (#14911)
* wallet: Improve coin state retry wait logic and improve retry store test

* Avoid sleeping after uncatched exceptions

* Sleep only at the beginning since we have reduced timeout now in tests
2023-04-03 09:51:13 -05:00
dustinface
6889c9cd30
wallet: Remove unused transaction getter (#14923) 2023-04-03 09:50:50 -05:00
dustinface
db7aada45a
util: Drop unused chia.util.pip_import (#14965) 2023-04-03 09:50:27 -05:00
Kyle Altendorf
ec6b13192b
just return 2023-04-03 08:26:00 -04:00
Arvid Norberg
20bfba0fa6
assert_before_height, assert_before_seconds fields in MempoolItem (#14931)
fix issue where assert_before_height and assert_before_seconds fields in MempoolItem would not be populated
2023-03-30 12:06:22 -05:00
Kyle Altendorf
d9f7d01e3a
Merge branch 'main' into hint_chia_cmds_passphrase 2023-03-29 22:17:32 -04:00
Kyle Altendorf
cabb0ceec5
move it 2023-03-29 22:11:52 -04:00
Kyle Altendorf
e376f82860
Merge branch 'main' into quieter_self_connection_logging 2023-03-29 22:06:21 -04:00
Kyle Altendorf
562e791ddb
avoid consuming exceptions while closing the daemon 2023-03-29 21:31:01 -04:00
Kyle Altendorf
de7d68468b
just ChiaServer.start() since it sometimes doesn't really start serving 2023-03-29 21:21:15 -04:00
Kyle Altendorf
89b8cfae9c
not private... 2023-03-29 21:18:51 -04:00
Kyle Altendorf
e2c4417f77
more passing arguments by name in ChiaServer 2023-03-29 21:16:22 -04:00
Amine Khaldi
1577f4aa33
Fix the mempool fee rate calculation (#14926)
* Fix the mempool fee per cost calculation.

It's currently performing integer division instead of float division, resulting in incorrect sorting of mempool items by fee rate. Items with x.y FPC get all treated as items of x.0 FPC.

* Add unit tests for mempool's spends_by_feerate.
2023-03-29 12:12:14 -05:00
Kyle Altendorf
3b29c2ff7f
add explicit listen option for Service() and ChiaServer.start_server() 2023-03-28 21:22:05 -04:00
Kyle Altendorf
a609a815ec
remove unused Service(server_listen_ports=) parameter 2023-03-28 13:55:44 -04:00
Sebastjan Trepca
123d695c4e
slightly faster nft complex offer tests (#14847)
* slightly faster nft complex offer tests

* cached bundle, faster offer matching

* nft metadata test fix

* more optimizations

* use get_nft_count method in tests

* use counts in bulk minting, avoid sleep

* flake

* offer cache fix

* forward compat param, max int16

* only parse programs with pairs

* cache offer data on method call, not init

* black
2023-03-28 11:46:09 -05:00
dustinface
5e5395305d
wallet: Drop some parameters from WalletStateManager.add_new_wallet (#14919) 2023-03-27 18:07:19 -05:00
Arvid Norberg
52ee3df272
update condition codes constants in clvm include file (#14723) 2023-03-27 15:43:59 -05:00
Amine Khaldi
9a664d9424
Minor simplification to the mempool conflicts check (#14918)
Minor simplification to the mempool conflicts check.
2023-03-27 15:43:31 -05:00
dustinface
8ca8de8046
wallet: Some tweaks and rename of WalletStateManager.new_coin_state (#14863)
* Rename `new_coin_state` -> `add_coin_states` in `WalletStateManager

* Avoid redundant coin id calculations

* Don't `max`, just use `derivation_index` since its max by the condition

* Just get the children in the begining since we anyway always fetch them

* Don't pre-hint `existing`

* Adjust some logging
2023-03-27 13:29:50 -05:00
dustinface
d83a6f8d14
consensus: Rename add block method/enum (#14459)
* `ReceiveBlockResult` -> `AddBlockResult`

* `Blockchain.receive_block` -> `Blockchain.add_block`
2023-03-27 12:57:37 -05:00
dustinface
d8fac8666e
wallet: Enable and fix more mypy in wallet_weight_proof_handler.py (#14912) 2023-03-27 10:19:25 -05:00
dustinface
4ee0ac9d90
wallet: Drop unused code in wallet_state_manager.py (#14898) 2023-03-27 10:19:01 -05:00
dustinface
170bd986fe
wallet: Some WalletType cleanup (#14897)
* Return `WalletTye` in `WalletProtocol.type`

* Compare to `WalletType` in `WalletStateManager.create`
2023-03-27 10:18:36 -05:00
dustinface
5a25241ffa
wallet: Add WalletProtocol.wallet_info (#14895) 2023-03-27 10:18:12 -05:00
dustinface
3772365198
wallet: Rename WalletNode.untrusted_caches -> WalletNode.peer_caches (#14886) 2023-03-27 10:17:48 -05:00
dustinface
9b608f40f9
wallet: Drop WalletCoinStore.get_multiple_coin_records (#14862) 2023-03-27 10:16:33 -05:00
dustinface
a5466ad646
server: Rename respond_peers to add_peers in node_dicovery.py (#14461)
server: `respond_peers` to `add_peers` `node_dicovery.py`
2023-03-27 10:15:53 -05:00
dustinface
3e76f78e37
daemon: Fix removal while iterating over connections set (#14887) 2023-03-25 00:28:25 -05:00
Earle Lowe
b8e5aebf54
Fixed windows issues with passphrase prompt on CLI by flushing prompt (#14904)
flush prompt on windows
2023-03-25 00:26:03 -05:00
William Allen
2d7111084e
checkpoint: into main from release/1.7.1 @ 9a4b42b022 (#14905)
Source hash: 9a4b42b022
Remaining commits: 2
2023-03-24 22:49:18 -05:00
Amine Khaldi
8afba0814d
Remove no longer needed cost_per_byte cases (#14850)
Remove no longer needed cost_per_byte cases.
2023-03-24 18:29:50 -05:00
Amine Khaldi
c1c655981d
Merge commit '9a4b42b022a31357e36fd92900cf3efc3be8a02d' into checkpoint/main_from_release_1.7.1_9a4b42b022a31357e36fd92900cf3efc3be8a02d 2023-03-24 20:01:56 +01:00
dustinface
df6991551a
wallet: Drop some unused members of WalletNode (#14876) 2023-03-24 13:29:17 -05:00
dustinface
d18af71e32
wallet: Simplify WalletStateManager.coin_added (#14852)
* Simplify coinbase/tx_type logic

* Confirm transactions immediately, don't create a list first

* Move transaction confirmation logic

* Combine `TransactionRecord` creation cases since they are equal

* Drop `timestamp`

* Drop redundant parentheses

* Just assign to `change`

* Rename `coin_record_1` -> `coin_record`

* `break` after transaction was confirmed

* Harden `coinbase` condition
2023-03-24 13:28:55 -05:00
Amine Khaldi
7acba82607
Merge commit 'f637881f80049f5648acd1936a2da936b5ca79a1' into checkpoint/main_from_release_1.7.1_f637881f80049f5648acd1936a2da936b5ca79a1 2023-03-24 14:36:57 +01:00
dustinface
c889ba02cd
wallet: Cleanup get_timestamp_for_height + Drop height_to_time (#14885) 2023-03-24 03:38:43 -05:00
Kyle Altendorf
22aabb4c5c
remove traceback from LockQueue._run() cancellation debug logging (#14805) 2023-03-24 03:37:59 -05:00
Arvid Norberg
8dbfc4840a
enable soft-fork2 conditions (incl. ASSERT_BEFORE) (#14733)
* enable soft-fork2

* add blockchain (consensus) test for time-lock conditions (non-ephemeral spend)

* introduce new soft-fork rule to compare ASSERT_SECONDS_* conditions against the previous transaction block's timestamp (to be consistent with ASSERT_HEIGHT_* conditions)

* bump chia_rs. This updates the mempool rules to disallow relative height- and time conditions on ephemeral coin spends

* implement assert_before in mempool_check_time_locks. Extend ephemeral coin test in blockchain with assert_before conditions

* implement support for assert_before conditions in compute_assert_height()

* support assert-before in mempool

* add timelock rule

* address review comments
2023-03-23 11:30:10 -05:00
Kyle Altendorf
83c0b0cb0f
change self peer connection error to info, remove traceback 2023-03-22 13:22:11 -04:00
Adam Kelly
15d338976d
Add placeholders for DAO Wallet directories (#14858) 2023-03-22 04:47:32 -05:00
Arvid Norberg
8d7a462702
can_replace() tests (#14864)
* mempool min fee increase is a constant

* make can_replace() a free function rather than a member of mempool. It doesn't need to be a member, and a free function is easier to test

* simplify can_replace by passing in MempoolItem

* slightly simplify handling of conflicting mempool items in mempool_manager, to avoid double lookups

* simplify can_replace() by just passing removal_names instead of the whole dict

* add unit test for can_replace()
2023-03-21 18:41:16 -05:00
Matt Hauff
38180cb2b6
Add support to cat_spend RPC for running TAIL (#14730) 2023-03-21 13:33:07 -05:00
Kyle Altendorf
c33a57f7fb
close daemon client even for a BaseException in acquire_connection_to_daemon() 2023-03-21 08:19:13 -04:00
Sebastjan Trepca
e11c235b9f
added wallet_removed to allowed changes (#14855) 2023-03-21 04:23:29 -05:00
dustinface
aeddd8e92e
util: Drop outdated comments (#14787) 2023-03-21 03:34:26 -05:00
Kyle Altendorf
9a4b42b022
exclude CompressorArg.generator from repr() due to size (#14849) 2023-03-21 00:26:06 -05:00
Arvid Norberg
f637881f80
1.7.1 fixes (#14860)
* Zstdwjb (#80)

* limit decompression output size

* added test

---------

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

* check MAX_GENERATOR_REF_LIST_SIZE earlier (#68)

* make INFINITE_COST more reasonable (#69)

---------

Co-authored-by: William Allen <wallentx@users.noreply.github.com>
Co-authored-by: William Blanke <wjb98672@gmail.com>
2023-03-21 00:20:53 -05:00
dustinface
543f8c24eb
wallet: Return a dict in WalletCoinStore.get_coin_records (#14828) 2023-03-20 13:17:59 -05:00
dustinface
6b39c133c1
full_node: Avoid some list copying in FullNode.update_wallets (#14827)
* full_node: Just add `new_states` since the entries can't be `None`

* Drop list creation, `lookup_coin_ids` is already a list
2023-03-20 13:17:37 -05:00
Matt Hauff
d2f1e25df2
Only compile CLVM if source newer than hex (#14840)
* Only compile CLVM is source newer than hex

* lint
2023-03-18 05:43:50 -05:00
dustinface
f5afa47d85
wallet: Disconnect untrusted peers if we find a trusted synced one (#14640)
* Move `request_time` creation into `is_peer_synced`

* Pass in `height: uint32` instead of `header_block: HeaderBlock`

* Disconnect untrusted peers as soon as we have a synced trusted

* Add `test_long_sync_untrusted_break`

* Ignore already disconnected peers
2023-03-17 19:28:39 -05:00
William Allen
ee1c7790ae
checkpoint: into main from release/1.7.1 @ 6d09a06037 (#14836)
Source hash: 6d09a06037
Remaining commits: 0
2023-03-17 00:17:49 -05:00
William Allen
090caf0f08
Added chia completion command (#14782)
* adding 'chia completion' command

* fixing lint

* Fixing isort

* Update chia/cmds/completion.py

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

* Update chia/cmds/completion.py

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

* Cleanup completions command

* formatting with black

* Update chia/cmds/completion.py

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

* Update chia/cmds/completion.py

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

* Update chia/cmds/completion.py

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

* Update chia/cmds/completion.py

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

* Update chia/cmds/completion.py

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

* fixup my mistakes

* just ["chia"]

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-03-16 12:50:30 -05:00
Amine Khaldi
dca1a2423d
Merge commit '6d09a060379a0eb77d11abf52ba810c93bd4be5f' into checkpoint/main_from_release_1.7.1_6d09a060379a0eb77d11abf52ba810c93bd4be5f 2023-03-16 18:18:35 +01:00
dustinface
fff3ca44c4
wallet: Handle trade coins in the try block of new_coin_state (#14833) 2023-03-16 11:42:55 -05:00
Sebastjan Trepca
6d09a06037
better handling of offer status and failed txs (#14812)
* better handling of offer status and failed txs

* 5 retries before tx is marked failed

* increase test timeouts

* fixed test

* require only difference vs whole fee

* polish + fee coins kick in only if we're missing fee
2023-03-15 20:50:25 -05:00
dustinface
62ee1c8766
wallet: Don't just subscribe to all coin ids from the DB (#14813) 2023-03-15 17:52:56 -05:00
Sebastjan Trepca
a6f423522b
nft royalty edge cases (#14789)
* nft royalty edge cases

* making tests faster

* Update tests/wallet/nft_wallet/test_nft_1_offers.py

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

* flake

---------

Co-authored-by: Matt Hauff <quexington@gmail.com>
2023-03-14 20:27:15 -05:00