Skip to content

feat(pxe)!: Add AppTaggingSecret kinds to keys in tagging stores - #24604

Merged
vezenovm merged 8 commits into
merge-train/fairies-v5from
mv/f-680-migrate-pxe-tagging-stores
Jul 9, 2026
Merged

feat(pxe)!: Add AppTaggingSecret kinds to keys in tagging stores#24604
vezenovm merged 8 commits into
merge-train/fairies-v5from
mv/f-680-migrate-pxe-tagging-stores

Conversation

@vezenovm

@vezenovm vezenovm commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes F-680

What changed

Migrates PXE tagging-store keys off the legacy two-part AppTaggingSecret string format (secret:app) so every persisted key uses the uniform self-describing kind:secret:app form.

  • AppTaggingSecret.toString() now always emits kind:secret:app (the unconstrained special case that emitted the legacy two-part key is gone).
  • AppTaggingSecret.fromString() only accepts the three-part form; a two-part legacy key now throws instead of parsing.
  • Bumped PXE_DATA_SCHEMA_VERSION 12 → 13.

Migration strategy (breaking)

Since the general PXE migration framework does not exist, and per the issue discussion, this cuts over via the schema-version bump rather than a dual-read / self-healing path.

initStoreForRollupAndSchemaVersion wipes any DB whose stored schema version differs from the current one on open, so a DB written with legacy keys is cleared before the new parser ever reads it.

Blast radius: the wipe resets the entire PXE DB (addresses, notes, contracts, key store, L2 tips, facts, and tagging), not just tagging data, because they share one backing KV store. Existing wallets re-sync from genesis after upgrade. This is inherent to any PXE_DATA_SCHEMA_VERSION bump.

Tests

  • app_tagging_secret.test.ts: pins the new three-part unconstrained toString(), adds a "rejects the legacy two-part format" case, drops the now-redundant kind-prefixed-unconstrained test.
  • pxe_db_compatibility.test.ts: adds a pre-migration wipe test that writes a raw legacy two-part key at schema v12, reopens at v13, and asserts the raw map is empty (it asserts raw map contents rather than a high-level getter, which would false-pass since a new three-part toString() never reconstructs a legacy key).

Drop the legacy two-part unconstrained AppTaggingSecret key format
(`secret:app`) so every persisted tagging-store key uses the uniform
self-describing `kind:secret:app` form. `toString()` always emits the
kind prefix and `fromString()` only accepts the three-part form,
rejecting legacy keys.

Because PXE tagging stores key their KV maps by `AppTaggingSecret`
strings, this is a breaking on-disk change. Rather than a dual-read /
self-healing path, bump `PXE_DATA_SCHEMA_VERSION` 12 -> 13; the version
manager wipes any DB with a mismatched schema on open, so legacy keys
never reach the new parser and legacy/prefixed keys cannot coexist.

Note this wipe resets the entire PXE DB (notes, contracts, keys, tips,
facts, tagging), so existing wallets re-sync from genesis on upgrade.

