100 Commits
Author SHA1 Message Date
f474f9cdc7 Make BlockStore.replace_proof own its write transaction (#21166)
* Make BlockStore.replace_proof own its write transaction

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add failure-path test for _replace_proof; fix log wording

The except block was re-indented by the previous commit and had no
coverage. The log message said "error while adding block, rolling
back", but this path replaces a compact proof and the rollback happens
inside the store's transaction now.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 09:21:06 -05:00
6f00ac69d7 Move raw hints query from FullNodeAPI into HintStore (#21165)
* Move raw hints query from FullNodeAPI into HintStore

Co-authored-by: Cursor <cursoragent@cursor.com>

* Convert hints to list for to_batches and skip empty input

to_batches only supports list and set at runtime, but
get_coin_ids_by_hints accepts any Collection[bytes]. Convert to a list
before batching, and return early on empty input to avoid opening a
read transaction for nothing.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add unit test for get_coin_ids_by_hints

Covers empty input (the early return flagged by diff-coverage),
set dedup across hints sharing a coin id, the multi-batch path via a
small SQLITE_MAX_VARIABLE_NUMBER, and tuple input.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 12:40:59 -07:00
6d5b52062b Slim CoinStoreProtocol down to the methods consensus uses (#21168)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 12:40:33 -07:00
b966c5c96b Add BlockStoreProtocol; drop consensus dependency on chia.full_node (#21169)
* Add BlockStoreProtocol; drop consensus dependency on chia.full_node

Co-authored-by: Cursor <cursoragent@cursor.com>

* Assert isinstance directly on bc.block_store

Review feedback: drop the intermediate block_store assignment; mypy
narrows the attribute expression after the isinstance assert.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 12:40:06 -07:00
359497ac2b Remove unused BlockHeightMapProtocol (#21167)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 07:39:15 -07:00
Richard KissandGitHub 1444569c75 Remove deprecated Python analyze-chain.py (#20580)
Remove deprecated Python analyze-chain.py in favor of Rust version

Per Arvid: this tool was ported to Rust before the hard fork.
The Python version is unmaintained.

Made-with: Cursor
2026-03-05 11:32:19 -06:00
e2c3f1dea9 Break daemon ↔ plotting cycle: move harvester config helpers to chia.util (#20544)
* Break daemon ↔ plotting cycle: move harvester config helpers to chia.util

- Add chia.util.harvester_config with add_plot_directory, get_plot_directories,
  remove_plot_directory (extracted from chia.plotting.util)
- Update daemon, harvester, plotters, cmds, simulator, and tests to import
  from chia.util.harvester_config
- Remove daemon's dependency on plotting in tach.toml (cycle broken)

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix mypy: add type parameters for dict in harvester_config

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-03-03 12:12:39 -06:00
Richard KissandGitHub ec35492946 Api stubs (#19979)
* harvester_api_protocol

* move to apis

* Remove `chia.apis` => `chia.harvester` dependency.

* Remove circular dependencies between `chia.apis` and service modules.

* SolverAPIStub, and add solver to tach.toml.

* Make the stubs (lack of) implementations more consistent.

* Use `stub_metadata_for_type` instead of `class_for_type`.

The only thing ever used from `ApiProtocol` in `WSConnection`
was the metadata field, so let's pass along only that.

* NewSignagePointHarvester2

* remove some stuff
2025-11-12 09:06:12 -07:00
Richard KissandGitHub 4e6038ba3b Simplify dependencies wrt chia.server (#19895)
Remove some dependencies in `chia.server`.
2025-08-06 12:03:47 -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
Richard KissandGitHub a8d7d32d53 Remove mozilla ca submodule and subsume this functionality (#19850)
<!-- 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:

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

### Current Behavior:

### New Behavior:

<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->

### Testing Notes:

<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2025-07-30 11:05:13 -07:00
Richard KissandGitHub ddc5a73d2d Update to ruff 0.12.4 (#19852)
Upgrade `ruff` to 0.12.4.
2025-07-21 08:52:39 -07:00
Richard KissandGitHub 7cee2b2b61 ruff issues (#19787) 2025-07-14 08:52:42 -05:00
Richard KissandGitHub d01758f9c8 BlockHeightMapProtocol (#19798) 2025-07-11 19:38:14 -05:00
a125e7b690 Create CoinStoreProtocol to remove a dependencies on chia.full_node from chia.consensus (#19741)
* `CoinStoreProtocol`

* Remove `.get_all_coins`

* Apply suggestions from code review

Uses `...` instead of values.

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

* Add `.is_empty` to protocol

* Improve test fixture stuff

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-06-30 16:05:40 -07:00
Richard KissandGitHub 1234bdd09c tach pre-commit (#19720)
* tach pre-commit

* Remove unused dependencies from `tach.toml`.
2025-06-20 08:49:50 -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
Richard KissandGitHub 14db91db6d Extract time lock validation and move to chia.consensus. (#19707)
Move `mempool_check_time_locks` to `chia.consensus` and rename to `check_time_locks`.
2025-06-16 14:33:26 -07:00
Richard KissandGitHub 4f03890871 chia/full_node/signage_point.py -> chia/consensus/signage_point.py (#19706) 2025-06-12 11:14:27 -07:00
Richard KissandGitHub cbfd5a53a2 Move chia.consensus.fee_estimate_store to chia.full_node (#19705)
The `chia.protocols` module no longer depends upon `chia.full_node`
2025-06-12 11:13:53 -07:00
Richard KissandGitHub 3a0efbd463 fix(full_node): use f-string for log message when adding blocks (#19681)
Fix a typo I introduced in prior PR.
2025-06-05 15:06:44 -07:00
Richard KissandGitHub 15a4536a7a The chia.consensus module no longer depends upon chia.wallet. (#19665)
<!-- 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 removes a dependency that is inappropriate and caused a
dependency loop.
2025-06-03 12:31:30 -07:00
Richard KissandGitHub 5617026604 The chia.protocols module no longer depends upon chia.full_node. (#19661) 2025-06-02 10:38:17 -05:00
Richard KissandGitHub a803d18c3b The chia.protocols module no longer depends upon chia.server. (#19636)
<!-- 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?) -->

The modules `chia.protocols` and `chia.server` form a dependency loop.
This change at least removes the direct dependency of `chia.protocols`
on `chia.server`.

### Purpose:

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

### Current Behavior:

### New Behavior:

<!-- As we aim for complete code coverage, please include details
regarding unit, and regression tests -->

### Testing Notes:

<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
2025-05-29 09:24:29 -07:00
Richard KissandGitHub fdfdca64b3 Fix problem with uv pip install. (#19652) 2025-05-29 09:21:46 -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 e4ccb8024f Fix chia.util <= chia.server dependency (#19629)
Move `get_unresolved_peer_infos` and `set_peer_info` from
`chia.util.config` to `chia.server.resolve_peer_info.py` so that
`chia.util` no longer depends upon `chia.server`.
2025-05-23 09:06:11 -05:00
Richard KissandGitHub 386787fb51 Move dump_keyring.py to remove dep chia.util => chia.cmds (#19600) 2025-05-22 10:17:54 -05:00
Richard KissandGitHub 6b88ae31a1 More significant digits in block_rate (#19608) 2025-05-16 10:12:41 -04:00
Richard KissandGitHub 20a0d934cb Move ssl_check.py to chia/ssl (#19596) 2025-05-12 08:53:18 -04: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
Richard KissandGitHub ee4c7f9573 chia.types no longer depends upon chia.protocols (#19215) 2025-02-03 09:17:49 -07:00
Richard KissandGitHub 3410597728 Move check_fork_next_block.py to chia.full_node (#19193)
Move `check_fork_next_block`
2025-01-28 13:46:02 -07:00
4910323dbc Replace class_for_type function with a dict (#18773)
* Pass down `class_for_type` dict instead of global function.

* Simplify

* Update chia/apis.py

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

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-11-01 09:54:10 -07:00
Richard KissandGitHub f126023591 Don't import a wallet file from util. (#18742)
* Don't import a `wallet` file from `util`.

* coverage
2024-10-29 09:31:25 -07:00
Richard KissandGitHub f69233aa08 Move some files closer to where they should live. (#18465)
* Move to `chia.full_node.util.safe_cancel_task`

* Move to `chia/wallet/util/pprint.py`

* Separate out `IPAddress` into `ip_address.py`
2024-10-17 14:25:05 -07:00
2064b61ccc Deprecate curry-and-treehash and replace it with curry. (#14066)
* Deprecate `curry-and-treehash` and replace it with `curry`.

* Reduce cost at expense of readability.

* Improvements to `curry.clib`.

* Fix comment

* Tweak names.

* change dashes to underscores

* Use macro version by quexington.

---------

Co-authored-by: Matt Hauff <quexington@gmail.com>
2023-01-30 16:09:08 -06:00
Richard KissandGitHub 42406f9e96 Recompress generators (#13376)
* Add `start`. Speed start-up. Format better.

* Add `--call` argument to invoke other python code.
2022-09-29 11:24:07 -05:00
Richard KissandGitHub 18c40d6269 Calculate puzzle hashes directly, as an optimization. (#13034) 2022-08-30 14:25:42 -05:00
Richard KissandGitHub a7462f66e9 Add Program.replace. (#12362) 2022-07-15 13:11:56 -05:00
Richard KissandMatt Hauff 3d5fed439d Add Program.replace. 2022-07-15 11:32:47 -05:00
Richard KissandGitHub c2100929a4 Document broken ROM code. (#12158) 2022-07-07 21:07:08 -05:00
Richard KissandGitHub 4c345e2fa5 Add some logging. (#10556) 2022-03-04 14:05:12 -08:00
Richard KissandGitHub 0c7e5194bd Add Program.at utility function. (#8713) 2021-10-19 10:35:25 -07:00
Richard KissandGitHub 6cf29102f9 Rename coin solution to coin spend (#6841)
* Rename `CoinSolution` as `CoinSpend` everywhere.

* Run `black` everywhere.
2021-07-12 16:31:27 -07:00
Richard Kiss 8d13e8d5d2 Revert "don't build a dict of the conditions, just to iterate over them (#6607)"
This reverts commit 7cdc93efac.
2021-06-08 15:22:25 -07:00
Richard KissandGitHub a7f996b4dc Tests skipping mempool (#3065)
* Avoid importing `test_constants` as it takes a long time.

* Some new tests that circumvents mempool.

* Fix lint problems.
2021-04-30 10:23:45 -07:00
b084813b12 Improve streamable (#3031)
* Avoid importing `test_constants` as it takes a long time.

* Factor out `parse_*` functions.

* First crack at refactoring `Streamable.parse`.

* Don't add `_parse_functions` attribute to `Streamable`.

This no longer requires an extra `_parse_functions` attribute on a
`Streamable`, as it may be confusing serializers or other functions
that use `__annotations__`.

* Fix lint problems with `black`.

* Fix `parse_tuple`.

* Defer some parsing failures to parse time rather than class-creation time.

* Tidy up & remove some obsolete stuff.

* Decorate `RequestBlocks` as `streamable`.

* Fix wrong uses of Streamable class

Revert an earlier commit and error out on class creation in case a
Streamable subclass is instantiated incorrectly, e.g. containing a
non-serializable member.

Fix cases where Streamable parent class was forgotten.

* Fix wrong types when creating DerivationRecord and WalletCoinRecord

* additional unit tests for streamable parsers

* add type annotations (#3222)

Co-authored-by: Rostislav <rostislav@users.noreply.github.com>
Co-authored-by: arvidn <arvid@libtorrent.org>
2021-04-30 10:22:11 -07:00
Richard KissandGene Hoffman 50f9d8b4c2 Add some ROM tests. 2021-04-20 17:08:27 -07:00
Richard KissandGitHub 170d451b7c ROM now outputs (coin-spends . block-level-extras) (#2149)
* Change input to ROM to `(coin-solution-inputs . extras)`.

* Add `deserializer` to `generator_for_single_coin`.

* Fix last test.

* ROM now outputs `(coin-spends . block-level-extras)`
2021-04-19 14:04:55 -07:00
Richard Kiss c3ebafdd31 Remove some obsolete comments. 2021-04-19 02:28:01 -07:00
Richard Kiss 212f5c7a61 Pass through spend_level_extras. 2021-04-19 02:28:01 -07:00
Richard Kiss 08b1dd3135 Improve format of COIN_SPEND output from ROM. 2021-04-18 23:40:06 -07:00
Richard Kiss b3880d7ea7 Simplify CSE input format.
It was `((parent amount) (puzzle solution))`.
It is now `(parent puzzle amount solution . *spend_level_extras)`
2021-04-18 22:57:00 -07:00
Richard Kiss 166ab7c99a Remove the tree abomination. 2021-04-18 18:58:56 -07:00
Richard Kiss 44ba53550d Rewrite "ROM" in clvm, including deserialization. 2021-04-18 16:02:53 -07:00
Richard KissandGitHub f1be1714dc Get rl_wallet clvm hex files loading. (#1999) 2021-04-17 12:02:08 -07:00
Richard Kiss 9872525f80 Remove message from (x). 2021-04-16 21:22:46 -07:00
Richard KissandGene Hoffman 8c96651a78 Revert erroneous type change in CostResult. 2021-04-08 21:16:30 -07:00
Richard KissandGene Hoffman 7506f64c35 Rename to ConditionWithArgs. 2021-04-08 11:35:50 -07:00
Richard KissandGene Hoffman 7472d74799 Remove as_python; add some types. 2021-04-08 11:35:50 -07:00
Richard KissandGene Hoffman b3f70a1c68 Bump clvm versions. 2021-04-06 18:33:41 -07:00
Richard Kiss 7906d02990 Simplify pyinstaller.spec. Solve daemon/chia name collision. 2021-04-06 13:29:41 -07:00
Richard KissandGene Hoffman 95d6030876 Fix azure pipeline (ht Gene). 2021-04-04 21:41:39 -07:00
Richard KissandGene Hoffman 6cae9625f6 Fix linux build. 2021-04-04 21:41:39 -07:00
Richard KissandGene Hoffman b9b3368866 Put data files in subdirectory due to name collision. 2021-04-04 21:41:39 -07:00
Richard KissandGene Hoffman f2b577dda1 git mv src chia 2021-04-04 21:41:39 -07:00
Richard KissandGene Hoffman 569ca16f50 Use sed to change imports from src to chia. 2021-04-04 21:41:39 -07:00
Richard KissandGene Hoffman 8a3e00548a Rename src to chia. 2021-04-04 21:41:39 -07:00
Richard KissandGene Hoffman 986b103aba Use src.PYINSTALLER_SPEC_PATH in build scripts. 2021-04-02 19:50:54 -07:00
Richard KissandGene Hoffman 7a970b8fe7 Add PYINSTALLER_SPEC_PATH. Simplify & unify spec file. 2021-04-02 19:50:54 -07:00
Richard KissandGene Hoffman 22caa0789a Rewrite sha256tree nonrecursively. 2021-03-25 15:56:53 -07:00
Richard KissandJustin England ddb92a0690 Spelling fix. 2021-03-24 15:41:53 -07:00
Richard KissandJustin England be4af4128c Monkey-patch click instead of forking. 2021-03-24 15:41:53 -07:00
Richard KissandJustin England 77e38fc109 Make minipnp an optional install. 2021-03-24 15:41:53 -07:00
Richard KissandJustin England f6cd947da2 Add some missing files to the sdist. 2021-03-24 15:41:53 -07:00
Richard KissandGene Hoffman 1c07dd2c19 Skip the softfork test. (#1357) 2021-03-17 18:40:45 -07:00
da57397087 Change rewards coin ids 2 (#1342)
Replay protection by encoding genesis challenge into coinbase parent ids. 

Co-authored-by: Yostra <straya@chia.net>
2021-03-17 18:40:45 -07:00
f79152d1ab Bump clvm and replace ((c P A)) with (a P A). Add some cc fixes prior to audit. (#1133)
* Bump clvm versions and replace `((c P A))` with `(a P A)`. Again.

* Modernize some clvm.

* Fix some comments and naming in `cc.clvm`.

* Prohibit `CREATE_ANNOUNCEMENT` in inner puzzle.

* fix cc.clvm

initial commit for innerpuz announcement test

Co-authored-by: matt <matt@chia.net>
2021-03-03 14:12:04 -08:00
Richard KissandGitHub 5063ad058c Bump clvm and recompiled scripts and replace ((c P A)) with (a P A).. *HARD FORK* (#1118)
* Revert "Bump clvm versions and replace `((c P A))` with `(a P A)`."

This reverts commit d0a08d2a93.

* Bump clvm versions and replace `((c P A))` with `(a P A)`. Again.
2021-03-03 10:40:33 -08:00
Richard KissandGene Hoffman a8a7af9ebc Revert "Bump clvm versions and replace ((c P A)) with (a P A)."
This reverts commit d0a08d2a93.
2021-03-01 17:14:13 -08:00
Richard Kiss d0a08d2a93 Bump clvm versions and replace ((c P A)) with (a P A). 2021-03-01 12:12:48 -08:00
Richard Kiss 3a2413cf3b Add tests for many puzzles, and fix some bugs found. 2021-02-28 16:54:26 -08:00
Richard Kiss 56aadf687d Redo some tests using block generator and puzzle utils. 2021-02-26 11:41:58 -08:00
Richard KissandGitHub 4e45fda663 Optimize standard puzzle a bit more (#1031)
* More optimizations to `p2_delegated_puzzle_or_hidden_puzzle.clvm`.

* Don't get cached plots.

* Bump up wallet test time.
2021-02-24 12:20:32 -08:00
Richard KissandGene Hoffman 249a5f3cca More improvements to main puzzle. 2021-02-23 11:20:55 -08:00
Richard KissandGene Hoffman 710e3dffcd Don't use broken test cache. 2021-02-23 11:20:55 -08:00
Richard KissandGene Hoffman 6db38b0ffa Renumbering and rename condition opcodes. Recompile clvm. 2021-02-23 11:20:55 -08:00
Richard KissandGene Hoffman ce2d901768 Fix big block test. 2021-02-23 11:20:55 -08:00
Richard KissandGene Hoffman 1c1cafc865 Use renumbered opcodes. 2021-02-23 11:20:55 -08:00
Richard Kiss 1a9488ae24 Add utility recompile-all.sh. 2021-02-22 12:26:53 -08:00
Richard Kiss 34f4913bf7 Add some comments to the standard puzzle. 2021-02-22 12:26:53 -08:00
Richard Kiss 46bd2e5d5a Improve debug_spend_bundle.py. 2021-02-22 12:26:53 -08:00
Richard Kiss 69f140b0f4 Use deserialize_and_run_program so opcode renumbers work. 2021-02-22 12:26:53 -08:00
Richard Kiss bbd820cb91 Add __repr__ to SerializedProgram`. 2021-02-22 12:26:53 -08:00
Richard Kiss d11d96fa9e Add puzzle_reveal to CoinSolution. 2021-02-21 19:08:18 -08:00
Richard Kiss 2f8feec753 Change name to CoinSolution.puzzle_solution_pair. 2021-02-21 19:08:18 -08:00
Richard KissandYostra 2a6347152c Skip the clean-up code for now. 2021-01-12 17:02:21 -05:00
Richard KissandYostra 78144fcd89 Support apply keyword. 2021-01-12 17:00:54 -05:00