* factor out the sync pipeline (fetch, validate and DB-insert) into a generic pipeline and simpler functions for each step
* review comments
* review comment
* review comment
* bump chia_rs to 0.45.1
* fix issue in test_spam_message_too_large
* allow a few more warnings that can be triggered because our tests leak aiohttp websocket clients
* fix flaky test: test_transaction_ack_duplicate_without_resend_ignored
* bump chia_rs to 0.45.0
* support parsing limited lists for rust types, using the new truncate() feature
* use the new, explicit, function to print private keys
* review comment
* review comments
* fix python import
* bump chia_rs
* updates to use and report any error message reported back from chia_rs
* bump test cache
* pass testnet to the proof-of-space functions
* review comments
### Purpose:
It was not failing on CI because we run smaller groups of tests, but
when running all tests in a single command, there would be failures.
This PR also revertes a recent patch to mitigate this issue.
### Current Behavior:
when running command line/CLI tests, we would not restore the
monkeypatches. This caused later tests running in the same process to
fail.
### New Behavior:
`create_service_and_wallet_client_generators` takes a
`pytest.MonkeyPatch` parameter and uses `monkeypatch.setattr()` for all
5 patches. The conftest wraps
it in `pytest.MonkeyPatch.context()`, which handles save/restore
automatically.
### Testing Notes:
<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: test-only changes that adjust how monkeypatching is applied
and automatically reverted; main potential issue is missing a patch or
incorrect scoping causing CLI tests to fail.
>
> **Overview**
> Fixes CLI command tests leaking monkeypatched RPC helpers into later
tests by changing `create_service_and_wallet_client_generators` to
accept a `pytest.MonkeyPatch` and applying patches via
`monkeypatch.setattr()`.
>
> Updates the `get_test_cli_clients` fixture to wrap setup in
`pytest.MonkeyPatch.context()`, ensuring all patched functions (RPC
client generators and `cli_confirm`) are automatically restored after
the fixture exits, and removes now-unneeded test RPC methods (`log_in`,
`get_pool_login_link`) tied to those patches.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
08788c422d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
* add PriorityThreadPoolExecutor, use a dedicated thread for high priority work, to minimize latency
* use PriorityThreadPoolExecutor to validate UnfinishedBlocks and FullBlocks
* make MempoolManager use the new priority thread pool
* make FullNodeRpcApi use the new FullNode thread pool
* make FullNodeAPI use the new thread pool. This is mostly used for servicing the Wallet protocol. trusted wallets have higher priority (lower nice) and untrusted wallets have the lowest priority
* add instrumentation to PrioritizedThreadPoolExecutor
* bump chia_rs to 0.42.0
* implement cost-per-spend after 3.0 hard fork
* update difficulty
* disable test_empty_sub_slots_epoch for HARD_FORK_3_0 as it seems we don't get any overflow blocks
* cache solve_proof() and get_qualities_for_challenge() results for tests
* add penalty to transactions with many spends, since we limit spends per block now
* evict mempool items based on priority as well
* fix test_limit_expiring_transactions
* Update chia_rs dependency. This version introduces condition costs in the hard
fork. So the tests that compute block costs are being updated to match these
cost rules. It also introduces a spend limit in the 2.7.0 soft fork, and the
mempool is updated to not produce blocks exceeding this limit.
* ensure both MAX_SPENDS_PER_BLOCK checks are covered by the test
* Streamable.from_bytes() is currently failing with an assert when not all bytes are consumed. Promote it to a proper run-time error (it's not a programmer error)
* fixup LegacyCATInfo
* update chia_rs dependency with the new ProofOfSpace type. use k-22 for v2 plots in simulator
* use new test cache
* review comments
* update test plots and chains to use k-20 for v2 plots, and only alternate between strength 2 and 3 (not 4)
* drop macos-13 and bump to macos-14
* use macos-15 everywhere
* don't sign python.framework
* go back to signing Python
* try adding --deep to codesign
* deep didn't work - try cp -a
---------
Co-authored-by: Earle Lowe <e.lowe@chia.net>
* track compact VDF requests made to peers.
reject unsolicited RespondCompactVDF messages
use an LRUSet to cover timed-out requests that may show up late, but cap the size of requests we remember. If a peer is so slow in responding that its tracking is evicted, we disconnect the peer.
* review comments
* bump chia_rs and make appropriate adjustments. The v2 PoS format has changed. There is no quality proof scan filter
bump test-cache blocks and test-plots
* add support for creating v2 plots in block_tools
* separate test chains into v1-plots, v1- and v2-mixed plots, and v2-only plots (after phase-out)
* (temporarily) disable running some tests with the 3.0 hard fork, until we fix them
* fix test_blockchain.py for the 3.0 hard fork chains
* Now that we have more test chains to run tests over (for PoS2), we'll need more time to run all the tests, on CI.
* remove comment about validating v2 plot cache entries when loading them. We can revisit this if it becomes a problem
* review
* fix tests
* fix long reorg
* readd todo
* remove usless todo
* fix comment
* long_reorg
* assert case exercised
* todo
* bump blocks-and-plots-version
* update lockfile
* fix overflow handling in test helper
* fix
* address cursor comments
* skip a few select tests on CI, to speed it up
---------
Co-authored-by: almogdepaz <almogdepaz@gmail.com>
* 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
* 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
move test_constants_modified from test_simulation.py into conftest.py to avoid circular dependencies. conftest defines the test chains, which are built using the test constants. test_simulation.py uses the test chains
optimize block tools by generating the block generator (for transaction_data=) up-front, rather than every time we farm a block, until we get a transaction block
* relax proof-of-space validation in weight proofs. make it height agnostic
* fix typo in block_tools logging. hoist calculations out of the block_tools PoS loop
* make the plot-filter schedule safe in proof-of-space validation as part of weight proofs
* review comments
* make test_conditions.py use the farmer reward, and not the pool reward, for its tests. This prepares this test to work with v2 plots, since they don't support redirecting the pool reward
* fix get_plot_id() for v2 proofs
* fix proof-of-space tests
* 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
* hoist calculations out of the loop over all test plots
* tweak phase-out to allow zero-epoch phase-outs, for tests
* review comments
* fix off-by-one in is_v1_phased_out
* review comments
* change v1 plot phase-out to not affect required iters, and to be quantized to epoch blocks
* disable hard-fork 2 tests until we have a new test cache
* fix rate limits test
* address review comments
* introduce file lock for creating the test-plots in tests. This avoids having every process in pytest-xdist create the same plots, clobbering each other
* add lockfile to the test fixtures that generate the test blockchains. These are quite expensive to generate, we don't want every pytest-xdist process to have to do it
* improve error message when the plot manager has an unexpected number of plots, in the simulator
* review comments: use FileLock instead of custom made
* bump chia_rs to 0.31.0
* integrate new pos2 API from chia_rs into V2Prover
* fixup test_harvester_api mocking of Prover
* review-comments: rename get_quality() to get_string() on Quality protocol
* reivew comments
* fixup bump chia_rs
* restore quality string to bytes32
fix issue in BlockTools where transaction_generator was (incorrectly) used as a proxy for whether the block was a TX block or not. Also improve error messages for plot sizes as well as the minimum plot size for v2 plots on testnet (which also affects our simulations in CI)
* remove unused default_settings in rate limits
* simplify rate_limit_numbers by flattening the structure. just map message type -> rate limits
* review comments
* stub chiapos2 API
* update block tools to support v2 plots when generating chains, as well as using the solve_proof() stub in the solver
* review comments
* use monotonic clock in rate limiter
* rename minute -> slot in rate limiter, as the length is a parameter
* mock timer in rate limit test to make them deterministic
* remove unnecessary pytest class
* improve comment in rate_limit_numbers
* fix minor typos in rate_limits.py
* replace test_too_many_messages() with a parametrized test for (almost) all rate-limit cases
* review comments: give better names to test parameters
* review comments
* review comments
* review comments
* review comments