-
Notifications
You must be signed in to change notification settings - Fork 599
fix: not reusing tags of partially reverted txs #20817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
benesjan
merged 8 commits into
merge-train/fairies
from
02-24-fix_not_reusing_tags_of_partially_reverted_txs
Mar 11, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e81f0b7
wip
benesjan d8643fa
wip
benesjan d0470b4
Update yarn-project/pxe/src/storage/tagging_store/sender_tagging_stor…
benesjan f02c92a
Bumping PXE_DATA_SCHEMA_VERSION
benesjan 2ee2922
fix
benesjan 96a5cfc
returning data instead of callback pattern
benesjan 22646e4
not using db tx
benesjan 546b43e
Revert "not using db tx"
benesjan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 16 additions & 11 deletions
27
yarn-project/pxe/src/contract_function_simulator/execution_tagging_index_cache.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,37 @@ | ||
| import { ExtendedDirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs'; | ||
| import { ExtendedDirectionalAppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs'; | ||
|
|
||
| /** | ||
| * A map that stores the tagging index for a given extended directional app tagging secret. | ||
| * A map that stores the tagging index range for a given extended directional app tagging secret. | ||
| * Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction | ||
| * of sender -> recipient matters. | ||
| */ | ||
| export class ExecutionTaggingIndexCache { | ||
| private taggingIndexMap: Map<string, number> = new Map(); | ||
| private taggingIndexMap: Map<string, { lowestIndex: number; highestIndex: number }> = new Map(); | ||
|
|
||
| public getLastUsedIndex(secret: ExtendedDirectionalAppTaggingSecret): number | undefined { | ||
| return this.taggingIndexMap.get(secret.toString()); | ||
| return this.taggingIndexMap.get(secret.toString())?.highestIndex; | ||
| } | ||
|
|
||
| public setLastUsedIndex(secret: ExtendedDirectionalAppTaggingSecret, index: number) { | ||
| const currentValue = this.taggingIndexMap.get(secret.toString()); | ||
| if (currentValue !== undefined && currentValue !== index - 1) { | ||
| throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`); | ||
| if (currentValue !== undefined && currentValue.highestIndex !== index - 1) { | ||
| throw new Error(`Invalid tagging index update. Current value: ${currentValue.highestIndex}, new value: ${index}`); | ||
| } | ||
| if (currentValue !== undefined) { | ||
| currentValue.highestIndex = index; | ||
| } else { | ||
| this.taggingIndexMap.set(secret.toString(), { lowestIndex: index, highestIndex: index }); | ||
| } | ||
| this.taggingIndexMap.set(secret.toString(), index); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the pre-tags that were used in this execution (and that need to be stored in the db). | ||
| * Returns the tagging index ranges that were used in this execution (and that need to be stored in the db). | ||
| */ | ||
| public getUsedPreTags(): PreTag[] { | ||
| return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({ | ||
| public getUsedTaggingIndexRanges(): TaggingIndexRange[] { | ||
| return Array.from(this.taggingIndexMap.entries()).map(([secret, { lowestIndex, highestIndex }]) => ({ | ||
| extendedSecret: ExtendedDirectionalAppTaggingSecret.fromString(secret), | ||
| index, | ||
| lowestIndex, | ||
| highestIndex, | ||
| })); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export const PXE_DATA_SCHEMA_VERSION = 3; | ||
| export const PXE_DATA_SCHEMA_VERSION = 4; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.