Commit Graph

3005 Commits

Author SHA1 Message Date
Almog De Paz
18c95da752
add local max subscription config (#14188)
* add local max subscription config

* add and use trusted wallet config
tests

* lint

* unused import

* break early

* dont break because we need to iterate for hints

* fix off by one

* lint
2023-01-02 21:38:38 -06:00
Adam Kelly
d48e65e749
Fix fee estimator being re-created every block (#14175)
* Hold a ref to the fee estimator when the Mempool is destroyed and re-created. Unify the sharing of information between Mempool and MempoolManager

* Adjust tests to new Mempool create interface

* Store dynamic Mempool info in the FeeEstimator and static info in the Mempool

* Adjust tests

* Restore logging of block cost % calculation to use documented full block size

* Omit check for nil self.last_mempool_info

* Annotate Mempool members

* Add integration test for add_mempool_item

* Annotate types in BitcoinFeeEstimator class
2023-01-02 15:02:10 -06:00
Kyle Altendorf
6e315e147a
allow more sqlite thread safety than the minimum we require (#14215)
https://docs.python.org/3.11/library/sqlite3.html#sqlite3.threadsafety

extracted from https://github.com/Chia-Network/chia-blockchain/pull/11407
2022-12-23 11:34:10 -06:00
Amine Khaldi
7cba58eb00
Remove redundant check for maximum block CLVM cost (#14212)
Remove redundant check for maximum block CLVM cost.
2022-12-23 11:33:02 -06:00
Kyle Altendorf
64c57fdd78
fully hint test_pool_rpc (#14204) 2022-12-23 11:32:35 -06:00
Adam Kelly
407c0ba4a4
Fixes the case when a fee estimation request is made before the FullNode has initialized a peak (#14193)
* Fixes the case when a fee estimation request is made before the FullNode has initialized a peak

* Clarify code by setting defaults early

* Only spawn one full node in test
2022-12-23 11:31:44 -06:00
Kyle Altendorf
b8068a856d
wait for wallet sync in test_wallet_coinbase_reorg() and test_wallet_tx_reorg() (#14202) 2022-12-22 00:12:50 -06:00
Kyle Altendorf
ccfaca8060
make wallet rpc client wallet id parameters accept int, not str (#14200)
* make wallet rpc client wallet id parameters accept int, not str

* Update chia/cmds/wallet_funcs.py
2022-12-22 00:12:33 -06:00
Kyle Altendorf
cb6c5fc17f
improve adjusted_timeout() to handle floats and None (#14198) 2022-12-21 23:59:36 -06:00
Amine Khaldi
a802007936
Remove redundant check for duplicate outputs (#14195)
Remove redundant check for duplicate outputs.
2022-12-21 23:59:17 -06:00
Kyle Altendorf
1d42886721
hint RpcClient.create() return type (#14197) 2022-12-20 14:11:10 -06:00
Earle Lowe
3140c223bd
TechDebt: add get_name to WalletProtocol (#13995)
* add get_name to WalletProtocol

* remove async from did_wallet::get_name

* Return "Standard Wallet" for get_name
2022-12-20 13:26:06 -06:00
Kyle Altendorf
55f5e371b3
Block and transaction processing helpers (#11535)
* Block and transaction processing helpers

* flake8

* more and hints

* More

* separate tests of the simulator from tests using the simulator

* move fixture to conftest

* amounts are uint64

* remove unneeded while loop

* backoff instead of fixed sleep times

* .farm_blocks() only forces tx blocks when needed

* fix test_wallet_create_hit_max_send_amount

* fix test_wallet_tx_reorg

* fix test_address_sliding_window

* rename to farm_blocks_to_wallet

* rename to farm_rewards_to_wallet

* undo changes to protocol endpoints

* reword farm_blocks_to_wallet() loop

* rename process_blocks() to farm_blocks_to_puzzlehash() for now

* timeouts

* debug

* debug

* debug... for 3,7

* fix

* up timeout per block to 2 seconds

* increase transaction processing default timeout

* make debug maybe ok to leave around

* tidy

* intersperse sleeps again for wallet progression

* remove debug code

* review tidy

* cheat on uint64() type

* Update tests/simulation/test_simulator.py

* another import fix

* more fixes

* farm_blocks_to_puzzlehash

* more

* tweak

* fix the two-tx-blocks-instead-of-one dilemma

thanks to almog for figuring this out

* fix

* fixup

* rework since it was still broken on 3.7/3.8...

* oops

* yucky timeout

* more timeout

* cleanup todos

* add balance assertion after reorg before resubmission processing

* Apply suggestions from code review

* rename funds to expected_confirmed_balance

* catchup
2022-12-19 16:40:58 -06:00
Adam Kelly
2762490fd1
Create logger object in module instead of passing it in (#14173) 2022-12-16 20:52:47 -06:00
Kyle Altendorf
777295b2ad
add system and os dependent timeout adjustments (#13778)
* add system and os dependent timeout adjustments

* Update time_out_assert.py

* add adjusted_timeout() and apply

* Update connection_utils.py
2022-12-15 20:00:00 -06:00
dustinface
e2e103241a
Wrap Union[IPv4Address, IPv6Address] in the class IPAddress (#14136) 2022-12-14 17:11:08 -06:00
Amine Khaldi
7defb1ebfc
Merge commit '618f93b4c42b176659cc74c02a4dd711adc62052' into checkpoint/main_from_release_1.6.2_618f93b4c42b176659cc74c02a4dd711adc62052 2022-12-14 19:24:34 +01:00
Matt Hauff
ffd02b2f80
Return existing CAT wallet instead of raising (#14101)
* Return existing CAT wallet instead of raising

There's no reason to raise here, all the caller is looking for is an instance of the CATWallet that they're looking for and to create it if it doesn't exist.

* rename create_wallet_for_cat -> get_or_...

* Move wallet created noti inside of function

* remove redundant call
2022-12-13 22:46:16 -06:00
Amine Khaldi
cd4874c584
create_bundle_from_mempool() doesn't need to be async (#14114)
create_bundle_from_mempool() doesn't need to be async.
2022-12-13 17:11:12 -06:00
dustinface
fbc3127bd5
util: Rework get_host_addr (#14068)
* util: Rework `get_host_addr`

* Require `prefer_ipv6` to be named

* Remove outdated comment

* Improve result selection
2022-12-13 09:48:41 -06:00
dustinface
a40f04012b
server: Replace WSChiaConnection.__getattr__ with call_api (#14052) 2022-12-13 00:35:42 -06:00
Almog De Paz
801e1a0431
account for asyncio.wait_for returning early for timeout (#14097) 2022-12-12 10:59:47 -06:00
Kyle Altendorf
618f93b4c4
handle incoming unknown capabilities (#14093)
* handle incoming unknown capabilities

* move it around

* chia.server.capabilities

* Update tests/util/test_network_protocol_files.py
2022-12-09 18:37:18 -06:00
dustinface
8a3ee3f4c0
server: Move api call processing into WSChiaConnection (#14008) 2022-12-09 03:47:46 -06:00
Kyle Altendorf
f41152559f
Add WalletStateManager.get_wallet() to centralize wallet type checking (#14030) 2022-12-08 23:43:42 -06:00
dustinface
80419cb4f0
tests: Use the self_hostname fixture in more places (#14067) 2022-12-08 11:33:40 -06:00
Amine Khaldi
2dea800491
Remove redundant checks in validate_spend_bundle() (#14035)
* Simplify addition_amount calculation in validate_spend_bundle() and remove unneeded COIN_AMOUNT_NEGATIVE and COIN_AMOUNT_EXCEEDS_MAXIMUM checks.

* Create a record for the test coin, return it from get_coin_record() and split the tests case by case.

* Add comments next to the unexpected error codes.

* Move the test block record into the fixture function.

* Make it explicit that we're not calling get_coin_record in these tests.

* Also test get_name_puzzle_conditions besides pre_validate_spendbundle.

* Revert testing get_name_puzzle_conditions besides pre_validate_spendbundle.
2022-12-07 22:12:27 -06:00
Arvid Norberg
d330691db1
move mempool tests from full_node to mempool directory (#14056) 2022-12-07 20:49:13 -06:00
Almog De Paz
4d068f284a
dont wait for timeout on None response (#13967)
* dont wait for timeout on None response

* handle return msg by type

* remove empty line

* isort

* improve reply check

* use map to check reply, add has_capability helper

* fix has_capability

* unused import
2022-12-07 20:47:21 -06:00
Kyle Altendorf
b8f6396078
fixup test_did.test_get_info() and .test_update_metadata() (#14061) (#14075) 2022-12-07 18:05:42 -06:00
Jack Nelson
88f7040677
add new, optimized tx queue (#13887)
* add new, optimized tx queue

* isort & fix starting index

* make faster

* fix order

* add comment, change to peer id, remove extra apis and change max size

* lint

* final lint fix

* change to simplequeue, get rid of task and change to cursor

* fix logic

* isort

* optimize  cleanup

* add unit tests

* fix comments and switch to random

also add better spacing

* stupid mypy

* undo changes + stupid mypy

* fix tests, raise if full & seperate out peer_id

* get rid of class

* change to simulated tx queue entry

* add local high priority test & remove un necessary asserts

* change to better, faster check

* remove internal asserts

* cleanup test

* Update test_tx_processing_queue.py
2022-12-07 16:03:14 -06:00
Kyle Altendorf
3e74f542b2
fixup test_did.test_get_info() and .test_update_metadata() (#14061) 2022-12-06 23:21:50 -06:00
William Allen
f6a71e294b
server: Fix invalid attribute accesses in WSChiaConnection (#14051)
<!-- 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
- Use the prompts below to provide information wherever applicable
-->
<!-- What is the purpose of the changes in this PR? -->



<!-- What is the current behavior?** (You can also link to an open issue
here) -->



<!-- What is the new behavior (if this is a feature change)? -->



<!-- Does this PR introduce a breaking change?** (What changes might
users need to make in their application due to this PR?) -->



<!-- Testing notes (is this code covered by tests, or equivalent manual
testing?) -->



<!-- Are there any visual examples to help explain this PR? (attach any
.gif/movie/console output below) -->


They are not yet discovered by `mypy` because we override `__getattr__`
here
b916275540/chia/server/ws_connection.py (L340)

which just returns a coroutine (`Any` by hint) for whatever attribute
you request.

This will be fixed in #14052.
2022-12-06 11:18:50 -06:00
xdustinface
c356fe0465
Fix ChiaServer.is_duplicate_or_self_connection 2022-12-05 07:41:56 +01:00
xdustinface
0cdce83b57
isort: Remove all tests exceptions and sort the related files 2022-12-05 02:06:00 +01:00
dustinface
b916275540
tools: Implement and test tools/legacy_keyring.py (#13947)
* Add `-l` option to `install.sh` and use it for linux tests on CI

* Implement and test `tools/legacy_keyring.py`

* Update install.sh

Co-authored-by: Jeff <paninaro@gmail.com>

Co-authored-by: Jeff <paninaro@gmail.com>
2022-12-03 23:31:51 -06:00
Arvid Norberg
306b318bcd
bump chia_rs version to 0.1.16 (#14013)
* bump chia_rs to 0.1.16

* bump performance test for test_duplicate_coin_announces
2022-12-03 21:15:20 -06:00
Kronus91
1a6967a9ba
Add bulk set NFT DID API (#13720) 2022-12-01 13:29:52 -06:00
Sebastjan Trepca
8bd216bcb7
Improve performance of wallets with many NFTs (#14023) 2022-11-29 14:35:25 -06:00
Kronus91
76ebb08ac8
Fix DID unnecessary wallet deletion (#13925) 2022-11-29 14:22:59 -06:00
Amine Khaldi
0cfd19f38d
Simplify the mempool manager instantiation by not making it depend on a coin store (#14015)
* Explore simplifying the mempool manager instantiation.

* Address reviews.
2022-11-29 12:18:09 -06:00
dustinface
23ac4f7c80
server: Drop unused WSChiaConnection.is_feeler (#14011) 2022-11-28 13:57:01 -06:00
Kronus91
13cd8a2ef2
Remove duplicate nft wallet deletion in reorg (#13892)
* Remove duplicate nft wallet deltion in reorg

* Fix unit test

* Fix get latest coin bug

* Add unit test
2022-11-26 20:22:16 -06:00
dustinface
bea4928741
flake8: Fix issues after update (#13997) 2022-11-24 13:32:04 -06:00
dustinface
57a90bf24c
server: Compare PeerInfo in address_manager.py (#13991)
* server: Compare `PeerInfo` in `address_manager.py`

* Pass correct type to `AddressManager.attempt` in `test_cleanup`
2022-11-23 13:01:07 -06:00
dustinface
122a747727
tests: Fix BlockTools import (#13987)
The file was added in #13936 which was merged before #13932 which 
enabled `mypy` in `setup_services` leading to the pre-commit failure.
2022-11-22 22:52:47 -06:00
Almog De Paz
efb670cf1b
Setup services mypy (#13932) 2022-11-22 17:01:01 -06:00
William Allen
a825e15a09
Add support for pending transactions to get_mempool_item_by_tx_id() #9443 (#13976)
Co-authored-by: russ <2751728+rwarren@users.noreply.github.com>
Co-authored-by: Earle Lowe <30607889+emlowe@users.noreply.github.com>
2022-11-22 15:44:11 -06:00
Jeff
ca536d7002
Display key labels when making a wallet key selection (#13936)
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-11-22 15:34:53 -06:00
dustinface
e6f04b3760
isort: Remove all tests.wallet exceptions and sort the related files (#13978) 2022-11-22 15:33:17 -06:00
Kyle Altendorf
caa7e42845
simplify TradeManager.respond_to_offer() return (#13927)
* simplify TradeManager.respond_to_offer() return

* require the exception

* correct to match=

* another failure case
2022-11-21 20:29:35 -06:00
Adam Kelly
5cbc415589
Preserve correct MempoolItem block height when rebuilding mempool (#13951) 2022-11-21 16:28:48 -06:00
dustinface
5f706cea27
isort: Remove all tests.core exceptions and sort the related files (#13962) 2022-11-19 11:18:44 -06:00
Jack Nelson
5a74cb3581
Fix wallet fingerprint cli tests (#13958) 2022-11-18 18:30:43 -06:00
Jack Nelson
fb72a2558d
Add --fingerprint option to chia keys show (#13909)
* add fingerprint option to keys func

* rename func

* add fingerprint to cli tests

* Update tests/core/cmds/test_keys.py

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

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-11-18 10:51:02 -06:00
dustinface
78e367665b
Introduce sync_store.Peak (#13615) 2022-11-18 10:44:13 -06:00
dustinface
2e2c297a80
util: Remove legacy keyring support (#13398) 2022-11-18 10:33:18 -06:00
Chris Marslender
c9758cc476
Trigger sync tests for all release types (#13942)
* Trigger sync tests for all release types

* Temporary fix unit test

Co-authored-by: ytx1991 <t.yu@chia.net>
2022-11-17 20:18:56 -06:00
Kronus91
cf944f0260
Return minted NFT ID & Allow transfer NFT with NFT ID (#13928) 2022-11-17 13:51:02 -06:00
Arvid Norberg
27cbd08229
Factor out member functions of ProofOfSpace to be free functions (#13930) 2022-11-17 13:46:22 -06:00
Almog De Paz
f85bc15d4b
setup services refactor (#13905)
* always return service

* adjust setup_simulators_and_wallets

* adjust setup_simulators_and_wallets

* refactor setup_simulators_and_wallets
add setup_simulators_and_wallets_service

* revert unneeded change

* fix broken fixtures

* lint, fix data_rpc init_wallet_and_node

* fix two_wallet_nodes fixture

* fix two_nodes_sim_and_wallets_services fixture

* fix one_wallet_node_and_rpc fixture

* lint
2022-11-16 20:40:03 -06:00
dustinface
5c861db42f
Make WSChiaConnection a dataclass (#13906)
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-16 13:38:28 -06:00
Kyle Altendorf
373880dc76
catch up test_complex_nft_offer() with return type change (#13926) 2022-11-16 10:41:49 -06:00
Almog De Paz
ac2203eda8
Refactor test utils for import availability outside of repo (#13880)
* refactor for import availability outside of repo

* refactor for import availability outside of repo

* small revert

* newline

* fix imports

* fix pre-commit issues

* types issort, adapt mypy ignore

* redundant imports

* move files from util to simulator

* run pre_commit

* remove setup_nodes/keyring from isort.cfg

* fix asyncio import
2022-11-15 18:51:05 -06:00
Kyle Altendorf
a531580868
rework around tx records and offer takes (#13603)
* mixed rework around tx records and offer takes

* more

* wait for wallets

* process_transaction_records() -> process_transactions()

* correct to use new bundles= parameter a couple spots

* .process_transaction_records()

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

* Some further explorations

* some more explorations

* Add delay while connections are closed in test

* Add a delay to make sure connections drain

* Update chia/server/server.py

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

* Update tests/connection_utils.py

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

* use log_exceptions context manager

* set close flag correctly

* Added callback type and other changes

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

* Adjust tests

* Fix merge

* Remove rl_wallet

* Fix tests

* Fix DID bugs

* Add tests

* Add additional spend for DID update

* Fix unit test

* Handle bugged DID

* Cover empty hint case

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

* Apply suggestions from code review

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

* Tweak error message

* Tweak formatting

* Make `WSChiaConnection.close_callback` optional

* Tweak assert message

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

* Don't provide a default for `close_callback`

* Adjust assertion

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

* Add get DID info API

* Resolve comments

* Add hints
2022-11-12 14:15:44 -06:00
Kyle Altendorf
46126d47b3
Re-enable the trusted parametrization of test_address_sliding_window() (#10081) 2022-11-11 16:39:49 -06:00
Matt Hauff
a29ab7dbd1
Fix trades between fungible assets <-> fungible assets + nfts (#13825)
* Fix fungible <-> fungible + royalties

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

* flake8

* mypy
2022-11-10 03:04:52 -06:00
dustinface
50d148eadd
Cleanup WSChiaConnection imports/usage (#13868) 2022-11-08 10:10:59 -06:00
Kyle Altendorf
095b9c337e
adjustments for new mypy (#13859)
* adjustments for new mypy

* assert something
2022-11-07 17:38:40 -06:00
Kyle Altendorf
8ff73e961a
add LimitedSemaphore (#13642)
* treat Semaphore._waiters as length zero when it is None

We access the `._waiters` private attribute of the Python asyncio
`Semaphore` class.  This was changed in Python 3.10.8 (and other versions)
to be initialized to `None` instead of an empty deque.  Our existing
unconditional length checks failed on the new `None` default.  This seems
to block syncing.

https://github.com/python/cpython/pull/97020

https://github.com/python/cpython/compare/v3.10.7..v3.10.8#diff-0fee1befb15023abc0dad2623effa93a304946796929f6cb445d11a57821e737

Reported traceback:
```python-traceback
2022-10-12T20:03:59.367 full_node full_node_server : INFO Connected with full_node {'host': '65.34.144.6', 'port': 8444}
2022-10-12T20:03:59.370 full_node full_node_server : ERROR Exception: object of type 'NoneType' has no len(), {'host': '65.34.144.6', 'port': 8444}. Traceback (most recent call last):
File "/home/summa/chia-blockchain/chia/server/server.py", line 598, in wrapped_coroutine
result = await coroutine
File "/home/summa/chia-blockchain/chia/full_node/full_node_api.py", line 114, in new_peak
waiter_count = len(self.full_node.new_peak_sem._waiters)
TypeError: object of type 'NoneType' has no len()

2022-10-12T20:03:59.371 full_node full_node_server : ERROR Exception: object of type 'NoneType' has no len() <class 'TypeError'>, closing connection {'host': '65.34.144.6', 'port': 8444}. Traceback (most recent call last):
File "/home/summa/chia-blockchain/chia/server/server.py", line 608, in api_call
response: Optional[Message] = await asyncio.wait_for(wrapped_coroutine(), timeout=timeout)
File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
return await fut
File "/home/summa/chia-blockchain/chia/server/server.py", line 605, in wrapped_coroutine
raise e
File "/home/summa/chia-blockchain/chia/server/server.py", line 598, in wrapped_coroutine
result = await coroutine
File "/home/summa/chia-blockchain/chia/full_node/full_node_api.py", line 114, in new_peak
waiter_count = len(self.full_node.new_peak_sem._waiters)
TypeError: object of type 'NoneType' has no len()

2022-10-12T20:03:59.487 full_node full_node_server : INFO Connection closed: 65.34.144.6, node id: 506fe4c05ce6b72bb707471842e552307c7a547aa9ba981175db5c08fa3e47e6
```

* add LimitedSemaphore
2022-11-06 11:38:25 -06:00
Jeff
7b781cbf12
add_private_key now returns the fingerprint of the added key (#13814)
* add_private_key now returns the fingerprint of the added key
Updated tests

* Addressed feedback

* Update tests/core/daemon/test_daemon.py

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

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2022-11-05 17:49:29 -05:00
Amine Khaldi
5dbc4aaa54
Merge commit '1bfe826e57215066c88dc8e953fc3930aa61a8ae' into checkpoint/main_from_release_1.6.1_1bfe826e57215066c88dc8e953fc3930aa61a8ae 2022-11-04 21:00:58 +01:00
Kyle Altendorf
806499cb3f
add task_instrumentation fixture (#13176)
* add task_instrumentation fixture

* fixup

* Update conftest.py
2022-11-03 23:14:21 -05:00
Amine Khaldi
b502f24357
Merge commit 'bfc35b796f16fe1af6ff322fc602b47ea016dffb' into checkpoint/main_from_release_1.6.1_bfc35b796f16fe1af6ff322fc602b47ea016dffb 2022-11-03 14:21:51 +01:00
Amine Khaldi
54ce10522b
Merge commit '00aac17996bc0c451133ab45d5f1641f368af959' into checkpoint/main_from_release_1.6.1_00aac17996bc0c451133ab45d5f1641f368af959 2022-11-02 19:07:34 +01:00
arty
787b1c7e8f
Bump for new clvm_tools and clvm_tools_rs versions (#13774)
* Bump for new clvm_tools and clvm_tools_rs versions

* remove no longer needed `type: ignore`

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-11-02 11:18:15 -05:00
Kyle Altendorf
3870414e47
Bump datalayer tests to 60 minute timeout :[ (#13790)
https://github.com/Chia-Network/chia-blockchain/actions/runs/3371261657/usage
2022-11-01 15:44:49 -05:00
Amine Khaldi
73acfc7409
Don't hold removals twice in mempool items as they're already part of the underlying spend bundle. (#13694) 2022-11-01 15:41:23 -05:00
Jeff
1bfe826e57
Return the CAT txn instead of the fee txn (if a fee is set) (#13748)
* Return the CAT txn instead of the fee txn (if a fee is set)

* Commenting

* Test cases for cat_spend with and without a fee

* Check that the coin spend is a CAT spend
2022-10-31 23:43:11 -05:00
Arvid Norberg
bfc35b796f
improve handling of unfinished block messages (#13777) 2022-10-31 22:41:11 -05:00
Almog De Paz
bc57b44884
Rework wallet new peak (#12586)
* validate wp from fork and fix bugs(pr #11826)
move WalletWeighProofHandler to wallet_node
remove code dupelication

* fix init bug
remove bad return path

* lint

* merge fixes
remove redundant ses_cache

* lint

* lint

* fix test

* lint

* shorter methods
check header block
dont set in db if sync failed
use exceptions

* remove redundant code path, we already set the new wp

* exceptions

* dont send wp request if secondary sync is already running

* clean code

* add types

* revert change

* dont disconnect peer

* test bad block response

* lint

* move WP shutdown to _close

* remove redundant task creation, use await

* assert not None

* revert

* fix imports

* lint

* isort

* typo, use log.exception

* remove redundant assert
add log

* lint

* fix pool new peak bug

* lint
2022-10-31 14:18:42 -05:00
Kyle Altendorf
00aac17996
strip input before bech32 decoding (#13759)
this avoids leading and trailing whitespace causing offer processing to fail
2022-10-31 10:45:08 -05:00
Kyle Altendorf
40e1d28b47
Increase job timeout for NFT wallet tests (#13675) (#13744)
(cherry picked from commit fe490d9e04)

Co-authored-by: Earle Lowe <30607889+emlowe@users.noreply.github.com>
2022-10-28 16:28:38 -05:00
Florin Chirica
ed55423db6
Add atari get sync status RPC. (#13440)
* Add atari get sync status RPC.

* Try to fix test.

* Try to fix test.

* Some fixes.

* Update tests/core/data_layer/test_data_rpc.py

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

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-10-28 15:05:03 -05:00
William Allen
4669be243b
Merge pull request #13702 from Chia-Network/checkpoint/main_from_release_1.6.1_b33eb8d8f41cf5c926e4dd317c0c0e0b36e02fe5
checkpoint: into main from release/1.6.1  @ b33eb8d8f4
2022-10-27 01:45:37 -05:00
Earle Lowe
738238f698
Minor Simulation CI test adjustments (#13612)
* Some simulation test CI hackery

* let me try this

* try this

* yet more attempts

* sigh

* some more attempts

* Adjusting test yaml

* directory != dir

* run a bunch of dups

* experiments

* correct len check

* minor simplifications

* undo test.yaml changes

* Use temp keyring and cleanup temp dirs

* Simplfied get_full_chia_simulator

* move empty_keyring fixture to conftest

* Update tests/simulation/test_start_simulator.py

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

* Update tests/simulation/test_start_simulator.py

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

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-10-26 20:26:05 -05:00
Kyle Altendorf
f03df27851
correct test decoration and returns (#13703)
* correct test decoration and returns

* ignore new deprecation warning

* xfail it

(cherry picked from commit 45b5ea39bb)
2022-10-25 17:47:54 -04:00
Kyle Altendorf
45b5ea39bb
correct test decoration and returns (#13703)
* correct test decoration and returns

* ignore new deprecation warning

* xfail it
2022-10-25 16:45:10 -05:00
Amine Khaldi
34328fc265
Merge commit 'b33eb8d8f41cf5c926e4dd317c0c0e0b36e02fe5' into checkpoint/main_from_release_1.6.1_b33eb8d8f41cf5c926e4dd317c0c0e0b36e02fe5 2022-10-25 12:12:32 +01:00
Jack Nelson
e8ff7ea9a4
Coin Selection CLI / RPC Expansion (#13325)
* add max coin amount everywhere

* add excluded amounts to bare minimum

offers really does not need it passed.

* add excluded coin ids

* finish rpc stuff

* finalize commands

add coins command group & expand various coin selection methods

* fix argument processing & clean up code

* fix grammer

* small miss

* Update wallet_rpc_api.py

* fix test

* add combination command

* fix error

* move command group

* add new built in funcs for direct wallet coin searches.

* add get coin rpc

* add last command

* switch to pageable function

* fix args

* expand multi rpc call and tests

+ fix other things

* da lint

* add reverse coin sorting and ability to select coins

* Update wallet_state_manager.py

* fix types

* align with protocol

* fix asserts

* fix imports

* isort

* Update wallet_coin_store.py

* Update wallet_rpc_api.py
2022-10-24 14:03:53 -05:00
Earle Lowe
fe490d9e04
Increase job timeout for NFT wallet tests (#13675) 2022-10-21 16:59:44 -04:00
Kyle Altendorf
bae4e0c5ce
refactor @api_request decorator and family to use a single decorator (#13565)
* more explicit and complete handling of api decorator data

* fix

* .message_class

* actually, those are different types...

* tweak

* simplify

* learn that functools.wraps copies random attributes

* hack the ~planet~ `@api_request` decorator

* R not T

* more future

* implementation detail renames
2022-10-20 16:10:23 -04:00
Kyle Altendorf
7abc062d0d
test service shutdown response to signals (#13576)
* minimal fixup for daemon signal handling regression

* test daemon shutdown response to signals

* positional

* test datalayer shutdown response to signals

* one parametrized test for the services

* colocate the daemon test

* drop sig

* add sendable_termination_signals

* oops, it was SIGTERM

* wait for the daemon
2022-10-20 16:08:49 -04:00
Kyle Altendorf
f5caa92b03
extend timeout in test_did_attest_after_recovery (#13601)
https://github.com/Chia-Network/chia-blockchain/actions/runs/3185807311/jobs/5195868861#step:16:40
```python-traceback
_____________ TestDIDWallet.test_did_attest_after_recovery[False] ______________
tests/wallet/did_wallet/test_did.py:470: in test_did_attest_after_recovery
    await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, spend_bundle.name())
E   AssertionError: Timed assertion timed out
```
2022-10-20 16:07:54 -04:00
Sebastjan Trepca
b33eb8d8f4
reverted offchain metadata fetched (#13660)
* reverted offchain metadata fetched

* test fix
2022-10-20 15:06:25 -05:00
Kyle Altendorf
4a54e49e10
process_transaction_records() -> process_transactions() (#13629)
* process_transaction_records() -> process_transactions()

* split to process_transaction_records()/_spend_bundles()/_coin_spends()

* expand tests to have multiple transactions etc per repeat

* back to .process_transaction_records() for calls

* one line function defs
2022-10-19 17:42:20 -05:00
Karlkim Suwanmongkol
a3c4c2367a
chia keys show --json (display all keys as json) (#13637)
* chia keys show --json (display all keys as json)

* black (linting) chia keys show --json (display all keys as json)

* output a root object containing the keys array

* support key with empty label

* add test_show_json and test_show_mnemonic_json to test_keys

* chia keys show --json -- do not format json output

* tests/core/cmds/test_keys.py -- result.output.find(<value>) != -1

* tests/core/cmds/test_keys.py -- result.output.find(<value>) != -1 -- black

* Pass root_path in show_all_keys and fix tests

Co-authored-by: Jeff Cruikshank <jeff@chia.net>
2022-10-19 17:41:03 -05:00
Adam Kelly
73e9d15cf7
Fee estimation. (#13645) 2022-10-18 09:12:22 -05:00
Harry H
71d33eb86b
feat: enable create_signed_transaction and push_transaction (#13466)
* feat: enable `create_signed_transaction` for CATs and `push_transactions` endpoints

* test: add test cases for create_signed_transaction and push_transactions

* chore: add backwards compatibility

* fix: add `signed_txs` for standard `create_signed_transaction`

* chore: run linter

* feat: accepts `return_single_tx` argument as legacy compat

* fix: improve typing hints

* chore: improve typing

* fix: get rid of `nullcontext` for `python<3.10`

* test: farming more blocks before checking CAT balance

* test: use more robust `farm_transaction` method
2022-10-08 20:54:20 -05:00
Matt Hauff
76a78ed180
Add a try/except for individual coin states (#13371)
* Add a try/except for individual coin states

* black

* Add a retry store

* Only retry for trusted and bug fixes

* lint

* tiny bad merge

* retry for untrusted too

* Only re-raise flaky exceptions in the WSM

* Add unit test

* Update to self.log.exception

* so that's what exception means

* Add an error log for missing peer

* import after merge

* isort

* bad merge
2022-10-06 14:56:40 -05:00
Kronus91
e4d4c8f57d
Fix memos & minter did (#13604)
* Fix memos & minter did

* Fix pre-commit
2022-10-06 14:34:50 -05:00
Matt Hauff
eb6aeb6405
Fix a breaking change in get_puzzle_and_solution RPC (#13519) 2022-10-06 11:05:23 -05:00
dustinface
7a5d9579ef
server: More use of ChiaServer.get_connections (#13573)
* Drop `get_full_node_connections` -> use `get_connections`

* Drop `connection_by_type`

I think the housekeeping required to have it isn't worth it since we
don't handle huge numbers of connections and `get_connections` should be
less enough overhead. Im open for complains though.
2022-10-05 11:21:38 -05:00
dustinface
aed8c61969
full_node: Set defaults in SyncStore (#13607) 2022-10-05 11:07:09 -05:00
Matt Hauff
dfe7140bd3
Fix CAT offer aggregation edge case (#13472)
* Fix CAT offer aggregation edge case

* typo

* Fix ring solving for >2 CATs

* Add comment for sort
2022-10-05 11:04:49 -05:00
Matt Hauff
c41d5a9eda
Force a 'resync' if we start to track a singleton that we have already synced (#13591) 2022-10-03 21:04:39 -05:00
Kyle Altendorf
5b39550f73
convert datalayer to DBWrapper2 (#13582)
* convert datalayer to DBWrapper2 (all write)

* more read, less write

* remove unneeded connection managers

* and...  close it

* data store now creates its own wrapper

* Drop unused hint DataLayer.batch_update_db_wrapper

* require named arguments for most of `DBWrapper2.create()`
2022-10-03 17:50:12 -05:00
Kyle Altendorf
a5ea7fb572
add missing future annotations import (#13583) 2022-10-01 13:25:09 -05:00
Kyle Altendorf
9e1811a331
remove unused variable from conftest (#13575) 2022-09-30 17:50:01 -05:00
dustinface
2aa117b58a
util|rpc: Refactor RpcEnvironment -> WebServer (#13515)
* Move `rpc.rpc_server.RpcEnvironment` -> `util.network.WebServer`

* Improve `WebServer`

* Drop attribute resets

* `black` fix after rebase

* Fix `test_nft_bulk_mint.py`
2022-09-30 17:47:00 -05:00
Kyle Altendorf
0f7d022108
add test_miniupnpc_imports_successfully() (#13535)
* add test_miniupnpc_imports_successfully()

* Update test_upnp.py

* Update test_upnp.py
2022-09-30 17:46:10 -05:00
Kyle Altendorf
61b497a701
add a transactional reader as DBWrapper2.reader() (#13468)
* add a transactional reader as `DBWrapper2.reader()`

* contextlib.AbstractAsyncContextManager

* try a minimal test

* rework test to allow the read to finish so the write can finish the commit after that

* pylint disable

* WAL!!!

* more tests

* if TYPE_CHECKING for typing variable assignments

* future

* cover some more test cases
2022-09-30 17:41:33 -05:00
Matt Hauff
28213628ae
Better proof to singleton mapping (#13458)
* Better proof to singleton mapping

* mypy

* black

* add one for one same values test cases

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-09-30 17:41:09 -05:00
Kyle Altendorf
3b084a165b
configure isort to add the future annotations import (#13327)
* configure isort to add the future annotations import

* apply the new isort setting

* remove type ignores for new mypy (#13539)

https://pypi.org/project/mypy/0.981/

* another
2022-09-30 03:40:22 -05:00
Kyle Altendorf
5fe03a0697
minor comment typo, hinting, and fixture cleanup (#13554)
* extractions

from https://github.com/Chia-Network/chia-blockchain/pull/13479

* oops
2022-09-29 14:53:43 -05:00
Kyle Altendorf
d06b6b0a57
test classes in global scope for hinting (#13544) 2022-09-29 12:14:57 -05:00
dustinface
345698aebd
server: Create ssl contexts earlier + store them instead of all paths (#13512) 2022-09-29 12:14:20 -05:00
Kyle Altendorf
bbd032e1c9
embrace click 8 (#13559)
* click==8.1.3, black==22.8.0

* black

* click option creator hinting

* ignores for to-be-resolved issue

* remove unused import
2022-09-29 11:24:36 -05:00
Geoff Walmsley
76ffd4c2df
Mint from DID (#12736)
* mint from did

* fix did puzzle announcements

* clean up params and test

* mypy

* add RPC endpoint

* use rpc client for test

* test create spends in loop

* transfer to target

* fix lineage proof for transfers

* isolate block timing issue in test

* DID lineage proof

* test transfer to targets

* add exclude list to select_coins RPC

* coin json

* move tests to did wallet

* fix typing royalties

* cleanup tests

* DID_HRP to AddressType

* clvm compilation

* improve checks in rpc api

* move mint_from_did to nft wallet

* reduce number of blocks in tests

* forgot to remove mint function from did_wallet.py

* mypy

* validate NFT metadata and edition numbers in test

* fix puzzle announcements, refactor and comments

* make tests work with new RPC server settings

* create puzzle assertions for eve and transfer spends

* rename vars for mint numbering

* rename more edition -> mint variables

* remove DID owner from eve spend

* make coin announcement from did spend

* make transfer from eve spend

* corrections for address options in RPC

* simplify intermediate launchers

* announcments for xch xpend

* re-order announcements for xch spend

* test with fewer blocks

* skip off chain metadata test with IPFS

* add bulk mint puzzle and methods to nft wallet

* add rpc endpoints

* add tests

* don't skip off chain metadata test

* fix default case for xch_coin_list
2022-09-29 11:23:33 -05:00
Kronus91
137e61d68a
Add Signing message APIs (#13491)
* Add sign APIs

* Add sign APIs

* Resolve comment

* Resolve comment & Add CLI

* Fix pre-commit

* Refine

* Fix unit tests

* Resolve comments
2022-09-28 04:26:54 -05:00
Kyle Altendorf
a20ee08fce
only compile clvm for developers (#13478)
* only compile clvm for developers

* retain existing behavior for backwards compatibility

* tests/check_clvm.py becomes tools/manage_clvm.py check (and add build subcommand)

* trigger recompilation in pytest runs
2022-09-27 11:21:54 -05:00
Kyle Altendorf
8436e6a17a
Confirm equality of client and server RPC routes (#11765)
* Confirm equality of client and server RPC routes

* Update rpc.py

* hints

* Update rpc.py

* Update mypy.ini

* Update rpc_server.py

* Update tests/util/rpc.py

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

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

* fixup

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

* recover logging
2022-09-26 11:17:20 -05:00
dustinface
d78c122505
Drop redundant RPC server instances in DataLayer related RPC tests (#13518) 2022-09-26 11:16:25 -05:00
Kyle Altendorf
682b39ab56
Update test_data_rpc.py (#13506)
https://github.com/Chia-Network/chia-blockchain/actions/runs/3105624081/jobs/5031501276#step:16:1151
```python-traceback
____________________________ test_get_owned_stores _____________________________
[gw0] darwin -- Python 3.9.14 /Users/runner/work/chia-blockchain/chia-blockchain/venv/bin/python
tests/core/data_layer/test_data_rpc.py:609: in test_get_owned_stores
    await time_out_assert(2, check_mempool_spend_count, True, full_node_api, 1)
E   AssertionError: Timed assertion timed out after 2 seconds: expected True, got False
```
2022-09-23 17:32:55 -05:00
Kyle Altendorf
6788bdd0ff
increase datalayer test timeout to 40 minutes (#13505) 2022-09-23 17:32:32 -05:00
dustinface
0df4d8cbe4
setup|plotting: chiapos==1.0.11 + drop invalid cache entries (#13502)
* Bump `chiapos` to `1.0.11`

* Drop invalid cache entries
2022-09-23 17:30:30 -05:00
Kyle Altendorf
1dbf575a3e
RpcApiProtocol and RpcServiceProtocol (#11522)
* provide a skeleton hint protocol for rpc apis

* more

* more self.custom_get_connections = None

* fix RpcApiProtocol.service hinting

* catch up with RpcApiProtocol._state_changed()

* FullNode.server is now non-optional.  'ish

* drop another todo

* custom_get_connections -> get_connections

* just make get_connections() a mandatory method with a helper provided

* lots

* try again

* ._start_with_fingerprint()

* fill out the Service generic parameter in start scripts

* ... instead of pass

* add docstrings to the protocols

* remove no longer needed hasattr/not None checks

* remove outdated comment

* refactor Harvester._is_shutdown to ._shut_down
2022-09-21 22:49:01 -05:00
Matt Hauff
736b83a933
On chain wallet notifications (#13261)
* initial design

* simplify

* curry amount

* add test for notficiation content

* Add some anti-spam to config

* remove comment function

* flake8

* mypy

* shatree

* add_rpcs

* isort

* lgtm

* isort

* golf a bit

* bad merge?

* add sorting and pagination

* Remove MSG_HASH from clvm

* black

* Decrease spam limit

* Add CLI and minor fix

* add newline
2022-09-21 00:53:31 -05:00
Almog De Paz
e8c11d74da
up synced timout to 20 on node/wallet setup (#13425) 2022-09-16 16:33:32 -05:00
dustinface
82e729a97d
pools: Make PoolWallet a dataclass (#13426)
* Drop unused `PoolWallet.singleton_list` definition

* Make `PoolWallet` a `dataclass`

* Drop the `ignore`, use `cast(PoolWallet, None)`
2022-09-16 16:01:47 -05:00
Kyle Altendorf
de72a56e1a
farm fewer blocks for wallet offer tests (#13413)
* farm fewer blocks for wallet offer tests

* black

* more explicit about balances

* remove unused imports
2022-09-16 16:01:18 -05:00
Kyle Altendorf
a9cce0f6e0
add final coverage handling (#11778)
* add final coverage handling

* switch to development coverage

* correct url

* only run one directory for now

* only 3.10

* delete windows data for now

* drop the 35% failure point

* recover full test matrix

* Use regular coverage

* Update test.yml

* put coverage reporting into an artifact

* oops

* oopsy

* pytest-cov

* maybe

* maybe help out flakes

* farm the spend bundle...

* some more

* more funds for the did test?

* more...

* report chia/ and tests/ separately

* job_timeout = 45 for core

* tidy and disable diff-cover

* remove job_timeout = 45

* --rcfile=.coveragerc

* Update .github/workflows/test.yml

* revert time and blocks

* assert spend is in mempool, lower times and block count

* remove sleep

* lint

* up timeout

* cat test - farm blocks until spend is included

* add spend check for nft endpoints

* fix nft endpoint test

* remove unused code

* 4

Co-authored-by: almog <almogdepaz@gmail.com>
2022-09-16 14:36:37 -05:00
dustinface
fe6358bd65
util: Remove the assigned label if a key gets removed (#13461) 2022-09-15 20:17:31 -05:00
Arvid Norberg
e4df3f9bf4
make a WalletProtocol, defining the shared API of all wallets (#13437)
* make a WalletProtocol, defining the shared API of all wallets and fix type checking

* add protocol check for DataLayerWallet. remove outdated comment
2022-09-15 20:16:01 -05:00
Amine Khaldi
a822c21469
Merge commit '96dfdfdd044f0c5c72252d6a23884b9871239703' into checkpoint/main_from_release_1.6.0_96dfdfdd044f0c5c72252d6a23884b9871239703 2022-09-14 21:53:45 +01:00
Kyle Altendorf
96dfdfdd04
fix unique error after cancelling offer (#13454)
* fix unique error after cancelling offer

* remove unwanted commented test

* add back the original

* tidy tests
2022-09-14 15:52:27 -05:00
dustinface
837a4798f6
daemon: Implement system metrics logger based on beta config (#12491) 2022-09-14 12:12:24 -05:00
Jeff
746b1c25f0
Add running_services command to list all running services (#13298)
* Extend `is_running` command to support checking multiple/all services

* Strip whitespace around service names.
Added tests for is_running()

* mypy

* Added `running_services` command to list all running services
Refactored `is_running` in terms of a common `is_service_running` fn
Added tests for the new/updated functions

* mypy

* Update chia/daemon/server.py

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

* Update chia/daemon/server.py

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

* Removed option to specify specific services to query.
Addressed PR feedback.

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-09-14 12:11:20 -05:00
Amine Khaldi
18ecb326a1
Merge commit '36d44bc2f5b8ef10b0743541478ced85554318f2' into checkpoint/main_from_release_1.6.0_36d44bc2f5b8ef10b0743541478ced85554318f2 2022-09-14 13:07:51 +01:00
Matt Hauff
36d44bc2f5
Hint to the ephemeral coin's innerpuzhash (#13448)
* Hint to the ephemeral coin's innerpuzhash

* update datalayer rpc test reference offer blobs and trade ids

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-09-13 20:14:01 -05:00
Matt Hauff
2de55aff17
Remove rl wallet (#13429)
* remove all references to RL wallet

* Missed one

* Some new references from main

* Fix is_transaction_confirmed

* mypy

* check for 'confirmed'

* Try again to fix is_transaction_confirmed

* remove from mypy.ini
2022-09-13 17:07:29 -05:00
Kronus91
b081c208e3
Add DID sign message API (#13269)
* Add DID sign message API

* Resolve comments
2022-09-13 16:08:46 -05:00
Sebastjan Trepca
657b654181
Integrating NFT store directly into NFT wallet (#12978)
* test passing on update nft store

* fix tests

* missed await

* fix formatting

* another test fix

* flaky test fix

* test fix

* cleanup

* nft count fix

* pr feedback fixes

* test fix
2022-09-13 10:36:29 -05:00