Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{
"highest_aged_index": [
{
"key": "utf8:constrained:0x0000000000000000000000000000000000000000000000000000000000000013:0x0000000000000000000000000000000000000000000000000000000000000017",
"value": "num:13"
},
{
"key": "utf8:unconstrained:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
"value": "num:13"
}
],
"highest_finalized_index": [
{
"key": "utf8:constrained:0x0000000000000000000000000000000000000000000000000000000000000013:0x0000000000000000000000000000000000000000000000000000000000000017",
"value": "num:11"
},
{
"key": "utf8:unconstrained:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
"value": "num:11"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"pending_indexes": [
{
"key": "utf8:constrained:0x0000000000000000000000000000000000000000000000000000000000000013:0x0000000000000000000000000000000000000000000000000000000000000017",
"value": "[{\"lowestIndex\":4,\"highestIndex\":7,\"txHash\":\"0x0000000000000000000000000000000000000000000000000000000000000025\"}]"
},
{
"key": "utf8:unconstrained:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
"value": "[{\"lowestIndex\":4,\"highestIndex\":7,\"txHash\":\"0x0000000000000000000000000000000000000000000000000000000000000013\"},{\"lowestIndex\":8,\"highestIndex\":11,\"txHash\":\"0x0000000000000000000000000000000000000000000000000000000000000017\"}]"
Expand All @@ -10,6 +14,10 @@
}
],
"last_finalized_indexes": [
{
"key": "utf8:constrained:0x0000000000000000000000000000000000000000000000000000000000000013:0x0000000000000000000000000000000000000000000000000000000000000017",
"value": "num:3"
},
{
"key": "utf8:unconstrained:0x0000000000000000000000000000000000000000000000000000000000000002:0x0000000000000000000000000000000000000000000000000000000000000003",
"value": "num:3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { GasFees } from '@aztec/stdlib/gas';
import { PublicKey, PublicKeys, deriveKeys } from '@aztec/stdlib/keys';
import {
AppTaggingSecret,
AppTaggingSecretKind,
ContractClassLog,
ContractClassLogFields,
PrivateLog,
Expand Down Expand Up @@ -530,10 +531,18 @@ export const SCHEMA_TESTS: readonly SchemaTest[] = [
const jobId = 'fixture-job';
const secretA = new AppTaggingSecret(new Fr(2n), AztecAddress.fromBigIntUnsafe(3n));
const secretB = new AppTaggingSecret(new Fr(5n), AztecAddress.fromBigIntUnsafe(7n));
// A constrained secret keys under the `constrained:` prefix, so the snapshot pins both kinds side by side.
const secretConstrained = new AppTaggingSecret(
new Fr(19n),
AztecAddress.fromBigIntUnsafe(23n),
AppTaggingSecretKind.CONSTRAINED,
);

await recipientTaggingStore.updateHighestFinalizedIndex(secretA, 11, jobId);
await recipientTaggingStore.updateHighestAgedIndex(secretA, 13, jobId);
await recipientTaggingStore.updateHighestFinalizedIndex(secretB, 17, jobId);
await recipientTaggingStore.updateHighestFinalizedIndex(secretConstrained, 11, jobId);
await recipientTaggingStore.updateHighestAgedIndex(secretConstrained, 13, jobId);
await kvStore.transactionAsync(() => recipientTaggingStore.commit(jobId));
},
snapshotStore: async kvStore => ({
Expand Down Expand Up @@ -584,10 +593,17 @@ export const SCHEMA_TESTS: readonly SchemaTest[] = [
const secretA = new AppTaggingSecret(new Fr(2n), AztecAddress.fromBigIntUnsafe(3n));
const secretB = new AppTaggingSecret(new Fr(5n), AztecAddress.fromBigIntUnsafe(7n));
const secretC = new AppTaggingSecret(new Fr(11n), AztecAddress.fromBigIntUnsafe(13n));
const secretConstrained = new AppTaggingSecret(
new Fr(19n),
AztecAddress.fromBigIntUnsafe(23n),
AppTaggingSecretKind.CONSTRAINED,
);
const txHashA = TxHash.fromBigInt(17n);
const txHashB = TxHash.fromBigInt(19n);
const txHashC = TxHash.fromBigInt(23n);
const txHashD = TxHash.fromBigInt(29n);
const txHashE = TxHash.fromBigInt(31n);
const txHashF = TxHash.fromBigInt(37n);

// secretA receives three pending ranges (one per tx); secretB receives one. After finalizing txHashA below,
// secretA's array shrinks to two elements (the txHashB and txHashC ranges, both with highestIndex > 3) which
Expand Down Expand Up @@ -626,7 +642,20 @@ export const SCHEMA_TESTS: readonly SchemaTest[] = [
jobId,
);

await senderTaggingStore.finalizePendingIndexes([txHashA], jobId);
// secretConstrained gets a finalized range (txHashE) plus a surviving higher pending range (txHashF), so the
// `constrained:` key lands in both pending_indexes and last_finalized_indexes.
await senderTaggingStore.storePendingIndexes(
[{ extendedSecret: secretConstrained, lowestIndex: 1, highestIndex: 3 }],
txHashE,
jobId,
);
await senderTaggingStore.storePendingIndexes(
[{ extendedSecret: secretConstrained, lowestIndex: 4, highestIndex: 7 }],
txHashF,
jobId,
);

await senderTaggingStore.finalizePendingIndexes([txHashA, txHashE], jobId);

await kvStore.transactionAsync(() => senderTaggingStore.commit(jobId));
},
Expand Down
Loading