Skip to content

Drop the quote wrapper for INTERNED_GENERATOR - #1522

Draft
richardkiss wants to merge 1 commit into
mainfrom
serde-2026-min
Draft

richardkiss wants to merge 1 commit into
mainfrom
serde-2026-min

Conversation

@richardkiss

@richardkiss richardkiss commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

[agent draft — I haven't reviewed this text yet]

Follow-up to #1511.

  • Drops the (q . ...) quote wrapper from the interned/serde_2026 generator format. Since the block is never executed under this flag, wrapping it in a quote (whose only purpose is to make run_program return its argument unchanged) served no purpose and cost 20 gas for nothing.
  • run_block_generator2, get_coinspends_for_trusted_block(_with_conditions), additions_and_removals, and get_puzzle_and_solution_for_coin2 now parse the interned spend list directly instead of calling run_program on it.
  • Pre-HF2 quoted formats (solution_generator, solution_generator_backrefs) are unchanged.

All existing tests updated; new tests cover the unquoted round-trip and the no-execution parse path for INTERNED_GENERATOR across all four consumers.


Note

High Risk
Changes consensus block generator encoding and validation under INTERNED_GENERATOR across builder, cost, and multiple parse paths; incorrect rollout would fork the network at HF2.

Overview
Removes the (q . ...) quote wrapper from the post–hard-fork serde_2026 / INTERNED_GENERATOR block generator. The on-chain blob is now a wrapped spend list ((spends...)), not a runnable quoted program, which drops useless quote execution cost and shrinks wrapper vbyte accounting (WRAPPER_VBYTES 11→5, empty builder block_cost 0).

build_generator(..., quote) keeps quoted output for solution_generator / solution_generator_backrefs; solution_generator_2026, InternedBlockBuilder::finalize, and interned base-cost in spendbundle_conditions emit the unquoted tree.

With INTERNED_GENERATOR, run_block_generator2, trusted coinspend helpers, and additions_and_removals decode the spend list directly (via first) instead of run_program on the generator; quote/node shape checks are skipped on that path. Invalid non–spend-list serde_2026 blobs now fail at spend parsing (InvalidCondition) rather than ComplexGeneratorReceived. Tests were updated for the new encoding and hashing (classic reference still quoted for pre-fork comparisons).

Reviewed by Cursor Bugbot for commit cf49946. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread crates/chia-consensus/fuzz/fuzz_targets/interned-block-builder.rs Outdated
@coveralls-official

Copy link
Copy Markdown

Coverage Report for CI Build 36228906768

Coverage increased (+0.07%) to 82.502%

Details

  • Coverage increased (+0.07%) from the base build.
  • Patch coverage: 7 uncovered changes across 3 files (192 of 199 lines covered, 96.48%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
crates/chia-consensus/src/build_interned_block/additional_tests.rs 20 17 85.0%
crates/chia-consensus/src/run_block_generator.rs 113 110 97.35%
crates/chia-consensus/src/additions_and_removals.rs 40 39 97.5%
Total (8 files) 199 192 96.48%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
wheel/src/api.rs 1 84.81%

Coverage Stats

Coverage Status
Relevant Lines: 20448
Covered Lines: 16870
Line Coverage: 82.5%
Coverage Strength: 11350794.89 hits per line

💛 - Coveralls

@richardkiss richardkiss changed the title Rename INTERNED_GENERATOR to INTERNED_SPEND_LIST and drop the quote wrapper Drop the quote wrapper; rename INTERNED_GENERATOR to INTERNED_SPEND_LIST Sep 30, 2026
@richardkiss richardkiss changed the title Drop the quote wrapper; rename INTERNED_GENERATOR to INTERNED_SPEND_LIST Drop the quote wrapper for INTERNED_GENERATOR Sep 30, 2026
@richardkiss
richardkiss force-pushed the serde-2026-min branch 2 times, most recently from e95b446 to 36a917f Compare September 30, 2026 21:54
- build_generator() takes a quote: bool param; when false, emits the
  unquoted spend list ((parent puzzle amount solution) ...) instead of
  (q . (...)). solution_generator_2026() uses quote: false.
- run_block_generator2, get_coinspends_for_trusted_block,
  get_coinspends_with_conditions_for_trusted_block, and
  additions_and_removals skip run_program/check_generator_quote/
  check_generator_node for INTERNED_GENERATOR: they deserialize the
  serde_2026 blob and parse the spend list directly.
- InternedBlockBuilder: drop the now-unneeded top-level quote execution
  cost (block_cost 20 -> 0, WRAPPER_VBYTES 11 -> 5).
- Add comments explaining the outer wrapper enables soft-fork expansion.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cf49946. Configure here.

{
let mut a = Allocator::new();
let generator = build_generator(&mut a, spends)?;
let generator = build_generator(&mut a, spends, false)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interned puzzle lookup still executes

High Severity

get_puzzle_and_solution_for_coin2 still runs the interned generator through run_program after solution_generator_2026 and InternedBlockBuilder dropped the (q . ...) wrapper. That tree is now a spend list, not an executable quote, so puzzle and solution lookup fails for every INTERNED_GENERATOR / serde_2026 block.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cf49946. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant