Commit Graph
376 Commits
Author SHA1 Message Date
Arvid Norberg 68c9aafc0a move SerializedProgram to its own file (#14391)
* move SerializedProgram into its own file (to fixup type annotations)

* fix type annotations for SerializedProgram

* fixup import statements for new SerializedProgram module
2023-01-27 17:20:23 -06:00
Geoff Walmsley 443875e945 Enable setting time between blocks in full node sim (#14310)
remove the reset on time_per_block in full node sim
2023-01-19 15:32:46 -06:00
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
Kyle Altendorf 8ea3f93339 use adjusted_timeout() for simulator helpers (#14221) 2022-12-23 11:34:42 -06:00
Kyle Altendorf 64c57fdd78 fully hint test_pool_rpc (#14204) 2022-12-23 11:32:35 -06:00
Kyle Altendorf cb6c5fc17f improve adjusted_timeout() to handle floats and None (#14198) 2022-12-21 23:59:36 -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
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 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 42f6a883ae isort: Remove the remaining exceptions and sort the related files (#14124) 2022-12-13 17:10:55 -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 8a3ee3f4c0 server: Move api call processing into WSChiaConnection (#14008) 2022-12-09 03:47:46 -06:00
dustinface bea4928741 flake8: Fix issues after update (#13997) 2022-11-24 13:32:04 -06:00
Almog De Paz efb670cf1b Setup services mypy (#13932) 2022-11-22 17:01:01 -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
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
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
Earle LoweandKyle Altendorf 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
Almog De Paz dbc71dc3f9 fix timestamps in block_tools (#13692)
* use latest timestamp for block creation

* fix calculation, refactor
2022-10-24 17:25:28 -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
Kyle Altendorf 8fad789346 extend allowed duration in block tools update callback (#13602)
https://github.com/Chia-Network/chia-blockchain/actions/runs/3185807311/jobs/5195866349#step:16:487
```python-traceback
________ ERROR at setup of TestMempoolManager.test_invalid_block_index _________
[gw3] darwin -- Python 3.10.7 /Users/runner/work/chia-blockchain/chia-blockchain/venv/bin/python
venv/lib/python3.10/site-packages/pytest_asyncio/plugin.py:293: in _asyncgen_fixture_wrapper
    result = event_loop.run_until_complete(setup())
../../../hostedtoolcache/Python/3.10.7/x64/lib/python3.10/asyncio/base_events.py:646: in run_until_complete
    return future.result()
venv/lib/python3.10/site-packages/pytest_asyncio/plugin.py:275: in setup
    res = await gen_obj.__anext__()
tests/conftest.py:437: in one_node_one_block
    nodes, _, bt = await async_gen.__anext__()
tests/setup_nodes.py:213: in setup_simulators_and_wallets
    await create_block_tools_async(
chia/simulator/block_tools.py:2113: in create_block_tools_async
    await bt.setup_plots()
chia/simulator/block_tools.py:337: in setup_plots
    assert len(self.plot_manager.plots) == len(self.expected_plots)
E   AssertionError
---------------------------- Captured stdout setup -----------------------------
  create_block_tools_async called 25 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpwl0ved2d, using it to generate TLS certificates
BlockTools daemon port: 46514
------------------------------ Captured log setup ------------------------------
22:37:05 chia.plotting.manager: ERROR _refresh_callback raised:  with the traceback: Traceback (most recent call last):
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/plotting/manager.py", line 194, in _refresh_task
    self._refresh_callback(PlotRefreshEvents.batch_processed, batch_result)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/simulator/block_tools.py", line 231, in test_callback
    assert update_result.duration < 5
AssertionError
```
2022-10-07 13:22:18 -05:00
Jack Nelson 320fafa197 add bitfield option (#13585) 2022-10-05 11:05:41 -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
Jack Nelson 671c52d606 format path properly depending on os in simulator block-tools (#13564)
* format path properly depending on os

* fix logic issue

* fix dir again
2022-09-29 12:12:23 -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
Gene Hoffman 1224ef924f Use codespell to catch some typos (#13557) 2022-09-28 04:27:34 -05:00
Kyle Altendorf 89c9242618 Add __tracebackhide__ to time_out_assert_not_none() (#13481) 2022-09-23 17:19:15 -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
Kyle Altendorf accf6fd824 separate process global setup for daemon (#13400) 2022-09-16 17:49:51 -05:00
Mariano SorgenteandKyle Altendorf 87a3e93cc4 Ms.mypy enable (#13320)
* Remove mempool.additions

* Don't re run the program, and remove program from mempool item

* Removals only stores item ids, and stores a list

* Move pending cache down to prevent cache dos

* Separate validation from adding to pool, and remove mypy exceptions

* Fix bug with replacing

* Add to mypy

* Revert cbgui

* precommit fail

* Properly update the seen dict

* lint error

* Fix mempool bug

* Enable mypy for a bunch of files

* Update after merge with main

* 99/260 remaining

* Address comments

* Enable more mypy

* Merge conflict mypy file

* More fixes

* pytest.ini and cb-gui

* One more flake8 fix

* Flake8 and tests

* More test fixes

* isort

* Make LGTM happy

* Update chia/full_node/block_store.py

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

* Update chia/full_node/full_node_store.py

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

* Update chia/wallet/util/peer_request_cache.py

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

* Apply all suggestions from PR comments

* Revert cb-gui

* 100 back to 1000, minor tweaks

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-09-08 12:57:15 -05:00
Kyle Altendorf ec056f59b3 Replace localhost with 127.0.0.1 for tests (#13324)
* Replace localhost with 127.0.0.1 in block tools config

* also make self_hostname fixture be 127.0.0.1

* Move config rewrite inside `automated_testing` conditional
2022-09-06 10:51:05 -05:00
Amine Khaldi eeb2277955 Merge commit '12fcaf0e982590efcf26a954c67cd760035d9e6e' into checkpoint/main_from_release_1.6.0_12fcaf0e982590efcf26a954c67cd760035d9e6e 2022-08-29 17:45:49 +01:00
Amine Khaldi b63aa1c87f Merge commit 'e314040d8d1034668f2563f0c2aeea6a39fd553c' into checkpoint/long_lived_atari_from_main_e314040d8d1034668f2563f0c2aeea6a39fd553c 2022-08-23 20:38:03 +01:00
Amine Khaldi 5440cc61bb Merge commit '105f02993f943f758b8f3276b94c9d0781006877' into checkpoint/long_lived_atari_from_main_105f02993f943f758b8f3276b94c9d0781006877 2022-08-23 13:59:19 +01:00
Amine Khaldi 8e65ceebc2 Merge commit '0dd5391f40df3414180d2df716fe1d9c2d02767f' into checkpoint/long_lived_atari_from_main_0dd5391f40df3414180d2df716fe1d9c2d02767f 2022-08-22 19:50:04 +01:00
Amine Khaldi 4b39c4e241 Merge commit 'ff8ecb35a0bd251b66e1b5102a8113d115c93604' into checkpoint/long_lived_atari_from_main_ff8ecb35a0bd251b66e1b5102a8113d115c93604 2022-08-22 19:04:09 +01:00
Jack Nelson a376057295 fix slight issue with simulator loading, this only really could affect tests (#12810)
* fix slight issue, this does not really effect anything

* remove old line

this is now part of the full node
2022-08-17 02:07:51 -05:00
Kyle Altendorf 8fc1e63895 Merge branch 'long_lived/atari' into atari-offer_rpc_stubs 2022-08-15 20:46:45 -04:00
Kyle Altendorf 1ce50051d7 Merge branch 'long_lived/atari' into atari-offer_rpc_stubs 2022-08-15 13:45:58 -04:00
Amine Khaldi a8efa403de Merge commit 'c62a17358a1484f47447dbf27f13d52b005203d1' into checkpoint/long_lived_atari_from_main_c62a17358a1484f47447dbf27f13d52b005203d1 2022-08-15 18:19:53 +01:00
Amine Khaldi 34d6197890 Merge commit '0bc54ae08b6655ec5242a8b21460d34b5e4a38c6' into checkpoint/long_lived_atari_from_main_0bc54ae08b6655ec5242a8b21460d34b5e4a38c6 2022-08-15 13:55:39 +01:00
Kyle Altendorf e21e3ecb13 Merge branch 'long_lived/atari' into atari-offer_rpc_stubs 2022-08-10 19:54:41 -04:00
Amine Khaldi 9585241286 Merge commit '7fda9596afa22e5eada462a6e9c9a9c550517ec0' into checkpoint/long_lived_atari_from_main_7fda9596afa22e5eada462a6e9c9a9c550517ec0 2022-08-10 15:48:22 +01:00
Jeff 0ea86b1079 Few additional sets of test SSL certs/keys for CI (#12702)
* Few additional sets of test SSL certs/keys for CI

* Track which sets of SSL test certs/keys are in use. Emits a warning if a set of test certs/keys are reused which still in use.

* Accidentally moved a set of certs/keys
2022-08-09 18:21:11 -05:00
Kyle Altendorf 4bfad071b3 Merge branch 'long_lived/atari' into atari-offer_rpc_stubs 2022-08-08 22:05:51 -04:00
Amine Khaldi ea9e94982c Merge commit 'f2061d86d62dd8ed4a09ea4f63404784e1726adc' into checkpoint/long_lived_atari_from_main_f2061d86d62dd8ed4a09ea4f63404784e1726adc 2022-08-08 18:46:26 +01:00
dustinface aa0e996ac5 util: Drop partially implemented BIP39 passphrase support (#12748) 2022-08-06 09:50:33 -05:00
Mariano Sorgente e314040d8d No network type (#12783)
* No network type

* Use selected network

* remove NETWORK_TYPE

* Don't warn on invalid key, and remove from config

* Remove bytes32

* Put back the warning log
2022-08-05 13:53:02 -05:00