Covers F-680.
@vezenovm vezenovm added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure ci-draft Run CI on draft PRs. labels Jul 8, 2026
@vezenovm vezenovm changed the title refactor(pxe): self-describing AppTaggingSecret keys in tagging stores feat(pxe)!: Add AppTaggingSecret kinds to keys in tagging stores Jul 8, 2026
Document the PXE data schema bump (12->13) and full PXE DB wipe in
migration_notes.md. Rename PRE_F680_PXE_SCHEMA_VERSION ->
PRE_KIND_PREFIXED_TAGGING_KEY_PXE_SCHEMA_VERSION and reword its comments to
drop the Linear issue reference from source, mirroring the sibling constant.
vezenovm added 4 commits July 8, 2026 17:34
…tests (#24615)

Stacked on #24604.

Extracts the duplicated schema-mismatch DB-wipe ceremony in the PXE
storage compatibility suite into one helper.

The two "wipes rows written under schema vN" tests (the key-store
removal at the schema-10 boundary, and the tagging-store key-format
migration at the schema-12 boundary added earlier in this stack) were
near-identical boilerplate: make a temp dir + `pxe_data` config, open
the store at the old schema version, seed a legacy row, close, reopen at
the current `PXE_DATA_SCHEMA_VERSION` (which makes
`DatabaseVersionManager` wipe the mismatched DB on open), assert the row
is gone, then remove the temp dir.

`expectStoreWipedOnUpgradeFrom(oldSchemaVersion, tmpDirPrefix,
seedLegacyRows, assertWiped)` now owns that lifecycle, so each test
spells out only its own legacy write and post-wipe assertion, and the
next schema-bump wipe test is a few lines rather than a copy of the
whole dance. The shared "wipes on version mismatch" explanation moves
into the helper's JSDoc; each test comment stays focused on its own
assertion.
…-trip

The unconstrained round-trip test pinned the literal kind:secret:app format,
duplicating what the PXE schema-compat per-store snapshots already fingerprint
for real stored keys. Leave format pinning to those snapshots; keep the
round-trip test focused on serialize/deserialize identity and kind preservation.
@vezenovm
vezenovm marked this pull request as ready for review July 8, 2026 21:47
@vezenovm
vezenovm requested review from mverzilli, nchamo and nventuro and removed request for mverzilli, nchamo and nventuro July 8, 2026 21:47

@mverzilli mverzilli left a comment

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.

Looks good! I'm now working on changing the behavior on version/rollup change, the wipe out is a bit excessive, so some of the assumptions here will be outdated soon. But we can deal with that once that's done.

@vezenovm
vezenovm enabled auto-merge (squash) July 9, 2026 13:17
…e snapshots (#24614)

Stacked on #24604.

Adds a `constrained`-kind `AppTaggingSecret` to the Recipient and Sender
tagging-store schema fixtures so the backwards-compatibility snapshots
pin both the `constrained:` and `unconstrained:` key prefixes side by
side. Previously the fixtures only used default (unconstrained) secrets.

The constrained secret lands in all four persisted maps (recipient
aged/finalized, sender pending/last-finalized).
@vezenovm
vezenovm merged commit 736f391 into merge-train/fairies-v5 Jul 9, 2026
12 checks passed
@vezenovm
vezenovm deleted the mv/f-680-migrate-pxe-tagging-stores branch July 9, 2026 14:02
@PhilWindle PhilWindle added port-to-next Forward-port this merged PR into next and removed port-to-next Forward-port this merged PR into next labels Jul 21, 2026
nchamo pushed a commit that referenced this pull request Jul 23, 2026
)

Fixes
[F-680](https://linear.app/aztec-labs/issue/F-680/migrate-pxe-tagging-stores-to-prefixed-apptaggingsecret-keys)

Migrates PXE tagging-store keys off the legacy two-part
`AppTaggingSecret` string format (`secret:app`) so every persisted key
uses the uniform self-describing `kind:secret:app` form.

- `AppTaggingSecret.toString()` now always emits `kind:secret:app` (the
unconstrained special case that emitted the legacy two-part key is
gone).
- `AppTaggingSecret.fromString()` only accepts the three-part form; a
two-part legacy key now throws instead of parsing.
- Bumped `PXE_DATA_SCHEMA_VERSION` 12 → 13.

Since the general PXE migration framework does not exist, and per the
issue discussion, this cuts over via the schema-version bump rather than
a dual-read / self-healing path.

`initStoreForRollupAndSchemaVersion` wipes any DB whose stored schema
version differs from the current one on open, so a DB written with
legacy keys is cleared before the new parser ever reads it.

**Blast radius:** the wipe resets the *entire* PXE DB (addresses, notes,
contracts, key store, L2 tips, facts, and tagging), not just tagging
data, because they share one backing KV store. Existing wallets re-sync
from genesis after upgrade. This is inherent to any
`PXE_DATA_SCHEMA_VERSION` bump.

- `app_tagging_secret.test.ts`: pins the new three-part unconstrained
`toString()`, adds a "rejects the legacy two-part format" case, drops
the now-redundant kind-prefixed-unconstrained test.
- `pxe_db_compatibility.test.ts`: adds a pre-migration wipe test that
writes a raw legacy two-part key at schema v12, reopens at v13, and
asserts the raw map is empty (it asserts raw map contents rather than a
high-level getter, which would false-pass since a new three-part
`toString()` never reconstructs a legacy key).

(cherry picked from commit 736f391)
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
…ecProtocol#24932)

Forward-ports the **pxe / client / txe** slice of the v5-next → next
backlog (work merged to `v5-next` after the ~2026-07-08 cut that
reshaped `next`).

## Applied (clean cherry-picks, chronological)
- fix: tweak depositToAztec gas config (AztecProtocol#24607)
- refactor: cache Aztec node reads per execution (AztecProtocol#24630)
- fix: prevent access to secrets not in scope (AztecProtocol#24616)
- docs: fee readme improvements (AztecProtocol#24666)
- fix(pxe): widen tracked sender tagging ranges with onchain discovery
evidence (AztecProtocol#24655)
- fix: tagging secrets not being scoped by sender (AztecProtocol#24772)

## Conflict resolutions (cherry-picked with `-x`, resolved against
reshaped `next`)
- fix(txe): align tagging strategy oracle with PXE (AztecProtocol#24561) — TXE oracle
version bumped to 4.0 (breaking rename `setTaggingSecretStrategy` ->
`setTaggingSecretStrategies`; `next` was at 3.0 with its own hash),
interface hash recomputed on the merged registry. Migration note
dropped: already on `next` under 5.0.0.
- feat(pxe)!: Add AppTaggingSecret kinds to keys in tagging stores
(AztecProtocol#24604) — `PXE_DATA_SCHEMA_VERSION` 12 -> 13 applies cleanly on `next`.
Migration note dropped: already on `next` under 5.0.0.
- feat: add batch is block in archive oracle (AztecProtocol#24634) — applied cleanly
on top of AztecProtocol#24561; contract oracle version 30.6 -> 30.7, v5 interface
hash matched the merged registry.
- feat: getTxEffects oracle (AztecProtocol#24636) — applied cleanly.
- ~~feat: preserve stores on schema version or rollup address change
(AztecProtocol#24631)~~ — ported separately via AztecProtocol#24947 together with the rest of the
sqlite/OPFS line
- feat(txe): add option to authorize all utility call targets (AztecProtocol#24662) —
additive on our 4.0 -> TXE oracle version 4.1 (was 3.0 -> 3.1 on v5),
hash recomputed.
- refactor(pxe): compute oracle interface hash from wire-structural
mapping labels (AztecProtocol#24752) — TXE hash recomputed under the new
wire-structural scheme; PXE hash from the pick matched.

Verified locally: full `yarn build`, `check_oracle_version` +
`check_txe_oracle_version`, TXE unit suite (21), pxe
tagging/type-mapping/utility-oracle suites, and 29 targeted aztec-nr +
onchain_delivery_test_contract TXE tests — all green.

Part of the manual v5-next → next backlog sweep.

## Added after review
- AztecProtocol#24627 fix(aztec.js): give waitForNode a bounded default timeout —
missed by the initial sweep (merge-commit wrapper + non-`(#N)` leaf);
genuinely absent from `next`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants