Skip to content

Commit 0afe779

Browse files
committed
Merge remote-tracking branch 'origin/maxim/f-669-aztec-nr-calculate_secret_and_index-helper-for-constrained' into maxim/f-669-aztec-nr-calculate_secret_and_index-helper-for-constrained
2 parents 37c3d0e + f686408 commit 0afe779

3 files changed

Lines changed: 5 additions & 19 deletions

File tree

barretenberg/cpp/src/barretenberg/aztec/aztec_constants.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@
247247
#define AVM_EMITPUBLICLOG_DYN_DA_GAS 32
248248
#define AVM_SSTORE_DYN_DA_GAS 64
249249
#define AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_HEIGHT 6
250-
#define AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_ROOT "0x13954b76f8ab76c38ab687731f802fc90e5d55e0592fa6f56d0a73024b3f8356"
250+
#define AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_ROOT \
251+
"0x13954b76f8ab76c38ab687731f802fc90e5d55e0592fa6f56d0a73024b3f8356"
251252
#define AVM_WRITTEN_PUBLIC_DATA_SLOTS_TREE_INITIAL_SIZE 1
252253
#define AVM_RETRIEVED_BYTECODES_TREE_HEIGHT 5
253254
#define AVM_RETRIEVED_BYTECODES_TREE_INITIAL_ROOT "0x0ff65ad321f05745d4c80e2e18e94241093d2e49017ff8cc151df4f207a43c12"

yarn-project/pxe/src/storage/tagging_store/sender_tagging_store.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Fr } from '@aztec/foundation/curves/bn254';
22
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
33
import { RevertCode } from '@aztec/stdlib/avm';
4-
import type { AppTaggingSecret, ExtendedDirectionalAppTaggingSecret, TaggingIndexRange } from '@aztec/stdlib/logs';
5-
import { PrivateLog, SiloedTag, siloedTagFor } from '@aztec/stdlib/logs';
4+
import type { AppTaggingSecret, TaggingIndexRange } from '@aztec/stdlib/logs';
5+
import { ExtendedDirectionalAppTaggingSecret, PrivateLog, SiloedTag, siloedTagFor } from '@aztec/stdlib/logs';
66
import { randomConstrainedAppTaggingSecret, randomExtendedDirectionalAppTaggingSecret } from '@aztec/stdlib/testing';
77
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
88

@@ -629,7 +629,6 @@ describe('SenderTaggingStore', () => {
629629
// finalizer must not treat it as a surviving constrained-tag. The onchain emission would have used the
630630
// constrained domain separator, so the values are different.
631631
it('does not cross-match a tag computed under the wrong domain separator', async () => {
632-
const sharedFr = Fr.random();
633632
const constrainedSecret = await randomConstrainedAppTaggingSecret();
634633

635634
const txHash = TxHash.random();
@@ -639,7 +638,7 @@ describe('SenderTaggingStore', () => {
639638
// this via the public construction path keeps the test independent of how the production code derives Frs.
640639
// Emit a tag using the *unconstrained* domain separator for the same Fr/index combination. This should NOT match.
641640
const wrongDomSepTag = await SiloedTag.compute({
642-
extendedSecret: { secret: sharedFr, app: constrainedSecret.app } as ExtendedDirectionalAppTaggingSecret,
641+
extendedSecret: new ExtendedDirectionalAppTaggingSecret(constrainedSecret.secret, constrainedSecret.app),
643642
index: 1,
644643
});
645644
const txEffect = makeTxEffect(txHash, [wrongDomSepTag]);

yarn-project/stdlib/src/logs/app_tagging_secret.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ describe('AppTaggingSecret helpers', () => {
3838
describe('TaggingIndexRangeSchema', () => {
3939
it('preserves constrained secret kind when parsing a TaggingIndexRange', async () => {
4040
const original = await randomConstrainedAppTaggingSecret();
41-
const index = 2;
4241

4342
const parsed = TaggingIndexRangeSchema.parse({
4443
extendedSecret: {
@@ -52,19 +51,6 @@ describe('AppTaggingSecret helpers', () => {
5251

5352
expect(parsed.extendedSecret).toBeInstanceOf(ConstrainedAppTaggingSecret);
5453
expect(parsed.extendedSecret.kind).toBe(AppTaggingSecretKind.CONSTRAINED);
55-
56-
const computedTag = await siloedTagFor(parsed.extendedSecret, index);
57-
58-
const expectedInner = await poseidon2Hash([original.secret, new Fr(index)]);
59-
const expectedLogTag = await computeLogTag(expectedInner, DomainSeparator.CONSTRAINED_MSG_LOG_TAG);
60-
const expectedSiloed = await computeSiloedPrivateLogFirstField(original.app, expectedLogTag);
61-
62-
expect(computedTag.value.toString()).toEqual(expectedSiloed.toString());
63-
64-
const wrongLogTag = await computeLogTag(expectedInner, DomainSeparator.UNCONSTRAINED_MSG_LOG_TAG);
65-
const wrongSiloed = await computeSiloedPrivateLogFirstField(original.app, wrongLogTag);
66-
67-
expect(computedTag.value.toString()).not.toEqual(wrongSiloed.toString());
6854
});
6955

7056
it('preserves unconstrained secret kind when parsing a TaggingIndexRange', async () => {

0 commit comments

Comments
 (0)