Skip to content

feat: sync cache invalidation oracle#21459

Merged
nchamo merged 11 commits intomerge-train/fairiesfrom
feat/contract-sync-cache-invalidation
Mar 18, 2026
Merged

feat: sync cache invalidation oracle#21459
nchamo merged 11 commits intomerge-train/fairiesfrom
feat/contract-sync-cache-invalidation

Conversation

@nchamo
Copy link
Copy Markdown
Contributor

@nchamo nchamo commented Mar 12, 2026

Summary

  • Adds a new invalidateContractSyncCache oracle that lets Noir contracts invalidate the PXE's sync cache for a specific contract, forcing re-sync on the next query
  • Wipes the full sync cache on registerSender so newly registered sender's tagged logs are discovered immediately

Fixes F-414

@nchamo nchamo requested a review from nventuro as a code owner March 12, 2026 22:23
@nchamo nchamo self-assigned this Mar 12, 2026
@@ -106,9 +104,6 @@ describe('e2e_offchain_payment', () => {
])
.simulate({ from: bob });

Copy link
Copy Markdown
Contributor Author

@nchamo nchamo Mar 12, 2026

Choose a reason for hiding this comment

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

This didn't have a TODO, but Claude deleted it and the test still passes. Should I put it back?

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.

No, the entire point of this PR was to be able to remove these two lines.

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.

Note that, as stated above, as soon as we add the balance check for Alice (which was blocked by scoped capsules), the forceEmptyBlock will still be necessary unless we selectively cache by scope and contract address

args: [],
returnTypes: [],
}),
contractStore.getFunctionCall.mockImplementation((_name, _args, address) =>
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.

Changed the mock so that it used the address from the param

@@ -20,12 +20,12 @@ export class ContractSyncService implements StagedStore {
readonly storeName = 'contract_sync';

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.

The only addition to this file is invalidateContract. The rest was a refactor to make ensureContractSynced more easy to read

@nchamo nchamo added the ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure label Mar 12, 2026
@nchamo nchamo requested a review from mverzilli March 12, 2026 23:03
@@ -106,9 +104,6 @@ describe('e2e_offchain_payment', () => {
])
.simulate({ from: bob });

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.

No, the entire point of this PR was to be able to remove these two lines.

Comment thread yarn-project/pxe/src/contract_sync/contract_sync_service.ts
Comment thread yarn-project/pxe/src/contract_sync/contract_sync_service.ts Outdated
Comment thread yarn-project/pxe/src/contract_sync/contract_sync_service.ts Outdated
Comment thread yarn-project/pxe/src/pxe.ts Outdated
Comment thread yarn-project/txe/src/rpc_translator.ts Outdated
nchamo and others added 3 commits March 14, 2026 15:28
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
…ontract-sync-cache-invalidation

# Conflicts:
#	yarn-project/pxe/src/contract_function_simulator/oracle/interfaces.ts
@nchamo nchamo requested a review from nventuro March 16, 2026 12:21
Comment thread noir-projects/aztec-nr/aztec/src/messages/processing/offchain.nr Outdated
Comment thread yarn-project/end-to-end/src/e2e_2_pxes.test.ts Outdated
Comment thread yarn-project/pxe/src/pxe.ts
@nchamo nchamo changed the title feat: per-contract sync cache invalidation oracle feat: sync cache invalidation oracle Mar 17, 2026
@nchamo nchamo requested a review from mverzilli March 17, 2026 18:19
Copy link
Copy Markdown
Contributor

@mverzilli mverzilli left a comment

Choose a reason for hiding this comment

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

Nice!

…ontract-sync-cache-invalidation

# Conflicts:
#	yarn-project/pxe/src/oracle_version.ts
@nchamo nchamo enabled auto-merge (squash) March 18, 2026 11:34
@nchamo nchamo merged commit 68e4332 into merge-train/fairies Mar 18, 2026
11 checks passed
@nchamo nchamo deleted the feat/contract-sync-cache-invalidation branch March 18, 2026 11:56
@AztecBot
Copy link
Copy Markdown
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

AztecBot pushed a commit that referenced this pull request Mar 18, 2026
Cherry-pick of 68e4332 with conflict markers preserved for review.
Conflicts in:
- yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution.test.ts
- yarn-project/pxe/src/oracle_version.ts
AztecBot pushed a commit that referenced this pull request Mar 18, 2026
Cherry-pick of 68e4332 with conflict markers preserved for review.
Conflicts in:
- yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution.test.ts
- yarn-project/pxe/src/oracle_version.ts
github-merge-queue Bot pushed a commit that referenced this pull request Mar 18, 2026
BEGIN_COMMIT_OVERRIDE
feat: sync cache invalidation oracle (#21459)
END_COMMIT_OVERRIDE
AztecBot added a commit that referenced this pull request Mar 19, 2026
BEGIN_COMMIT_OVERRIDE
feat: entrypoint replay protection (#21649)
feat: guard BoundedVec oracle returns against dirty trailing storage
(#21589)
fix: add bounds when allocating arrays in deserialization (#21622)
feat: implement manual Packable for structs with sub-Field members
(#21576)
fix(aztec-node): throw on existing nullifier in
getLowNullifierMembershipWitness (#21472)
fix: use trait dispatch for array Packable::unpack in card_game_contract
(#21683)
fix(p2p): penalize peers for errors during response reading (#21680)
fix: update nullifier non-inclusion test expectations after early oracle
throw (backport #21600) (#21615)
fix(aztec-nr): fix OOB index with nonzero offset (#21613)
fix(builder): persist contractsDB across blocks within a checkpoint
(#21520)
fix(stdlib): accept null return_type for void Noir functions (#21647)
feat: gas estimations on send (#21646)
fix(validator): process block proposals from own validator keys in HA
setups (backport #21603) (#21659)
fix(p2p): penalize peer on tx rejected by pool (#21677)
fix(sequencer): fix checkpoint budget redistribution for multi-block
slots (#21692)
feat: sync cache invalidation oracle (backport #21459) (#21730)
feat!: make AES128 decrypt oracle return Option (backport #21696)
(#21735)
feat!: include init_hash in private initialization nullifier (backport
#21427) (#21736)
fix(sequencer): extract gas and blob configs from valid requests only
(A-677) (#21747)
chore: backport #21744 — replace dead BOOTSTRAP_TO env var with
bootstrap.sh build arg (#21748)
refactor: revert remove assert_bounded_vec_trimmed (#21758)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4-next 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.

4 participants