Commit Graph
83 Commits
Author SHA1 Message Date
Arvid NorbergandGitHub 062f6257e1 Blockchain does not have run_generator() (#20433)
Blockchain does not have run_generator(). In this test, these calls are never made, but just here in case something changes
2026-02-05 08:32:36 -08:00
Amine KhaldiandGitHub 20f86e15d1 CHIA-3866 Prioritize trusted peers in FullNodeAPI's send_transaction (#20401)
Prioritize trusted peers in FullNodeAPI's send_transaction.
2026-01-14 13:43:45 -08:00
Almog De PazandGitHub 6b8202cd6a Augmented usage fix (#20361)
* pass augmented into test_utils

* add invariant

* remove redundant check

* check prev is in underlying

* fix check for genesis

* use try_block_recoed

* tests

* use assertion error
2026-01-05 09:36:21 -08:00
Earle LoweandGitHub 05094c27c9 context manager for BlockTools (#20326)
* context manager for BlockTools

* Missed one usage and fixed up Self import

* Ignore cleanup errors in tempdir cleanup for BlockTools

* Remove debug prints

* Fixed up sync blocktools and use @contextmanager

* Address review comments

* Add return type

* Empty commit for github

* Strange github things

* adjust order of finding ports
2025-12-15 09:49:12 -08:00
Arvid NorbergandGitHub 70b182e9c7 [CHIA-3805] reduce use of pool_reward_puzzle_hash feature of BlockTools (#20277)
* reduce use of pool_reward_puzzle_hash feature of BlockTools, since it's not supported by v2 plots

* the BlockTools feature to ask for a specific pool puzzle hash are not supported by v2 proofs. v2 plots only have pool contract puzzle hash
2025-11-21 09:44:53 -08:00
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
Almog De PazandGitHub ab53414e2a fix tx block refrences in blocktools (#20239)
* fix tx block refrences in blocktools

* fix patch in test

* use pre_sp_block_height fix load_block_list

* rename

* fix params

* remove redundant param
2025-11-12 11:45:44 -07:00
Almog De PazandGitHub 54e915b723 prev_tx_before_sp (#20235)
* prev_tx_before_sp

* update wp to avoid crash

* fix genesis test

* comment

* comments, var names

* check to throw correct error
2025-11-10 11:14:04 -07:00
Arvid NorbergandGitHub 67a047eef1 block header validation (#20155)
* minor simplification of block header validation test. Run it for all consensus modes

* reduce indentation level in test_long_chain()
2025-10-17 06:23:14 -07:00
Arvid NorbergandGitHub f17dedd5be bump chia_rs dependency (#20023) 2025-09-05 06:31:21 -07:00
Arvid NorbergandGitHub 81c1025eeb Bump chia rs 0.29 (#19953)
### Purpose:

Bump the chia_rs dependency and adjust interactions according to changes
to its API. Specifically,
https://github.com/Chia-Network/chia_rs/pull/1213 .

`validate_clvm_and_signature()` takes flags instead of height.
`SpendConditions` has a `fingerprint` field.
2025-08-13 09:22:11 -07:00
Matt HauffandGitHub a803dc0fa6 [CHIA-3633] August 2025 pass of Ruff linting rules (#19929)
* Enable Ruff `PLR1704` (`redefined-argument-from-local`)

* Enable Ruff `PLR5501` (`collapsible-else-if`)

* Enable Ruff `PLW2901` (`redefined-loop-name`)

* bad change

* Enable Ruff `RUF043` (`pytest-raises-ambiguous-pattern`)

* Enable Ruff `RUF046` (`unnecessary-cast-to-int`)

* Enable Ruff `RUF052` (`used-dummy-variable`)

* Remove unused ignore `UP006`

* One mis-signaled regex

* Comments by @altendky

* bad change, my bad
2025-08-11 14:39:12 -07:00
cac84b5e05 Simplify BlockStore (#19880)
* Simplify `BlockStore`

* Update chia/full_node/block_store.py

Co-authored-by: Arvid Norberg <arvid.norberg@gmail.com>

---------

Co-authored-by: Arvid Norberg <arvid.norberg@gmail.com>
2025-07-31 20:35:54 -05:00
Arvid NorbergandGitHub dac837e799 bump chia_rs (#19802) 2025-07-10 16:12:29 -05:00
Amine KhaldiandGitHub c609d0bba1 CHIA-2900 Fast forward mempool optimization (#19713)
Fast forward mempool optimization.
2025-07-09 20:49:45 -05:00
Arvid NorbergandGitHub 224fb82383 require block generators to use canonical CLVM serialization after 3.0-hard fork (#19714) 2025-06-26 10:18:37 -07:00
matt-o-howandGitHub 80d38200a3 Migrate away from clvm imports (#19730)
* migrate casts to wallet util

* reset mempool_check_conditions

* ruff to re-order imports

* reset full_node_rpc_api

* add tests for casts

* ruff and type

* move to util to avoid consensus depending on wallet

* ruff again

* add a deterministic seed for random
2025-06-26 10:18:04 -07:00
c0410e97ec Bump chia rs >=0.24, <0.25 (#19615)
* bump chia_rs

* update db_graftroot test

* update SerializedProgram and Program use, to accommodate new chia_rs interface

* review comments

* review comments

---------

Co-authored-by: Matthew Howard <m.o.howard97@gmail.com>
2025-05-29 09:24:08 -07:00
Richard KissandGitHub 1a0eb383dc Remove dependency chia.types so chia.util no longer depends on it (#19633)
* Move chia.util.full_block_utils to chia.full_node.full_block_utils

* chia.util.generator_tools => chia.consensus.generator_tools

* chia.util.vdf_prover => chia.simulator.vdf_prover

* Move 'chia.util.condition_tools' to 'chia.consensus'.
2025-05-27 09:03:23 -07:00
Richard KissandGitHub c800e06ac4 Remove the dependency of chia.consensus on the module chia.types (#19590)
* Move `chia/types/spend_bundle.py` to wallet.

* Move `compute_additions` functions into wallet.

* Move `chia/types/eligible_coin_spends.py` to `chia/full_node`.
2025-05-09 13:56:01 -05: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
Amine KhaldiandGitHub 6824b11ba0 CHIA-2743 Synchronous block generator creation (#19505)
Synchronous block generator creation.
2025-04-24 10:24:42 -05:00
Kyle AltendorfandGitHub fcd20ce543 more chia_rs directly (#19520)
* more `chia_rs` directly

* maybe

* undo, kinda
2025-04-21 14:05:05 -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
Arvid NorbergandGitHub d0f64c6cbc Refactor BlockTools (#19492)
* simplify BlockTools by making include_transactions=True independent from transaction_data

* improve error message in validate_coins()

* we don't know if a block will become a transaction block, we we can't mutate state as if spends will make it in until once it's confirmed

* factor out NewBlockGenerator creation into a function

* remove unused variable

* use latest version of test-cache

* extend timeout

* fix coverage

* extend sync timeout
2025-04-16 11:25:52 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Earle Lowe
31a8715919 build(deps): bump ruff from 0.9.6 to 0.11.4 (#19482)
* build(deps): bump ruff from 0.9.6 to 0.11.4

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.9.6 to 0.11.4.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.9.6...0.11.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.11.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* ruff fixes

* ruff fixes

* ruff fixes

* Address review suggestions

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
2025-04-14 16:09:07 -05:00
Arvid NorbergandGitHub f241889b41 [CHIA-2541] validate more of cached test chains (#19463) 2025-04-09 07:48:40 -07:00
Kyle AltendorfandGitHub bdcac366df use chia_rs directly for slots (#19468) 2025-04-04 07:35:06 -05:00
Arvid NorbergandGitHub a7a81a567f cache get_unspent_lineage_info() (#19335)
* no need to pass get_unspent_lineage_info_from_puzzle_hash function into create_bundle_from_mempool(), we already have it as a member now

* cache results from get_lineage_info_for_puzzle_hash()
2025-03-04 09:05:41 -08:00
Kyle AltendorfandGitHub d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -08:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Earle LoweEarle LoweKyle Altendorf
d7e2358a32 build(deps): bump ruff from 0.8.5 to 0.9.6 (#19260)
* build(deps): bump ruff from 0.8.5 to 0.9.6

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.8.5 to 0.9.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.8.5...0.9.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update source to ruff 0.9.6

* Apply suggestions from code review

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
Co-authored-by: Earle Lowe <30607889+emlowe@users.noreply.github.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-02-27 09:53:34 -08:00
Kyle AltendorfandGitHub fb6b78ef07 use chia_rs directly for foliage (#19308) 2025-02-25 11:33:25 -08:00
Kyle AltendorfandGitHub e446d6b726 use chia_rs directly for sized ints (#19303)
* use chia_rs directly for sized ints

* Update data_layer_rpc_api.py
2025-02-24 14:33:09 -08:00
Kyle AltendorfandGitHub 30c4ef2689 use chia_rs directly for consensus constants (#19301) 2025-02-21 10:03:17 -08:00
Almog De PazandGitHub 59583e75ef Assert height to hash in contains block (#19136)
* add assertions

* use_height_if_available

* use try_block_record

* fix recursion

* handle none

* remove assert

* remove assert

* use try in wallet blockchain

* fix height o and height to hash in augmented

* get_correct_block_for_fork

* remove debug code

* use try_block_record

* check main chain againt undelying blockchain

* pass augmented in tests

* lint

* revert changes to wallet blockchain

* remove redundant comment

* lint

* remove debug message

* revert bad merge

* make height mandatory

* make height mandatory

* use try_block_record

* fix unfinished test

* remove from hh, test contains block

* fix test

* fix mock and cache
2025-02-11 07:18:52 -07:00
Arvid NorbergandGitHub aff979242e bump chia_rs to 0.18.0 (#19133) 2025-01-14 08:26:34 -07:00
Amine KhaldiandGitHub 11d0dd9aef CHIA-2109 Clarify cases when transactions filter is computed with just reward coins (#19078)
Clarify cases when transactions filter is computed with just reward coins.
2025-01-09 06:50:12 -07:00
Amine KhaldiandGitHub 922892e2ec CHIA-1945 Avoid computing a transactions filter with just reward coins when the filter is not requested from get_block_header (#18969)
Avoid computing a transactions filter with just reward coins when the filter is not requested from get_block_header.
2024-12-19 10:33:54 -07:00
Arvid NorbergandGitHub bc065b5d52 add some validation of fork_info in Blockchain.add_block() (#18981)
* add some validation of fork_info in Blockchain.add_block(). This would have caught the bug introduced in main a while ago

* simplify add_blocks_in_batches
2024-12-10 10:30:43 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>MattKyle Altendorf
29d2eedd3c build(deps): bump ruff from 0.7.1 to 0.8.1 (#18973)
* build(deps): bump ruff from 0.7.1 to 0.8.1

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.7.1...0.8.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix ruff issues

* >-

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt <quexington@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-12-04 08:59:18 -07:00
Arvid NorbergandGitHub 84dc738252 move get_name_puzzle_conditions() into test utils (#18839)
move get_name_puzzle_conditions() into test utils. It's only used by tests
2024-11-20 08:57:12 -07:00
Matt HauffandGitHub 604fc1feb0 [CHIA-1732] Add Ruff specific linting rules (#18845)
* Add Ruff specific linting rules

* Further tighten ignore list

* Address comments by @altendky

* One more comment @altendky
2024-11-14 15:58:12 -07:00
Amine KhaldiandGitHub 8d492e638c CHIA-1727 Clarify the validation state that we calculate for the next block if it's validated (#18835)
Clarify the validation state that we calculate for the next block if it's validated.
2024-11-14 08:14:29 -07:00
6c90a76b56 Tighten up ruff ignore list (#18837)
* Tighten up ruff ignore list

* Okay that fix was indeed unsafe

* enable type-name-incorrect-variance

* enable literal-membership

* enable non-augmented-assignment

* enable useless-return

* enable global-variable-not-assigned

* -

* fixup

* Clean up roff.toml from annotations

* use ignore instead of explicit re-export

* use more descriptive names

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-11-12 12:19:31 -07:00
Arvid NorbergandGitHub 06b2447f6c [CHIA-1655] simplify pre_validate_blocks_multiprocessing() (#18836)
simplify pre_validate_blocks_multiprocessing() by making it pre-validated one block at a time. That's how we use it in production code anyway
2024-11-12 08:57:02 -07:00
Arvid NorbergandGitHub 6ceaec4477 [CHIA-1562] move signature validation into run_block_generator() (#18812)
* use run_block_generator() directly in block creation, to compute the final cost of the block we're creating. This lets us avoid validating the signature (to save time) and run in mempool mode

* always validate signatures in run_block_generator().

* remove PreValidationResult.validated_signature and instead defer to the inner SpendBundleConditions field
2024-11-06 10:57:03 -07:00
Matt HauffandGitHub 2808ee2446 [CHIA-1681] Replace black with Ruff (#18813)
* Replace black with Ruff

* Change build_network_protocol_files.py
2024-11-04 15:22:18 -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 0e703e48e0 (Mostly) Replace flake8 with Ruff (#18801)
* Get flake8 config partially ready

* Mostly remove flake8 config

* Delete arithmetic whitespace ignore

* Delete unused program strings from tests

* Remove unnecessary noqas

* A couple more flake8 warnings
2024-11-01 09:55:16 -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