Skip to content

fix: only delete logs from rolled-back blocks, not entire tag (A-686)#21687

Merged
spalladino merged 2 commits intomerge-train/spartanfrom
phil/a-686-deletelogs-deletes-all-logs-for-a-tag-not-just-rolled-back
Mar 18, 2026
Merged

fix: only delete logs from rolled-back blocks, not entire tag (A-686)#21687
spalladino merged 2 commits intomerge-train/spartanfrom
phil/a-686-deletelogs-deletes-all-logs-for-a-tag-not-just-rolled-back

Conversation

@PhilWindle
Copy link
Collaborator

During reorg, deleteLogs was deleting the entire log entry for a tag instead of only removing logs from the rolled-back blocks. This caused logs from earlier blocks to be lost.

Fixes https://linear.app/aztec-labs/issue/A-686

@PhilWindle PhilWindle closed this Mar 17, 2026
@PhilWindle PhilWindle reopened this Mar 17, 2026
Copy link
Contributor

@nventuro nventuro left a comment

Choose a reason for hiding this comment

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

The fix looks correct. I'd add two tests where we have two txs in different blocks emit logs with the same tag, reorg the second block and check that the node query fns still return the first (un-reorged) log.

@spalladino spalladino added the claudebox Owned by claudebox. it can push to this PR. label Mar 17, 2026
@spalladino spalladino marked this pull request as ready for review March 17, 2026 21:19
@AztecProtocol AztecProtocol deleted a comment from AztecBot Mar 17, 2026
@spalladino spalladino enabled auto-merge (squash) March 17, 2026 21:27
const firstBlockToDelete = Math.min(...blockNumbers);

// Collect all unique private tags across all blocks being deleted
const allPrivateTags = new Set(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably extract blocks.map(block => this.#privateLogKeysByBlock.getAsync(block.number)) into a temporary

@spalladino spalladino merged commit 946ddb1 into merge-train/spartan Mar 18, 2026
16 checks passed
@spalladino spalladino deleted the phil/a-686-deletelogs-deletes-all-logs-for-a-tag-not-just-rolled-back branch March 18, 2026 02:06
@AztecBot
Copy link
Collaborator

❌ Failed to cherry-pick to v4 due to conflicts. (🤖) View backport run.

AztecBot pushed a commit that referenced this pull request Mar 18, 2026
ludamad added a commit that referenced this pull request Mar 18, 2026
…entire tag (A-686) (#21713)

## Summary
Backport of #21687
to v4.

During reorg, `deleteLogs` was deleting the entire log entry for a tag
instead of only removing logs from the rolled-back blocks. This caused
logs from earlier blocks to be lost.

## Cherry-pick conflicts
The automatic cherry-pick failed due to API differences between `next`
and `v4`:
- `next` uses `store.addProposedBlock(block)` (singular) — v4 uses
`store.addProposedBlocks([block])` (plural, takes array)
- `next` uses a helper `addProposedBlocks(store, ...)` — adapted to call
`store.addProposedBlocks(...)` directly in v4

## Commit structure
1. **Cherry-pick with conflicts** — raw cherry-pick preserving conflict
markers
2. **Conflict resolution** — adapted `addProposedBlock` →
`addProposedBlocks` API calls

Fixes https://linear.app/aztec-labs/issue/A-686

ClaudeBox log: https://claudebox.work/s/1f9640fef77e1838?run=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4 claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants