Skip to content

feat: testing private events from Aztec.nr#20640

Closed
benesjan wants to merge 22 commits into
merge-train/fairiesfrom
02-18-feat_testing_private_events_from_aztec.nr
Closed

feat: testing private events from Aztec.nr#20640
benesjan wants to merge 22 commits into
merge-train/fairiesfrom
02-18-feat_testing_private_events_from_aztec.nr

Conversation

@benesjan

@benesjan benesjan commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Note: We will probably want to merge Serialize and Deserialize traits before merging this as it would make the diff smaller - waiting for response from Mitch to see whether it's a good time to do that change.

Closes https://linear.app/aztec-labs/issue/F-300/feature-access-events-in-aztecnr-tests

benesjan commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan force-pushed the 02-18-feat_testing_private_events_from_aztec.nr branch from e3ee438 to 21ff0cc Compare February 18, 2026 14:12
@benesjan benesjan force-pushed the 02-18-feat_testing_private_events_from_aztec.nr branch from 557d5c7 to 58006da Compare February 20, 2026 08:12
@benesjan benesjan changed the base branch from merge-train/fairies to graphite-base/20640 February 20, 2026 12:02
@benesjan benesjan force-pushed the 02-18-feat_testing_private_events_from_aztec.nr branch from 58006da to 7d799f3 Compare February 20, 2026 12:02
@benesjan benesjan changed the base branch from graphite-base/20640 to 02-20-fix_txe_committing_after_txs February 20, 2026 12:03
@benesjan benesjan force-pushed the 02-18-feat_testing_private_events_from_aztec.nr branch from 7d799f3 to 74001a2 Compare February 20, 2026 12:06
@benesjan benesjan added ci-draft Run CI on draft PRs. and removed ci-draft Run CI on draft PRs. labels Feb 20, 2026
Base automatically changed from 02-20-fix_txe_committing_after_txs to merge-train/fairies February 23, 2026 10:19
@benesjan benesjan force-pushed the 02-18-feat_testing_private_events_from_aztec.nr branch from 74001a2 to 7dc8ff2 Compare February 26, 2026 04:43
Comment thread noir-projects/aztec-nr/aztec/src/macros/utils.nr
@benesjan benesjan marked this pull request as ready for review February 26, 2026 04:58
@benesjan benesjan requested review from nchamo and removed request for LeilaWang and nventuro February 26, 2026 06:00
@benesjan

Copy link
Copy Markdown
Contributor Author

@nchamo LMK if you would not feel comfortable enough yet to review this. Can re-assing if that's the case.

@nchamo nchamo 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.

Great improvement!

Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/test_environment/test/events.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr
@benesjan benesjan marked this pull request as draft February 27, 2026 03:49
@benesjan benesjan force-pushed the 02-18-feat_testing_private_events_from_aztec.nr branch from 3660419 to 908c4d6 Compare February 27, 2026 06:25
@benesjan benesjan marked this pull request as ready for review February 27, 2026 07:04
@AztecBot

Copy link
Copy Markdown
Collaborator

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/a319774110c064b4�a319774110c064b48;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/duplicate_attestation_slash.test.ts (152s) (code: 0) group:e2e-p2p-epoch-flakes

@benesjan benesjan requested a review from nventuro February 27, 2026 07:25
Comment thread docs/docs-developers/docs/aztec-nr/testing_contracts.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/testing_contracts.md Outdated
Comment thread noir-projects/aztec-nr/aztec/src/macros/utils.nr Outdated
Comment thread docs/docs-developers/docs/aztec-nr/testing_contracts.md Outdated
Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/test_environment/test/events.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr Outdated
Comment on lines +86 to +87
/// Returns up to `MAX_PRIVATE_EVENTS_PER_TXE_QUERY` private events of type `Event` that were emitted by
/// `contract_address` and available in `scope`.

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.

This is inaccurate as it is missing the fact that it only searches the last block. It also does not explain wtf scope is.

@benesjan benesjan Mar 5, 2026

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.

Somewhat addressed in 3361896

But I am not sure about this:

This is inaccurate as it is missing the fact that it only searches the last block.

Do you mean by that "up to last block"?

By searching only the last block I imagine events emitted in the last block. Or is your mental model here that "last block" contains any state that got accumulated by the chain up to that block?

I don't know the code of TXE enough to be sure here.

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.

I may have been wrong when I wrote this, as it seems like the oracle does search from genesis all the way to the latest block.

Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr Outdated
Comment thread noir-projects/noir-contracts/contracts/app/token_contract/src/test/utils.nr Outdated
@benesjan benesjan marked this pull request as draft March 4, 2026 10:45
benesjan and others added 10 commits March 4, 2026 11:46
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
Wraps the low-level oracle so users don't need to import and call the
oracle directly. This provides a higher-level API consistent with the
rest of TestEnvironment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Short first paragraph, clarify that only last block is searched, explain
what scope means (event recipient), mention self.emit, and point users
to TestEnvironment method instead of using the oracle directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move experimental warning to top of section as a note block. Use
env.get_private_events instead of importing the oracle directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@benesjan

benesjan commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

@nventuro Re-requested a review here even though the PR is not yet finished as I need some clarifications - left the questions in unresolved discussions above.

Also please LMK if merging merge-train/fairies to this branch messed up the Github view of "changes since last review". If it messed it up I will wait with resolving conflicts for after the review finishes next time.

@benesjan benesjan requested a review from nventuro March 5, 2026 05:17
Base automatically changed from merge-train/fairies to next March 26, 2026 04:08
@nventuro nventuro changed the base branch from next to merge-train/fairies March 31, 2026 19:58
@nventuro

Copy link
Copy Markdown
Contributor

I'd hold this off until we need it, given it's not high priority right now and would either go unused or subject users to API churn.

@benesjan

Copy link
Copy Markdown
Contributor Author

Giving up on this

@benesjan benesjan closed this May 18, 2026
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.

4 participants