Commit Graph

3094 Commits

Author SHA1 Message Date
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
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
5d514487e3
tests: Drop some unused code in test_puzzle_store.py (#15047) 2023-04-18 11:28:25 -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
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
Amine Khaldi
3410cf3deb
Introduce and use the ability to honor spends IDs in make_test_conds (#15060)
Introduce and use the ability to honor spends IDs in make_test_conds.
2023-04-17 15:43:50 -05: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
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
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
dustinface
ed66308272
tests: Reuse puzzle_utils.make_create_coin_condition in test_puzzles (#15018) 2023-04-12 11:30:57 -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
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
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
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
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
4710dd87d7
skip empty directories pre-commit (#14973) 2023-04-03 13:31:11 -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
Matt Hauff
bdd6eb8bfa
Make sql pre-commit check work when pre-commit hooks are in non-standard locations (#14955)
* make sql pre-commit check work with git worktrees

* Comment reasoning in script file

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

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-03-31 15:42:17 -05: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
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
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
Amine Khaldi
db6386ab3b
Add unit tests for replace by fee dynamics (#14815)
* Add unit tests for replace by fee dynamics.

* Separate scenarios into their own tests.

* Remove the TestReplaceByFee class.
2023-03-28 10:41:08 -05:00
dustinface
5e5395305d
wallet: Drop some parameters from WalletStateManager.add_new_wallet (#14919) 2023-03-27 18:07:19 -05:00
Amine Khaldi
faad1d7fd6
Improve core mempool test runs (#14914)
Improve mempool test runs.
2023-03-27 15:50:00 -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
9b608f40f9
wallet: Drop WalletCoinStore.get_multiple_coin_records (#14862) 2023-03-27 10:16:33 -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
7acba82607
Merge commit 'f637881f80049f5648acd1936a2da936b5ca79a1' into checkpoint/main_from_release_1.7.1_f637881f80049f5648acd1936a2da936b5ca79a1 2023-03-24 14:36:57 +01:00
Kyle Altendorf
8cdaacf23c
increase wallet.nft_wallet test job timeout to 70 minutes (#14881)
from https://github.com/Chia-Network/chia-blockchain/actions/runs/4455716184/usage i see macos with nominal low 40s runtime and outliers into the low 50s, windows has a wider variance with highs in the low 50s and 8'ish hung runs that timed out at the 75 minute timeout, linux looks like 30'ish with a high of maybe 36.
2023-03-24 02:17:53 -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
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
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
Kyle Altendorf
f09d051552
fixup tests that do not close all event loops (#14851)
* remove event loop fixture from `test_dl_wallet`

* stop importing unused `Iterator`

* fixup more
2023-03-20 15:01:02 -05:00
dustinface
543f8c24eb
wallet: Return a dict in WalletCoinStore.get_coin_records (#14828) 2023-03-20 13:17:59 -05:00
Arvid Norberg
ea2da6ce6e
fix renaming of respond_block -> add_block (#14846) 2023-03-18 05:56:40 -05:00
dustinface
26c2ca29de
tests: Fix flaky RPC related tests in test_nft_bulk_mint.py (#14834)
* `assert spend_bundle is not None`, required after hinting in next commit

* Don't start duplicated RPC servers, use the already started ones

* Wait for wallet sync before minting
2023-03-17 19:34:46 -05:00