Commit Graph

1000 Commits

Author SHA1 Message Date
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
Amine Khaldi
7defb1ebfc
Merge commit '618f93b4c42b176659cc74c02a4dd711adc62052' into checkpoint/main_from_release_1.6.2_618f93b4c42b176659cc74c02a4dd711adc62052 2022-12-14 19:24:34 +01: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
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
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
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
xdustinface
c356fe0465
Fix ChiaServer.is_duplicate_or_self_connection 2022-12-05 07:41:56 +01: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
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
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
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
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
Arvid Norberg
27cbd08229
Factor out member functions of ProofOfSpace to be free functions (#13930) 2022-11-17 13:46:22 -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
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
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
dustinface
50d148eadd
Cleanup WSChiaConnection imports/usage (#13868) 2022-11-08 10:10:59 -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
b502f24357
Merge commit 'bfc35b796f16fe1af6ff322fc602b47ea016dffb' into checkpoint/main_from_release_1.6.1_bfc35b796f16fe1af6ff322fc602b47ea016dffb 2022-11-03 14:21:51 +01: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
Arvid Norberg
bfc35b796f
improve handling of unfinished block messages (#13777) 2022-10-31 22:41:11 -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
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
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
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
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
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