chia-blockchain/chia/types
Amine Khaldi eb898dfe95
Identical spend aggregation (#13799)
* Exploring identical spend aggregation.

* Attempt to address review.

* Revert this.

* Explore spend-based processing instead of the bundle-based one.

* Attempt to address reviews.

* Update against chia_rs and add some improvements.

* Leverage the fact that we're in a function now to perform early exits.

* Explore propagating exceptions.

* Relax the exception handling.

* Add unit tests.

* Add some comments and perform some renames for more readability.

* Refactor tests and split them by scenario.

* Take Arvid's suggestion to simplify the check.

* Improve test readability.

* Make the set explicit instead of computing it with union().

* Run in MEMPOOL_MODE for cost and additions.

* Use int_from_bytes() instead of int.from_bytes().

* Add more unit tests for run_for_cost_and_additions (to cover coin amount 0 as well as a negative amount).

* Don't use as_python() for created coins.

* Account for the cost of create coin conditions and extract additions from the NPCResult.

* Rely on NPCResult for the maximum allowed cost.

* Stop looking for the relevant spend at the first occurrence (then process its created coins).

* Add a unit test for spending a coin in different ways then finding it spent in new peak.

This makes sure all mempool items that would spend that coin get removed.

* Parameterize the test for spending a coin in different ways then finding it spent in new peak, to account for both the optimized and the reorg code paths.

* Keep track of coin spends cost and additions in mempool items in case they won't make it into the block, so we don't rerun that again next time.

* Extend replace by fee tests with eligibility scenarios.

* Refactor find_duplicate_spends into get_deduplication_info and process_mempool_items into create_bundle_from_mempool_items.
Slightly refactor check_removals and create_bundle_from_mempool.

* Cast to uint64 in the return statement.

* Adapt to the recent addition of seq.

* Add unit tests for mempool items' bundle_coin_spends.

* Leverage the recently added make_test_conds when creating this npc_result.

* Pass in bundle_coin_spends and max_cost instead of InternalMempoolItem so that it remains internal.

* Add a test for the scenario where we pick a sub-optimal aggregation by deduplicating on solution A, seen in a relatively higher FPC item, then receiving better cost saving items on solution B after that one.

* Add some end-to-end tests for identical spend aggregation.

* Add a comment documenting why eligible_coin_spends map is ephemeral.
2023-05-12 10:55:53 -05:00
..
blockchain_format 1.7.1 fixes (#14860) 2023-03-21 00:20:53 -05:00
__init__.py git mv src chia 2021-04-04 21:41:39 -07:00
announcement.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
block_protocol.py move SerializedProgram to its own file (#14391) 2023-01-27 17:20:23 -06:00
clvm_cost.py Fee estimation. (#13645) 2022-10-18 09:12:22 -05:00
coin_record.py configure isort to add the future annotations import (#13327) 2022-09-30 03:40:22 -05:00
coin_solution.py isort: Remove all chia.types exceptions and sort the related files (#13961) 2022-11-19 11:18:27 -06:00
coin_spend.py make SpendBundle.additions() count complete cost (#14612) 2023-02-21 18:37:12 -06:00
condition_opcodes.py Chialisp file extensions (#14996) 2023-04-18 11:27:17 -05:00
condition_with_args.py configure isort to add the future annotations import (#13327) 2022-09-30 03:40:22 -05:00
eligible_coin_spends.py Identical spend aggregation (#13799) 2023-05-12 10:55:53 -05:00
end_of_slot_bundle.py configure isort to add the future annotations import (#13327) 2022-09-30 03:40:22 -05:00
fee_rate.py Correct fee estimate calculation to be in mojos, not millimojos (#14474) 2023-02-04 14:09:39 -06:00
full_block.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
generator_types.py exclude CompressorArg.generator from repr() due to size (#14849) 2023-03-21 00:26:06 -05:00
header_block.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
internal_mempool_item.py Identical spend aggregation (#13799) 2023-05-12 10:55:53 -05:00
mempool_inclusion_status.py configure isort to add the future annotations import (#13327) 2022-09-30 03:40:22 -05:00
mempool_item.py Identical spend aggregation (#13799) 2023-05-12 10:55:53 -05:00
mempool_submission_status.py configure isort to add the future annotations import (#13327) 2022-09-30 03:40:22 -05:00
mojos.py Fee estimation. (#13645) 2022-10-18 09:12:22 -05:00
peer_info.py server: Rework config peer resolving and connection handling (#14997) 2023-04-14 15:22:24 -06:00
signing_mode.py Add SigningMode and update verify_signature RPC to work with sign_message_by_* RPCs (#14213) 2023-01-25 12:44:37 -06:00
spend_bundle_conditions.py bump chia_rs version to 0.1.16 (#14013) 2022-12-03 21:15:20 -06:00
spend_bundle.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
transaction_queue_entry.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
unfinished_block.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
unfinished_header_block.py hint most chia.types (#14741) 2023-03-06 16:34:22 -06:00
weight_proof.py configure isort to add the future annotations import (#13327) 2022-09-30 03:40:22 -05:00