Commit Graph
45 Commits
Author SHA1 Message Date
Matt HauffandGitHub 40db4635a8 [LABS-245] Enable PEP604 Ruff rules (#20269)
* Enable PEP604 Ruff rules

* Fix harcoded signature in test

* Hack CLVMStreamable test with note to fast follow
2025-11-18 12:34:00 -08:00
Kyle AltendorfandGitHub f054d339a1 unignore some ruff s rules (#19703) 2025-06-12 11:12:54 -07:00
Richard KissandGitHub 44643084b0 Move augmented_chain.py and prev_transaction_block.py to chia/consensus (#19587) 2025-05-08 15:11:31 -05:00
Kyle AltendorfandGitHub 1911044e97 use chia_rs directly for more types (#19475)
* use chia_rs directly for more types

* more more

* undo submodule change...
2025-04-18 11:45:44 -05:00
Almog De PazandGitHub 26b0fbee8e move augmented to caller (#19161)
* move augmented to caller

* use undelying height_to_hash to check main chain
2025-01-27 13:12:10 -07:00
Amine KhaldiandGitHub 9063e29810 CHIA-2020 Simplify add_block_batch (#19004)
Simplify add_block_batch.

1. No need to accept AugmentedBlockchain and reconstruct it again.
2. No need to return both success and an unused optional error.
2024-12-10 06:38:37 -07:00
Matt HauffandGitHub 73e4a5bbea [CHIA-1680] Finish replacing flake8 with Ruff (#18802)
* Apply ruff unsafe fixes

* Manually fix tuples with `as`

* Remove all references to flake8
2024-11-04 08:59:57 -07:00
Matt HauffandGitHub 6084112d48 [CHIA-1553] Replace pylint with ruff (#18759)
* Replace pylint with ruff

* poetry

* remove pylint

* Address comments by @altendky

* Undo formatting

* actually undo formatting
2024-10-25 15:55:37 -07:00
Arvid NorbergandGitHub 2df931bf87 [CHIA-1566] pipeline block validation in sync_from_fork_point() (#18703)
* make pre_validate_multi_processing() return futures, rather than the awaited and joined results from the thread jobs. This is crucial to allow the validaion jobs to run concurrently with the database interaction in the main thread

* Split up the add_block_batch() function into 3 parts, preparing them to be pipelined in long-sync

* pass AugmentedBlockchain into pre_validate_multiprocessing() and prevalidate_blocks(), to support the augmented blockchain to outlive a single batch

* pipeline pre-validation in sync_from_forkpoint()

* optimize the common case of _reconsider_peak(), to avoid one database lookup

* address review comments

* rename filter_blocks() -> skip_blocks(). It's is only relevant at the start of the sync, add comment and assert
2024-10-25 08:38:23 -07:00
Almog De PazandGitHub a80d779fe6 refactor full_node add_block (#18584)
* refactor

* minor fixes

* fix_tests

* add finish sync to add_blocks_in_batches

* add_blocks_in_batches updates wallets

* test fixes

* fix condition in add_block

* add known block to cache

* restore comment

* remove init file from log dir

* fix failed reorg test

* revert known block info change

* assert height in cat test

* wait for wallet height in nft test

* assert sync all height for all wallets

* test_cat_creation assert height

* rename vars

* assert height in process states
2024-10-22 12:14:18 -07:00
Arvid NorbergandGitHub e7241ebfe0 simplify passing around difficulty, sub slot iterators and prev_ses_block (#18660)
* combine current sub slot iterations, current difficulty and previous ses block into ChainState, to make it easier to pass around and update

* address review comments

* address review comments. rename ChainState -> ValidationState. add more comments
2024-10-07 11:09:15 -07:00
Almog De PazandGitHub 9559295725 refactor pre_validate_blocks_multiprocessing (#18469)
* refactor pre_validate_blocks_multiprocessing

* fix condtion

* get diff and ssi from blocks

* works_with_skip_ses

* add default

* propegate_to_header_validation

* pass data between batches

* remove redundant code

* merge fix

* remove optionals and refactor tests

* only use cache

* merge fix

* fix test

* dont traverse if we have prev sub epoch block

* return bad_prev error if block is missing

* mandetory param names

* clean

* fix_benchmark_test
2024-09-07 05:11:42 +08:00
8eb41c59d7 bump chia_rs to 0.7.0 (#17909)
* bump chia_rs to 0.7.0 and transition using sized ints and sized bytes from chia_rs

* transition StructStream to use the version from chia_rs

* Initial port of ConsensusConstants to Rust

* Revert max cost calculation to use int for now

* Remove SizedBytes, since it was moved to chia_rs

* Remove test_struct_stream, since it was moved to chia_rs

* use [0] * 100 instead of bytes(100)

* restore wallet_rpc_api, and make type hints match JsonDict (Any)

* fixup ConsensusConstants; restore return value of calculate_prefix_bits()

* fixup ConsensusConstants; construct int for intermedate cost values

* fixup ConsensusConstants; construct int for intermedate cost values

* fixup: transition StructStream to use the version from chia_rs

* revert changing type annotations for json dict

---------

Co-authored-by: Rigidity <me@rigidnetwork.com>
2024-04-26 08:06:25 -07:00
Kyle AltendorfandGitHub a89222a428 move tests (#17209)
* prep

* verify source and installed tests match

* move

* remove move script
2024-03-14 10:19:20 -07:00
Arvid NorbergandGitHub eb543fd888 transition FullBlock and BlockRecord to rust (#17525)
* use rust version of FullBlock and UnfinishedBlock

* use rust type for BlockRecord
2024-02-20 13:11:31 -08:00
Kyle AltendorfandGitHub 714c4d1985 move run_full_sync() to tests/ (#17268)
* move `run_full_sync()` to `tests/`

* update mypy exclusions
2024-01-10 09:32:04 -06:00
Kyle AltendorfandGitHub fbdb27bef1 managers for services (#16670) 2023-11-16 19:21:12 -06:00
Amine KhaldiandGitHub a420d8ea0c Simplify add_block_batch by making it take PeerInfo instead of WSChiaConnection (#16692) 2023-10-26 10:33:45 -05:00
Kyle AltendorfandGitHub f1059bcb44 @dataclass FullNode to avoid risks of instances without attributes set (#1332) 2023-10-03 14:33:19 -05:00
Almog De PazandGitHub d966f3f9e6 Add bad peak cache (#16027)
* add and check bad peak hash

* move check

* refactor, add tests, change cache to Dict

* pr fixes

* fix bad f-string

* refactor chip-0013 errors

* limit cache size, add size to constants

* test cache invalidation fix invalidation bug

* fix off by one

* move cache size to config

* remove bt conf override

* use get_peers_with_peak

* fix expected exception in test_soft_fork4_activation
2023-08-30 13:27:22 -05:00
Kyle AltendorfandGitHub 42a6d1afa6 remove support for Python 3.7 (#14611)
* remove support for Python 3.7

* python_requires=">=3.8, <4"

* 3.8.1+

* catchup

* remove todos handled in https://github.com/Chia-Network/chia-blockchain/pull/15755
2023-07-14 12:49:58 -05:00
Kyle AltendorfandGitHub 03943a0e51 allow tests/tools/test_full_sync.py::test_full_sync_test to run on 3.7 (#15570)
* allow tests/tools/test_full_sync.py::test_full_sync_test to run on 3.7

* drop dirs_exist_ok=

* more

* less
2023-06-21 18:14:34 -05:00
Kyle AltendorfandGitHub 7f7bce8677 help= not short_help= (#15076)
* help= not short_help=

* oops

* more

* more
2023-05-03 00:29:13 -05:00
Kyle AltendorfandGitHub 2ed75d47f3 more mypy platforms in ci (#12299)
* more mypy platforms in ci

* check not checks

* oh yeah, activate...

* add 3.11

* adjust job names

* actually use the right python version for install

* adjust for 3.7 hinting support

* exclude macos 3.7 and macos arm 3.8

* back to 3.8 for now

* major_dot_minor

* oops

* move ignore comments for 3.7

* and more
2023-04-27 09:51:18 -05:00
Kyle AltendorfandGitHub ff5ef6e073 remove leading newlines from indented code blocks (#14653)
* remove leading newlines from indented code blocks

* catch another one
2023-02-23 21:53:48 -06:00
dustinfaceandGitHub c098ee9166 full_node: Rename some receive/respond prefixes to add (#14458)
* full_node: Rename `FullNode.resond_block` to `FullNode.add_bock`

The naming `respond_block` is confusing here imo, we have a full node
API method called `respond_block` but here in the `FullNode` class this
method is there to try adding a block to the full nodes's chain so i
think `add_block` is the better choice?

Also change the `respond_block: full_node_protocol.RespondBlock`
parameter to `block: FullBlock` which lets us get rid of many
`full_node_protocol.RespondBlock` wrappings.

* `FullNode.receive_block_batch` -> `FullNode.add_block_batch`

* `receive_unfinished_block` -> `add_unfinished_block` + change parameter

* `FullNode.respond_transaction` -> `FullNode.add_transaction`

* `FullNode.respond_end_of_sub_slot` -> `FullNode.add_end_of_sub_slot`

* `FullNode.respond_compact_vdf` -> `FullNode.add_compact_vdf`

* `respond_compact_proof_of_time` -> `add_compact_proof_of_time`

* `respond_transaction_semaphore` -> `add_transaction_semaphore`
2023-02-23 10:28:29 -06:00
Kyle AltendorfandGitHub d53f249e5c only send_to_all(), drop send_to_all_except() (#14229)
* only send_to_all(), drop send_to_all_except()

* catch up tools/ as well

* add default
2023-01-02 21:39:11 -06:00
dustinfaceandGitHub 8e2e51a8c8 Add optional outbound parameter to get_connections (#13879) 2022-11-15 17:40:16 -06:00
dustinfaceandGitHub 50d148eadd Cleanup WSChiaConnection imports/usage (#13868) 2022-11-08 10:10:59 -06:00
Kyle AltendorfandGitHub 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
Arvid NorbergandGitHub 92a5f38a86 remove soft fork logic at height 2300000 (#12563)
* remove soft fork logic at height 2300000. The whole chain can be validated with the post-soft-fork rules. Remove testing of pre-soft-fork rules

* fix test_full_sync
2022-08-01 17:32:53 -05:00
Jack NelsonandGitHub 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
Arvid NorbergandGitHub 969c2586f1 add checkpoint feature to test_full_sync (#11723) 2022-06-01 12:53:48 -05:00
Arvid NorbergandGitHub d346ef89f1 extend benchmark to make the db-sync mode and node-profiler configurable (#11647) 2022-05-31 15:37:20 -05:00
Arvid NorbergandGitHub 3795a52152 fix some LGTM issues (#11453) 2022-05-12 15:17:24 -07:00
Mariano SorgenteandGitHub e0df18f85d Ms.hint refactor (#11222)
* Some work on hints

* More cleanup and test_generator_tools

* Change relevant calls

* More refactor and cleanup

* More refactor

* Small fix

* Create wrapper object PeakPostProcessingResult

* Lint and small fix

* Fix a hint bug

* Fix hint update_wallets

* Fix test_full_sync

* pre-commit

* Start with PR review comments

* More efficient iteration

* Remove tx_removals_additions_and_hints

* Revert mozilla ca

* Fix issue with startup
2022-05-05 08:19:57 -07:00
Arvid NorbergandGitHub 79034bb82e improve generate_chain (#11242)
* improve generate_chain to have proper command line options. Make it include block references by default.

* fix shell linter
2022-04-27 11:43:33 -07:00
Arvid NorbergandGitHub 511c13e632 add tool to generate a blockchain with full blocks, as a benchmark (#11146) 2022-04-15 10:11:42 -07:00
Arvid NorbergandGitHub 492503f109 print average block rate at different block height windows (#11064) 2022-04-05 16:11:03 -07:00
Arvid NorbergandGitHub b377339372 fix memory leak in test_full_sync (#11004) 2022-04-05 08:53:12 -07:00
Arvid NorbergandGitHub 8ca0633d9f fix test_full_sync.py to only feed the blocks in the main chain to the node (#10974) 2022-03-31 23:03:59 -07:00
Arvid NorbergandGitHub 1bcf409ee1 single thread executor (#10919)
* add inline executor and an option to run single-threaded

* add option to run test_full_sync in single-thread mode, to include block validation in profiles. Also attempt to speed it up by disabling db_sync
2022-03-28 12:47:46 -07:00
98971de9d5 pre-commit: Add a new hook to run isort (#8827)
* pre-commit: Add a new hook to run `isort`

* contributing: Add hint about `isort`

* add isort to dev deps, ignore existing .py files, use black profile

* long list to lines not comma delimited

* isort: Update and sort ignore list to match latest `main`

* add bash command line to generate isort extend skip list (#3)

* add bash command line to generate extend skip list

* tidy

* isort: More files to ignore after rebase

* tests: Fix `test_wallet_user_store.py` after rebase

* Some fixes after rebase

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-02-15 07:28:53 -08:00
229eea9b55 Log slow block height (#10160)
* improve logging of blocks that are slow

* add profiler to test_full_sync

* Update tools/test_full_sync.py

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

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2022-02-14 12:51:21 -08:00
Arvid NorbergandGitHub 13bf50833c add tool to test adding every block from a blockchain database (#10076)
* add tool to test adding every block from a blockchain database, as a sanity check for a new version of the full node

* exercise full_node in artificial sync from scratch test

* add test exercising test_full_sync.py
2022-02-03 10:31:49 -08:00