Skip to content

Conversation

@mverzilli
Copy link
Contributor

@mverzilli mverzilli commented Jan 9, 2026

Third part of the series started with #19445.

This makes the stores related to tagging synchronization work based on staged writes.

@mverzilli mverzilli added the ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure label Jan 9, 2026
@mverzilli mverzilli changed the base branch from next to martin/capsule-store-with-staged-writes January 9, 2026 21:46
@mverzilli mverzilli changed the title refactor: staged writes in tagging stores (wip) refactor: staged writes in tagging stores Jan 9, 2026
@AztecBot AztecBot force-pushed the martin/capsule-store-with-staged-writes branch from 1de3908 to b30c796 Compare January 12, 2026 18:35
Base automatically changed from martin/capsule-store-with-staged-writes to next January 12, 2026 19:18
Copy link
Contributor

@nventuro nventuro left a comment

Choose a reason for hiding this comment

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

It looks like the capsule changes got here. Can you fix the branch?

Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

Most of it are nits and would approve if it were not for the sender_tagging_store test. Those seems to be quite messy.

All the naming suggestions are up for a debate. Just felt like plenty of it could be cuter.

BTW really like the whole staging approach you came up with. It's very elegant. Great job!

end: number,
aztecNode: AztecNode,
taggingStore: SenderTaggingStore,
jobId: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

The docs became stale here but I also feel like the param is not worth documenting (as well as aztecNode and taggingStore).

When I implemented loadPrivateLogsForSenderRecipientPair I decided to use the better style of docs which Nico proposed in Aztec.nr. Maybe we could do the same here.

app: AztecAddress,
aztecNode: AztecNode,
taggingStore: SenderTaggingStore,
jobId: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as before here is also missing param desc but I see that I didn't bother with documenting here aztecNode and taggingStore when working on this.

Do you think it's ok to have the standard TSDoc style without having all the params described?

Comment on lines 13 to 14
*
* TODO(benesjan): Relocate to yarn-project/pxe/src/storage/tagging_store
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
*
* TODO(benesjan): Relocate to yarn-project/pxe/src/storage/tagging_store

Unrelated but I forgot to drop this comment before and this is a good PR to sneak that in.

return jobStagedHighestAgedIndex;
}

async #getHighestFinalizedIndexFromStage(jobId: string, secret: string): Promise<number | undefined> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
async #getHighestFinalizedIndexFromStage(jobId: string, secret: string): Promise<number | undefined> {
async #getHighestFinalizedIndexForJob(jobId: string, secret: string): Promise<number | undefined> {

Think the original name is misleading (I think of stage as e.g. stake 2 of a multiple staged process). Please also update the rest if you agree.

this.#stagedHighestFinalizedIndex = new Map();
}

#getJobStagedHighestAgedIndex(jobId: string): Map<string, number> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#getJobStagedHighestAgedIndex(jobId: string): Map<string, number> {
#getHighestAgedIndexForJob(jobId: string): Map<string, number> {

Think this name is a bit easier to comprehend.

Comment on lines +577 to +579
const txHash1 = TxHash.random();
const txHash2 = TxHash.random();
const txHash3 = TxHash.random();
Copy link
Contributor

Choose a reason for hiding this comment

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

These values are used only once so would drop these and have them be hardcoded directly in the call.

const anotherStagingJobId: string = 'another-staging-job-id';

// Committed: index 3 pending
await taggingStore.storePendingIndexes([{ secret: secret1, index: 3 }], txHash1, commitJobId);
Copy link
Contributor

Choose a reason for hiding this comment

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

OTOH the index here and below are then checked against so makes sense to have them be a constant.


// Committed: index 3 pending
await taggingStore.storePendingIndexes([{ secret: secret1, index: 3 }], txHash1, commitJobId);
await taggingStore.commit(commitJobId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why even commit here? It should be fine to just check for undefined, no?

expect(await taggingStore.getLastFinalizedIndex(secret1, stagingJobId)).toBe(3);
});

it('stages pending and finalized index operations independently', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this test name could also be clearer. Why introduce "operations" here when the term is not used anywhere else?

expect(await taggingStore.getLastUsedIndex(secret1, stagingJobId)).toBe(7);
});

it('drops pending indexes in staging correctly', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't test anything new that removes all pending indexes for a given tx hash test case doesn't test.

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.

4 participants