@aztec/stdlib 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1
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/contract_artifact.d.ts +2 -2
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +1 -1
- package/dest/abi/selector.js +3 -1
- package/dest/avm/avm_accumulated_data.js +5 -2
- package/dest/avm/avm_circuit_public_inputs.js +3 -1
- package/dest/avm/public_data_update_request.js +3 -1
- package/dest/avm/public_inner_call_request.js +3 -1
- package/dest/avm/revert_code.js +3 -1
- package/dest/aztec-address/index.js +4 -2
- package/dest/block/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/body.js +3 -1
- package/dest/block/l2_block.d.ts +6 -3
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +6 -4
- package/dest/block/l2_block_code_to_purge.d.ts +2 -3
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +2 -8
- package/dest/block/l2_block_header.d.ts +8 -12
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_header.js +25 -18
- package/dest/block/l2_block_new.d.ts +1 -2
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +4 -1
- package/dest/block/l2_block_source.d.ts +245 -41
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +23 -5
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +12 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +102 -30
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +483 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +13 -13
- package/dest/checkpoint/checkpoint.d.ts +1 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +1 -0
- package/dest/checkpoint/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/database-version/version_manager.js +3 -1
- package/dest/gas/gas.js +3 -1
- package/dest/gas/gas_fees.js +3 -1
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -4
- package/dest/interfaces/aztec-node-admin.d.ts +16 -10
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -3
- package/dest/interfaces/aztec-node.d.ts +11 -10
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +10 -5
- package/dest/interfaces/configs.d.ts +6 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/p2p.d.ts +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- package/dest/interfaces/proving-job.d.ts +170 -170
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +1 -7
- package/dest/interfaces/server_circuit_prover.d.ts +4 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +41 -7
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -1
- package/dest/interfaces/world_state.d.ts +8 -6
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/claimed_length_array.js +3 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- 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 +5 -6
- package/dest/kernel/hints/transient_data_squashing_hint.js +3 -1
- package/dest/kernel/log_hash.js +3 -1
- package/dest/kernel/private_log_data.js +5 -2
- package/dest/kernel/private_to_avm_accumulated_data.js +5 -2
- package/dest/kernel/private_to_public_accumulated_data.js +3 -1
- package/dest/kernel/private_to_rollup_accumulated_data.js +3 -1
- package/dest/kernel/private_validation_requests.js +3 -1
- package/dest/kernel/public_call_request.js +5 -2
- package/dest/logs/contract_class_log.js +3 -1
- package/dest/logs/index.d.ts +1 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +0 -1
- package/dest/logs/private_log.js +3 -1
- package/dest/logs/public_log.js +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts +18 -39
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +29 -50
- package/dest/messaging/in_hash.d.ts +4 -2
- package/dest/messaging/in_hash.d.ts.map +1 -1
- package/dest/messaging/in_hash.js +3 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +88 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +158 -42
- package/dest/messaging/out_hash.d.ts +2 -1
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +13 -4
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +85 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +120 -37
- package/dest/p2p/checkpoint_attestation.d.ts +77 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +154 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +217 -0
- package/dest/p2p/consensus_payload.d.ts +6 -7
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -2
- package/dest/p2p/gossipable.d.ts +4 -3
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +16 -5
- package/dest/p2p/index.d.ts +4 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +3 -1
- package/dest/p2p/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +40 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +70 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +8 -2
- package/dest/rollup/block_rollup_public_inputs.d.ts +4 -9
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.js +6 -10
- package/dest/rollup/checkpoint_constant_data.js +3 -1
- package/dest/rollup/checkpoint_header.d.ts +15 -12
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +33 -19
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +6 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +6 -2
- package/dest/rollup/root_rollup_public_inputs.d.ts +8 -3
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +6 -3
- package/dest/tests/factories.d.ts +38 -7
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +77 -13
- package/dest/tests/mocks.d.ts +59 -10
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +89 -41
- package/dest/trees/append_only_tree_snapshot.js +3 -1
- package/dest/tx/block_header.js +3 -1
- package/dest/tx/call_context.js +3 -1
- package/dest/tx/global_variable_builder.d.ts +2 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.js +3 -1
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_execution_result.d.ts +1 -5
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -20
- package/dest/tx/public_call_request_with_calldata.js +3 -1
- package/dest/tx/state_reference.js +3 -1
- package/dest/tx/tree_snapshots.js +3 -1
- package/dest/tx/tx.d.ts +10 -3
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +12 -3
- package/dest/tx/tx_effect.d.ts +1 -1
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +6 -2
- package/dest/tx/tx_execution_request.d.ts +1 -1
- package/dest/tx/tx_execution_request.d.ts.map +1 -1
- package/dest/tx/tx_execution_request.js +6 -2
- package/package.json +8 -8
- package/src/abi/contract_artifact.ts +10 -10
- package/src/block/attestation_info.ts +9 -6
- package/src/block/l2_block.ts +6 -5
- package/src/block/l2_block_code_to_purge.ts +3 -11
- package/src/block/l2_block_header.ts +26 -17
- package/src/block/l2_block_new.ts +5 -1
- package/src/block/l2_block_source.ts +66 -16
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +12 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +121 -38
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +485 -36
- package/src/block/validate_block_result.ts +35 -31
- package/src/checkpoint/checkpoint.ts +1 -0
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +14 -6
- package/src/interfaces/aztec-node-admin.ts +7 -4
- package/src/interfaces/aztec-node.ts +43 -13
- package/src/interfaces/configs.ts +5 -0
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/proving-job.ts +2 -11
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/interfaces/validator.ts +57 -7
- package/src/interfaces/world_state.ts +9 -7
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +5 -8
- package/src/logs/index.ts +0 -1
- package/src/logs/tx_scoped_l2_log.ts +37 -53
- package/src/messaging/in_hash.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +176 -52
- package/src/messaging/out_hash.ts +17 -7
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +185 -41
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +337 -0
- package/src/p2p/consensus_payload.ts +5 -2
- package/src/p2p/gossipable.ts +14 -4
- package/src/p2p/index.ts +3 -1
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +83 -0
- package/src/p2p/topic_type.ts +3 -2
- package/src/rollup/block_rollup_public_inputs.ts +3 -9
- package/src/rollup/checkpoint_header.ts +43 -20
- package/src/rollup/checkpoint_rollup_public_inputs.ts +6 -0
- package/src/rollup/root_rollup_public_inputs.ts +6 -0
- package/src/tests/factories.ts +98 -17
- package/src/tests/mocks.ts +166 -64
- package/src/tx/global_variable_builder.ts +1 -1
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +0 -15
- package/src/tx/tx.ts +11 -2
- package/src/tx/tx_effect.ts +3 -1
- package/src/tx/tx_execution_request.ts +2 -0
- package/dest/logs/log_with_tx_data.d.ts +0 -19
- package/dest/logs/log_with_tx_data.d.ts.map +0 -1
- package/dest/logs/log_with_tx_data.js +0 -49
- package/dest/p2p/block_attestation.d.ts +0 -80
- package/dest/p2p/block_attestation.d.ts.map +0 -1
- package/dest/tx/content_commitment.d.ts +0 -49
- package/dest/tx/content_commitment.d.ts.map +0 -1
- package/dest/tx/content_commitment.js +0 -90
- package/src/logs/log_with_tx_data.ts +0 -46
- package/src/tx/content_commitment.ts +0 -113
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, PRIVATE_TO_ROLLUP_ACCUMULATED_DATA_LENGTH } from '@aztec/constants';
|
|
2
3
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
4
|
import { arraySerializedSizeOfNonEmpty } from '@aztec/foundation/collection';
|
|
@@ -9,6 +10,7 @@ import { inspect } from 'util';
|
|
|
9
10
|
import { PrivateLog } from '../logs/private_log.js';
|
|
10
11
|
import { ScopedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
|
|
11
12
|
import { ScopedLogHash } from './log_hash.js';
|
|
13
|
+
_computedKey = inspect.custom;
|
|
12
14
|
/**
|
|
13
15
|
* Data that is accumulated during the execution of the transaction.
|
|
14
16
|
*/ export class PrivateToRollupAccumulatedData {
|
|
@@ -87,7 +89,7 @@ import { ScopedLogHash } from './log_hash.js';
|
|
|
87
89
|
}
|
|
88
90
|
return fields;
|
|
89
91
|
}
|
|
90
|
-
[
|
|
92
|
+
[_computedKey]() {
|
|
91
93
|
return `PrivateToRollupAccumulatedData {
|
|
92
94
|
noteHashes: [${this.noteHashes.filter((x)=>!x.isZero()).map((x)=>inspect(x)).join(', ')}],
|
|
93
95
|
nullifiers: [${this.nullifiers.filter((x)=>!x.isZero()).map((x)=>inspect(x)).join(', ')}],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '@aztec/constants';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
4
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
@@ -5,6 +6,7 @@ import { inspect } from 'util';
|
|
|
5
6
|
import { ScopedKeyValidationRequestAndGenerator } from '../kernel/hints/scoped_key_validation_request_and_generator.js';
|
|
6
7
|
import { ClaimedLengthArray, ClaimedLengthArrayFromBuffer } from './claimed_length_array.js';
|
|
7
8
|
import { ScopedReadRequest } from './hints/read_request.js';
|
|
9
|
+
_computedKey = inspect.custom;
|
|
8
10
|
/**
|
|
9
11
|
* Validation requests accumulated during the execution of the transaction.
|
|
10
12
|
*/ export class PrivateValidationRequests {
|
|
@@ -49,7 +51,7 @@ import { ScopedReadRequest } from './hints/read_request.js';
|
|
|
49
51
|
static empty() {
|
|
50
52
|
return new PrivateValidationRequests(ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedKeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_TX));
|
|
51
53
|
}
|
|
52
|
-
[
|
|
54
|
+
[_computedKey]() {
|
|
53
55
|
return `PrivateValidationRequests {
|
|
54
56
|
noteHashReadRequests: ${inspect(this.noteHashReadRequests)},
|
|
55
57
|
nullifierReadRequests: ${inspect(this.nullifierReadRequests)},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey, _computedKey1;
|
|
1
2
|
import { COUNTED_PUBLIC_CALL_REQUEST_LENGTH, PUBLIC_CALL_REQUEST_LENGTH } from '@aztec/constants';
|
|
2
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import { schemas } from '@aztec/foundation/schemas';
|
|
@@ -6,6 +7,7 @@ import { inspect } from 'util';
|
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
8
9
|
import { computeCalldataHash } from '../hash/index.js';
|
|
10
|
+
_computedKey = inspect.custom;
|
|
9
11
|
/**
|
|
10
12
|
* Represents a request to call a public function.
|
|
11
13
|
*/ export class PublicCallRequest {
|
|
@@ -84,7 +86,7 @@ import { computeCalldataHash } from '../hash/index.js';
|
|
|
84
86
|
isEmpty() {
|
|
85
87
|
return this.msgSender.isZero() && this.contractAddress.isZero() && !this.isStaticCall && this.calldataHash.isEmpty();
|
|
86
88
|
}
|
|
87
|
-
[
|
|
89
|
+
[_computedKey]() {
|
|
88
90
|
return `PublicCallRequest {
|
|
89
91
|
msgSender: ${this.msgSender}
|
|
90
92
|
contractAddress: ${this.contractAddress}
|
|
@@ -97,6 +99,7 @@ import { computeCalldataHash } from '../hash/index.js';
|
|
|
97
99
|
return new PublicCallRequest(msgSender, contractAddress, isStaticCall, calldataHash);
|
|
98
100
|
}
|
|
99
101
|
}
|
|
102
|
+
_computedKey1 = inspect.custom;
|
|
100
103
|
/**
|
|
101
104
|
* Represents lengths of arrays of public call requests.
|
|
102
105
|
*/ export class PublicCallRequestArrayLengths {
|
|
@@ -156,7 +159,7 @@ import { computeCalldataHash } from '../hash/index.js';
|
|
|
156
159
|
*/ static fromPlainObject(obj) {
|
|
157
160
|
return new PublicCallRequestArrayLengths(obj.setupCalls, obj.appLogicCalls, obj.teardownCall);
|
|
158
161
|
}
|
|
159
|
-
[
|
|
162
|
+
[_computedKey1]() {
|
|
160
163
|
return `PublicCallRequestArrayLengths {
|
|
161
164
|
setupCalls: ${this.setupCalls}
|
|
162
165
|
appLogicCalls: ${this.appLogicCalls}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { CONTRACT_CLASS_LOG_LENGTH, CONTRACT_CLASS_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
2
3
|
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
3
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -82,6 +83,7 @@ export class ContractClassLogFields {
|
|
|
82
83
|
return ContractClassLogFields.fromBuffer(this.toBuffer());
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
_computedKey = inspect.custom;
|
|
85
87
|
export class ContractClassLog {
|
|
86
88
|
contractAddress;
|
|
87
89
|
fields;
|
|
@@ -170,7 +172,7 @@ export class ContractClassLog {
|
|
|
170
172
|
}
|
|
171
173
|
return new ContractClassLog(AztecAddress.fromPlainObject(obj.contractAddress), ContractClassLogFields.fromPlainObject(obj.fields), obj.emittedLength);
|
|
172
174
|
}
|
|
173
|
-
[
|
|
175
|
+
[_computedKey]() {
|
|
174
176
|
return `ContractClassLog {
|
|
175
177
|
contractAddress: ${this.contractAddress.toString()},
|
|
176
178
|
emittedLength: ${this.emittedLength},
|
package/dest/logs/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './log_with_tx_data.js';
|
|
2
1
|
export * from './directional_app_tagging_secret.js';
|
|
3
2
|
export * from './pre_tag.js';
|
|
4
3
|
export * from './contract_class_log.js';
|
|
@@ -15,4 +14,4 @@ export * from './message_context.js';
|
|
|
15
14
|
export * from './debug_log.js';
|
|
16
15
|
export * from './tag.js';
|
|
17
16
|
export * from './siloed_tag.js';
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUNBQXFDLENBQUM7QUFDcEQsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxrQ0FBa0MsQ0FBQztBQUNqRCxjQUFjLCtCQUErQixDQUFDO0FBQzlDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxzQkFBc0IsQ0FBQztBQUNyQyxjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsaUJBQWlCLENBQUMifQ==
|
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,qCAAqC,CAAC;AACpD,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,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
package/dest/logs/index.js
CHANGED
package/dest/logs/private_log.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { PRIVATE_LOG_LENGTH, PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
2
3
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
@@ -6,6 +7,7 @@ import { schemas } from '@aztec/foundation/schemas';
|
|
|
6
7
|
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
7
8
|
import { inspect } from 'util';
|
|
8
9
|
import { z } from 'zod';
|
|
10
|
+
_computedKey = inspect.custom;
|
|
9
11
|
export class PrivateLog {
|
|
10
12
|
fields;
|
|
11
13
|
emittedLength;
|
|
@@ -85,7 +87,7 @@ export class PrivateLog {
|
|
|
85
87
|
equals(other) {
|
|
86
88
|
return this.fields.every((field, i)=>field.equals(other.fields[i])) && this.emittedLength === other.emittedLength;
|
|
87
89
|
}
|
|
88
|
-
[
|
|
90
|
+
[_computedKey]() {
|
|
89
91
|
return `PrivateLog {
|
|
90
92
|
fields: [${this.fields.map((x)=>inspect(x)).join(', ')}],
|
|
91
93
|
emittedLength: ${this.emittedLength},
|
package/dest/logs/public_log.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH, PUBLIC_LOG_HEADER_LENGTH } from '@aztec/constants';
|
|
2
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import { schemas } from '@aztec/foundation/schemas';
|
|
@@ -100,6 +101,7 @@ export class FlatPublicLogs {
|
|
|
100
101
|
return this.length === 0;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
_computedKey = inspect.custom;
|
|
103
105
|
export class PublicLog {
|
|
104
106
|
contractAddress;
|
|
105
107
|
fields;
|
|
@@ -174,7 +176,7 @@ export class PublicLog {
|
|
|
174
176
|
fields
|
|
175
177
|
}));
|
|
176
178
|
}
|
|
177
|
-
[
|
|
179
|
+
[_computedKey]() {
|
|
178
180
|
return `PublicLog {
|
|
179
181
|
contractAddress: ${inspect(this.contractAddress)},
|
|
180
182
|
fields: [${this.fields.map((x)=>inspect(x)).join(', ')}],
|
|
@@ -1,70 +1,49 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { z } from 'zod';
|
|
3
|
-
import { L2BlockHash } from '../block/block_hash.js';
|
|
4
4
|
import { TxHash } from '../tx/tx_hash.js';
|
|
5
5
|
import type { UInt64 } from '../types/shared.js';
|
|
6
|
-
import { PrivateLog } from './private_log.js';
|
|
7
|
-
import { PublicLog } from './public_log.js';
|
|
8
6
|
export declare class TxScopedL2Log {
|
|
9
7
|
txHash: TxHash;
|
|
10
|
-
dataStartIndexForTx: number;
|
|
11
|
-
logIndexInTx: number;
|
|
12
8
|
blockNumber: BlockNumber;
|
|
13
|
-
blockHash: L2BlockHash;
|
|
14
9
|
blockTimestamp: UInt64;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
logData: Fr[];
|
|
11
|
+
noteHashes: Fr[];
|
|
12
|
+
firstNullifier: Fr;
|
|
13
|
+
constructor(txHash: TxHash, blockNumber: BlockNumber, blockTimestamp: UInt64, logData: Fr[], noteHashes: Fr[], firstNullifier: Fr);
|
|
18
14
|
static get schema(): z.ZodEffects<z.ZodObject<{
|
|
19
15
|
txHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, TxHash, string>;
|
|
20
|
-
dataStartIndexForTx: z.ZodNumber;
|
|
21
|
-
logIndexInTx: z.ZodNumber;
|
|
22
16
|
blockNumber: z.ZodEffects<z.ZodPipeline<z.ZodUnion<[z.ZodNumber, z.ZodBigInt, z.ZodString]>, z.ZodNumber>, BlockNumber, string | number | bigint>;
|
|
23
|
-
blockHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
|
|
24
17
|
blockTimestamp: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, "strict", z.ZodTypeAny, {
|
|
29
|
-
fields: import("../../../foundation/dest/schemas/schemas.js").Fr[];
|
|
30
|
-
emittedLength: number;
|
|
31
|
-
}, {
|
|
32
|
-
fields: string[];
|
|
33
|
-
emittedLength: number;
|
|
34
|
-
}>, PrivateLog, {
|
|
35
|
-
fields: string[];
|
|
36
|
-
emittedLength: number;
|
|
37
|
-
}>, import("../schemas/schemas.js").ZodFor<PublicLog>]>;
|
|
18
|
+
logData: z.ZodArray<z.ZodType<Fr, any, string>, "many">;
|
|
19
|
+
noteHashes: z.ZodArray<z.ZodType<Fr, any, string>, "many">;
|
|
20
|
+
firstNullifier: z.ZodType<Fr, any, string>;
|
|
38
21
|
}, "strip", z.ZodTypeAny, {
|
|
39
22
|
txHash: TxHash;
|
|
40
|
-
dataStartIndexForTx: number;
|
|
41
|
-
logIndexInTx: number;
|
|
42
23
|
blockNumber: number & {
|
|
43
24
|
_branding: "BlockNumber";
|
|
44
25
|
};
|
|
45
|
-
blockHash: L2BlockHash;
|
|
46
26
|
blockTimestamp: bigint;
|
|
47
|
-
|
|
27
|
+
logData: Fr[];
|
|
28
|
+
noteHashes: Fr[];
|
|
29
|
+
firstNullifier: Fr;
|
|
48
30
|
}, {
|
|
49
31
|
txHash: string;
|
|
50
|
-
dataStartIndexForTx: number;
|
|
51
|
-
logIndexInTx: number;
|
|
52
32
|
blockNumber: string | number | bigint;
|
|
53
|
-
blockHash: string;
|
|
54
33
|
blockTimestamp: string | number | bigint;
|
|
55
|
-
|
|
34
|
+
logData: string[];
|
|
35
|
+
noteHashes: string[];
|
|
36
|
+
firstNullifier: string;
|
|
56
37
|
}>, TxScopedL2Log, {
|
|
57
38
|
txHash: string;
|
|
58
|
-
dataStartIndexForTx: number;
|
|
59
|
-
logIndexInTx: number;
|
|
60
39
|
blockNumber: string | number | bigint;
|
|
61
|
-
blockHash: string;
|
|
62
40
|
blockTimestamp: string | number | bigint;
|
|
63
|
-
|
|
41
|
+
logData: string[];
|
|
42
|
+
noteHashes: string[];
|
|
43
|
+
firstNullifier: string;
|
|
64
44
|
}>;
|
|
65
45
|
toBuffer(): Buffer<ArrayBuffer>;
|
|
66
46
|
static fromBuffer(buffer: Buffer): TxScopedL2Log;
|
|
67
|
-
static random(isFromPublic?: boolean): Promise<TxScopedL2Log>;
|
|
68
47
|
equals(other: TxScopedL2Log): boolean;
|
|
69
48
|
}
|
|
70
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfc2NvcGVkX2wyX2xvZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvZ3MvdHhfc2NvcGVkX2wyX2xvZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFxQixNQUFNLGlDQUFpQyxDQUFDO0FBQ2pGLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQVNwRCxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBR3hCLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUMxQyxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVqRCxxQkFBYSxhQUFhO0lBS2YsTUFBTSxFQUFFLE1BQU07SUFJZCxXQUFXLEVBQUUsV0FBVztJQUl4QixjQUFjLEVBQUUsTUFBTTtJQUl0QixPQUFPLEVBQUUsRUFBRSxFQUFFO0lBSWIsVUFBVSxFQUFFLEVBQUUsRUFBRTtJQU1oQixjQUFjLEVBQUUsRUFBRTtJQTFCM0IsWUFJUyxNQUFNLEVBQUUsTUFBTSxFQUlkLFdBQVcsRUFBRSxXQUFXLEVBSXhCLGNBQWMsRUFBRSxNQUFNLEVBSXRCLE9BQU8sRUFBRSxFQUFFLEVBQUUsRUFJYixVQUFVLEVBQUUsRUFBRSxFQUFFLEVBTWhCLGNBQWMsRUFBRSxFQUFFLEVBQ3ZCO0lBRUosTUFBTSxLQUFLLE1BQU07Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztPQWNoQjtJQUVELFFBQVEsd0JBU1A7SUFFRCxNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRSxNQUFNLGlCQVUvQjtJQUVELE1BQU0sQ0FBQyxLQUFLLEVBQUUsYUFBYSxXQVcxQjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_scoped_l2_log.d.ts","sourceRoot":"","sources":["../../src/logs/tx_scoped_l2_log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_scoped_l2_log.d.ts","sourceRoot":"","sources":["../../src/logs/tx_scoped_l2_log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AASpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,aAAa;IAKf,MAAM,EAAE,MAAM;IAId,WAAW,EAAE,WAAW;IAIxB,cAAc,EAAE,MAAM;IAItB,OAAO,EAAE,EAAE,EAAE;IAIb,UAAU,EAAE,EAAE,EAAE;IAMhB,cAAc,EAAE,EAAE;IA1B3B,YAIS,MAAM,EAAE,MAAM,EAId,WAAW,EAAE,WAAW,EAIxB,cAAc,EAAE,MAAM,EAItB,OAAO,EAAE,EAAE,EAAE,EAIb,UAAU,EAAE,EAAE,EAAE,EAMhB,cAAc,EAAE,EAAE,EACvB;IAEJ,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAchB;IAED,QAAQ,wBASP;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,iBAU/B;IAED,MAAM,CAAC,KAAK,EAAE,aAAa,WAW1B;CACF"}
|
|
@@ -1,91 +1,70 @@
|
|
|
1
1
|
import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
-
import {
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { schemas as foundationSchemas } from '@aztec/foundation/schemas';
|
|
4
|
+
import { BufferReader, bigintToUInt64BE, numToUInt32BE, serializeArrayOfBufferableToVector } from '@aztec/foundation/serialize';
|
|
3
5
|
import { z } from 'zod';
|
|
4
|
-
import { L2BlockHash } from '../block/block_hash.js';
|
|
5
6
|
import { schemas } from '../schemas/schemas.js';
|
|
6
7
|
import { TxHash } from '../tx/tx_hash.js';
|
|
7
|
-
import { PrivateLog } from './private_log.js';
|
|
8
|
-
import { PublicLog } from './public_log.js';
|
|
9
|
-
// TODO(#14460): Split to private and public versions instead of having this weird mix.
|
|
10
8
|
export class TxScopedL2Log {
|
|
11
9
|
txHash;
|
|
12
|
-
dataStartIndexForTx;
|
|
13
|
-
logIndexInTx;
|
|
14
10
|
blockNumber;
|
|
15
|
-
blockHash;
|
|
16
11
|
blockTimestamp;
|
|
17
|
-
|
|
12
|
+
logData;
|
|
13
|
+
noteHashes;
|
|
14
|
+
firstNullifier;
|
|
18
15
|
constructor(/*
|
|
19
16
|
* Hash of the tx where the log is included
|
|
20
17
|
*/ txHash, /*
|
|
21
|
-
* The next available leaf index for the note hash tree for this transaction. It is stored
|
|
22
|
-
* with the log so the noteHashIndex can be reconstructed after decryption.
|
|
23
|
-
*/ dataStartIndexForTx, /*
|
|
24
|
-
* The index of the log in the transaction. Note that public and private logs are in separate arrays in the tx
|
|
25
|
-
* effect and for this reason these indices are independent (a private and public log can have the same index).
|
|
26
|
-
*/ logIndexInTx, /*
|
|
27
18
|
* The block this log is included in
|
|
28
19
|
*/ blockNumber, /*
|
|
29
|
-
* The block this log is included in
|
|
30
|
-
*/ blockHash, /*
|
|
31
20
|
* The timestamp of the block this log is included in
|
|
32
21
|
*/ blockTimestamp, /*
|
|
33
|
-
* The log data as
|
|
34
|
-
*/
|
|
22
|
+
* The log data as an array of field elements
|
|
23
|
+
*/ logData, /*
|
|
24
|
+
* The note hashes from the tx effect
|
|
25
|
+
*/ noteHashes, /*
|
|
26
|
+
* The first nullifier from the tx effect. Used for nonce discovery when processing notes from logs.
|
|
27
|
+
*
|
|
28
|
+
* (Note nonces are computed as `hash(firstNullifier, noteIndexInTx)`.)
|
|
29
|
+
*/ firstNullifier){
|
|
35
30
|
this.txHash = txHash;
|
|
36
|
-
this.dataStartIndexForTx = dataStartIndexForTx;
|
|
37
|
-
this.logIndexInTx = logIndexInTx;
|
|
38
31
|
this.blockNumber = blockNumber;
|
|
39
|
-
this.blockHash = blockHash;
|
|
40
32
|
this.blockTimestamp = blockTimestamp;
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return this.log instanceof PublicLog;
|
|
33
|
+
this.logData = logData;
|
|
34
|
+
this.noteHashes = noteHashes;
|
|
35
|
+
this.firstNullifier = firstNullifier;
|
|
45
36
|
}
|
|
46
37
|
static get schema() {
|
|
47
38
|
return z.object({
|
|
48
39
|
txHash: TxHash.schema,
|
|
49
|
-
dataStartIndexForTx: z.number(),
|
|
50
|
-
logIndexInTx: z.number(),
|
|
51
40
|
blockNumber: BlockNumberSchema,
|
|
52
|
-
blockHash: L2BlockHash.schema,
|
|
53
41
|
blockTimestamp: schemas.UInt64,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}).transform(({ txHash, dataStartIndexForTx, logIndexInTx, blockNumber, blockHash, blockTimestamp, log })=>new TxScopedL2Log(txHash, dataStartIndexForTx, logIndexInTx, blockNumber, blockHash, blockTimestamp, log));
|
|
42
|
+
logData: z.array(foundationSchemas.Fr),
|
|
43
|
+
noteHashes: z.array(foundationSchemas.Fr),
|
|
44
|
+
firstNullifier: foundationSchemas.Fr
|
|
45
|
+
}).transform(({ txHash, blockNumber, blockTimestamp, logData, noteHashes, firstNullifier })=>new TxScopedL2Log(txHash, blockNumber, blockTimestamp, logData, noteHashes, firstNullifier));
|
|
59
46
|
}
|
|
60
47
|
toBuffer() {
|
|
61
48
|
return Buffer.concat([
|
|
62
49
|
this.txHash.toBuffer(),
|
|
63
|
-
numToUInt32BE(this.dataStartIndexForTx),
|
|
64
|
-
numToUInt32BE(this.logIndexInTx),
|
|
65
50
|
numToUInt32BE(this.blockNumber),
|
|
66
|
-
this.blockHash.toBuffer(),
|
|
67
51
|
bigintToUInt64BE(this.blockTimestamp),
|
|
68
|
-
|
|
69
|
-
this.
|
|
52
|
+
serializeArrayOfBufferableToVector(this.logData),
|
|
53
|
+
serializeArrayOfBufferableToVector(this.noteHashes),
|
|
54
|
+
this.firstNullifier.toBuffer()
|
|
70
55
|
]);
|
|
71
56
|
}
|
|
72
57
|
static fromBuffer(buffer) {
|
|
73
58
|
const reader = BufferReader.asReader(buffer);
|
|
74
59
|
const txHash = reader.readObject(TxHash);
|
|
75
|
-
const dataStartIndexForTx = reader.readNumber();
|
|
76
|
-
const logIndexInTx = reader.readNumber();
|
|
77
60
|
const blockNumber = BlockNumber(reader.readNumber());
|
|
78
|
-
const blockHash = reader.readObject(L2BlockHash);
|
|
79
61
|
const blockTimestamp = reader.readUInt64();
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
static async random(isFromPublic = Math.random() < 0.5) {
|
|
85
|
-
const log = isFromPublic ? await PublicLog.random() : PrivateLog.random();
|
|
86
|
-
return new TxScopedL2Log(TxHash.random(), 1, 1, BlockNumber(1), L2BlockHash.random(), 1n, log);
|
|
62
|
+
const logData = reader.readVector(Fr);
|
|
63
|
+
const noteHashes = reader.readVector(Fr);
|
|
64
|
+
const firstNullifier = reader.readObject(Fr);
|
|
65
|
+
return new TxScopedL2Log(txHash, blockNumber, blockTimestamp, logData, noteHashes, firstNullifier);
|
|
87
66
|
}
|
|
88
67
|
equals(other) {
|
|
89
|
-
return this.txHash.equals(other.txHash) && this.
|
|
68
|
+
return this.txHash.equals(other.txHash) && this.blockNumber === other.blockNumber && this.blockTimestamp === other.blockTimestamp && this.logData.length === other.logData.length && this.logData.every((f, i)=>f.equals(other.logData[i])) && this.noteHashes.length === other.noteHashes.length && this.noteHashes.every((h, i)=>h.equals(other.noteHashes[i])) && this.firstNullifier.equals(other.firstNullifier);
|
|
90
69
|
}
|
|
91
70
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Computes the inHash for a checkpoint (or the first block in a checkpoint) given its l1 to l2 messages.
|
|
4
|
+
*/
|
|
3
5
|
export declare function computeInHashFromL1ToL2Messages(unpaddedL1ToL2Messages: Fr[]): Fr;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5faGFzaC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21lc3NhZ2luZy9pbl9oYXNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUdwRDs7R0FFRztBQUNILHdCQUFnQiwrQkFBK0IsQ0FBQyxzQkFBc0IsRUFBRSxFQUFFLEVBQUUsR0FBRyxFQUFFLENBR2hGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in_hash.d.ts","sourceRoot":"","sources":["../../src/messaging/in_hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD
|
|
1
|
+
{"version":3,"file":"in_hash.d.ts","sourceRoot":"","sources":["../../src/messaging/in_hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,sBAAsB,EAAE,EAAE,EAAE,GAAG,EAAE,CAGhF"}
|
|
@@ -2,7 +2,9 @@ import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { computeBalancedShaRoot } from '@aztec/foundation/trees';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Computes the inHash for a checkpoint (or the first block in a checkpoint) given its l1 to l2 messages.
|
|
7
|
+
*/ export function computeInHashFromL1ToL2Messages(unpaddedL1ToL2Messages) {
|
|
6
8
|
const l1ToL2Messages = padArrayEnd(unpaddedL1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
7
9
|
return new Fr(computeBalancedShaRoot(l1ToL2Messages.map((msg)=>msg.toBuffer())));
|
|
8
10
|
}
|
|
@@ -1,15 +1,97 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { SiblingPath } from '@aztec/foundation/trees';
|
|
4
|
+
/**
|
|
5
|
+
* # L2-to-L1 Message Tree Structure and Leaf IDs
|
|
6
|
+
*
|
|
7
|
+
* ## Overview
|
|
8
|
+
* L2-to-L1 messages are organized in a hierarchical 4-level tree structure within each epoch:
|
|
9
|
+
* Epoch → Checkpoints → Blocks → Transactions → Messages
|
|
10
|
+
*
|
|
11
|
+
* Each level uses an unbalanced Merkle tree, and some levels use compression (skipping zero hashes).
|
|
12
|
+
*
|
|
13
|
+
* ## Tree Levels
|
|
14
|
+
*
|
|
15
|
+
* 1. **Message Tree (TX Out Hash)**
|
|
16
|
+
* - Leaves: Individual L2-to-L1 messages within a transaction
|
|
17
|
+
* - Root: TX out hash
|
|
18
|
+
* - Type: Unbalanced, non-compressed (the circuits ensure that all messages are not empty.)
|
|
19
|
+
*
|
|
20
|
+
* 2. **Block Tree**
|
|
21
|
+
* - Leaves: TX out hashes from all transactions in a block
|
|
22
|
+
* - Root: Block out hash
|
|
23
|
+
* - Type: Unbalanced, compressed (zero hashes are skipped)
|
|
24
|
+
* - Compression: If a tx has no messages (out hash = 0), that branch is ignored
|
|
25
|
+
*
|
|
26
|
+
* 3. **Checkpoint Tree**
|
|
27
|
+
* - Leaves: Block out hashes from all blocks in a checkpoint
|
|
28
|
+
* - Root: Checkpoint out hash
|
|
29
|
+
* - Type: Unbalanced, compressed (zero hashes are skipped)
|
|
30
|
+
* - Compression: If a block has no messages (out hash = 0), that branch is ignored
|
|
31
|
+
*
|
|
32
|
+
* 4. **Epoch Tree**
|
|
33
|
+
* - Leaves: Checkpoint out hashes from all checkpoints in an epoch (padded to AZTEC_MAX_EPOCH_DURATION)
|
|
34
|
+
* - Root: Epoch out hash (set in the root rollup's public inputs and inserted into the Outbox on L1 when the epoch is proven)
|
|
35
|
+
* - Type: Unbalanced, non-compressed
|
|
36
|
+
* - **Important**: Padded with zeros up to AZTEC_MAX_EPOCH_DURATION to allow for proofs of partial epochs
|
|
37
|
+
*
|
|
38
|
+
* ## Combined Membership Proof
|
|
39
|
+
* To prove a message exists in an epoch, we combine the sibling paths from all 4 trees:
|
|
40
|
+
* [message siblings] + [tx siblings] + [block siblings] + [checkpoint siblings]
|
|
41
|
+
*
|
|
42
|
+
* ## Leaf ID: Stable Message Identification
|
|
43
|
+
*
|
|
44
|
+
* Each message gets a unique, stable **leaf ID** that identifies its position in the combined tree.
|
|
45
|
+
* The leaf ID is computed as:
|
|
46
|
+
* leafId = 2^pathSize + leafIndex
|
|
47
|
+
*
|
|
48
|
+
* Where:
|
|
49
|
+
* - `pathSize`: Total length of the combined sibling path (from all 4 tree levels)
|
|
50
|
+
* - `leafIndex`: The message's index in a balanced tree representation at that height
|
|
51
|
+
*
|
|
52
|
+
* ### Why Leaf IDs Are Stable
|
|
53
|
+
*
|
|
54
|
+
* The leaf ID is based on the message's position in the tree structure, which is determined by:
|
|
55
|
+
* - The checkpoint index within the epoch
|
|
56
|
+
* - The block index within the checkpoint
|
|
57
|
+
* - The transaction index within the block
|
|
58
|
+
* - The message index within the transaction
|
|
59
|
+
*
|
|
60
|
+
* These indices are structural and do NOT depend on the total number of blocks/checkpoints in the epoch.
|
|
61
|
+
*
|
|
62
|
+
* ### Critical Property: Preserving Consumed Status
|
|
63
|
+
*
|
|
64
|
+
* **Problem**: On L1, epoch proofs can be submitted incrementally. For example:
|
|
65
|
+
* - First, a proof for checkpoints 1-10 of epoch 0 is submitted (proves the first 10 checkpoints)
|
|
66
|
+
* - Later, a proof for checkpoints 1-20 of epoch 0 is submitted (proves all 20 checkpoints)
|
|
67
|
+
*
|
|
68
|
+
* When the longer proof is submitted, it updates the epoch's out hash root on L1 to reflect the complete epoch (all 20
|
|
69
|
+
* checkpoints). However, some messages from checkpoints 1-10 may have already been consumed.
|
|
70
|
+
*
|
|
71
|
+
* **Solution**: The Outbox on L1 tracks consumed messages using a bitmap indexed by leaf ID.
|
|
72
|
+
* Because leaf IDs are stable (they don't change when more checkpoints are added to the epoch), messages that were consumed
|
|
73
|
+
* under the shorter proof remain marked as consumed under the longer proof.
|
|
74
|
+
*
|
|
75
|
+
* This prevents double-spending of L2-to-L1 messages when longer epoch proofs are submitted.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* Computes the unique leaf ID for an L2-to-L1 message.
|
|
79
|
+
*
|
|
80
|
+
* The leaf ID is stable across different epoch proof lengths and is used by the Outbox
|
|
81
|
+
* on L1 to track which messages have been consumed.
|
|
82
|
+
*
|
|
83
|
+
* @param membershipWitness - Contains the leafIndex and siblingPath for the message
|
|
84
|
+
* @returns The unique leaf ID used for tracking message consumption on L1
|
|
85
|
+
*/
|
|
86
|
+
export declare function getL2ToL1MessageLeafId(membershipWitness: Pick<L2ToL1MembershipWitness, 'leafIndex' | 'siblingPath'>): bigint;
|
|
4
87
|
export interface MessageRetrieval {
|
|
5
|
-
getL2ToL1Messages(
|
|
88
|
+
getL2ToL1Messages(epoch: EpochNumber): Promise<Fr[][][][]>;
|
|
6
89
|
}
|
|
7
90
|
export type L2ToL1MembershipWitness = {
|
|
8
91
|
root: Fr;
|
|
9
92
|
leafIndex: bigint;
|
|
10
93
|
siblingPath: SiblingPath<number>;
|
|
11
94
|
};
|
|
12
|
-
export declare function computeL2ToL1MembershipWitness(messageRetriever: MessageRetrieval,
|
|
13
|
-
export declare function
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfdG9fbDFfbWVtYmVyc2hpcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21lc3NhZ2luZy9sMl90b19sMV9tZW1iZXJzaGlwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25FLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsV0FBVyxFQUE0RCxNQUFNLHlCQUF5QixDQUFDO0FBRWhILE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsaUJBQWlCLENBQUMsYUFBYSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLEVBQUUsR0FBRyxTQUFTLENBQUMsQ0FBQztDQUM1RTtBQUVELE1BQU0sTUFBTSx1QkFBdUIsR0FBRztJQUNwQyxJQUFJLEVBQUUsRUFBRSxDQUFDO0lBQ1QsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixXQUFXLEVBQUUsV0FBVyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0NBQ2xDLENBQUM7QUFFRix3QkFBc0IsOEJBQThCLENBQ2xELGdCQUFnQixFQUFFLGdCQUFnQixFQUNsQyxhQUFhLEVBQUUsV0FBVyxFQUMxQixPQUFPLEVBQUUsRUFBRSxHQUNWLE9BQU8sQ0FBQyx1QkFBdUIsR0FBRyxTQUFTLENBQUMsQ0FPOUM7QUFJRCx3QkFBZ0IsbURBQW1ELENBQ2pFLGlCQUFpQixFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQ3pCLE9BQU8sRUFBRSxFQUFFLEdBQ1YsdUJBQXVCLENBNER6QjtBQUVELHdCQUFnQixzQkFBc0IsQ0FDcEMsaUJBQWlCLEVBQUUsSUFBSSxDQUFDLHVCQUF1QixFQUFFLFdBQVcsR0FBRyxhQUFhLENBQUMsR0FDNUUsTUFBTSxDQUVSIn0=
|
|
95
|
+
export declare function computeL2ToL1MembershipWitness(messageRetriever: MessageRetrieval, epoch: EpochNumber, message: Fr): Promise<L2ToL1MembershipWitness | undefined>;
|
|
96
|
+
export declare function computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch: Fr[][][][], message: Fr): L2ToL1MembershipWitness;
|
|
97
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfdG9fbDFfbWVtYmVyc2hpcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21lc3NhZ2luZy9sMl90b19sMV9tZW1iZXJzaGlwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25FLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsV0FBVyxFQUE0RCxNQUFNLHlCQUF5QixDQUFDO0FBRWhIOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0F3RUc7QUFFSDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFnQixzQkFBc0IsQ0FDcEMsaUJBQWlCLEVBQUUsSUFBSSxDQUFDLHVCQUF1QixFQUFFLFdBQVcsR0FBRyxhQUFhLENBQUMsR0FDNUUsTUFBTSxDQUVSO0FBRUQsTUFBTSxXQUFXLGdCQUFnQjtJQUMvQixpQkFBaUIsQ0FBQyxLQUFLLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0NBQzVEO0FBRUQsTUFBTSxNQUFNLHVCQUF1QixHQUFHO0lBQ3BDLElBQUksRUFBRSxFQUFFLENBQUM7SUFDVCxTQUFTLEVBQUUsTUFBTSxDQUFDO0lBQ2xCLFdBQVcsRUFBRSxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUM7Q0FDbEMsQ0FBQztBQUVGLHdCQUFzQiw4QkFBOEIsQ0FDbEQsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQ2xDLEtBQUssRUFBRSxXQUFXLEVBQ2xCLE9BQU8sRUFBRSxFQUFFLEdBQ1YsT0FBTyxDQUFDLHVCQUF1QixHQUFHLFNBQVMsQ0FBQyxDQU85QztBQUlELHdCQUFnQixpREFBaUQsQ0FDL0QsZUFBZSxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUMzQixPQUFPLEVBQUUsRUFBRSxHQUNWLHVCQUF1QixDQW1GekIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l2_to_l1_membership.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_membership.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"l2_to_l1_membership.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_membership.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,WAAW,EAA4D,MAAM,yBAAyB,CAAC;AAEhH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,aAAa,CAAC,GAC5E,MAAM,CAER;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;CAC5D;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,EAAE,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,EAAE,GACV,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAO9C;AAID,wBAAgB,iDAAiD,CAC/D,eAAe,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC3B,OAAO,EAAE,EAAE,GACV,uBAAuB,CAmFzB"}
|