Skip to content

fix: dropped tagging indices no longer cause a pxe crash on sync#23044

Merged
nventuro merged 14 commits into
merge-train/fairiesfrom
nico/f-630-bug-pxe-conflicting-range-in-sendertaggingstore-on-repeated
May 12, 2026
Merged

fix: dropped tagging indices no longer cause a pxe crash on sync#23044
nventuro merged 14 commits into
merge-train/fairiesfrom
nico/f-630-bug-pxe-conflicting-range-in-sendertaggingstore-on-repeated

Conversation

@nventuro
Copy link
Copy Markdown
Contributor

@nventuro nventuro commented May 7, 2026

Fixes #22949.

We keep track of the range of tagging indices used by a tx as (lowestIdx, highestIdx) - we need this so that future transactions start from highest + 1 even if a previous tx has not yet been mined, avoiding tag duplication. The lowest index is required in case of transaction reverts: we walk all indices from low to high and test which ones survived onchain, and that way determine the actual highest index for a tx.

On sync, we validate that our records for a tx match the indices used in said tx - this helps detect bugs (like the bug being fixed here). This check started failing because our (low, high) record did not consider the possibility of logs being squashed - if either low or high got squashed then the range would change. Note that we don't care about indices between low and high being squashed , gaps are ok - we only really care about the edges.

This PR fixes this by inspecting tx effects to adjust the range prior to storing the indices in the database. It hints at the need for a tagging service layer, but that was a bigger change that I didn't want to introduce here. I added tests for both new functions created, plus an e2e regression test that checks we've fixed the original issue. I validated that the test fails without this fix.

@AztecBot
Copy link
Copy Markdown
Collaborator

AztecBot commented May 7, 2026

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/11010b5487048e57�11010b5487048e578;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_missed_l1_publish.test.ts (152s) (code: 0) group:e2e-p2p-epoch-flakes

Copy link
Copy Markdown
Contributor

@nchamo nchamo left a comment

Choose a reason for hiding this comment

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

Great work!

Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.ts
Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.test.ts
Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.test.ts
Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.test.ts
Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.test.ts
Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.test.ts Outdated
Comment thread yarn-project/pxe/src/pxe.ts
Comment thread yarn-project/pxe/src/tagging/persist_sender_tagging_index_ranges.ts
Comment thread yarn-project/pxe/src/tagging/persist_sender_tagging_index_ranges.test.ts Outdated
Copy link
Copy Markdown
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

Very nice. Thanks

Comment thread yarn-project/pxe/src/tagging/persist_sender_tagging_index_ranges.ts
@@ -0,0 +1,122 @@
import { type Logger, createLogger } from '@aztec/foundation/log';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It makes sense to move this file, persist_sender_tagging_index_ranges.ts, reconcile_tagging_index_ranges.test.ts and reconcile_tagging_index_ranges.ts to yarn-project/pxe/src/tagging/sender_sync as this is sender sync related. Directly in the tagging dir I kept only functionality relevant to both sender and recipient sync.

Copy link
Copy Markdown
Contributor Author

@nventuro nventuro May 11, 2026

Choose a reason for hiding this comment

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

This is not part of the sync though, it's part of sending a transaction in which tags were used. I think the more complete answer might be that we're missing some intermediate layer e.g. a TaggingService, and I'd rather not hide that here. But it's a good callout at this being smelly.

