Skip to content

refactor!: reimplement partial notes on FactStore#24369

Open
mverzilli wants to merge 207 commits into
merge-train/fairies-v5from
martin/f-711-reimplement-partial-notes
Open

refactor!: reimplement partial notes on FactStore#24369
mverzilli wants to merge 207 commits into
merge-train/fairies-v5from
martin/f-711-reimplement-partial-notes

Conversation

@mverzilli

@mverzilli mverzilli commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Closes F-771

mverzilli added 30 commits June 10, 2026 08:31
Adds empty(), map, filter, any, all, find and read_as to EphemeralArray
(spun off from #23928) and mirrors them on TransientArray.
Both types are now aliases of a single OracleArray<T, Oracle> generic,
parameterized by an ArrayOracle backend trait whose impls wrap the
existing #[oracle] declarations. Foreign-call names and the TS-side
services are untouched; monomorphization emits the same calls as before.

empty_at stays ephemeral-only via a specialized impl. Test suites are
byte-for-byte unchanged. Expansion snapshots regenerated: nargo expand
now prints the resolved OracleArray paths.
Each behavior check is written once in oracle_array/test_helpers.nr,
generic over the ArrayOracle backend; the ephemeral and transient test
modules keep one named #[test] wrapper per behavior so counts, names
and CI filters are unchanged. Backend-specific tests (empty_at,
store/load/delete) stay with their backend.
Moves empty_at from the ephemeral-only impl into the shared OracleArray
impl, making it available on TransientArray as well. Its doc notes that
for cross-frame backends it wipes data other frames may have written.
The empty_at test moves to the shared suite and runs on both backends.
Generic store/load/delete cores live in oracle_array; ephemeral and
transient expose them via thin module-level wrappers, so both backends
now have identical public surfaces (alias + oracle marker +
store/load/delete). The store/load test bodies move to the shared
suite; each backend keeps a store_and_load smoke test through its own
wrappers. Also fixes the stale test_helpers doc that still described
empty_at and store/load as backend-specific.
Backend test modules no longer list one wrapper per shared check.
Annotating a test module with ephemeral_oracle_array_tests /
transient_oracle_array_tests reflects over test_helpers and emits one
#[test] per unconstrained check with that backend's oracle swapped in,
so new checks automatically run against every backend and the suites
cannot drift. should_fail_with messages come from a single manifest in
test_helpers; an unregistered failing check fails loudly rather than
silently. Generated test names match the previous hand-written ones.
Replaces the two per-backend attribute functions with one
oracle_array_tests(module, oracle) attribute that takes the backend's
oracle as a quoted path at the annotation site.
The module name collided with crate::ephemeral, which owns the
EphemeralArray type. Name the oracle module after what it holds --
the #[oracle(...)] declarations -- so the array module keeps the
plain ephemeral name and the two are unambiguous at use sites.
The module name collided with crate::transient, which owns the
TransientArray type. Name the oracle module after what it holds --
the #[oracle(...)] declarations -- so the array module keeps the
plain transient name and the two are unambiguous at use sites.
OracleArray and ArrayOracle were near-anagrams, forcing readers to
disambiguate which was the struct and which the backend trait. Keep
ArrayOracle (it names the set of oracles that implement an array) and
rename the struct to UnconstrainedArray, after the property every
backend shares: its operations are unconstrained foreign calls into
PXE-side storage, so the data is host-provided and must be verified
before being trusted in constrained code. The oracle_array module,
the ArrayOracle trait, and the Oracle type parameter are unchanged.
Follows the struct rename: the module and its test macro were still
named after the old OracleArray struct. Rename the module directory to
unconstrained_array and the oracle_array_tests macro to
unconstrained_array_tests so the module mirrors the type it houses. The
ArrayOracle trait and the store/load/delete helpers keep their names.
…y rename

UnconstrainedArray is longer than the old OracleArray, so several doc
lines that referenced the type (or its method links) tipped past the
120-column limit. nargo fmt breaks an over-long comment line by pushing
only the trailing word onto a new line, which left mid-paragraph orphans
like '/// not' and '/// the'. Rejoin those words and rewrap the affected
paragraphs at natural points, keeping every line within 120 columns.
…ntOracles

Each of these names a set of oracle operations -- the full backend an
array needs (ArrayOracles) and the concrete ephemeral/transient bundles
that implement it -- so the plural reads truer and matches the
ephemeral_oracles/transient_oracles module names. The singular Oracle
remains as the type parameter: one backend slot filled by one bundle.
The explanatory paragraph on the ArrayOracles trait was dropped during
the previous pluralize commit (a formatter re-stage race on the shared
working tree); the rename itself only swapped the identifier. Restore
the paragraph verbatim. nargo fmt run directly keeps it intact.
…suleArray

for_each iterated in reverse so the callback could remove the current
element without shifting unvisited ones, but nothing in production uses
that capability and backward iteration is surprising both relative to
general intuition and to the sibling methods (map/filter/find), which
all read elements in order.

Iterate forward instead, document that structural mutation from inside
the callback is unsupported, and drop the tests that existed solely to
exercise remove-during-iteration. The order test now asserts the exact
forward visit order.

Linear: F-729
The manual index loop in get_pending_partial_notes_completion_logs
existed only because for_each had arbitrary iteration order. Now that
for_each visits elements in order, the loop can use it directly while
preserving the index alignment between the request array and the
partial note array.

Linear: F-729
@mverzilli mverzilli requested a review from nventuro as a code owner June 29, 2026 15:53
@mverzilli mverzilli changed the title refacto!: reimplement partial notes on FactStore refactor!: reimplement partial notes on FactStore Jun 29, 2026
Comment thread docs/docs-developers/docs/resources/migration_notes.md Outdated
Comment thread noir-projects/aztec-nr/aztec/src/partial_notes/mod.nr Outdated
@mverzilli mverzilli force-pushed the martin/f-711-reimplement-partial-notes branch from 66f0265 to a087115 Compare July 1, 2026 14:00
@@ -1,182 +0,0 @@
use crate::{

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.

note: moved and split into aztec/src/partial_notes/mod.nr and aztec/src/partial_notes/mod.nr

@mverzilli mverzilli removed the request for review from nventuro July 1, 2026 21:48
@@ -1,182 +0,0 @@
use crate::{

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.

moved to new folder (..)/aztec/src/partial_notes

@mverzilli mverzilli requested a review from nventuro July 2, 2026 09:41
Base automatically changed from martin/f-762-fact-origin-block-state-in-offchain-receive to merge-train/fairies-v5 July 2, 2026 10:31
@mverzilli mverzilli removed the request for review from nventuro July 2, 2026 11:55
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