@aztec/stdlib 0.0.1-commit.7ac86ea28 → 0.0.1-commit.7b86788
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/decoder.d.ts +1 -1
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +1 -4
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +9 -5
- package/dest/avm/avm.d.ts +300 -300
- package/dest/avm/avm_proving_request.d.ts +166 -166
- package/dest/avm/revert_code.d.ts +16 -1
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -5
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +10 -0
- package/dest/ha-signing/config.d.ts +101 -0
- package/dest/ha-signing/config.d.ts.map +1 -0
- package/dest/ha-signing/config.js +92 -0
- package/dest/ha-signing/index.d.ts +3 -0
- package/dest/ha-signing/index.d.ts.map +1 -0
- package/dest/ha-signing/index.js +2 -0
- package/dest/ha-signing/types.d.ts +85 -0
- package/dest/ha-signing/types.d.ts.map +1 -0
- package/dest/ha-signing/types.js +32 -0
- package/dest/interfaces/p2p.d.ts +3 -8
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +2 -2
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -3
- package/dest/logs/debug_log_store.d.ts +30 -0
- package/dest/logs/debug_log_store.d.ts.map +1 -0
- package/dest/logs/debug_log_store.js +30 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
- package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +23 -15
- package/dest/logs/index.d.ts +3 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -1
- package/dest/logs/pre_tag.d.ts +16 -11
- package/dest/logs/pre_tag.d.ts.map +1 -1
- package/dest/logs/pre_tag.js +2 -2
- package/dest/logs/siloed_tag.d.ts +5 -3
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +6 -1
- package/dest/logs/tag.js +1 -1
- package/dest/p2p/attestation_utils.d.ts +11 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +45 -0
- package/dest/p2p/block_proposal.d.ts +2 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +2 -2
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +1 -1
- package/dest/p2p/client_type.d.ts +2 -5
- package/dest/p2p/client_type.d.ts.map +1 -1
- package/dest/p2p/client_type.js +0 -7
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/p2p/topic_type.d.ts +3 -4
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +7 -24
- package/dest/tests/factories.d.ts +3 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +8 -0
- package/dest/tests/mocks.d.ts +2 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +5 -5
- package/dest/tx/tx_receipt.d.ts +16 -2
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +11 -3
- package/package.json +10 -10
- package/src/abi/decoder.ts +1 -4
- package/src/abi/encoder.ts +8 -5
- package/src/avm/revert_code.ts +15 -0
- package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
- package/src/ha-signing/config.ts +149 -0
- package/src/ha-signing/index.ts +18 -0
- package/src/ha-signing/types.ts +112 -0
- package/src/interfaces/p2p.ts +2 -13
- package/src/interfaces/validator.ts +1 -1
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
- package/src/kernel/hints/build_transient_data_hints.ts +17 -2
- package/src/logs/debug_log_store.ts +54 -0
- package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +24 -16
- package/src/logs/index.ts +2 -1
- package/src/logs/pre_tag.ts +5 -5
- package/src/logs/siloed_tag.ts +8 -2
- package/src/logs/tag.ts +1 -1
- package/src/p2p/attestation_utils.ts +56 -0
- package/src/p2p/block_proposal.ts +1 -1
- package/src/p2p/checkpoint_proposal.ts +1 -1
- package/src/p2p/client_type.ts +0 -6
- package/src/p2p/index.ts +0 -1
- package/src/p2p/topic_type.ts +8 -15
- package/src/tests/factories.ts +9 -0
- package/src/tests/mocks.ts +7 -3
- package/src/tx/tx_receipt.ts +10 -0
- package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
- package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { MAX_NOTE_HASH_READ_REQUESTS_PER_TX } from '@aztec/constants';
|
|
2
2
|
import { NoteHashReadRequestHintsBuilder } from './note_hash_read_request_hints.js';
|
|
3
3
|
import { PendingReadHint, ReadRequestActionEnum, ReadRequestResetActions } from './read_request_hints.js';
|
|
4
|
-
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
5
4
|
export function isValidNoteHashReadRequest(readRequest, noteHash) {
|
|
6
5
|
return noteHash.value.equals(readRequest.value) && noteHash.contractAddress.equals(readRequest.contractAddress) && readRequest.counter > noteHash.counter;
|
|
7
6
|
}
|
|
8
|
-
export function getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes
|
|
7
|
+
export function getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes) {
|
|
9
8
|
const resetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
10
9
|
const noteHashMap = new Map();
|
|
11
10
|
noteHashes.getActiveItems().forEach((noteHash, index)=>{
|
|
@@ -17,15 +16,19 @@ export function getNoteHashReadRequestResetActions(noteHashReadRequests, noteHas
|
|
|
17
16
|
});
|
|
18
17
|
noteHashMap.set(value, arr);
|
|
19
18
|
});
|
|
20
|
-
const futureNoteHashMap = new ScopedValueCache(futureNoteHashes);
|
|
21
19
|
for(let i = 0; i < noteHashReadRequests.claimedLength; ++i){
|
|
22
20
|
const readRequest = noteHashReadRequests.array[i];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
26
|
-
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNoteHash.index));
|
|
27
|
-
} else if (!futureNoteHashMap.get(readRequest).find((futureNoteHash)=>isValidNoteHashReadRequest(readRequest, futureNoteHash))) {
|
|
21
|
+
if (readRequest.contractAddress.isZero()) {
|
|
22
|
+
// Settled read: empty contract address means resolve against the note hash tree.
|
|
28
23
|
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_SETTLED;
|
|
24
|
+
} else {
|
|
25
|
+
// Pending read: non-empty contract address means match against a pending note hash.
|
|
26
|
+
const pendingNoteHash = noteHashMap.get(readRequest.value.toBigInt())?.find((n)=>isValidNoteHashReadRequest(readRequest, n.noteHash));
|
|
27
|
+
if (pendingNoteHash) {
|
|
28
|
+
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
29
|
+
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNoteHash.index));
|
|
30
|
+
}
|
|
31
|
+
// Otherwise, the read request may be resolved by a future note hash. Leave as NOOP.
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
return resetActions;
|
|
@@ -67,7 +70,7 @@ export async function buildNoteHashReadRequestHintsFromResetActions(oracle, note
|
|
|
67
70
|
});
|
|
68
71
|
return builder.toHints();
|
|
69
72
|
}
|
|
70
|
-
export async function buildNoteHashReadRequestHints(oracle, noteHashReadRequests, noteHashes,
|
|
71
|
-
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes
|
|
73
|
+
export async function buildNoteHashReadRequestHints(oracle, noteHashReadRequests, noteHashes, maxPending = MAX_NOTE_HASH_READ_REQUESTS_PER_TX, maxSettled = MAX_NOTE_HASH_READ_REQUESTS_PER_TX) {
|
|
74
|
+
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes);
|
|
72
75
|
return await buildNoteHashReadRequestHintsFromResetActions(oracle, noteHashReadRequests, noteHashes, resetActions, maxPending, maxSettled);
|
|
73
76
|
}
|
|
@@ -11,12 +11,12 @@ interface NullifierMembershipWitnessWithPreimage {
|
|
|
11
11
|
membershipWitness: MembershipWitness<typeof NULLIFIER_TREE_HEIGHT>;
|
|
12
12
|
leafPreimage: NullifierLeafPreimage;
|
|
13
13
|
}
|
|
14
|
-
export declare function getNullifierReadRequestResetActions(nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>, nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX
|
|
14
|
+
export declare function getNullifierReadRequestResetActions(nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>, nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>): ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>;
|
|
15
15
|
export declare function buildNullifierReadRequestHintsFromResetActions<PENDING extends number, SETTLED extends number>(oracle: {
|
|
16
16
|
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitnessWithPreimage>;
|
|
17
17
|
}, nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>, resetActions: ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>, maxPending?: PENDING, maxSettled?: SETTLED): Promise<import("./nullifier_read_request_hints.js").NullifierReadRequestHints<PENDING, SETTLED>>;
|
|
18
18
|
export declare function buildNullifierReadRequestHints<PENDING extends number, SETTLED extends number>(oracle: {
|
|
19
19
|
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitnessWithPreimage>;
|
|
20
|
-
}, nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>, nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
20
|
+
}, nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>, nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>, maxPending?: PENDING, maxSettled?: SETTLED): Promise<import("./nullifier_read_request_hints.js").NullifierReadRequestHints<PENDING, SETTLED>>;
|
|
21
21
|
export {};
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfbnVsbGlmaWVyX3JlYWRfcmVxdWVzdF9oaW50cy5kLnRzIiwic291cmNlUm9vdCI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ullifier_read_request_hints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,kCAAkC,EAClC,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAA0C,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"build_nullifier_read_request_hints.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/build_nullifier_read_request_hints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,kCAAkC,EAClC,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAA0C,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE1G,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,WAMrG;AAED,UAAU,sCAAsC;IAC9C,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,CAAC;IACnE,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED,wBAAgB,mCAAmC,CACjD,qBAAqB,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC,EACvG,UAAU,EAAE,kBAAkB,CAAC,eAAe,EAAE,OAAO,qBAAqB,CAAC,GAC5E,uBAAuB,CAAC,OAAO,kCAAkC,CAAC,CAgCpE;AAED,wBAAsB,8CAA8C,CAAC,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EACjH,MAAM,EAAE;IACN,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;CAC/F,EACD,qBAAqB,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC,EACvG,YAAY,EAAE,uBAAuB,CAAC,OAAO,kCAAkC,CAAC,EAChF,UAAU,GAAE,OAAuD,EACnE,UAAU,GAAE,OAAuD,oGA+BpE;AAED,wBAAsB,8BAA8B,CAAC,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EACjG,MAAM,EAAE;IACN,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;CAC/F,EACD,qBAAqB,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC,EACvG,UAAU,EAAE,kBAAkB,CAAC,eAAe,EAAE,OAAO,qBAAqB,CAAC,EAC7E,UAAU,GAAE,OAAuD,EACnE,UAAU,GAAE,OAAuD,oGAUpE"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '@aztec/constants';
|
|
2
2
|
import { NullifierReadRequestHintsBuilder } from './nullifier_read_request_hints.js';
|
|
3
3
|
import { PendingReadHint, ReadRequestActionEnum, ReadRequestResetActions } from './read_request_hints.js';
|
|
4
|
-
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
5
4
|
export function isValidNullifierReadRequest(readRequest, nullifier) {
|
|
6
5
|
return readRequest.value.equals(nullifier.value) && nullifier.contractAddress.equals(readRequest.contractAddress) && readRequest.counter > nullifier.counter;
|
|
7
6
|
}
|
|
8
|
-
export function getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers
|
|
7
|
+
export function getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers) {
|
|
9
8
|
const resetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
10
9
|
const nullifierMap = new Map();
|
|
11
10
|
nullifiers.getActiveItems().forEach((nullifier, index)=>{
|
|
@@ -17,15 +16,19 @@ export function getNullifierReadRequestResetActions(nullifierReadRequests, nulli
|
|
|
17
16
|
});
|
|
18
17
|
nullifierMap.set(value, arr);
|
|
19
18
|
});
|
|
20
|
-
const futureNullifiersMap = new ScopedValueCache(futureNullifiers);
|
|
21
19
|
for(let i = 0; i < nullifierReadRequests.claimedLength; ++i){
|
|
22
20
|
const readRequest = nullifierReadRequests.array[i];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
26
|
-
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNullifier.index));
|
|
27
|
-
} else if (!futureNullifiersMap.get(readRequest).some((futureNullifier)=>isValidNullifierReadRequest(readRequest, futureNullifier))) {
|
|
21
|
+
if (readRequest.contractAddress.isZero()) {
|
|
22
|
+
// Settled read: empty contract address means resolve against the nullifier tree.
|
|
28
23
|
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_SETTLED;
|
|
24
|
+
} else {
|
|
25
|
+
// Pending read: non-empty contract address means match against a pending nullifier.
|
|
26
|
+
const pendingNullifier = nullifierMap.get(readRequest.value.toBigInt())?.find(({ nullifier })=>isValidNullifierReadRequest(readRequest, nullifier));
|
|
27
|
+
if (pendingNullifier) {
|
|
28
|
+
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
29
|
+
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNullifier.index));
|
|
30
|
+
}
|
|
31
|
+
// Otherwise, the read request may be resolved by a future nullifier. Leave as NOOP.
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
return resetActions;
|
|
@@ -54,7 +57,7 @@ export async function buildNullifierReadRequestHintsFromResetActions(oracle, nul
|
|
|
54
57
|
}
|
|
55
58
|
return builder.toHints();
|
|
56
59
|
}
|
|
57
|
-
export async function buildNullifierReadRequestHints(oracle, nullifierReadRequests, nullifiers,
|
|
58
|
-
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers
|
|
60
|
+
export async function buildNullifierReadRequestHints(oracle, nullifierReadRequests, nullifiers, maxPending = MAX_NULLIFIER_READ_REQUESTS_PER_TX, maxSettled = MAX_NULLIFIER_READ_REQUESTS_PER_TX) {
|
|
61
|
+
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers);
|
|
59
62
|
return await buildNullifierReadRequestHintsFromResetActions(oracle, nullifierReadRequests, resetActions, maxPending, maxSettled);
|
|
60
63
|
}
|
|
@@ -2,10 +2,13 @@ import type { Tuple } from '@aztec/foundation/serialize';
|
|
|
2
2
|
import type { ClaimedLengthArray } from '../claimed_length_array.js';
|
|
3
3
|
import type { ScopedNoteHash } from '../note_hash.js';
|
|
4
4
|
import type { ScopedNullifier } from '../nullifier.js';
|
|
5
|
+
import type { PrivateLogData, ScopedPrivateLogData } from '../private_log_data.js';
|
|
5
6
|
import type { ScopedReadRequest } from './read_request.js';
|
|
6
7
|
import { TransientDataSquashingHint } from './transient_data_squashing_hint.js';
|
|
7
|
-
export declare function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIERS_LEN extends number>(noteHashes: ClaimedLengthArray<ScopedNoteHash, NOTE_HASHES_LEN>, nullifiers: ClaimedLengthArray<ScopedNullifier, NULLIFIERS_LEN>, futureNoteHashReads: ScopedReadRequest[], futureNullifierReads: ScopedReadRequest[], noteHashNullifierCounterMap: Map<number, number>, splitCounter: number): {
|
|
8
|
+
export declare function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIERS_LEN extends number>(noteHashes: ClaimedLengthArray<ScopedNoteHash, NOTE_HASHES_LEN>, nullifiers: ClaimedLengthArray<ScopedNullifier, NULLIFIERS_LEN>, futureNoteHashReads: ScopedReadRequest[], futureNullifierReads: ScopedReadRequest[], futureLogs: PrivateLogData[], noteHashNullifierCounterMap: Map<number, number>, splitCounter: number): {
|
|
8
9
|
numTransientData: number;
|
|
9
10
|
hints: Tuple<TransientDataSquashingHint, NULLIFIERS_LEN>;
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
/** Counts private logs that are linked to squashed note hashes and would be removed along with them. */
|
|
13
|
+
export declare function countSquashedLogs<NOTE_HASHES_LEN extends number, LOGS_LEN extends number>(noteHashes: ClaimedLengthArray<ScopedNoteHash, NOTE_HASHES_LEN>, privateLogs: ClaimedLengthArray<ScopedPrivateLogData, LOGS_LEN>, squashingHints: TransientDataSquashingHint[]): number;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGRfdHJhbnNpZW50X2RhdGFfaGludHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9rZXJuZWwvaGludHMvYnVpbGRfdHJhbnNpZW50X2RhdGFfaGludHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUN0RCxPQU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UMsRUFDL0QsY0FBYyxFQUFFLDBCQUEwQixFQUFFLEdBQzNDLE1BQU0sQ0FHUiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_transient_data_hints.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/build_transient_data_hints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"build_transient_data_hints.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/build_transient_data_hints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,wBAAgB,uBAAuB,CAAC,eAAe,SAAS,MAAM,EAAE,cAAc,SAAS,MAAM,EACnG,UAAU,EAAE,kBAAkB,CAAC,cAAc,EAAE,eAAe,CAAC,EAC/D,UAAU,EAAE,kBAAkB,CAAC,eAAe,EAAE,cAAc,CAAC,EAC/D,mBAAmB,EAAE,iBAAiB,EAAE,EACxC,oBAAoB,EAAE,iBAAiB,EAAE,EACzC,UAAU,EAAE,cAAc,EAAE,EAC5B,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,YAAY,EAAE,MAAM,GACnB;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,0BAA0B,EAAE,cAAc,CAAC,CAAA;CAAE,CA8DxF;AAED,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,eAAe,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,EACvF,UAAU,EAAE,kBAAkB,CAAC,cAAc,EAAE,eAAe,CAAC,EAC/D,WAAW,EAAE,kBAAkB,CAAC,oBAAoB,EAAE,QAAQ,CAAC,EAC/D,cAAc,EAAE,0BAA0B,EAAE,GAC3C,MAAM,CAGR"}
|
|
@@ -3,17 +3,19 @@ import { isValidNoteHashReadRequest } from './build_note_hash_read_request_hints
|
|
|
3
3
|
import { isValidNullifierReadRequest } from './build_nullifier_read_request_hints.js';
|
|
4
4
|
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
5
5
|
import { TransientDataSquashingHint } from './transient_data_squashing_hint.js';
|
|
6
|
-
export function buildTransientDataHints(noteHashes, nullifiers, futureNoteHashReads, futureNullifierReads, noteHashNullifierCounterMap, splitCounter) {
|
|
6
|
+
export function buildTransientDataHints(noteHashes, nullifiers, futureNoteHashReads, futureNullifierReads, futureLogs, noteHashNullifierCounterMap, splitCounter) {
|
|
7
7
|
const futureNoteHashReadsMap = new ScopedValueCache(futureNoteHashReads);
|
|
8
8
|
const futureNullifierReadsMap = new ScopedValueCache(futureNullifierReads);
|
|
9
|
+
const futureLogNoteHashCounters = new Set(futureLogs.filter((l)=>l.noteHashCounter > 0).map((l)=>l.noteHashCounter));
|
|
9
10
|
const nullifierIndexMap = new Map();
|
|
10
11
|
nullifiers.getActiveItems().forEach((n, i)=>nullifierIndexMap.set(n.counter, i));
|
|
11
12
|
const hints = [];
|
|
12
13
|
for(let noteHashIndex = 0; noteHashIndex < noteHashes.claimedLength; noteHashIndex++){
|
|
13
14
|
const noteHash = noteHashes.array[noteHashIndex];
|
|
14
15
|
const noteHashNullifierCounter = noteHashNullifierCounterMap.get(noteHash.counter);
|
|
15
|
-
// The note hash might not be linked to a nullifier or it might be read in the future
|
|
16
|
-
|
|
16
|
+
// The note hash might not be linked to a nullifier, or it might be read in the future, or a future log might be
|
|
17
|
+
// linked to it.
|
|
18
|
+
if (!noteHashNullifierCounter || futureNoteHashReadsMap.get(noteHash).find((read)=>isValidNoteHashReadRequest(read, noteHash)) || futureLogNoteHashCounters.has(noteHash.counter)) {
|
|
17
19
|
continue;
|
|
18
20
|
}
|
|
19
21
|
const nullifierIndex = nullifierIndexMap.get(noteHashNullifierCounter);
|
|
@@ -48,3 +50,7 @@ export function buildTransientDataHints(noteHashes, nullifiers, futureNoteHashRe
|
|
|
48
50
|
hints: padArrayEnd(hints, noActionHint, nullifiers.array.length)
|
|
49
51
|
};
|
|
50
52
|
}
|
|
53
|
+
/** Counts private logs that are linked to squashed note hashes and would be removed along with them. */ export function countSquashedLogs(noteHashes, privateLogs, squashingHints) {
|
|
54
|
+
const squashedNoteHashCounters = new Set(squashingHints.map((h)=>noteHashes.array[h.noteHashIndex].counter));
|
|
55
|
+
return privateLogs.getActiveItems().filter((l)=>squashedNoteHashCounters.has(l.inner.noteHashCounter)).length;
|
|
56
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
2
|
+
import type { DebugLog } from './debug_log.js';
|
|
3
|
+
/**
|
|
4
|
+
* Store for debug logs emitted by public functions during transaction execution.
|
|
5
|
+
*
|
|
6
|
+
* Uses the Null Object pattern: production code uses NullDebugLogStore (no-op), while test mode uses
|
|
7
|
+
* InMemoryDebugLogStore (stores and serves logs).
|
|
8
|
+
*/
|
|
9
|
+
export interface DebugLogStore {
|
|
10
|
+
/** Store debug logs for a processed transaction. */
|
|
11
|
+
storeLogs(txHash: string, logs: DebugLog[]): void;
|
|
12
|
+
/** Decorate a TxReceipt with any stored debug logs for the given tx. */
|
|
13
|
+
decorateReceiptWithLogs(txHash: string, receipt: TxReceipt): void;
|
|
14
|
+
/** Whether debug log collection is enabled. */
|
|
15
|
+
readonly isEnabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** No-op implementation for production mode. */
|
|
18
|
+
export declare class NullDebugLogStore implements DebugLogStore {
|
|
19
|
+
storeLogs(_txHash: string, _logs: DebugLog[]): void;
|
|
20
|
+
decorateReceiptWithLogs(_txHash: string, _receipt: TxReceipt): void;
|
|
21
|
+
get isEnabled(): boolean;
|
|
22
|
+
}
|
|
23
|
+
/** In-memory implementation for test mode that stores and serves debug logs. */
|
|
24
|
+
export declare class InMemoryDebugLogStore implements DebugLogStore {
|
|
25
|
+
private map;
|
|
26
|
+
storeLogs(txHash: string, logs: DebugLog[]): void;
|
|
27
|
+
decorateReceiptWithLogs(txHash: string, receipt: TxReceipt): void;
|
|
28
|
+
get isEnabled(): boolean;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVidWdfbG9nX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9kZWJ1Z19sb2dfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckQsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFL0M7Ozs7O0dBS0c7QUFDSCxNQUFNLFdBQVcsYUFBYTtJQUM1QixvREFBb0Q7SUFDcEQsU0FBUyxDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLFFBQVEsRUFBRSxHQUFHLElBQUksQ0FBQztJQUNsRCx3RUFBd0U7SUFDeEUsdUJBQXVCLENBQUMsTUF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AI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAClD,wEAAwE;IACxE,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAClE,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,gDAAgD;AAChD,qBAAa,iBAAkB,YAAW,aAAa;IACrD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAElD;IACD,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI,CAElE;IACD,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF;AAED,gFAAgF;AAChF,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,GAAG,CAAiC;IAE5C,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAIhD;IAED,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAOhE;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** No-op implementation for production mode. */ export class NullDebugLogStore {
|
|
2
|
+
storeLogs(_txHash, _logs) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
decorateReceiptWithLogs(_txHash, _receipt) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
get isEnabled() {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** In-memory implementation for test mode that stores and serves debug logs. */ export class InMemoryDebugLogStore {
|
|
13
|
+
map = new Map();
|
|
14
|
+
storeLogs(txHash, logs) {
|
|
15
|
+
if (logs.length > 0) {
|
|
16
|
+
this.map.set(txHash, logs);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
decorateReceiptWithLogs(txHash, receipt) {
|
|
20
|
+
if (receipt.isMined()) {
|
|
21
|
+
const debugLogs = this.map.get(txHash);
|
|
22
|
+
if (debugLogs) {
|
|
23
|
+
receipt.debugLogs = debugLogs;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
get isEnabled() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
|
+
import type { CompleteAddress } from '../contract/complete_address.js';
|
|
5
|
+
/**
|
|
6
|
+
* Extended directional application tagging secret used for log tagging.
|
|
7
|
+
*
|
|
8
|
+
* "Extended" because it bundles the directional app tagging secret with the app (contract) address. This bundling was
|
|
9
|
+
* done because where this type is used we commonly need access to both the secret and the address.
|
|
10
|
+
*
|
|
11
|
+
* "Directional" because the derived secret is bound to the recipient address: A→B differs from B→A even with the same
|
|
12
|
+
* participants and app.
|
|
13
|
+
*
|
|
14
|
+
* Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides in
|
|
15
|
+
* `pxe/src/tagging`. We need to use this type in `PreTag` that in turn is used by other types in stdlib hence there
|
|
16
|
+
* doesn't seem to be a good way around this.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ExtendedDirectionalAppTaggingSecret {
|
|
19
|
+
readonly secret: Fr;
|
|
20
|
+
readonly app: AztecAddress;
|
|
21
|
+
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Derives shared tagging secret and from that, the app address and recipient derives the directional app tagging
|
|
24
|
+
* secret.
|
|
25
|
+
*
|
|
26
|
+
* @param localAddress - The complete address of entity A in the shared tagging secret derivation scheme
|
|
27
|
+
* @param localIvsk - The incoming viewing secret key of entity A
|
|
28
|
+
* @param externalAddress - The address of entity B in the shared tagging secret derivation scheme
|
|
29
|
+
* @param app - Contract address to silo the secret to
|
|
30
|
+
* @param recipient - Recipient of the log. Defines the "direction of the secret".
|
|
31
|
+
* @returns The secret that can be used along with an index to compute a tag to be included in a log.
|
|
32
|
+
*/
|
|
33
|
+
static compute(localAddress: CompleteAddress, localIvsk: Fq, externalAddress: AztecAddress, app: AztecAddress, recipient: AztecAddress): Promise<ExtendedDirectionalAppTaggingSecret>;
|
|
34
|
+
toString(): string;
|
|
35
|
+
static fromString(str: string): ExtendedDirectionalAppTaggingSecret;
|
|
36
|
+
}
|
|
37
|
+
export declare const ExtendedDirectionalAppTaggingSecretSchema: z.ZodObject<{
|
|
38
|
+
secret: z.ZodType<Fr, any, string>;
|
|
39
|
+
app: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
secret: Fr;
|
|
42
|
+
app: AztecAddress;
|
|
43
|
+
}, {
|
|
44
|
+
secret: string;
|
|
45
|
+
app?: any;
|
|
46
|
+
}>;
|
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRfZGlyZWN0aW9uYWxfYXBwX3RhZ2dpbmdfc2VjcmV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9leHRlbmRlZF9kaXJlY3Rpb25hbF9hcHBfdGFnZ2luZ19zZWNyZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLEtBQUssRUFBRSxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRzdELE9BQU8sRUFBRSxDQUFDLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFeEIsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBR3ZFOzs7Ozs7Ozs7Ozs7R0FZRztBQUNILHFCQUFhLG1DQUFtQzthQUU1QixNQUFNLEVBQUUsRUFBRTthQUNWLEdBQUcsRUFBRSxZQUFZO0lBRm5DLE9BQU8sZUFHSDtJQUVKOzs7Ozs7Ozs7O09BVUc7SUFDSCxPQUFhLE9BQU8sQ0FDbEIsWUFBWSxFQUFFLGVBQWUsRUFDN0IsU0FBUyxFQUFFLEVBQUUsRUFDYixlQUFlLEVBQUUsWUFBWSxFQUM3QixHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsWUFBWSxHQUN0QixPQUFPLENBQUMsbUNBQW1DLENBQUMsQ0FNOUM7SUFFRCxRQUFRLElBQUksTUFBTSxDQUVqQjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFLE1BQU0sR0FBRyxtQ0FBbUMsQ0FHbEU7Q0FDRjtBQW9CRCxlQUFPLE1BQU0seUNBQXlDOzs7Ozs7Ozs7RUFHcEQsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extended_directional_app_tagging_secret.d.ts","sourceRoot":"","sources":["../../src/logs/extended_directional_app_tagging_secret.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE;;;;;;;;;;;;GAYG;AACH,qBAAa,mCAAmC;aAE5B,MAAM,EAAE,EAAE;aACV,GAAG,EAAE,YAAY;IAFnC,OAAO,eAGH;IAEJ;;;;;;;;;;OAUG;IACH,OAAa,OAAO,CAClB,YAAY,EAAE,eAAe,EAC7B,SAAS,EAAE,EAAE,EACb,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,mCAAmC,CAAC,CAM9C;IAED,QAAQ,IAAI,MAAM,CAEjB;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,mCAAmC,CAGlE;CACF;AAoBD,eAAO,MAAM,yCAAyC;;;;;;;;;EAGpD,CAAC"}
|
package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js}
RENAMED
|
@@ -2,20 +2,26 @@ import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
|
2
2
|
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
5
6
|
import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Extended directional application tagging secret used for log tagging.
|
|
8
9
|
*
|
|
9
|
-
* "
|
|
10
|
-
*
|
|
10
|
+
* "Extended" because it bundles the directional app tagging secret with the app (contract) address. This bundling was
|
|
11
|
+
* done because where this type is used we commonly need access to both the secret and the address.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
* "Directional" because the derived secret is bound to the recipient address: A→B differs from B→A even with the same
|
|
14
|
+
* participants and app.
|
|
15
|
+
*
|
|
16
|
+
* Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides in
|
|
17
|
+
* `pxe/src/tagging`. We need to use this type in `PreTag` that in turn is used by other types in stdlib hence there
|
|
18
|
+
* doesn't seem to be a good way around this.
|
|
19
|
+
*/ export class ExtendedDirectionalAppTaggingSecret {
|
|
20
|
+
secret;
|
|
21
|
+
app;
|
|
22
|
+
constructor(secret, app){
|
|
23
|
+
this.secret = secret;
|
|
24
|
+
this.app = app;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Derives shared tagging secret and from that, the app address and recipient derives the directional app tagging
|
|
@@ -38,13 +44,14 @@ import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
|
|
|
38
44
|
appTaggingSecret,
|
|
39
45
|
recipient
|
|
40
46
|
]);
|
|
41
|
-
return new
|
|
47
|
+
return new ExtendedDirectionalAppTaggingSecret(directionalAppTaggingSecret, app);
|
|
42
48
|
}
|
|
43
49
|
toString() {
|
|
44
|
-
return this.
|
|
50
|
+
return `${this.secret.toString()}:${this.app.toString()}`;
|
|
45
51
|
}
|
|
46
52
|
static fromString(str) {
|
|
47
|
-
|
|
53
|
+
const [secretStr, appStr] = str.split(':');
|
|
54
|
+
return new ExtendedDirectionalAppTaggingSecret(Fr.fromString(secretStr), AztecAddress.fromString(appStr));
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
// Returns shared tagging secret computed with Diffie-Hellman key exchange.
|
|
@@ -59,6 +66,7 @@ async function computeSharedTaggingSecret(localAddress, localIvsk, externalAddre
|
|
|
59
66
|
// leads to a positive y-coordinate, which is the only valid address point
|
|
60
67
|
return Grumpkin.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, localIvsk));
|
|
61
68
|
}
|
|
62
|
-
export const
|
|
63
|
-
|
|
69
|
+
export const ExtendedDirectionalAppTaggingSecretSchema = z.object({
|
|
70
|
+
secret: Fr.schema,
|
|
71
|
+
app: AztecAddress.schema
|
|
64
72
|
});
|
package/dest/logs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './extended_directional_app_tagging_secret.js';
|
|
2
2
|
export * from './pre_tag.js';
|
|
3
3
|
export * from './contract_class_log.js';
|
|
4
4
|
export * from './public_log.js';
|
|
@@ -12,6 +12,7 @@ export * from './shared_secret_derivation.js';
|
|
|
12
12
|
export * from './tx_scoped_l2_log.js';
|
|
13
13
|
export * from './message_context.js';
|
|
14
14
|
export * from './debug_log.js';
|
|
15
|
+
export * from './debug_log_store.js';
|
|
15
16
|
export * from './tag.js';
|
|
16
17
|
export * from './siloed_tag.js';
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsOENBQThDLENBQUM7QUFDN0QsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxrQ0FBa0MsQ0FBQztBQUNqRCxjQUFjLCtCQUErQixDQUFDO0FBQzlDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxzQkFBc0IsQ0FBQztBQUNyQyxjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxpQkFBaUIsQ0FBQyJ9
|
package/dest/logs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAC;AAC7D,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
package/dest/logs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './extended_directional_app_tagging_secret.js';
|
|
2
2
|
export * from './pre_tag.js';
|
|
3
3
|
export * from './contract_class_log.js';
|
|
4
4
|
export * from './public_log.js';
|
|
@@ -12,5 +12,6 @@ export * from './shared_secret_derivation.js';
|
|
|
12
12
|
export * from './tx_scoped_l2_log.js';
|
|
13
13
|
export * from './message_context.js';
|
|
14
14
|
export * from './debug_log.js';
|
|
15
|
+
export * from './debug_log_store.js';
|
|
15
16
|
export * from './tag.js';
|
|
16
17
|
export * from './siloed_tag.js';
|
package/dest/logs/pre_tag.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ExtendedDirectionalAppTaggingSecret } from './extended_directional_app_tagging_secret.js';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a preimage of a private log tag (see `Tag` in `pxe/src/tagging`).
|
|
5
5
|
*
|
|
@@ -8,27 +8,32 @@ import { type DirectionalAppTaggingSecret } from './directional_app_tagging_secr
|
|
|
8
8
|
* around this.
|
|
9
9
|
*/
|
|
10
10
|
export type PreTag = {
|
|
11
|
-
|
|
11
|
+
extendedSecret: ExtendedDirectionalAppTaggingSecret;
|
|
12
12
|
index: number;
|
|
13
13
|
};
|
|
14
14
|
export declare const PreTagSchema: z.ZodObject<{
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
extendedSecret: z.ZodObject<{
|
|
16
|
+
secret: z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>;
|
|
17
|
+
app: import("@aztec/foundation/schemas").ZodFor<import("../aztec-address/index.js").AztecAddress>;
|
|
17
18
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
|
|
19
|
+
secret: import("@aztec/foundation/schemas").Fr;
|
|
20
|
+
app: import("../aztec-address/index.js").AztecAddress;
|
|
19
21
|
}, {
|
|
20
|
-
|
|
22
|
+
secret: string;
|
|
23
|
+
app?: any;
|
|
21
24
|
}>;
|
|
22
25
|
index: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
23
26
|
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
extendedSecret: {
|
|
28
|
+
secret: import("@aztec/foundation/schemas").Fr;
|
|
29
|
+
app: import("../aztec-address/index.js").AztecAddress;
|
|
26
30
|
};
|
|
27
31
|
index: number;
|
|
28
32
|
}, {
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
extendedSecret: {
|
|
34
|
+
secret: string;
|
|
35
|
+
app?: any;
|
|
31
36
|
};
|
|
32
37
|
index: string | number | bigint;
|
|
33
38
|
}>;
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlX3RhZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvZ3MvcHJlX3RhZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLE9BQU8sRUFDTCxLQUFLLG1DQUFtQyxFQUV6QyxNQUFNLDhDQUE4QyxDQUFDO0FBRXREOzs7Ozs7R0FNRztBQUNILE1BQU0sTUFBTSxNQUFNLEdBQUc7SUFDbkIsY0FBYyxFQUFFLG1DQUFtQyxDQUFDO0lBQ3BELEtBQUssRUFBRSxNQUFNLENBQUM7Q0FDZixDQUFDO0FBRUYsZUFBTyxNQUFNLFlBQVk7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztFQUd2QixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre_tag.d.ts","sourceRoot":"","sources":["../../src/logs/pre_tag.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"pre_tag.d.ts","sourceRoot":"","sources":["../../src/logs/pre_tag.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,KAAK,mCAAmC,EAEzC,MAAM,8CAA8C,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,cAAc,EAAE,mCAAmC,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;EAGvB,CAAC"}
|
package/dest/logs/pre_tag.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { schemas } from '@aztec/foundation/schemas';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { ExtendedDirectionalAppTaggingSecretSchema } from './extended_directional_app_tagging_secret.js';
|
|
4
4
|
export const PreTagSchema = z.object({
|
|
5
|
-
|
|
5
|
+
extendedSecret: ExtendedDirectionalAppTaggingSecretSchema,
|
|
6
6
|
index: schemas.Integer
|
|
7
7
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
3
3
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PreTag } from './pre_tag.js';
|
|
5
|
+
import { Tag } from './tag.js';
|
|
5
6
|
/** Branding to ensure fields are not interchangeable types. */
|
|
6
7
|
export interface SiloedTag {
|
|
7
8
|
/** Brand. */
|
|
@@ -14,10 +15,11 @@ export interface SiloedTag {
|
|
|
14
15
|
export declare class SiloedTag {
|
|
15
16
|
readonly value: Fr;
|
|
16
17
|
constructor(value: Fr);
|
|
17
|
-
static compute(
|
|
18
|
+
static compute(preTag: PreTag): Promise<SiloedTag>;
|
|
19
|
+
static computeFromTagAndApp(tag: Tag, app: AztecAddress): Promise<SiloedTag>;
|
|
18
20
|
toString(): string;
|
|
19
21
|
toJSON(): string;
|
|
20
22
|
equals(other: SiloedTag): boolean;
|
|
21
23
|
static get schema(): ZodFor<SiloedTag>;
|
|
22
24
|
}
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lsb2VkX3RhZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvZ3Mvc2lsb2VkX3RhZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUc5RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDM0MsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUkvQiwrREFBK0Q7QUFDL0QsTUFBTSxXQUFXLFNBQVM7SUFDeEIsYUFBYTtJQUNiLFNBQVMsRUFBRSxXQUFXLENBQUM7Q0FDeEI7QUFFRDs7O0dBR0c7QUFDSCxxQkFBYSxTQUFTO2FBQ1EsS0FBSyxFQUFFLEVBQUU7SUFBckMsWUFBNEIsS0FBSyxFQUFFLEVBQUUsRUFBSTtJQUV6QyxPQUFhLE9BQU8sQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FHdkQ7SUFFRCxPQUFhLG9CQUFvQixDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBR2pGO0lBRUQsUUFBUSxJQUFJLE1BQU0sQ0FFakI7SUFFRCxNQUFNLElBQUksTUFBTSxDQUVmO0lBRUQsTUFBTSxDQUFDLEtBQUssRUFBRSxTQUFTLEdBQUcsT0FBTyxDQUVoQztJQUVELE1BQU0sS0FBSyxNQUFNLElBQUksTUFBTSxDQUFDLFNBQVMsQ0FBQyxDQUVyQztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siloed_tag.d.ts","sourceRoot":"","sources":["../../src/logs/siloed_tag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"siloed_tag.d.ts","sourceRoot":"","sources":["../../src/logs/siloed_tag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,aAAa;IACb,SAAS,EAAE,WAAW,CAAC;CACxB;AAED;;;GAGG;AACH,qBAAa,SAAS;aACQ,KAAK,EAAE,EAAE;IAArC,YAA4B,KAAK,EAAE,EAAE,EAAI;IAEzC,OAAa,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAGvD;IAED,OAAa,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAGjF;IAED,QAAQ,IAAI,MAAM,CAEjB;IAED,MAAM,IAAI,MAAM,CAEf;IAED,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEhC;IAED,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,CAErC;CACF"}
|
package/dest/logs/siloed_tag.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computeSiloedPrivateLogFirstField } from '../hash/hash.js';
|
|
2
2
|
import { schemas } from '../schemas/schemas.js';
|
|
3
|
+
import { Tag } from './tag.js';
|
|
3
4
|
/**
|
|
4
5
|
* Represents a tag used in private log as it "appears on the chain" - that is the tag is siloed with a contract
|
|
5
6
|
* address that emitted the log.
|
|
@@ -8,7 +9,11 @@ import { schemas } from '../schemas/schemas.js';
|
|
|
8
9
|
constructor(value){
|
|
9
10
|
this.value = value;
|
|
10
11
|
}
|
|
11
|
-
static async compute(
|
|
12
|
+
static async compute(preTag) {
|
|
13
|
+
const tag = await Tag.compute(preTag);
|
|
14
|
+
return SiloedTag.computeFromTagAndApp(tag, preTag.extendedSecret.app);
|
|
15
|
+
}
|
|
16
|
+
static async computeFromTagAndApp(tag, app) {
|
|
12
17
|
const siloedTag = await computeSiloedPrivateLogFirstField(app, tag.value);
|
|
13
18
|
return new SiloedTag(siloedTag);
|
|
14
19
|
}
|
package/dest/logs/tag.js
CHANGED
|
@@ -7,4 +7,14 @@ import type { CheckpointAttestation } from './checkpoint_attestation.js';
|
|
|
7
7
|
* @todo: perform this logic within the memory attestation store instead?
|
|
8
8
|
*/
|
|
9
9
|
export declare function orderAttestations(attestations: CheckpointAttestation[], orderAddresses: EthAddress[]): CommitteeAttestation[];
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Trims attestations to the minimum required number to save L1 calldata gas.
|
|
12
|
+
* Each signature costs 65 bytes of calldata vs 20 bytes for just an address.
|
|
13
|
+
*
|
|
14
|
+
* Priority order for keeping attestations:
|
|
15
|
+
* 1. The proposer's attestation (required by L1 contract - MissingProposerSignature revert)
|
|
16
|
+
* 2. Attestations from the local node's validator keys
|
|
17
|
+
* 3. Remaining attestations filled to reach the required count
|
|
18
|
+
*/
|
|
19
|
+
export declare function trimAttestations(attestations: CheckpointAttestation[], required: number, proposerAddress: EthAddress, localAddresses: EthAddress[]): CheckpointAttestation[];
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ZXN0YXRpb25fdXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wMnAvYXR0ZXN0YXRpb25fdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFaEUsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUV6RTs7OztHQUlHO0FBQ0gsd0JBQWdCLGlCQUFpQixDQUMvQixZQUFZLEVBQUUscUJBQXFCLEVBQUUsRUFDckMsY0FBYyxFQUFFLFVBQVUsRUFBRSxHQUMzQixvQkFBb0IsRUFBRSxDQXFCeEI7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFnQixnQkFBZ0IsQ0FDOUIsWUFBWSxFQUFFLHFCQUFxQixFQUFFLEVBQ3JDLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLGVBQWUsRUFBRSxVQUFVLEVBQzNCLGNBQWMsRUFBRSxVQUFVLEVBQUUsR0FDM0IscUJBQXFCLEVBQUUsQ0F3Q3pCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/attestation_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,qBAAqB,EAAE,EACrC,cAAc,EAAE,UAAU,EAAE,GAC3B,oBAAoB,EAAE,CAqBxB"}
|
|
1
|
+
{"version":3,"file":"attestation_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/attestation_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,qBAAqB,EAAE,EACrC,cAAc,EAAE,UAAU,EAAE,GAC3B,oBAAoB,EAAE,CAqBxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,qBAAqB,EAAE,EACrC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,UAAU,EAC3B,cAAc,EAAE,UAAU,EAAE,GAC3B,qBAAqB,EAAE,CAwCzB"}
|