Skip to content

fix(checkpoint): drop parse-side total OL-log payload cap#154

Open
prajwolrg wants to merge 1 commit into
mainfrom
fix/checkpoint-sidecar-log-payload-cap
Open

fix(checkpoint): drop parse-side total OL-log payload cap#154
prajwolrg wants to merge 1 commit into
mainfrom
fix/checkpoint-sidecar-log-payload-cap

Conversation

@prajwolrg

@prajwolrg prajwolrg commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Description

CheckpointSidecar::new enforced MAX_TOTAL_LOG_PAYLOAD_BYTES — a hand-rolled 16 KiB cap on the summed OL-log payload, layered on top of the SSZ schema caps. That cap doesn't belong on the parse side. ASM only parses checkpoint payloads out of Bitcoin transactions, where overall size is already bounded implicitly by the transaction limit, and the real budget is enforced downstream at construction. Enforcing a 16 KiB total here is both incoherent with the schema (which permits MAX_OL_LOGS_PER_CHECKPOINT logs of MAX_LOG_PAYLOAD_LEN each) and actively wrong: a checkpoint that is valid on-chain but carries more than 16 KiB of log data would fail to parse.

This removes the constant, its manual validate_ol_logs_payloads check, and the OLLogsTotalPayloadTooLarge error variant. The sidecar now enforces only the schema caps (state-diff size, log count, per-log size), all of which SSZ decoding already guarantees.

It also reworks the sidecar/payload proptest strategies, which were keyed off arbitrary magic sizes (0..1024, 0..512, a MAX_LOGS = 10 / MAX_TOTAL_LOG_PAYLOAD_BYTES / MAX_LOGS per-log bound) and the now-removed cap. They now draw against the real SSZ constants (OL_DA_DIFF_MAX_SIZE, MAX_OL_LOGS_PER_CHECKPOINT, MAX_LOG_PAYLOAD_LEN, MAX_PROOF_LEN). The log strategy hands over candidate payload sizes so checkpoint_sidecar_strategy can apply a proptest-tractability budget (reusing OL_DA_DIFF_MAX_SIZE as a representative ceiling) before materializing any bytes — keeping a draw bounded rather than allocating the schema's multi-MiB worst case.

Finally, the previously-unexercised checkpoint_sidecar_strategy / checkpoint_payload_strategy are wired into ssz_proptest (capped at 32 cases, since each case spans the full valid size range), so their round-trip and tree-hash invariants are actually checked.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New or updated tests

Notes to Reviewers

The dropped MAX_TOTAL_LOG_PAYLOAD_BYTES and OLLogsTotalPayloadTooLarge variant were used only inside this crate — no downstream consumers. If 16 KiB is actually a consensus rule the ASM must enforce at parse time (the comment cited SPS-ol-chain-structures), this should be reconsidered; the working assumption here is that the total-payload budget is a construction-side concern checked downstream.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

N/A

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...rates/subprotocols/checkpoint/types/src/payload.rs 90.81% <ø> (-1.50%) ⬇️
...es/subprotocols/checkpoint/types/src/test_utils.rs 91.50% <100.00%> (+51.72%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Commit: 7328020
SP1 Execution Results

program cycles gas
asm-stf 136,419,333 141,510,063
moho 5,223,535 5,525,300

prajwolrg added a commit to alpenlabs/alpen that referenced this pull request Jun 17, 2026
Bumps asm v0.1-alpha.13 -> v0.1-alpha.14, strata-common rc25 -> rc26, and
zkaleido beta.4 -> beta.5, adapting to the breaking changes they bring:

- L1Payload::new now validates SSZ bounds and returns Result: unwrap at
  test sites, propagate at the checkpoint-submission RPC.
- The ASM worker's submit_block now takes a BlockHash and returns the
  processed commitments; the BlockSubmitter adapter converts the
  commitment and discards the returned vec.
- L1DataProvider gained get_l1_block_height; implement it against the
  bitcoin client mirroring the existing fetch helpers.
- The checkpoint sidecar proptest leaned on asm's checkpoint_sidecar_strategy,
  which can emit OL logs exceeding the new 16 KiB total-payload cap and
  panics; use a locally bounded strategy until alpenlabs/asm#154 lands.
CheckpointSidecar::new enforced MAX_TOTAL_LOG_PAYLOAD_BYTES, a hand-rolled
16 KiB cap layered on top of the SSZ schema caps. ASM only parses
checkpoint payloads out of Bitcoin transactions, where overall size is
already bounded implicitly by the transaction limit and the real budget is
checked downstream at construction. Enforcing a 16 KiB total here is both
incoherent with the schema (which permits MAX_OL_LOGS_PER_CHECKPOINT logs
of MAX_LOG_PAYLOAD_LEN each) and actively wrong: a checkpoint valid
on-chain but carrying more than 16 KiB of log data would fail to parse.

Remove the constant, its manual validation, and the
OLLogsTotalPayloadTooLarge variant; the sidecar now enforces only the
schema caps (state-diff size, log count, per-log size), which SSZ decoding
already guarantees.

Also rework the sidecar/payload proptest strategies, previously keyed off
arbitrary magic sizes and the removed cap, to draw against the real SSZ
constants, and wire the previously-unexercised checkpoint_sidecar and
checkpoint_payload strategies into ssz_proptest so their round-trip and
tree-hash invariants are actually checked.
@prajwolrg prajwolrg force-pushed the fix/checkpoint-sidecar-log-payload-cap branch from 261eb60 to 6b43450 Compare June 18, 2026 02:59
@prajwolrg prajwolrg changed the title test(checkpoint): bound ol_logs_strategy to the sidecar payload cap fix(checkpoint): drop parse-side total OL-log payload cap Jun 18, 2026
@prajwolrg prajwolrg marked this pull request as ready for review June 18, 2026 03:16

@krsnapaudel krsnapaudel 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.

Some nits.

/// Maximum total OL log payload size per checkpoint (16 KiB per SPS-ol-chain-structures).
pub const MAX_TOTAL_LOG_PAYLOAD_BYTES: usize = 16 * 1024;

// Re-export OLLog for consumers parsing checkpoint sidecar logs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This comment should be with the export.

/// truncating before materializing keeps a draw bounded while still exercising both regimes — large
/// payloads fill the budget after a few logs, near-empty payloads extend the prefix toward the
/// [`MAX_OL_LOGS_PER_CHECKPOINT`] count cap.
fn bounded_ol_logs(sizes: Vec<usize>) -> Vec<OLLog> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

build_bounded_ol_logs?

@krsnapaudel

krsnapaudel commented Jun 18, 2026

Copy link
Copy Markdown

@prajwolrg This is breaking in a way since OL block assembly uses the constant. I created this ticket to update block assembly.

@storopoli storopoli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK 6b43450

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.

4 participants