Commit Graph
119 Commits
Author SHA1 Message Date
Arvid NorbergandGitHub 507a2b858d update the fast FullBlock parser (#20458)
* update the fast FullBlock parser (that just skips fields) to support the new serialization of RewardChainBlock

* add test and shard the test, to enable it running in parallel

* disable expensive tests on MacOS Intel

* document some aspects of the full_blocks_utils test
2026-02-10 11:00:57 -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
Earle LoweandGitHub b6c777ec3b Add context handler features to MempoolManager (#20343)
* Add context handler features to MempoolManager

* No need to manually shut_down mempoolmanager

* Fix up issues with ordering in full node

* Fix dumb programmer issues

* Fix up some bugbot issues

* Move timing to inside context manager

* fix wrong indent
2025-12-15 09:48:34 -08:00
Arvid NorbergandGitHub 426590feaf bump chia_rs and update uses of RewardChainBlock and SubEpochSummary (#20304) 2025-12-03 10:27:55 -08:00
8315f62ae6 Import check_time_locks() and CoinRecord (#19848)
* initial commit

* fix int to bool map

* another int bool map

* cast error to Err class

* cast to Err in a couple other places

* remaining couple

* ruff

* inline coinstore bool

* typing fixes

* import directly from rust and remove legacy file

* fix lingering ref to coinrecord

* another outdated import

* ruff

* typping fix

* minor simplifications

* Fix test

* fix import merge

* address comments

* undo coin_store change

---------

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>
Co-authored-by: Matt <quexington@gmail.com>
2025-11-26 12:48:42 -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
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Earle Lowe
38d8598fc6 build(deps): bump click from 8.1.8 to 8.3.0 (#20146)
* build(deps): bump click from 8.1.8 to 8.3.0

Bumps [click](https://github.com/pallets/click) from 8.1.8 to 8.3.0.
- [Release notes](https://github.com/pallets/click/releases)
- [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/click/compare/8.1.8...8.3.0)

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

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

* Remove workaround for click.Choice and Enum

* place the default sortkey first to fix some click strangeness

* Ignore duplicate option warnings for specific test

---------

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-10-23 10:05:27 -07:00
Kyle AltendorfandGitHub 8bba60158d use now allowed randbytes and other helpers (#19838) 2025-07-21 08:55:55 -07:00
Richard KissandGitHub d01758f9c8 BlockHeightMapProtocol (#19798) 2025-07-11 19:38:14 -05:00
Amine KhaldiandGitHub c609d0bba1 CHIA-2900 Fast forward mempool optimization (#19713)
Fast forward mempool optimization.
2025-07-09 20:49:45 -05:00
Amine KhaldiandGitHub 91e4c16d25 CHIA-3207 Pass coin IDs from Blockchain's _reconsider_peak to CoinStore's new_block to avoid recomputing them (#19749)
Pass coin IDs from Blockchain's _reconsider_peak to CoinStore's new_block to avoid recomputing them.
2025-06-26 16:29:25 -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
Richard KissandGitHub 3e30f67405 Refactor BlockHeightMap Creation to Decouple It from Blockchain (#19711)
Create `BlockHeightMap` outside of `Blockchain` so `chia.consensus`
doesn't have to depend on a specific storage mechanism.
2025-06-17 11:53:26 -07:00
6050235bdb [CHIA-3043] Add (hopefully) non-controversial ruff rules (#19684)
* Add (hopefully) non-controversial ruff rules

* mypy-exclusions.txt

* PIE

* Fix pre-commit?

* PYI

* RSE

* S + ignores

* Whitespace fix

* Re-add build-init-files.py

* Add comment about security ignores

* Update mypy-exclusions.txt

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

* Fix the executable status of build-init-files.py

* Set executable bit for tools/run_block.py and readd shebang

* Fix new errors

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-06-11 08:36:08 -07:00
Amine KhaldiandGitHub 6db502c7d0 CHIA-3068 Avoid recomputing coin IDs in run_new_block_benchmark (#19691)
Avoid recomputing coin IDs in run_new_block_benchmark.
2025-06-09 10:09:32 -07:00
Arvid NorbergandGitHub 2b7a453e38 promote block-creation setting to user-facing (#19545)
* make the mempool block creation more configurable

* update tests to cover both block creation functions
2025-06-02 10:39:04 -05:00
matt-o-howandGitHub 8f0e8e4b0b Improve the serialisation of AddressManager (#19467)
<!-- Merging Requirements:
- Please give your PR a title that is release-note friendly
- In order to be merged, you must add the most appropriate category
Label (Added, Changed, Fixed) to your PR
-->
<!-- Explain why this is an improvement (Does this add missing
functionality, improve performance, or reduce complexity?) -->

### Purpose:
This PR is an optimisation for the way that AddressManager and
ExtendedPeerInfo are serialized, which happens periodically in a task
called from node_discovery.py

As well as the format of the serialization, the serialization algorithm
itself has had a multitude of speedups, including removing redundant
loops, minimising allocations, and so on.

<!-- Does this PR introduce a breaking change? -->

### Current Behavior:

Previously we were serialising ExtendedPeerInfo as a string and
AddressManager as an `@streamable` `.to_bytes()`.
Copying all the data to this class was taking a deal of time.

The serialising function also had a lot of complicated pieces of
redundant code, looping over data multiple times when 1 pass might do.

### New Behavior:

This PR instead serialises AddressManager directly using a bytearray,
and refactors the code to reduce the complexity and number of loops.

More comments have been added in this area of the codebase as well.

### Testing Notes:

This PR includes a new benchmark file for the AddressManager's
serialisation.
Here are my personal results comparing this PR with `main`:

On main: `Average serialize time:   1.544302 seconds`
Sum of my optimisations: `Average serialize time:   0.468669 seconds`

Feel free to run `benchmarks/address_manager_store.py` to see for
yourself.

I have also added in a migration test in
`chia/_tests/core/full_node/test_address_manager.py` which creates an
old serialisation, loads it using the current loading code, then
serialises it using the new serialization, and then loads that.
It is also checked at each step along the way to ensure that the
serialisation has remained good.
<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2025-05-06 11:23:30 -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 cf17f20ccf [CHIA-2052] Compressed blocks (#19270)
* introduce create_block_generator2() to mempool, which picks transactions and compresses them incrementally, allowing us to fill blocks even when compressing

* improve test, comment and pragma no cover

* fix mempool test

* simplify item selection logic in create_block_generator2()

* add test coverage of timeout in create_block_generator2()

* address review comments

* fixup
2025-03-27 12:42:46 -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 c57dea6512 use chia_rs directly for reward chain block (#19336) 2025-03-04 09:04:38 -08:00
Kyle AltendorfandGitHub dd01af2c2b use chia_rs directly for pool target (#19332) 2025-03-03 09:34:02 -08:00
Kyle AltendorfandGitHub d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -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
Amine Khaldi 5bfdb395e0 Merge commit 'de0b0d8c69247fe8c32fe95d541d2c163a7d37de' into checkpoint/main_from_release_2.5.2_de0b0d8c69247fe8c32fe95d541d2c163a7d37de 2025-02-19 19:55:50 +01:00
Amine KhaldiandGitHub de0b0d8c69 CHIA-2381 Validate fast forward spends before adding their spend bundle to the mempool (#19272)
Validate fast forward spends before adding their spend bundle to the mempool.

Make sure that all fast forward spends of a spend bundle would still have unspent coins.
2025-02-17 13:26:53 -07:00
Arvid NorbergandGitHub 0f35f707bd create_block_generator refactor (#19207)
* make item_inclusion_filter optional and move it to the end with default None, to simplify calls

* move block generator creation into the Mempool class

* update benchmark

* add test
2025-02-13 19:20:45 -07:00
Kyle AltendorfandGitHub 1ffa73e99e task referencer (#18914)
* put otherwise unheld tasks into the pit

* and the rest too

* cull less often

* task referencer

* private

* report unexpectedly unreferenced tasks

* also warn for automated catching in tests

* reporting task

* undo some

* fixup for 3.9

* ban asyncio.create_task

* oof

* simplify including using `Task.add_done_callback()` for culling
2025-01-02 10:13:51 -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
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
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
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
Kyle AltendorfandGitHub 3b6f547d45 bytes zeros (#18475)
* `ZERO_32`

* `bytes(\d+)\(\[0\] \* \1\)`

* `bytes(\d+)\(b"\\(x00|0)" \* \1\)`

* `bytes(\d+)\(b"0" \* \1\)`

* Revert "`bytes(\d+)\(b"0" \* \1\)`"

This reverts commit 2d629dcb0a.
2024-10-22 12:07:07 -07:00
Kyle AltendorfandGitHub 9c8557a1f8 Remove Python 3.8 support and update source to 3.9 standards (#18687)
* manual python 3.8 removals

* poetry

* pyupgrade

* black

* isort

* manually tidy imports

* work around shadowed type

* catch up build network protocol files for pyupgrade changes

* placate pylint

* re-enable 20.04

* placate flake8
2024-10-16 14:21:15 -07:00
pengbanbanandGitHub 3d916bd25d chore: fix some comments (#18485)
Signed-off-by: pengbanban <pengbanban@aliyun.com>
2024-09-13 10:52:32 -05:00
Arvid NorbergandGitHub 1947d99e4f Refactor get_block_generator() (#18531)
* refactor get_block_generator() to prepare for easier composing of a layered blockchain class

* make get_block_generator() part of the interface to the blockchain rather than an independent, free function passed in the validation. This keeps the view of the blockchain more focused to a single class.

* add test for get_block_generator

* add unit test for Blockchain.lookup_block_generators()

* address review comments

* address review comments
2024-09-07 01:49:51 +08:00
Amine KhaldiandGitHub 4d225bed35 CHIA-1291 Switch mempool TX prevalidation to the Rust version (#18557)
Switch mempool TX prevalidation to the Rust version.
2024-09-05 22:17:23 +08:00
Amine KhaldiandGitHub 8129b41473 CHIA-210 Introduce WalletSpendBundle and use it across code related to wallets (#18264)
Introduce WalletSpendBundle and use it across code related to wallets.
2024-08-30 21:36:26 +08:00
Arvid NorbergandGitHub 6dceabe2d3 [CHIA-691] simplify MempoolItem (#18143)
make MempoolItem and InternalMempoolItem contain the SpendBundleConditions directly, rather than the NPCResult. A mempool item is guaranteed to be valid, so the error state of NPCResult will never be engaged anyway.
2024-07-08 09:44:49 -07:00
Kyle AltendorfandGitHub 3061cd83d7 remove some pylint ignores (#18140) 2024-06-18 14:24:30 -05:00
Matt HauffandGitHub 3637bd33c6 Delete chia.util.misc (#18170)
* Move VersionedBlob to chia.util.streamable

* Move format_bytes to chia.cmds.cmds_util

* Move format_minutes to chia.cmds.cmds_util

* Move prompt_yes_no to chia.cmds.cmds_util

* Move get_list_or_len to from chia.plot_sync.receiver

* Move validate_directory_writable to chia.cmds.cmds_util

* Move *termination_signals to test_services

* Move UInt*Range to chia.util.streamable

* Create chia.util.batches

* Create chia.server.signal_handlers

* Create chia._tests.util.split_managers

* Move ValuedEvent to chia.types.transaction_queue_entry

* Move available_logical_cores to chia.util.cpu

* Move caller_file_and_line to chia._tests.util.misc

* Move satisfies_hint to chia._tests.wallet.test_singleton_lifecycle_fast
2024-06-18 08:27:17 -05:00
RigidityandGitHub de75f058dd CHIA-194: CHIP-0026 Mempool Updates (#17980)
* Initial draft of mempool updates [skip ci]

* More implementation work, but capability issue [skip ci]

* Temp (will probably revert)

* Get first test passing

* Setup spent coin tests

* Add unrelated test data to make tests better

* Refactor test

* Finish testing

* Update tests

* Include removal reason and block inclusion tests

* Remove unnecessary dict

* Add missing message to test

* Fix after rebase

* Broadcast support from node for mempool updates

* Remove redundant code

* Use new_block

* Filter and early return suggestions

* Reword comments on PeakPostProcessingResult

* Improve mempool fn name and doc comment

* Bump wallet protocol version

* Add ratelimits

* Add tests for querying mempool items

* Asserts and more tests

* Add peers for spend bundle tests
2024-06-06 10:59:44 +01:00
a58cc334a4 clvm mypie (#16898)
* clvm mypie

* update exclusions

* wip

* some

* undo for now

* more

* more

* drop the program usage in datalayer tests

* ignore tree hash errors

* ignore enough in _sexp_replace...

* again

* almost

* Fix test_singleton.py

* dl fixup

* did fixup

* touchup

* nft fixup

* fixup tests

* Revert "fixup tests"

This reverts commit 5df1a705ec.

* or this i guess

* blah

* Fix get_owner_did

* tidy

* blah

* `.as_atom()`

* `.as_int()`

* Update chia/wallet/nft_wallet/nft_puzzles.py

* `rrrff`

* stop using `CastableType`

* undo stuff around using `CastableType`

* `announcement_assertions: List[Program]`

* Update chia/types/blockchain_format/program.py

* more

* clvm==0.9.10

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
Co-authored-by: Matt <quexington@gmail.com>
2024-05-22 12:28:07 -05: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 c932324ec0 Bump chia rs 0.5.2 (#17505)
* bump chia_rs to 0.5.2

* specify the correct fixed-width integer types for rust bindings
2024-02-08 09:04:26 -08:00
Amine KhaldiandGitHub a6827c2e92 Singleton fast forward (#16919)
Initial iteration of singleton fast forward.
2024-01-26 13:20:42 -08:00