Conversation
## Summary Fixes https://linear.app/aztec-labs/issue/F-339 The issue reported three resource leaks in `PXE.stop()`: 1. **`L2BlockStream` — active `RunningPromise` with timers**: The issue assumed the block stream runs in polling mode (`start()`), but in the PXE context `blockStream.start()` is never called — the stream is only used in manual sync mode via `blockStream.sync()`. So there are no active timers or `InterruptibleSleep` handles keeping the event loop alive. That said, calling `blockStream.stop()` is still good defensive practice in case the usage mode changes. 2. **LMDB store — open file descriptors**: `PXE.stop()` already calls `this.db.close()`, so this part was already fixed at some point after the issue was filed. 3. **HTTP keep-alive sockets from `createAztecNodeClient`**: Node's built-in `fetch` (undici) uses HTTP keep-alive by default — after a request completes, the underlying TCP socket stays open in case another request comes to the same host. These idle sockets register as active handles on the event loop, preventing `process.exit()` from happening naturally. Fixing this would require either using a custom undici `Agent`/`Pool` with a `close()` method, or setting `keepalive: false` (which hurts performance). In practice this doesn't matter: the sockets time out on their own after a few seconds, and for long-running services (the main use case) the process stays up anyway. Only relevant if you need the process to exit immediately after `stop()` without calling `process.exit(0)`. **What this PR actually fixes**: `BlockSynchronizer` had no `stop()` method at all. If `PXE.stop()` were called while a sync was in progress, the ongoing sync could race against `db.close()`. While the job queue draining makes this unlikely in practice, adding an explicit `stop()` is the right defensive pattern and matches what `ServerWorldStateSynchronizer` already does. ### Changes - Adds a `stop()` method to `BlockSynchronizer` that awaits any in-progress sync, then stops the block stream - Calls `blockStateSynchronizer.stop()` in `PXE.stop()` between draining the job queue and closing the DB - Shutdown order: job queue drains (no new syncs) → synchronizer stops (waits for in-flight sync) → DB closes Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary - Fixes `TEST_ACCOUNTS=false` being ignored when running `aztec start --local-network` (hardcoded to `true`) - Adds `--local-network.testAccounts` CLI option bound to `TEST_ACCOUNTS` env var (defaults to `true` for backwards compatibility) - Fixes `extractNamespacedOptions` namespace mismatch — Commander camelCases `--local-network.*` to `localNetwork.*`, but the extraction used the `local-network.` prefix (also fixes `--local-network.l1Mnemonic` which was silently broken) Closes #21563 ## Test plan - Added 2 unit tests verifying `TEST_ACCOUNTS=false` env var is respected and the default is `true` - All 12 tests in `aztec_start_options.test.ts` pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Until now we have only checked that `aztec` dep matches the version of `aztec cli`. This was incomplete as there are also other crates in the aztec-nr repo (e.g. `uint_note`) that should have this same check applied to them. In this PR I tackle that. ## AI Summary - Broadens `warnIfAztecVersionMismatch` to inspect **every** dependency in a contract's `Nargo.toml` whose git URL points at `github.com/AztecProtocol/aztec-nr`, rather than only the single dep literally named `aztec`. - Dependencies like `uint_note`, `compressed_string`, `balance_set`, etc. are now flagged when their `tag` drifts from the CLI version (common after `aztec-up` forgets one). - Warning now names the offending dep so users know exactly which one to bump. - URL normalization handles `.git` suffixes and trailing slashes. Closes [F-504](https://linear.app/aztec-labs/issue/F-504/check-all-aztec-nr-dependencies-have-matching-tags-not-just-aztec). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
More attempts at reducing our RPC load. This will result in broadly the same amount of roundtrips, but we'll reduce the bandwidth consumed (which is important in the browser)
…22590) When working on [another PR](#22550) of mine I realized that we are having a problem and that is that we have 2 paths by which contracts get compiled: 1. one is via aztec-packages bootstrap, 2. another is via `aztec compile` This started to become problematic as our contract compilation pipeline was getting more complicated: 1. nargo compile, 2. transpile, 3. strip prefixes, 4. and with that PR also inject aztec version This meant that the duplication started to have real cost. In this PR I clean this up a bit by moving the prefix stripping into the `bb aztec_process` command. This results that the compilation pipeline is simply: 1. `nargo compile`, 2. `bb aztec_process` Given that it's just 2 commands it is fine to have it be duplicated between `bootstrap.sh` and `aztec compile`. Once this is merged I will try to refactor #22550 such that the version is also injected only in `bb aztec_process`. ## AI Summary - Moved `__aztec_nr_internals__` prefix stripping into `bb aztec_process` (C++), which already handles transpilation and VK generation - Simplified the bootstrap `compile` function to just call `nargo compile` + `bb aztec_process`, removing ~50 lines of manual VK generation shell code - Removed the separate `stripInternalPrefixes()` TypeScript function from the CLI path - Deleted the now-unused `strip_aztec_nr_prefix.sh` script - Updated protocol-fuzzer scripts and docs to reflect the unified pipeline Both compilation paths (bootstrap and `aztec compile`) now go through `bb aztec_process` for all post-nargo processing, eliminating the duplication. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BEGIN_COMMIT_OVERRIDE
fix(pxe): stop block synchronizer on PXE shutdown (#22604)
fix(aztec): respect TEST_ACCOUNTS env var in local network mode (#22600)
fix: check all aztec-nr dependency tags, not just aztec (#22483)
fix: reuse anchor block in kernel oracle (#22631)
refactor: unify contract compilation pipeline via bb aztec_process (#22590)
fix(pxe): queue registerSender wipe to avoid racing with in-flight jobs (#22623)
fix(pxe): bounds-check PropertySelector in pick_notes (#22614)
fix(pxe): guard private event store rollback against in-flight jobs (#22615)
refactor(pxe): rename sideEffectCounter to initialSideEffectCounter (#22599)
fix(pxe): correct stale authwitness comment and inverted tagging error (#22537)
fix(aztec-nr): range-check auth witness fields before byte cast (#22624)
fix(pxe): serialize block stream event handling to prevent race conditions (#22635)
fix(pxe): throw error on origin/contract address mismatch in simulation (#22637)
END_COMMIT_OVERRIDE