Comment thread yarn-project/pxe/src/tagging/reconcile_tagging_index_ranges.test.ts
nchamo and others added 12 commits May 11, 2026 08:36
…yte code size blow up (#23062)

Resolves
[F-637](https://linear.app/aztec-labs/issue/F-637/aztec-nr-macros-contain-self-construction-to-a-function-to-prevent)

Stacks on #23061

- New `generate_public_self_creator` emits a per-contract
`__aztec_nr_internals__create_public_self<let N: u32>()` helper
- `generate_public_external` now emits a single call to it instead of
inlining the preamble. This can be seen in the snapshots.
- Helper is emitted from `process_functions` and gated on
`public_functions.len() > 0`

~~Improvements tested locally:~~

I need to test further. Either way this is cleaner macro code.
@nventuro nventuro enabled auto-merge (squash) May 11, 2026 23:58
@nventuro nventuro merged commit 6226e13 into merge-train/fairies May 12, 2026
14 checks passed
@nventuro nventuro deleted the nico/f-630-bug-pxe-conflicting-range-in-sendertaggingstore-on-repeated branch May 12, 2026 00:19
AztecBot pushed a commit that referenced this pull request May 12, 2026
)

Fixes #22949.

We keep track of the range of tagging indices used by a tx as
`(lowestIdx, highestIdx)` - we need this so that future transactions
start from `highest + 1` even if a previous tx has not yet been mined,
avoiding tag duplication. The lowest index is required in case of
transaction reverts: we walk all indices from low to high and test which
ones survived onchain, and that way determine the actual highest index
for a tx.

On sync, we validate that our records for a tx match the indices used in
said tx - this helps detect bugs (like the bug being fixed here). This
check started failing because our `(low, high)` record did not consider
the possibility of logs being squashed - if either `low` or `high` got
squashed then the range would change. Note that we don't care about
indices between low and high being squashed , gaps are ok - we only
really care about the edges.

This PR fixes this by inspecting tx effects to adjust the range prior to
storing the indices in the database. It hints at the need for a tagging
service layer, but that was a bigger change that I didn't want to
introduce here. I added tests for both new functions created, plus an
e2e regression test that checks we've fixed the original issue. I
validated that the test fails without this fix.

---------

Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
@AztecBot
Copy link
Copy Markdown
Collaborator

✅ Successfully backported to backport-to-v4-next-staging #23142.

benesjan added a commit that referenced this pull request May 12, 2026
…ertion regex (#23193)

## Summary

Compat-e2e regressed on `v4.3.0-nightly.20260512-1`
(https://github.com/AztecProtocol/aztec-packages/actions/runs/25731562906).
After review with Jan and David, the two failing tests need different
treatments — the PXE error enrichment itself is *not* broken; this is
purely test-vs-old-artifact text drift.

## What this PR does

- **`e2e_event_logs.test.ts`**: drop from the compat-e2e matrix. The new
`tagging cache reconciliation against kernel squashing` test added in PR
#23044 calls `TestLog::deliver_squashed_and_surviving_notes`, a method
that does not exist in legacy 4.2.x artifacts. There is no reasonable
backwards-compat coverage here without backporting the contract method
itself.
- **`e2e_avm_simulator.test.ts`**: keep it in the compat-e2e matrix and
loosen the assertion-message regex to accept either the older or the
newer assertion-span form:
  - old (pre-#22911 nargo): `'not_true == true'`
- new (post-#22911 nargo): `'assert(not_true == true, "This assertion
should fail!")'`

The regex becomes `/Assertion failed: This assertion should
fail!.*not_true == true/`, which matches both shapes and still rejects
unrelated assertions. The test continues to validate the PXE's
public-error enrichment pipeline (assertion decode + opcode→source
resolution) against legacy artifacts — which is the actually-valuable
coverage David flagged in the team-fairies thread.

## Why not exclude `avm_simulator` too?

David pointed out that this case is the only public-error-enrichment
test we have, and the enrichment code path is genuinely worth keeping
under compat watch. Verified manually that enrichment runs correctly
against legacy 4.2.x artifacts (paths, line/col, function names,
assertion message all resolve); the only thing that differed was the
locationText span granularity that nargo bakes into the artifact at
compile time. Loosening the regex preserves the coverage without
breaking on the legacy span shape.

## Test plan

- `node -e '/Assertion failed: This assertion should fail!.*not_true ==
true/.test(…)'` matches both old and new forms, rejects unrelated
assertions.
- `bash -c 'shopt -s extglob; ls
src/e2e_!(block_building|prover_*|kernelless_simulation|event_logs).test.ts'`
from `yarn-project/end-to-end` resolves to 49 files (was 48 when
`avm_simulator` was also excluded), `event_logs` correctly absent.
- Compat-e2e is `continue-on-error` for nightlies — next nightly should
be green on `ci-compat-e2e` once this lands.

A forward-port of the regex loosening to `next` is also worthwhile (same
file, identical strict regex there today), but mainline `next` doesn't
run compat-e2e so it isn't blocking; can ship as a follow-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants