Commit Graph
45 Commits
Author SHA1 Message Date
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
Earle LoweandGitHub 5727efb904 Fixes to test_long_sync_untrusted_break (#20327)
* Fixes to test_long_sync_untrusted_break

* Address bugbot comments re ip address string

* Remove commented out debug code

* Apply suggestions from bugbot
2025-12-18 08:48:08 -08:00
Arvid NorbergandGitHub aefefb416e bump WEIGHT_PROOF_RECENT_BLOCKS for tests (#20348)
* increase WEIGHT_PROOF_RECENT_BLOCKS in the test constants, to make it more robust

* improve error message when WEIGHT_PROOF_RECENT_BLOCKS is too small

* fix test_wallet_blockchain.py

* fix test_wallet_node.py

* fix test_wallet_sync.py
2025-12-15 09:47:08 -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
Arvid NorbergandGitHub 4576684c14 integrate PLOT_V1_PHASE_OUT constant (#19820)
* integrate PLOT_V1_PHASE_OUT constant

* current test chains won't work after the plot v1 phase-out
2025-07-21 08:59:16 -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
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 44643084b0 Move augmented_chain.py and prev_transaction_block.py to chia/consensus (#19587) 2025-05-08 15:11:31 -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
Matt HauffandGitHub a6a5a35c7d [CHIA-1251] Add puzzle hash generation to action scopes (#19283)
* (squash) Add puzzle hash generation to action scopes

* Add comment for unused/last_index
2025-04-03 15:34:07 -05:00
Kyle AltendorfandGitHub d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35: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
Matt HauffandGitHub 482d83788d Standardize the Wallet API for generate_signed_transaction (#19209)
* Standardize the `Wallet` API for `generate_signed_transaction`

* Some test fixes

* Fix `create_tandem_xch_tx`

* Fix the other `create_tandem_xch_tx`s

* More test fixes

* More test fixes

* Bad fix from last time
2025-02-05 15:12:16 -07: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
Matt HauffandGitHub c99492cc19 [CHIA-773] Swap out Payment for CreateCoin (#19144)
* Swap out `Payment` for `CreateCoin`

* Fix mypy-exclusions

* tweak
2025-01-27 08:22:29 -07:00
RigidityandGitHub 8f484e6bc9 Name wallet protocol subscription messages consistently (#19132)
* Name wallet protocol subscription messages consistently

* fix changelog

* fix name in full_node_api

* missed a spot
2025-01-14 10:12:09 -07:00
Amine KhaldiandGitHub 0b21fd1533 CHIA-2108 Cover computing transactions filter for transaction blocks with only reward coins (#19076)
Cover computing transactions filter for transaction blocks with only reward coins.
2025-01-07 10:00:52 -07:00
Amine KhaldiandGitHub c6a6c0bbc3 CHIA-1862 Fix FullNodeAPI's request_block_headers returned filter (#18923)
Fix FullNodeAPI's request_block_headers returned filter.
2024-12-18 12:01:30 -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
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
Almog De PazandGitHub 61703ce09a fix trusted wallet sync on deep reorg (#18831)
* fix trusted wallet sync on deep reorg

* handle long sync exception case in finish sync

* fix_wallet_sync_test

* fix test_long_sync_wallet

* reconnect only untrusted node in test

* fix long_sync test, update only on finish_sync()

* revert add_blocks_in_batches

* types

* fix  flakey test_long_reorg_nodes_and_wallet
2024-12-02 11:22:55 -07:00
ff3cf282c2 explicitly collect api methods instead of later using getattr (#18800)
* explicitly collect api methods instead of later using getattr

* api as a class itself

* tidy

* fixup

* tidier

* and...

* fixup

* oops

* mm

* hum

* fixup

* monkey patching helper

* ...

* tidy

* back to instances

* fix

* self-patch

* duplicate original request attributes

* Update chia/_tests/wallet/sync/test_wallet_sync.py

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>

* test that `@metadata.request()` fails on repeated request type

* ...

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2024-11-08 08:58:15 -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
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
Arvid NorbergandGitHub 8c72d22edf move add_blocks_in_batches() out of tests (#18750)
move add_blocks_in_batches() out of tests, since the node simulator depends on it
2024-10-23 08:50:08 -05: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
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
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
Arvid NorbergandGitHub d5c36e38ac BlockchainInterface cleanups (#18522)
* use ... in BlockInfo protocol

* move prev_block_hash() from BlockchainInterface into BlockRecordsProtocol to transition find_fork_point_in_chain() and lookup_fork_chain() to use the more narrow protocol to lookup the chain

* the WalletBlockchain doesn't need to implement the full BlockchainInterface, but just BlockRecordsProtocol

* remove unused GeneratorBlockCacheInterface and BlockDict

* add unit test for BlockCache
2024-08-27 23:58:19 +08:00
Arvid NorbergandGitHub 700a67344b BlockchainInterface as a protocol (#18486)
* turn BlockchainInterface into a proper Protocol, to allow mypy to check it

* split out a subset of BlockchainInterface into BlockRecordsInterface

* separate BlockCache into the (simple) production use case and the (complex) test use case of mocking a blockchain object
2024-08-23 01:02:43 +08:00
Matt HauffandGitHub 64003a63f5 [CHIA-1067] Integrate coin selection with action scopes (#18424)
* Add TXConfig to action scopes

* Fix DID test

* Fix CR-CAT method

* Fix NFT offer test

* Utilize streamable for WalletSideEffects serialization

* Integrate coin selection with action scopes

* Fix action scope test

* Fix DID test

* Fix NFT tests

* Fix NFT tests
2024-08-19 09:02:36 -07:00
Matt HauffandGitHub 8bc332f95e [CHIA-1037] Add TXConfig to action scopes (#18406)
* Add TXConfig to action scopes

* Fix DID test

* Fix CR-CAT method

* Fix NFT offer test
2024-08-07 11:27:13 -07:00
Matt HauffandGitHub 055588914e [CHIA-714] Add usage of action scope throughout wallet codebase (#18128)
* Add the concept of 'action scopes'

* Add `WalletActionScope`

* Fix CATWallet pending_change calculation

* Add action_scope: WalletActionScope to all tx endpoints

* Add usage of action scope throughout wallet codebase

* Add the concept of 'action scopes'

* pylint and test coverage

* add try/finally

* add try/except

* Undo giving a variable a name

* Fix CRCAT test

* Fix trade tests

* Fix cat test

* Fix miscellaneous test

* Fix miscellaneous test

* Fix miscellaneous test

* pylint

* Add auto claim test coverage

* Take advantage of extra_spends

* Fix tests

* test fixes

* pylint
2024-07-17 12:17:16 -07:00
Matt HauffandGitHub 4ffb6dfa6f [CHIA-713] Add action_scope: WalletActionScope to all tx endpoints (#18127)
* Add the concept of 'action scopes'

* Add `WalletActionScope`

* Fix CATWallet pending_change calculation

* Add action_scope: WalletActionScope to all tx endpoints

* Add the concept of 'action scopes'

* pylint and test coverage

* add try/finally

* add try/except

* Undo giving a variable a name

* Fix CRCAT test

* Fix trade tests

* Fix cat test

* Fix miscellaneous test

* Fix miscellaneous test

* Fix miscellaneous test

* Add auto claim test coverage
2024-07-16 11:06:01 -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
Matt HauffandGitHub aefe7fdf28 Observer Mode (#17792)
* Observer Mode

* Address comments by @altendky

* Change RPC default and fix test coverage

* Add test coverage for rpc marshaller

* Fix @marshal util to return proper transactions
2024-05-07 13:39:25 -07:00
matt-o-howandGitHub bed6ec7055 Use Rust version of MerkleSet (#17908)
* drop in merkle set from rust

* add test of non-inclusion

* migrate sync_utils to use chia_rs

* remove unused import

* flake8 fixes

* mypy fix

* more lint fixes

* isort

* remove old merkle_set.py

* make test proof of exlcusion more explicit

* covnert test_merkle_set to use chia_rs MerkleSet

* isort again
2024-04-29 11:05:32 -07:00
Felix BruckerandGitHub acaf7e0a3b Add use_delta_sync option (#17573)
* Add `use_delta_sync` option

* Use fixture for `use_delta_sync` bool param

* Add note in initial-config
2024-03-15 09:22:01 -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