Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
50d1bf9
feat: richer EphemeralArray and TransientArray APIs
mverzilli Jun 10, 2026
fe86aae
refactor: unify EphemeralArray and TransientArray over OracleArray
mverzilli Jun 10, 2026
f751057
refactor: share OracleArray test bodies across backends
mverzilli Jun 10, 2026
0b346bf
feat: empty_at for transient arrays
mverzilli Jun 10, 2026
0f9f79f
feat: store/load/delete for ephemeral arrays, symmetric array APIs
mverzilli Jun 10, 2026
c4857f9
refactor: generate per-backend OracleArray tests with a comptime macro
mverzilli Jun 10, 2026
7413220
refactor: single parameterized oracle_array_tests macro
mverzilli Jun 10, 2026
d49fc3f
refactor: should_fail_ prefix for failing oracle array checks
mverzilli Jun 10, 2026
eb07d6c
Merge branch 'merge-train/fairies-v5' into martin/richer-ephemeral-an…
mverzilli Jun 10, 2026
7845f7b
refactor(aztec-nr): rename oracle::ephemeral module to ephemeral_oracles
mverzilli Jun 11, 2026
b5948b0
refactor(aztec-nr): rename oracle::transient module to transient_oracles
mverzilli Jun 11, 2026
62ad854
refactor(aztec-nr): rename OracleArray struct to UnconstrainedArray
mverzilli Jun 11, 2026
e8ad51f
refactor(aztec-nr): rename oracle_array module to unconstrained_array
mverzilli Jun 11, 2026
91772da
docs(aztec-nr): reflow doc comments orphaned by the UnconstrainedArra…
mverzilli Jun 11, 2026
15a7e00
refactor(aztec-nr): pluralize ArrayOracles, EphemeralOracles, Transie…
mverzilli Jun 11, 2026
aa90beb
docs(aztec-nr): restore ArrayOracles trait doc paragraph
mverzilli Jun 11, 2026
e174bce
properly document panics
mverzilli Jun 11, 2026
950a4a2
empty does not need to clear
mverzilli Jun 11, 2026
c85569f
make find short-circuit
mverzilli Jun 11, 2026
0ca93c6
remove read_as for now
mverzilli Jun 11, 2026
5fac01b
move Serialize/Deserialize traits from UnconstrainedArray
mverzilli Jun 11, 2026
f7cbb01
refactor kv functions
mverzilli Jun 11, 2026
1523392
commit missing file
mverzilli Jun 11, 2026
788bd2f
refactor test helpers
mverzilli Jun 11, 2026
51d06cb
another one
mverzilli Jun 11, 2026
261face
tighten access
mverzilli Jun 11, 2026
8e9e6ee
remove excess comments
mverzilli Jun 11, 2026
6f881e0
Merge branch 'merge-train/fairies-v5' into martin/richer-ephemeral-an…
mverzilli Jun 11, 2026
3275759
fix(aztec-nr): iterate for_each forward in UnconstrainedArray and Cap…
mverzilli Jun 11, 2026
981a212
refactor(aztec-nr): use for_each to build log retrieval requests
mverzilli Jun 11, 2026
025cdb8
remove unneeded comment
mverzilli Jun 11, 2026
02a1080
Update migration_notes.md
mverzilli Jun 11, 2026
b2794c7
fix(aztec-nr): defer pending partial note removal until iteration is …
mverzilli Jun 11, 2026
61030ca
refactor(aztec-nr): process partial note completion logs in a backwar…
mverzilli Jun 11, 2026
84ea55b
Merge branch 'merge-train/fairies-v5' into martin/f-729-fix-array-for…
mverzilli Jun 12, 2026
3766597
feat(pxe): EntityStore for entity-scoped fact storage
mverzilli Jun 10, 2026
1918471
feat(pxe): prune retractable entity facts on chain prune
mverzilli Jun 10, 2026
a1752cd
test(pxe): cover retractable entity prune in the synchronizer test
mverzilli Jun 10, 2026
eea00a0
refactor(pxe): rename entity store anchor to origin block
mverzilli Jun 10, 2026
753c09f
refactor(pxe): split StoredFact and StoredEntity into separate files
mverzilli Jun 10, 2026
e43ca83
add type aliases for readability
mverzilli Jun 12, 2026
b4d85e7
refactor
mverzilli Jun 12, 2026
f740bbf
more test coverage
mverzilli Jun 12, 2026
f41a8ab
renames
mverzilli Jun 12, 2026
9c546af
more refactors
mverzilli Jun 12, 2026
9fc3d50
make entity and fact creation idempotent instead of overwriting
mverzilli Jun 12, 2026
6b638e9
refactor
mverzilli Jun 12, 2026
4a8a441
refactor
mverzilli Jun 12, 2026
db2fb8b
more refactors
mverzilli Jun 12, 2026
7b40aa2
and more refactors
mverzilli Jun 12, 2026
19b6079
stronger write checks
mverzilli Jun 15, 2026
50b2a2f
more refactors
mverzilli Jun 15, 2026
bfbd60e
another refactor
mverzilli Jun 15, 2026
1c8cd73
tweak
mverzilli Jun 15, 2026
1d639bf
refactor
mverzilli Jun 15, 2026
fe78892
more refactors
mverzilli Jun 15, 2026
c59658e
rename files
mverzilli Jun 15, 2026
aeefa59
move types
mverzilli Jun 15, 2026
58f44d5
clean up stored_entity
mverzilli Jun 15, 2026
5a51955
simplify stored fact module
mverzilli Jun 15, 2026
e3843bc
comment cleanup
mverzilli Jun 15, 2026
cd75caa
use random values instead of hand-picked ones in tests
mverzilli Jun 15, 2026
476272f
sanitize tests
mverzilli Jun 15, 2026
9a2db88
fix ci
mverzilli Jun 15, 2026
e85a246
Merge branch 'merge-train/fairies-v5' into martin/f-729-fix-array-for…
mverzilli Jun 16, 2026
40d0613
Merge branch 'martin/f-729-fix-array-for-each' into martin/entity-store
mverzilli Jun 16, 2026
6c73766
Merge branch 'merge-train/fairies-v5' into martin/entity-store
mverzilli Jun 16, 2026
e82f03f
make entity creation idempotent
mverzilli Jun 17, 2026
fed3132
make blocksynchronizer ivars readonly
mverzilli Jun 17, 2026
1b4b0ab
simplify test description
mverzilli Jun 17, 2026
a328b40
commitRecord->commitFact
mverzilli Jun 17, 2026
63e6561
rename internal staged ops
mverzilli Jun 17, 2026
b560096
bifurcate block synchronizer prune test
mverzilli Jun 17, 2026
fddc199
add doesEntityExist
mverzilli Jun 17, 2026
bf3906b
idb hardening
mverzilli Jun 17, 2026
f550dce
enhance block synchronizer tests
mverzilli Jun 19, 2026
7547439
further explain entity store
mverzilli Jun 19, 2026
7568955
address code review feedback
mverzilli Jun 19, 2026
13fd6a8
more test coverage
mverzilli Jun 19, 2026
b4a1105
extract deleteFact
mverzilli Jun 19, 2026
1f39d9d
change stored entity encoding
mverzilli Jun 19, 2026
fe234b3
add logs for defensive cases
mverzilli Jun 19, 2026
0d27ad2
minor tweak
mverzilli Jun 19, 2026
b3a2331
linter
mverzilli Jun 19, 2026
c34c755
Merge branch 'merge-train/fairies-v5' into martin/entity-store
mverzilli Jun 19, 2026
391f21e
fix ci
mverzilli Jun 19, 2026
33b95b5
wip
mverzilli Jun 22, 2026
1600151
refactor entity -> fact collection
mverzilli Jun 22, 2026
c5563e7
more robust for idb
mverzilli Jun 22, 2026
d99df2b
tweaks
mverzilli Jun 22, 2026
231ca47
refactor(pxe): encode scope in fact collection keys
mverzilli Jun 22, 2026
17402d4
refactor(pxe): isolate fact collections by scope in the store
mverzilli Jun 22, 2026
712a7d2
test(pxe): update block synchronizer fact tests for scope-in-key
mverzilli Jun 22, 2026
273344c
test(pxe): regenerate fact store schema snapshots for scope-in-key (P…
mverzilli Jun 22, 2026
b935e93
docs(pxe): correct stale fact store JSDoc after scope-isolation refactor
mverzilli Jun 22, 2026
9e7ef97
trim comments
mverzilli Jun 22, 2026
cab7fb1
final touches
mverzilli Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 188 additions & 20 deletions yarn-project/pxe/src/block_synchronizer/block_synchronizer.test.ts

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions yarn-project/pxe/src/block_synchronizer/block_synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { BlockHeader } from '@aztec/stdlib/tx';
import type { BlockSynchronizerConfig } from '../config/index.js';
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
import type { AnchorBlockStore } from '../storage/anchor_block_store/index.js';
import type { FactStore } from '../storage/fact_store/fact_store.js';
import type { NoteStore } from '../storage/note_store/index.js';
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
import { blockStreamSourceFromAztecNode } from './block_stream_source.js';
Expand All @@ -26,14 +27,15 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
protected readonly blockStream: L2BlockStream;

constructor(
private node: AztecNode,
private store: AztecAsyncKVStore,
private anchorBlockStore: AnchorBlockStore,
private noteStore: NoteStore,
private privateEventStore: PrivateEventStore,
private l2TipsStore: L2TipsKVStore,
private contractSyncService: ContractSyncService,
private config: Partial<BlockSynchronizerConfig> = {},
private readonly node: AztecNode,
Comment thread
mverzilli marked this conversation as resolved.
private readonly store: AztecAsyncKVStore,
private readonly anchorBlockStore: AnchorBlockStore,
private readonly noteStore: NoteStore,
private readonly privateEventStore: PrivateEventStore,
private readonly factStore: FactStore,
private readonly l2TipsStore: L2TipsKVStore,
private readonly contractSyncService: ContractSyncService,
private readonly config: Partial<BlockSynchronizerConfig> = {},
bindings?: LoggerBindings,
) {
this.log = createLogger('pxe:block_synchronizer', bindings);
Expand Down Expand Up @@ -152,6 +154,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
await this.store.transactionAsync(async () => {
await this.noteStore.rollback(event.block.number);
await this.privateEventStore.rollback(event.block.number);
await this.factStore.rollback(event.block.number);
await this.updateAnchorBlockHeader(newAnchorBlockHeader);
});
break;
Expand Down
3 changes: 3 additions & 0 deletions yarn-project/pxe/src/pxe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export class PXE {
capsuleStore,
keyStore,
l2TipsStore,
factStore,
} = openPxeStores(store, initialBlockHash);
const contractSyncService = new ContractSyncService(
node,
Expand All @@ -289,6 +290,7 @@ export class PXE {
anchorBlockStore,
noteStore,
privateEventStore,
factStore,
l2TipsStore,
contractSyncService,
config,
Expand All @@ -302,6 +304,7 @@ export class PXE {
recipientTaggingStore,
privateEventStore,
noteStore,
factStore,
contractSyncService,
]);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"facts": [
{
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000aa:0x0000000000000000000000000000000000000000000000000000000000000003:0x00eebee6df09ad503384e049aea9fbf0c0db2f5af46673e550694c6564d973f7:6:0x0000000000000000000000000000000000000000000000000000000000000002",
"value": "00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000aa000000000000000000000000000000000000000000000000000000000000000300000001000000000000000000000000000000000000000000000000000000000000000501000000060000000000000000000000000000000000000000000000000000000000000002"
},
{
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb:0x0000000000000000000000000000000000000000000000000000000000000001:0x00a802572c436574f713d43f1852859f4496d694de0e5b17b89cf983439e6143:none",
"value": "00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000bb000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000000000000000"
},
{
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb:0x0000000000000000000000000000000000000000000000000000000000000002:0x00df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b811:5:0x0000000000000000000000000000000000000000000000000000000000000001",
"value": "00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000bb00000000000000000000000000000000000000000000000000000000000000020000000001000000050000000000000000000000000000000000000000000000000000000000000001"
}
],
"facts_by_collection": [
{
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000aa",
"value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000aa:0x0000000000000000000000000000000000000000000000000000000000000003:0x00eebee6df09ad503384e049aea9fbf0c0db2f5af46673e550694c6564d973f7:6:0x0000000000000000000000000000000000000000000000000000000000000002"
},
{
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb",
"value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb:0x0000000000000000000000000000000000000000000000000000000000000001:0x00a802572c436574f713d43f1852859f4496d694de0e5b17b89cf983439e6143:none"
},
{
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb",
"value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb:0x0000000000000000000000000000000000000000000000000000000000000002:0x00df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b811:5:0x0000000000000000000000000000000000000000000000000000000000000001"
}
],
"facts_by_block": [
{
"key": "num:5",
"value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000bb:0x0000000000000000000000000000000000000000000000000000000000000002:0x00df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b811:5:0x0000000000000000000000000000000000000000000000000000000000000001"
},
{
"key": "num:6",
"value": "utf8:0x0000000000000000000000000000000000000000000000000000000000000064:0x0000000000000000000000000000000000000000000000000000000000000001:0x0000000000000000000000000000000000000000000000000000000000000007:0x00000000000000000000000000000000000000000000000000000000000000aa:0x0000000000000000000000000000000000000000000000000000000000000003:0x00eebee6df09ad503384e049aea9fbf0c0db2f5af46673e550694c6564d973f7:6:0x0000000000000000000000000000000000000000000000000000000000000002"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"schemaVersion": 8,
"schemaVersion": 9,
"stores": [
{
"name": "address_book",
Expand Down Expand Up @@ -37,6 +37,18 @@
"name": "events_by_contract_selector",
"kind": "multimap"
},
{
"name": "facts",
"kind": "map"
},
{
"name": "facts_by_block",
"kind": "multimap"
},
{
"name": "facts_by_collection",
"kind": "multimap"
},
{
"name": "header",
"kind": "singleton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import { AddressStore } from '../address_store/address_store.js';
import { AnchorBlockStore } from '../anchor_block_store/index.js';
import { CapsuleStore } from '../capsule_store/capsule_store.js';
import { ContractStore } from '../contract_store/contract_store.js';
import { FactStore } from '../fact_store/fact_store.js';
import { FactCollectionKey } from '../fact_store/fact_store_keys.js';
import { NoteStore } from '../note_store/note_store.js';
import { PrivateEventStore } from '../private_event_store/private_event_store.js';
import { RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '../tagging_store/index.js';
Expand Down Expand Up @@ -214,6 +216,40 @@ export const SCHEMA_TESTS: readonly SchemaTest[] = [
}),
},

{
name: 'FactStore',
writeToStore: async kvStore => {
const factStore = new FactStore(kvStore);
const jobId = 'fixture-job';
const contract = AztecAddress.fromBigInt(100n);
const scope = AztecAddress.fromBigInt(1n);
const factCollectionTypeId = new Fr(7n);
const keyA = FactCollectionKey.from({
contractAddress: contract,
scope,
factCollectionTypeId,
factCollectionId: new Fr(0xaan),
});
const keyB = FactCollectionKey.from({
contractAddress: contract,
scope,
factCollectionTypeId,
factCollectionId: new Fr(0xbbn),
});
// A collection whose only fact is retractable (origin block 6): pruned on a reorg above block 6.
await factStore.recordFact(keyA, new Fr(3n), [new Fr(5n)], { blockNumber: 6, blockHash: new Fr(2n) }, jobId);
// A collection with a non-retractable and a retractable fact.
await factStore.recordFact(keyB, new Fr(1n), [new Fr(9n)], undefined, jobId);
await factStore.recordFact(keyB, new Fr(2n), [], { blockNumber: 5, blockHash: new Fr(1n) }, jobId);
await kvStore.transactionAsync(() => factStore.commit(jobId));
},
snapshotStore: async kvStore => ({
facts: await snapshotMap(kvStore.openMap<string, Buffer>('facts')),
facts_by_collection: await snapshotMap(kvStore.openMultiMap<string, string>('facts_by_collection')),
facts_by_block: await snapshotMap(kvStore.openMultiMap<number, string>('facts_by_block')),
}),
},

{
name: 'KeyStore',
writeToStore: async kvStore => {
Expand Down
Loading
Loading