feat(aztec-nr)!: add explicit custom_sync_state hook to AztecConfig#23446
Open
nchamo wants to merge 1 commit into
Open
feat(aztec-nr)!: add explicit custom_sync_state hook to AztecConfig#23446nchamo wants to merge 1 commit into
nchamo wants to merge 1 commit into
Conversation
nchamo
commented
May 20, 2026
|
|
||
| ### [Aztec.nr] Defining a custom `sync_state` function now requires `AztecConfig` | ||
|
|
||
| Contracts that previously overrode the default `sync_state` by defining their own function with that name will now get a compile error. Use `AztecConfig::custom_sync_state()` instead. |
Contributor
Author
There was a problem hiding this comment.
I wasn't sure if we should call this custom_sync_state() or custom_sync_handler(). What do you think?
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.
Why we are doing this
Contracts that wanted to customize state sync had to override the macro-generated
sync_stateutility by defining a function with that name. The override happened silently — the macro had no way to surface that the default was being replaced, and there was no compile-time signal when the override accidentally shadowed the generated function.Our fix
Adds an explicit
AztecConfig::custom_sync_state()builder that registers aCustomSyncHandler. The handler receives the same parameters as the defaultdo_sync_stateand can wrap, delegate to, or skip it. Defining a function namedsync_statedirectly now errors with a message pointing users at the new builder.The naming follows the existing
CustomMessageHandlerpattern for sibling consistency. Acustom_sync_state_contractexercises the full flow (deploy + execute_utility) and verifies the handler is invoked in the right scope.Migration
See migration_notes.md. Only contracts that previously defined their own
sync_statefunction are affected; users of the default macro-generated sync need no changes.Fixes F-655