Skip to content

feat: add optional additional scopes to wallet transaction API#20487

Open
nchamo wants to merge 4 commits intomerge-train/fairiesfrom
refactor/additional-scopes
Open

feat: add optional additional scopes to wallet transaction API#20487
nchamo wants to merge 4 commits intomerge-train/fairiesfrom
refactor/additional-scopes

Conversation

@nchamo
Copy link
Contributor

@nchamo nchamo commented Feb 13, 2026

Summary

Previously, PrivateExecutionOracle automatically expanded scopes when making nested private calls to registered account contracts. This behavior was pretty hidden and made it hard to reason about which addresses' private state was accessible during execution.

This PR removes the auto-expansion and instead introduces an explicit additionalScopes option on send(), simulate(), and deploy(). Callers now declare upfront which additional addresses' private state they need access to beyond the sender's.

@nchamo nchamo changed the title refactor: add explicit additionalScopes to wallet transaction API feat: add optional additional scopes to wallet transaction API Feb 13, 2026

#[external("private")]
fn test_recursively_create_notes(owner: AztecAddress, how_many_recursions: u64) {
fn test_recursively_create_notes(recipients: [AztecAddress; 10], how_many_recursions: u64) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had to make these changes when we introduced scopes, because there was no way to inject multiple scopes. Since now there is, we can revert the change we made

@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 Feb 13, 2026
@nchamo nchamo self-assigned this Feb 13, 2026

isStaticCall = isStaticCall || this.callContext.isStaticCall;

// When scopes are set and the target contract is a registered account (has keys in the keyStore),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Die hack, die!

Copy link
Contributor

Choose a reason for hiding this comment

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

congrats :D

// When `from` is the zero address (e.g. when deploying a new account contract), we use only the
// additionalScopes if any, or an empty list which acts as deny-all: no notes are visible and
// no keys are accessible. Otherwise, we combine `from` with any additionalScopes, deduplicating.
protected scopesFor(from: AztecAddress, additionalScopes: AztecAddress[] = []): AztecAddress[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this name doesn't make match sense, maybe scopesFrom would make more sense.

And the comments are just a natural language description of the imperative steps the function does, which personally distracted me more than just reading the code. I would just remove the comment.

Copy link
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.

Looks good! I think it's missing migration notes, and some documentation in general

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants