Skip to content

feat(aztec-nr)!: add explicit custom_sync_state hook to AztecConfig#23446

Open
nchamo wants to merge 1 commit into
merge-train/fairiesfrom
nchamo/f-655-add-explicit-custom-sync_state-hook-to-aztecconfig
Open

feat(aztec-nr)!: add explicit custom_sync_state hook to AztecConfig#23446
nchamo wants to merge 1 commit into
merge-train/fairiesfrom
nchamo/f-655-add-explicit-custom-sync_state-hook-to-aztecconfig

Conversation

@nchamo
Copy link
Copy Markdown
Contributor

@nchamo nchamo commented May 20, 2026

Why we are doing this

Contracts that wanted to customize state sync had to override the macro-generated sync_state utility 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 a CustomSyncHandler. The handler receives the same parameters as the default do_sync_state and can wrap, delegate to, or skip it. Defining a function named sync_state directly now errors with a message pointing users at the new builder.

The naming follows the existing CustomMessageHandler pattern for sibling consistency. A custom_sync_state_contract exercises 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_state function are affected; users of the default macro-generated sync need no changes.

Fixes F-655

@nchamo nchamo requested a review from nventuro as a code owner May 20, 2026 22:19
@nchamo nchamo self-assigned this 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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if we should call this custom_sync_state() or custom_sync_handler(). What do you think?

@nchamo nchamo requested a review from mverzilli May 20, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant