feat!: scoped capsule arrays#21588
Conversation
I see what you mean but I don't think they are the same thing (leaving aside naming difficulties): ALL_SCOPES denotes "all the addresses known to PXE", whereas what we're calling global here means "shared contract storage space" |
| pub unconstrained fn at_global_scope(contract_address: AztecAddress, base_slot: Field) -> Self { | ||
| Self { contract_address, base_slot, scope: Option::none() } |
There was a problem hiding this comment.
Omg it reaches so far outside of the internals. We need to get rid of global scopes asap. Would it make sense to do that now and then rebase this pr on top, without these bits?
There was a problem hiding this comment.
I'm not sure I parse what you're proposing. I split the scoped capsules work in 3 logical step to make it easier to review and discuss implications of the changes, not necessarily to ship it in steps. So if what we want is to make sure that at_global_scope doesn't exist in the version we merge, I can:
- Tackle complete obliteration of global scopes in refactor: forbid globally scoped capsules #21614 (downstream of this)
- Once I get the whole stack approved, "fold" everything back on to feat!: scoped capsules #21533 (upstream of this)
- Merge the result, where global scopes won't exist anymore
Would that address your concern here?
…tin/default-to-scoped-capsules
| parameter. This enables multiple independent namespaces within the same contract's capsule storage. If you need to keep | ||
| the previous (global) behavior, call said methods with `Option::none()` as scope. | ||
|
|
||
| `CapsuleArray::at` now requires a `scope: AztecAddress` argument that isolates the array's data to that scope. For the previous (global) behavior, use the new `CapsuleArray::at_global_scope` constructor. |
There was a problem hiding this comment.
Given that this goes away in #21614, eithre remove this from migration notes, or remove it here.
Depends on #21588 Uses the new scoped functionalities of capsules from as many places in the codebase as possible Note: this PR makes the distinction between stored capsules and volatile arrays even more painfully clear, as capsules used just for rpc comms between Aztec.nr and PXE don't really need a scope but at the same time would be better off not being global to remove concurrency constraints Closes F-459
Second part of implementing scopes in capsules. First part at: #21533
CapsuleArray::at_global_scopethat defaults to no-scope, which provides the legacy, unscoped behaviorCapsuleArray::atwithCapsuleArray::at_global_scope, to allow future PRs to deal with each caseCapsuleArray::atwork only with explicit scopes, intended to be the defaultCloses F-458