Commit Graph
376 Commits
Author SHA1 Message Date
Jack Nelson 105f02993f Move simulator tests over to new file, to allow other programs to use it (#12759)
* Separate test file at Cameron's request

this lets other tools easily use these tests

* fix accidental text duplication
2022-08-05 13:52:39 -05:00
Jack NelsonandMariano Sorgente 0dd5391f40 Simulator Final touches (#12703)
* add new rpc and add tests.

I added, get_all_blocks rpc, and expanded the get_all_puzzle_hashes rpc.

* lint pass

* update plot directory for simulator

* return peak height on new block farm

* expand test coverage

* fix plot directory craziness

* simulator sync override

* Add new simulator networktype

* add logging to simulator

* Fix race condition, mempool and confirm

* add reorg seed

* farm block if block 0 sim & fix unsynced for sim

* lint

* oops i forgot to lint

* switch to detecting simulator in network type

also remove inline genesis generation

* fix config loading to use correct variable

Co-authored-by: Mariano Sorgente <sorgente711@gmail.com>
2022-08-05 01:23:18 -05:00
Jack Nelson ff8ecb35a0 Fix no keys loaded error by making KeychainProxy automatically reconnect when a connection is lost (#12782)
* Add proper types to daemon client & keychain

* pre type pass on keychain proxy

* add auto restarting keychain proxy

* finalize keychain proxy v2

* move event calls

* fix close on timeout

* fix possible key leak in logging

* fix last little error

* log on disconnection & reduce duplicate code

* Update client.py
2022-08-04 20:28:58 -05:00
Kyle Altendorf 6fd1caf137 Merge branch 'long_lived/atari' into atari-offer_rpc_stubs 2022-08-04 09:29:46 -07:00
Amine Khaldi be6a9ebc7d Merge commit '1205418f224db9f48830d1c6ca7a8cad89fb213b' into checkpoint/long_lived_atari_from_main_1205418f224db9f48830d1c6ca7a8cad89fb213b 2022-08-03 17:09:59 +01:00
Amine Khaldi 5316bd085c Merge commit '61de7bdb393fd8c11737f2d34d15560bfb9d632b' into checkpoint/long_lived_atari_from_main_61de7bdb393fd8c11737f2d34d15560bfb9d632b 2022-07-31 19:26:06 +01:00
Jack Nelson c62a17358a Last new simulator rpc's (#12549)
* add coin rpc's

* finish coin rpc's

* mac lint pass

* Add both block reversion RPC's

* Mac Lint pass

* add tests

* add last tests

* small issue, oops

* quick sql change

* allow developer customization to sim tests

add automated_testing values

* fix camel case

* mac lint pass

* address nitpicks 😄
2022-07-29 12:21:25 -05:00
Kyle Altendorf 1951d1893b Merge branch 'long_lived/atari' into atari-offer_rpc_stubs 2022-07-25 15:55:58 -07:00
Jack Nelson 0bc54ae08b Move simulator test requirements over to new module (#12521)
* create new test.simulator module

to allow other packages to use the simulator without it crashing.
also tiny QOL fixes

* change user mode sim plot filter

Now only plots matching the user set fingerprint are loaded, this decreases the chance of user error.

* fix small oops in configure

* oops

* fix lint

* isort, who dis

* move folder over to chia/simulator

also change mypy settings again
2022-07-25 14:07:38 -05:00
Amine Khaldi 87ca957976 Merge commit '421ec50a4f199729b2f297429ff55eab38da8b82' into checkpoint/long_lived_atari_from_main_421ec50a4f199729b2f297429ff55eab38da8b82 2022-07-22 20:14:33 +01:00
Kyle Altendorf 8f45a0bd10 start implementing make offer rpc 2022-07-21 08:44:19 -07:00
Amine Khaldi 18313573d3 Merge commit '90516263aa19afbfc4ef62947c8ac7e8c2889e32' into checkpoint/long_lived_atari_from_main_90516263aa19afbfc4ef62947c8ac7e8c2889e32 2022-07-16 17:12:58 +01:00
Jack Nelson 7fda9596af Replace existing simulator config & Fix simulator (#12072)
* redesign simulator config loader

* edit initial config file and use it in start_simulator

also final lint cleanup

* small change

* aarggggghhhh

LINTTTTTTTTTTTTTTTT

* fix lint for the last time

DAMN END OF LINE

* Add Types & change port

* fix config loading for tests

* change config options

remove unnecessary options & change ports back

* Add additional config options for old simulator

* Get working simulator & implement the requirements

i hope my code makes sense:)

* remove extra part of config

* fix config typos

* add callback for autofarm

we can call this to tell the node to farm a block

* add auto farm rpc to simulator

* add plot_directory to config

add separate plot dir to avoid issues where the plot dir is shared with tests and an assert fails

* remove port from config

no longer needed due to existing gui simulator being broken

* switch to dedicated plot creation function

* modify api for greater block customization

Added block type option & amount of block option

* disable auto farm for tests

breaks them all ;)
Also made sure to run autofarm while a transaction is in mempool if the mode was just changed

* change farm_block for the better

* clean up autofarm

remove unnecessary optional

* update create block tools and allow additional plot creation tweaks

& do requested fixes

* change to k18's

* minor nitpick

* testing some changes

stop reading these descriptions, just ask me on keybase

* change plot directory name stuff

* add editing of root level keys

* use config_overrides

* update plot info

* re separate create_block_tools

* revert some changes as requested

change back get_plot_dir & undo change to asyncio.run

* replace unnessary catch while adding plot locations

switch to better if logic

* combine simulator_bt function into main

fix block_tools logic too

* fix lint

windows bad

* test auto_farming

* remove change that causes more harm then good

* move test over and unflake it

* make test do the bare minimum

* add proper block waiting or wait avoidance

* fix failing test

* add new rpc client & a small fix

* add new test & add some minor changes to start_sim to support it

New test tests whole user facing simulator with real keychain, gui and daemon.

* merge fixes

* update block-cache version

CHANGE TO MY USER, REVERT THIS LATER

PLS REVERT BEFORE MERGE

fix version

* Revert "update block-cache version"

This reverts commit 3afbbc5f51.

* block args from reaching simulator

* clean up test plot creation

* remove extra bt's being called

this reduces load time

* fix stupid bug

* damn lint

* Revert "remove extra bt's being called"

This reverts commit f78debcc26.

* Revert "clean up test plot creation"

This reverts commit d006a1a196.

* align with 12204

* rename RPC's for clarity

* disable cache error when not running in automated mode

* update tests with new rpc's

oops i forgor

* finalize sim api

* something funky going on

* Revert "something funky going on"

This reverts commit afa1ddde27.

* fix config

* add get_farming_ph rpc

* remove random simulation thing, why are we even using this.

* update tests

* simplify test code & fix lint

* lol one of my own pr's broke another one of my pr's

git funny
2022-07-15 20:49:40 -05:00
Kyle Altendorf f2061d86d6 rework service creation to be hint checkable (#12153)
* rework service creation to be hint checkable

* fixup config vs. service_config

* more fixup

* service start cleanup

* Update nft_metadata_updater_default.clvm.hex

* reorder advertised_port= parameter

* undo unrelated tweaks

* Optional[RpcInfo]

* undo unrelated whitespace change
2022-07-13 11:43:48 -05:00
Kyle Altendorf 1205418f22 Simplify service start configuration loading (#12204)
* Simplify service start configuration loading

* oops

* more oops

* rename `config` to `service_config` as appropriate

* rename `full_config` to `config`
2022-07-07 19:57:08 -05:00
Kyle Altendorf 61de7bdb39 EndpointResult (#12026)
* just create and apply EndpointResult

* int -> uint32

* hexstr_to_bytes -> bytes32.from_hexstr

* deal with returning tuples with success and error data

* uint64

* assert height is not None

* more uint64() for nft coin amount

(cherry picked from commit 544d3d5892)

* TransactionRecord -> List[TransactionRecord]

* return generic error from create_new_wallet()

* Dict[Union[int, bytes32], int]

* just ignore the optional coin issues
2022-07-05 16:27:47 -05:00
dustinface 421ec50a4f rpc: Introduce rpc_server.Endpoint hint alias (#11889) 2022-06-21 16:57:42 -05:00
Kyle Altendorf 90516263aa remove chia.util.path.mkdir() (#10842)
* remove chia.util.path.mkdir()

* remove submodule change

* less tmpdir, more tmp_path
2022-06-08 10:24:40 -05:00
Kyle Altendorf 0a8ae6352a fixup create coins tests 2022-05-25 16:26:19 -04:00
Kyle Altendorf b6c5babba3 Merge commit 'd154105a6b35f94649f15bca4e3fb8a11a39e70e' into atari-merge_main_d154105a6b35f94649f15bca4e3fb8a11a39e70e 2022-04-19 22:44:02 -04:00
Yostra 0e9c917119 Expose farm_block RPC for simulator (#10830)
* expose farm block api to RPC for simulator

* lint

* pre-commit lint
2022-04-10 21:18:18 -07:00
dustinface a48fd43100 streamable: Simplify and force correct usage (#10509)
* streamable: Merge `strictdataclass` into `Streamable` class

* tests: Test not supported streamable types

* streamable: Reorder decorators

* streamable: Simplify streamable decorator and force correct usage/syntax

* streamable: Just move some stuff around in the file

* streamable: Improve syntax error messages

* mypy: Drop `type_checking.py` and `test_type_checking.py` from exclusion

* streamable: Use cached fields instead of `__annotations__`

This is now possible after merging `__post_init__` into `Streamable`

* Introduce `DefinitionError` as `StreamableError`

* `/t` -> `    `
2022-04-08 18:29:32 -07:00
Mariano Sorgente 890c7d3754 Fix remaining linting issues (#10962)
* FIx remaining linting issues

* Revert type:ignore

* Revert token_bytes change
2022-04-02 13:22:55 -07:00
Kyle Altendorf 5c4becaad0 catchup with isort enforcement/ignores 2022-03-10 21:35:35 -05:00
Kyle Altendorf a50b113bc7 Merge commit 'fa2cdd6492bcffbe61f50fde8b5e1d4fd2ac5a16' into atari-merge_main_fa2cdd6492bcffbe61f50fde8b5e1d4fd2ac5a16 2022-03-01 10:25:32 -05:00
Mariano Sorgente f0a6189f2d Move BLS validation to other processes during sync (#9746)
* Try putting BLS in multiprocess

* Fix test

* Fix test again

* Fix test again ^ 2

* Don't use cache unless necessary, cleanup of unused code.

* WIP fixing tests

* Blockchain tests passing

* Remaining tests and lint

* More test fixes

* Fix full_node_rpc test

* Fix remaining tests

* Correct boolean

* Don't validate sig if CLVM fails. Also testing signature validation properly

* Simplify block prevalidation API and improve tests

* Fix logic error and remaining tests

* Update comments and change to AssertionError

* Try to improve CI performance

* Fix mempool test, try to fix test_blockchain performance

* Set default argument to fix test

* Fix DB conversion test

* Use cache for validating signatures (#9859)

* Use cache for validating signatures

* comments: fix typo

* Don't rerun the super slow part of the test (#9887)
2022-01-20 14:50:41 -08:00
Kyle Altendorf a3b4f3f1f4 Merge pull request #9845 from Chia-Network/atari_small_test_fix 2022-01-19 14:00:44 -05:00
Matt Hauff aee8857a44 Test utility changes 2022-01-19 11:40:57 -07:00
Matt Hauff a7b087bd07 Lint but mypy mostly 2022-01-14 20:30:31 -07:00
Kyle Altendorf 55e67d8846 some hint fixups 2021-12-17 21:40:17 -05:00
Kyle Altendorf 1946cfd65f lint 2021-12-14 15:11:26 -05:00
Kyle Altendorf 1b0b7f6082 mypy 2021-12-14 13:52:31 -05:00
Kyle Altendorf d51ec3be7c hints and related 2021-12-08 22:25:30 -05:00
Kyle Altendorf d17ce9efab Merge branch 'main' into atari 2021-12-07 21:39:10 -05:00
Kyle Altendorf 113efb739a fixup 2021-12-06 17:13:12 -05:00
Kyle Altendorf 784ee1f8ec add missing await 2021-12-06 16:50:09 -05:00
Kyle Altendorf b7ee24dc63 add the wallet state manager lock 2021-12-03 16:36:55 -05:00
Kyle Altendorf 34e5d80d7f add test for FullNodeSimulator.create_coins_with_amounts() 2021-12-03 16:07:06 -05:00
Kyle Altendorf 9ddee2e2d1 add test for FullNodeSimulator.process_transaction_records() 2021-12-03 16:06:25 -05:00
Kyle Altendorf 501ade5404 add test for FullNodeSimulator.wait_transaction_records_entered_mempool() 2021-12-03 12:10:45 -05:00
Kyle Altendorf 8291f0221a Make the sized bytes types hint compatible (#9369)
* Rework sized bytes for type hinting compatibility

* add a bunch of type: ignores

* this will be handled elsewhere

* noqa E501 instead of changing code

* normalize comment plurality

* @classmethod

* Revert "@classmethod"

This reverts commit 95db80e339.

* add ignore in benchmarks

* just E501 again...

* add some new type: ignores
2021-12-02 09:43:39 -08:00
Kyle Altendorf 441cb66806 mypy 2021-12-01 21:21:59 -05:00
Kyle Altendorf 0393e92ebe wait for block to actually be processed 2021-12-01 20:33:47 -05:00
Kyle Altendorf 2a2bd63f3f update docstrings 2021-12-01 20:15:18 -05:00
Kyle Altendorf 734903181f wait for transaction records to actually be in the coin store 2021-12-01 19:51:32 -05:00
Kyle Altendorf 9b0c6ae92d drop timeouts 2021-12-01 18:49:03 -05:00
Kyle Altendorf a29f85ced9 mypy 2021-12-01 09:07:54 -05:00
Kyle Altendorf cd67110487 actually wait for the wallet to receive the farmed coins 2021-12-01 01:29:14 -05:00
Kyle Altendorf 7283bc5d2c wait for transaction records, not spend bundle names 2021-11-30 19:44:39 -05:00
Kyle Altendorf 47ec412ee7 lint 2021-11-30 18:15:16 -05:00