@aztec/stdlib 0.0.1-commit.d1cd2107c → 0.0.1-commit.d1da697d6
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/abi.d.ts +138 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +10 -2
- package/dest/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +5 -44
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +12 -67
- package/dest/abi/function_selector.js +1 -1
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/abi/selector.d.ts +2 -2
- package/dest/abi/selector.d.ts.map +1 -1
- package/dest/abi/selector.js +1 -1
- package/dest/avm/avm.d.ts +300 -300
- package/dest/avm/revert_code.d.ts +8 -18
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -30
- package/dest/block/l2_block_source.d.ts +90 -10
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +17 -4
- 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 +3 -2
- package/dest/checkpoint/checkpoint.d.ts +7 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -1
- package/dest/checkpoint/checkpoint_data.d.ts +71 -5
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_data.js +10 -0
- package/dest/checkpoint/validate.js +2 -2
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/pipelining-config.d.ts +19 -0
- package/dest/config/pipelining-config.d.ts.map +1 -0
- package/dest/config/pipelining-config.js +18 -0
- package/dest/contract/contract_address.d.ts +3 -3
- package/dest/contract/contract_address.js +3 -3
- package/dest/contract/contract_class_id.d.ts +2 -2
- package/dest/contract/contract_class_id.js +2 -2
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_class.d.ts +3 -156
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -28
- package/dest/epoch-helpers/index.d.ts +11 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +16 -2
- package/dest/file-store/factory.d.ts +4 -3
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +2 -2
- package/dest/file-store/http.d.ts +9 -2
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +20 -9
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/gas/gas_settings.d.ts +40 -3
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +50 -6
- package/dest/hash/hash.d.ts +19 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +29 -0
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +5 -3
- package/dest/interfaces/aztec-node-admin.d.ts +10 -6
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -1
- package/dest/interfaces/aztec-node.d.ts +3 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -0
- package/dest/interfaces/block-builder.d.ts +32 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +6 -4
- package/dest/interfaces/configs.d.ts +7 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/l2_logs_source.d.ts +5 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +200 -200
- package/dest/interfaces/validator.d.ts +2 -10
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +0 -1
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +4 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +7 -3
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/p2p/checkpoint_proposal.d.ts +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +13 -11
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- package/dest/tests/factories.d.ts +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +11 -28
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +2 -2
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/dest/tx/global_variable_builder.d.ts +14 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/simulated_tx.d.ts +111 -3
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +2 -2
- package/dest/tx/tx_receipt.d.ts +14 -5
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +14 -18
- package/dest/tx/validator/error_texts.d.ts +5 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +6 -0
- package/dest/update-checker/package_version.d.ts +2 -2
- package/dest/update-checker/package_version.d.ts.map +1 -1
- package/dest/update-checker/package_version.js +16 -3
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/package.json +8 -8
- package/src/abi/abi.ts +25 -2
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +23 -78
- package/src/abi/function_selector.ts +1 -1
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/abi/selector.ts +1 -1
- package/src/avm/revert_code.ts +25 -39
- package/src/block/l2_block_source.ts +20 -9
- package/src/block/l2_block_stream/l2_tips_store_base.ts +24 -12
- package/src/block/test/l2_tips_store_test_suite.ts +8 -1
- package/src/checkpoint/checkpoint.ts +11 -1
- package/src/checkpoint/checkpoint_data.ts +40 -4
- package/src/checkpoint/validate.ts +2 -2
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- package/src/contract/contract_address.ts +3 -3
- package/src/contract/contract_class_id.ts +2 -2
- package/src/contract/index.ts +0 -2
- package/src/contract/interfaces/contract_class.ts +2 -82
- package/src/epoch-helpers/index.ts +27 -0
- package/src/file-store/factory.ts +13 -4
- package/src/file-store/http.ts +29 -10
- package/src/file-store/index.ts +1 -0
- package/src/gas/README.md +123 -0
- package/src/gas/gas_settings.ts +65 -12
- package/src/hash/hash.ts +34 -0
- package/src/interfaces/archiver.ts +5 -3
- package/src/interfaces/aztec-node-admin.ts +4 -3
- package/src/interfaces/aztec-node.ts +10 -1
- package/src/interfaces/block-builder.ts +39 -13
- package/src/interfaces/configs.ts +4 -1
- package/src/interfaces/l2_logs_source.ts +4 -1
- package/src/interfaces/merkle_tree_operations.ts +8 -18
- package/src/interfaces/prover-client.ts +8 -0
- package/src/interfaces/validator.ts +1 -5
- package/src/interfaces/world_state.ts +4 -3
- package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
- package/src/logs/index.ts +1 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +7 -2
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/messaging/l1_to_l2_message_source.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/note/note_dao.ts +1 -4
- package/src/p2p/checkpoint_proposal.ts +23 -20
- package/src/proofs/chonk_proof.ts +91 -5
- package/src/tests/factories.ts +5 -34
- package/src/tests/mocks.ts +2 -2
- package/src/tx/capsule.ts +10 -2
- package/src/tx/global_variable_builder.ts +15 -0
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/simulated_tx.ts +5 -1
- package/src/tx/tx_receipt.ts +18 -16
- package/src/tx/validator/error_texts.ts +8 -0
- package/src/update-checker/package_version.ts +19 -6
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/dest/contract/private_function_membership_proof.d.ts +0 -32
- package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/private_function_membership_proof.js +0 -124
- package/dest/contract/utility_function_membership_proof.d.ts +0 -27
- package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/utility_function_membership_proof.js +0 -87
- package/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
|
@@ -178,29 +178,32 @@ export class CheckpointProposal extends Gossipable {
|
|
|
178
178
|
blockNumber: lastBlockInfo?.blockHeader?.globalVariables.blockNumber ?? BlockNumber(0),
|
|
179
179
|
dutyType: DutyType.CHECKPOINT_PROPOSAL,
|
|
180
180
|
};
|
|
181
|
-
const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
|
|
182
181
|
|
|
183
|
-
if (
|
|
184
|
-
|
|
182
|
+
if (lastBlockInfo) {
|
|
183
|
+
// Sign block proposal before signing checkpoint proposal to ensure HA protection
|
|
184
|
+
const lastBlockProposal = await BlockProposal.createProposalFromSigner(
|
|
185
|
+
lastBlockInfo.blockHeader,
|
|
186
|
+
lastBlockInfo.indexWithinCheckpoint,
|
|
187
|
+
checkpointHeader.inHash,
|
|
188
|
+
archiveRoot,
|
|
189
|
+
lastBlockInfo.txHashes,
|
|
190
|
+
lastBlockInfo.txs,
|
|
191
|
+
payloadSigner,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
|
|
195
|
+
|
|
196
|
+
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, {
|
|
197
|
+
blockHeader: lastBlockInfo.blockHeader,
|
|
198
|
+
indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
|
|
199
|
+
txHashes: lastBlockInfo.txHashes,
|
|
200
|
+
signature: lastBlockProposal.signature,
|
|
201
|
+
signedTxs: lastBlockProposal.signedTxs,
|
|
202
|
+
});
|
|
185
203
|
}
|
|
186
204
|
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
lastBlockInfo.indexWithinCheckpoint,
|
|
190
|
-
checkpointHeader.inHash,
|
|
191
|
-
archiveRoot,
|
|
192
|
-
lastBlockInfo.txHashes,
|
|
193
|
-
lastBlockInfo.txs,
|
|
194
|
-
payloadSigner,
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, {
|
|
198
|
-
blockHeader: lastBlockInfo.blockHeader,
|
|
199
|
-
indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
|
|
200
|
-
txHashes: lastBlockInfo.txHashes,
|
|
201
|
-
signature: lastBlockProposal.signature,
|
|
202
|
-
signedTxs: lastBlockProposal.signedTxs,
|
|
203
|
-
});
|
|
205
|
+
const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
|
|
206
|
+
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature);
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
/**
|
|
@@ -1,21 +1,41 @@
|
|
|
1
|
+
import { BarretenbergSync, flattenChonkProofFields } from '@aztec/bb.js';
|
|
1
2
|
import { CHONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
3
|
import { times } from '@aztec/foundation/collection';
|
|
3
4
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
4
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
6
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
6
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
7
|
+
import { BufferReader, numToUInt32BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serialization format detection for ChonkProof is size-based:
|
|
11
|
+
* - UNCOMPRESSED (legacy): [field_count=1632: uint32] [fields...] → total ≈ 52KB (>= 40KB)
|
|
12
|
+
* - COMPRESSED: [byte_count: uint32] [compressed_bytes] → total ≈ 35KB (< 40KB)
|
|
13
|
+
*
|
|
14
|
+
* Detection: if the first uint32 equals CHONK_PROOF_LENGTH (1632), it's legacy format
|
|
15
|
+
* (field count). Otherwise, it's compressed format (byte count). The old uncompressed
|
|
16
|
+
* format is never smaller than 40KB; compressed proofs are always smaller than 40KB.
|
|
17
|
+
*/
|
|
7
18
|
|
|
8
19
|
// CHONK: "Client Honk" - An UltraHonk variant with incremental folding and delayed non-native arithmetic.
|
|
9
20
|
export class ChonkProof {
|
|
21
|
+
/**
|
|
22
|
+
* Optional compressed proof bytes from chonk compression (point compression + u256 encoding).
|
|
23
|
+
* When set, toBuffer() will serialize in compressed format (~1.7x smaller).
|
|
24
|
+
* When reading from compressed format, this is populated and fields are decompressed on demand.
|
|
25
|
+
*/
|
|
26
|
+
public compressedProof?: Buffer;
|
|
27
|
+
|
|
10
28
|
constructor(
|
|
11
29
|
// The proof fields.
|
|
12
30
|
// For native verification, attach public inputs via `attachPublicInputs(publicInputs)`.
|
|
13
31
|
// Not using Tuple here due to the length being too high.
|
|
14
32
|
public fields: Fr[],
|
|
33
|
+
compressedProof?: Buffer,
|
|
15
34
|
) {
|
|
16
35
|
if (fields.length !== CHONK_PROOF_LENGTH) {
|
|
17
36
|
throw new Error(`Invalid ChonkProof length: ${fields.length}`);
|
|
18
37
|
}
|
|
38
|
+
this.compressedProof = compressedProof;
|
|
19
39
|
}
|
|
20
40
|
|
|
21
41
|
public attachPublicInputs(publicInputs: Fr[]) {
|
|
@@ -53,19 +73,84 @@ export class ChonkProof {
|
|
|
53
73
|
return this.toBuffer();
|
|
54
74
|
}
|
|
55
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Deserialize a ChonkProof from a buffer.
|
|
78
|
+
* Supports both legacy (field elements) and compressed (chonk compression) formats.
|
|
79
|
+
*
|
|
80
|
+
* Size-based format detection:
|
|
81
|
+
* - First uint32 == CHONK_PROOF_LENGTH (1632): legacy format, read field elements
|
|
82
|
+
* Total proof data ≈ 52KB (always >= 40KB)
|
|
83
|
+
* - Otherwise: compressed format, first uint32 is byte count of compressed data
|
|
84
|
+
* Total proof data ≈ 35KB (always < 40KB)
|
|
85
|
+
*/
|
|
56
86
|
static fromBuffer(buffer: Buffer | BufferReader): ChonkProof {
|
|
57
87
|
const reader = BufferReader.asReader(buffer);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
const firstUint32 = reader.readNumber();
|
|
89
|
+
|
|
90
|
+
if (firstUint32 === CHONK_PROOF_LENGTH) {
|
|
91
|
+
// Legacy format: firstUint32 is the field count (1632)
|
|
92
|
+
// Widen to `number` to prevent TS from narrowing to literal 1632,
|
|
93
|
+
// which would cause Tuple<Fr, 1632> to exceed the recursion limit.
|
|
94
|
+
const fieldCount: number = firstUint32;
|
|
95
|
+
const proof = reader.readArray(fieldCount, Fr);
|
|
96
|
+
return new ChonkProof(proof);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Compressed format: firstUint32 is the compressed byte count
|
|
100
|
+
const compressedBytes = reader.readBytes(firstUint32);
|
|
101
|
+
return ChonkProof.fromCompressedBytes(Buffer.from(compressedBytes));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Create a ChonkProof from compressed bytes by decompressing via the BarretenbergSync API.
|
|
106
|
+
* The compressed format uses point compression and u256 encoding (from PR #20645).
|
|
107
|
+
*
|
|
108
|
+
* @param compressed - Compressed proof bytes from chonk compression
|
|
109
|
+
* @returns ChonkProof with both fields and compressed bytes populated
|
|
110
|
+
*/
|
|
111
|
+
static fromCompressedBytes(compressed: Buffer): ChonkProof {
|
|
112
|
+
const api = BarretenbergSync.getSingleton();
|
|
113
|
+
const result = api.chonkDecompressProof({ compressedProof: new Uint8Array(compressed) });
|
|
114
|
+
|
|
115
|
+
// Flatten the structured bb.js ChonkProof into flat Fr[] field elements
|
|
116
|
+
const flatFields = flattenChonkProofFields(result.proof);
|
|
117
|
+
const fields = flatFields.map(f => Fr.fromBuffer(Buffer.from(f)));
|
|
118
|
+
|
|
119
|
+
// The decompressed proof includes public inputs in hidingOinkProof.
|
|
120
|
+
// Since ChonkProof stores fields WITHOUT public inputs, strip them.
|
|
121
|
+
// The number of public inputs = total fields - CHONK_PROOF_LENGTH
|
|
122
|
+
if (fields.length > CHONK_PROOF_LENGTH) {
|
|
123
|
+
const numPubInputs = fields.length - CHONK_PROOF_LENGTH;
|
|
124
|
+
const proofFields = fields.slice(numPubInputs);
|
|
125
|
+
return new ChonkProof(proofFields, compressed);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return new ChonkProof(fields, compressed);
|
|
61
129
|
}
|
|
62
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Serialize the proof to a buffer.
|
|
133
|
+
* If compressed bytes are available, uses the compressed format (~1.7x smaller).
|
|
134
|
+
* Otherwise falls back to legacy field element format.
|
|
135
|
+
*/
|
|
63
136
|
public toBuffer() {
|
|
137
|
+
if (this.compressedProof) {
|
|
138
|
+
// Compressed format: [compressed_byte_count: uint32] [compressed_bytes]
|
|
139
|
+
return Buffer.concat([numToUInt32BE(this.compressedProof.length), this.compressedProof]);
|
|
140
|
+
}
|
|
141
|
+
// Legacy format: [field_count=1632: uint32] [fields...]
|
|
64
142
|
return serializeToBuffer(this.fields.length, this.fields);
|
|
65
143
|
}
|
|
66
144
|
}
|
|
67
145
|
|
|
68
146
|
export class ChonkProofWithPublicInputs {
|
|
147
|
+
/**
|
|
148
|
+
* Optional compressed proof bytes (covers the full proof WITH public inputs).
|
|
149
|
+
* Set by the prover when using chonk compression. Flows through to ChonkProof
|
|
150
|
+
* via removePublicInputs() so the Tx can serialize in compressed format.
|
|
151
|
+
*/
|
|
152
|
+
public compressedProof?: Buffer;
|
|
153
|
+
|
|
69
154
|
constructor(
|
|
70
155
|
// The proof fields with public inputs.
|
|
71
156
|
// For recursive verification, use without public inputs via `removePublicInputs()`.
|
|
@@ -83,7 +168,8 @@ export class ChonkProofWithPublicInputs {
|
|
|
83
168
|
|
|
84
169
|
public removePublicInputs() {
|
|
85
170
|
const numPublicInputs = this.fieldsWithPublicInputs.length - CHONK_PROOF_LENGTH;
|
|
86
|
-
|
|
171
|
+
// Flow compressed proof bytes through so the ChonkProof can serialize efficiently
|
|
172
|
+
return new ChonkProof(this.fieldsWithPublicInputs.slice(numPublicInputs), this.compressedProof);
|
|
87
173
|
}
|
|
88
174
|
|
|
89
175
|
public isEmpty() {
|
package/src/tests/factories.ts
CHANGED
|
@@ -92,10 +92,8 @@ import {
|
|
|
92
92
|
type ContractClassPublic,
|
|
93
93
|
ContractDeploymentData,
|
|
94
94
|
type ContractInstanceWithAddress,
|
|
95
|
-
type ExecutablePrivateFunctionWithMembershipProof,
|
|
96
95
|
type PrivateFunction,
|
|
97
96
|
SerializableContractInstance,
|
|
98
|
-
type UtilityFunctionWithMembershipProof,
|
|
99
97
|
computeContractClassId,
|
|
100
98
|
computePublicBytecodeCommitment,
|
|
101
99
|
} from '../contract/index.js';
|
|
@@ -234,7 +232,7 @@ export function makeTxContext(seed: number = 1): TxContext {
|
|
|
234
232
|
* Creates a default instance of gas settings. No seed value is used to ensure we allocate a sensible amount of gas for testing.
|
|
235
233
|
*/
|
|
236
234
|
export function makeGasSettings() {
|
|
237
|
-
return GasSettings.
|
|
235
|
+
return GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) });
|
|
238
236
|
}
|
|
239
237
|
|
|
240
238
|
/**
|
|
@@ -1183,35 +1181,6 @@ export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
|
|
|
1183
1181
|
});
|
|
1184
1182
|
}
|
|
1185
1183
|
|
|
1186
|
-
export function makeExecutablePrivateFunctionWithMembershipProof(
|
|
1187
|
-
seed = 0,
|
|
1188
|
-
): ExecutablePrivateFunctionWithMembershipProof {
|
|
1189
|
-
return {
|
|
1190
|
-
selector: makeSelector(seed),
|
|
1191
|
-
bytecode: makeBytes(100, seed + 1),
|
|
1192
|
-
artifactTreeSiblingPath: makeTuple(3, fr, seed + 2),
|
|
1193
|
-
artifactTreeLeafIndex: seed + 2,
|
|
1194
|
-
privateFunctionTreeSiblingPath: makeTuple(3, fr, seed + 3),
|
|
1195
|
-
privateFunctionTreeLeafIndex: seed + 3,
|
|
1196
|
-
artifactMetadataHash: fr(seed + 4),
|
|
1197
|
-
functionMetadataHash: fr(seed + 5),
|
|
1198
|
-
utilityFunctionsTreeRoot: fr(seed + 6),
|
|
1199
|
-
vkHash: fr(seed + 7),
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
export function makeUtilityFunctionWithMembershipProof(seed = 0): UtilityFunctionWithMembershipProof {
|
|
1204
|
-
return {
|
|
1205
|
-
selector: makeSelector(seed),
|
|
1206
|
-
bytecode: makeBytes(100, seed + 1),
|
|
1207
|
-
artifactTreeSiblingPath: makeTuple(3, fr, seed + 2),
|
|
1208
|
-
artifactTreeLeafIndex: seed + 2,
|
|
1209
|
-
artifactMetadataHash: fr(seed + 4),
|
|
1210
|
-
functionMetadataHash: fr(seed + 5),
|
|
1211
|
-
privateFunctionsArtifactTreeRoot: fr(seed + 6),
|
|
1212
|
-
};
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
1184
|
export async function makeContractClassPublic(seed = 0, publicBytecode?: Buffer): Promise<ContractClassPublic> {
|
|
1216
1185
|
const artifactHash = fr(seed + 1);
|
|
1217
1186
|
const privateFunctionsRoot = fr(seed + 3);
|
|
@@ -1223,8 +1192,6 @@ export async function makeContractClassPublic(seed = 0, publicBytecode?: Buffer)
|
|
|
1223
1192
|
artifactHash,
|
|
1224
1193
|
packedBytecode,
|
|
1225
1194
|
privateFunctionsRoot,
|
|
1226
|
-
privateFunctions: [],
|
|
1227
|
-
utilityFunctions: [],
|
|
1228
1195
|
version: 1,
|
|
1229
1196
|
};
|
|
1230
1197
|
}
|
|
@@ -1748,6 +1715,10 @@ export function makeL2Tips(
|
|
|
1748
1715
|
block: { number: bn, hash },
|
|
1749
1716
|
checkpoint: { number: cpn, hash: cph },
|
|
1750
1717
|
},
|
|
1718
|
+
proposedCheckpoint: {
|
|
1719
|
+
block: { number: bn, hash },
|
|
1720
|
+
checkpoint: { number: cpn, hash: cph },
|
|
1721
|
+
},
|
|
1751
1722
|
proven: {
|
|
1752
1723
|
block: { number: bn, hash },
|
|
1753
1724
|
checkpoint: { number: cpn, hash: cph },
|
package/src/tests/mocks.ts
CHANGED
|
@@ -134,7 +134,7 @@ export const mockTx = async (
|
|
|
134
134
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
135
135
|
const firstNullifier = new Nullifier(new Fr(seed + 1), Fr.ZERO, 0);
|
|
136
136
|
data.constants.anchorBlockHeader = anchorBlockHeader;
|
|
137
|
-
data.constants.txContext.gasSettings = GasSettings.
|
|
137
|
+
data.constants.txContext.gasSettings = GasSettings.fallback({ gasLimits, maxFeesPerGas, maxPriorityFeesPerGas });
|
|
138
138
|
data.feePayer = feePayer ?? (await AztecAddress.random());
|
|
139
139
|
data.gasUsed = gasUsed;
|
|
140
140
|
data.constants.txContext.chainId = chainId;
|
|
@@ -200,7 +200,7 @@ export async function mockProcessedTx({
|
|
|
200
200
|
db,
|
|
201
201
|
chainId = Fr.ZERO,
|
|
202
202
|
version = Fr.ZERO,
|
|
203
|
-
gasSettings = GasSettings.
|
|
203
|
+
gasSettings = GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) }),
|
|
204
204
|
vkTreeRoot = Fr.ZERO,
|
|
205
205
|
protocolContracts = makeProtocolContracts(seed + 0x100),
|
|
206
206
|
globalVariables = GlobalVariables.empty(),
|
package/src/tx/capsule.ts
CHANGED
|
@@ -19,6 +19,8 @@ export class Capsule {
|
|
|
19
19
|
public readonly storageSlot: Fr,
|
|
20
20
|
/** Data passed to the contract */
|
|
21
21
|
public readonly data: Fr[],
|
|
22
|
+
/** Optional namespace for the capsule contents */
|
|
23
|
+
public readonly scope?: AztecAddress,
|
|
22
24
|
) {}
|
|
23
25
|
|
|
24
26
|
static get schema() {
|
|
@@ -30,12 +32,18 @@ export class Capsule {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
toBuffer() {
|
|
33
|
-
return
|
|
35
|
+
return this.scope
|
|
36
|
+
? serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data), true, this.scope)
|
|
37
|
+
: serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data), false);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
static fromBuffer(buffer: Buffer | BufferReader): Capsule {
|
|
37
41
|
const reader = BufferReader.asReader(buffer);
|
|
38
|
-
|
|
42
|
+
const contractAddress = AztecAddress.fromBuffer(reader);
|
|
43
|
+
const storageSlot = Fr.fromBuffer(reader);
|
|
44
|
+
const data = reader.readVector(Fr);
|
|
45
|
+
const hasScope = reader.readBoolean();
|
|
46
|
+
return new Capsule(contractAddress, storageSlot, data, hasScope ? AztecAddress.fromBuffer(reader) : undefined);
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
toString() {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { FeeHeader } from '@aztec/ethereum/contracts';
|
|
2
|
+
import type { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
4
|
import type { SlotNumber } from '@aztec/foundation/schemas';
|
|
3
5
|
|
|
@@ -6,6 +8,18 @@ import type { GasFees } from '../gas/gas_fees.js';
|
|
|
6
8
|
import type { UInt32 } from '../types/index.js';
|
|
7
9
|
import type { CheckpointGlobalVariables, GlobalVariables } from './global_variables.js';
|
|
8
10
|
|
|
11
|
+
/** Fee header fields needed for pipelining overrides. */
|
|
12
|
+
export type ForceProposedFeeHeader = {
|
|
13
|
+
checkpointNumber: CheckpointNumber;
|
|
14
|
+
feeHeader: FeeHeader;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** Options for building checkpoint global variables during pipelining. */
|
|
18
|
+
export type BuildCheckpointGlobalVariablesOpts = {
|
|
19
|
+
forcePendingCheckpointNumber?: CheckpointNumber;
|
|
20
|
+
forceProposedFeeHeader?: ForceProposedFeeHeader;
|
|
21
|
+
};
|
|
22
|
+
|
|
9
23
|
/**
|
|
10
24
|
* Interface for building global variables for Aztec blocks.
|
|
11
25
|
*/
|
|
@@ -32,5 +46,6 @@ export interface GlobalVariableBuilder {
|
|
|
32
46
|
coinbase: EthAddress,
|
|
33
47
|
feeRecipient: AztecAddress,
|
|
34
48
|
slotNumber: SlotNumber,
|
|
49
|
+
opts?: BuildCheckpointGlobalVariablesOpts,
|
|
35
50
|
): Promise<CheckpointGlobalVariables>;
|
|
36
51
|
}
|
|
@@ -11,7 +11,7 @@ import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inp
|
|
|
11
11
|
import type { IsEmpty } from '../kernel/utils/interfaces.js';
|
|
12
12
|
import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
|
|
13
13
|
import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
|
|
14
|
-
import { type
|
|
14
|
+
import { type TaggingIndexRange, TaggingIndexRangeSchema } from '../logs/tagging_index_range.js';
|
|
15
15
|
import { Note } from '../note/note.js';
|
|
16
16
|
import { type ZodFor, mapSchema, schemas } from '../schemas/index.js';
|
|
17
17
|
import { HashedValues } from './hashed_values.js';
|
|
@@ -137,8 +137,8 @@ export class PrivateCallExecutionResult {
|
|
|
137
137
|
public returnValues: Fr[],
|
|
138
138
|
/** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */
|
|
139
139
|
public offchainEffects: { data: Fr[] }[],
|
|
140
|
-
/** The
|
|
141
|
-
public
|
|
140
|
+
/** The tagging index ranges used in this tx to compute tags for private logs */
|
|
141
|
+
public taggingIndexRanges: TaggingIndexRange[],
|
|
142
142
|
/** The nested executions. */
|
|
143
143
|
public nestedExecutionResults: PrivateCallExecutionResult[],
|
|
144
144
|
/**
|
|
@@ -161,7 +161,7 @@ export class PrivateCallExecutionResult {
|
|
|
161
161
|
noteHashNullifierCounterMap: mapSchema(z.coerce.number(), z.number()),
|
|
162
162
|
returnValues: z.array(schemas.Fr),
|
|
163
163
|
offchainEffects: z.array(z.object({ data: z.array(schemas.Fr) })),
|
|
164
|
-
|
|
164
|
+
taggingIndexRanges: z.array(TaggingIndexRangeSchema),
|
|
165
165
|
nestedExecutionResults: z.array(z.lazy(() => PrivateCallExecutionResult.schema)),
|
|
166
166
|
contractClassLogs: z.array(CountedContractClassLog.schema),
|
|
167
167
|
})
|
|
@@ -178,7 +178,7 @@ export class PrivateCallExecutionResult {
|
|
|
178
178
|
fields.noteHashNullifierCounterMap,
|
|
179
179
|
fields.returnValues,
|
|
180
180
|
fields.offchainEffects,
|
|
181
|
-
fields.
|
|
181
|
+
fields.taggingIndexRanges,
|
|
182
182
|
fields.nestedExecutionResults,
|
|
183
183
|
fields.contractClassLogs,
|
|
184
184
|
);
|
package/src/tx/profiling.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type ZodFor, optional, schemas } from '@aztec/foundation/schemas';
|
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
6
7
|
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
7
8
|
import { type PrivateExecutionStep, PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
|
|
8
9
|
|
|
@@ -160,6 +161,9 @@ export class TxProfileResult {
|
|
|
160
161
|
export class UtilityExecutionResult {
|
|
161
162
|
constructor(
|
|
162
163
|
public result: Fr[],
|
|
164
|
+
public offchainEffects: { data: Fr[]; contractAddress: AztecAddress }[],
|
|
165
|
+
/** Timestamp of the anchor block used during utility execution. */
|
|
166
|
+
public anchorBlockTimestamp: bigint,
|
|
163
167
|
public stats?: SimulationStats,
|
|
164
168
|
) {}
|
|
165
169
|
|
|
@@ -167,13 +171,18 @@ export class UtilityExecutionResult {
|
|
|
167
171
|
return z
|
|
168
172
|
.object({
|
|
169
173
|
result: z.array(schemas.Fr),
|
|
174
|
+
offchainEffects: z.array(z.object({ data: z.array(schemas.Fr), contractAddress: AztecAddress.schema })),
|
|
175
|
+
anchorBlockTimestamp: schemas.BigInt,
|
|
170
176
|
stats: optional(SimulationStatsSchema),
|
|
171
177
|
})
|
|
172
|
-
.transform(
|
|
178
|
+
.transform(
|
|
179
|
+
({ result, offchainEffects, anchorBlockTimestamp, stats }) =>
|
|
180
|
+
new UtilityExecutionResult(result, offchainEffects, anchorBlockTimestamp, stats),
|
|
181
|
+
);
|
|
173
182
|
}
|
|
174
183
|
|
|
175
184
|
static random(): UtilityExecutionResult {
|
|
176
|
-
return new UtilityExecutionResult([Fr.random()], {
|
|
185
|
+
return new UtilityExecutionResult([Fr.random()], [], 0n, {
|
|
177
186
|
nodeRPCCalls: {
|
|
178
187
|
perMethod: { getBlockHeader: { times: [1] } },
|
|
179
188
|
roundTrips: {
|
package/src/tx/simulated_tx.ts
CHANGED
|
@@ -38,7 +38,11 @@ export type ContractOverrides = Record<
|
|
|
38
38
|
* set, it *must* be run without the kernel circuits, or validations will fail
|
|
39
39
|
*/
|
|
40
40
|
export class SimulationOverrides {
|
|
41
|
-
|
|
41
|
+
public contracts?: ContractOverrides;
|
|
42
|
+
|
|
43
|
+
constructor(contracts: ContractOverrides = {}) {
|
|
44
|
+
this.contracts = Object.keys(contracts).length > 0 ? contracts : undefined;
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
static get schema() {
|
|
44
48
|
return z
|
package/src/tx/tx_receipt.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { BlockNumber, BlockNumberSchema, EpochNumber, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export enum TxStatus {
|
|
|
15
15
|
PROPOSED = 'proposed',
|
|
16
16
|
CHECKPOINTED = 'checkpointed',
|
|
17
17
|
PROVEN = 'proven',
|
|
18
|
-
FINALIZED = 'finalized',
|
|
18
|
+
FINALIZED = 'finalized',
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** Tx status sorted by finalization progress. */
|
|
@@ -31,9 +31,16 @@ export const SortedTxStatuses: TxStatus[] = [
|
|
|
31
31
|
/** Execution result - only set when tx is in a block. */
|
|
32
32
|
export enum TxExecutionResult {
|
|
33
33
|
SUCCESS = 'success',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
REVERTED = 'reverted',
|
|
35
|
+
/** @deprecated Use REVERTED instead. */
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
37
|
+
APP_LOGIC_REVERTED = 'reverted',
|
|
38
|
+
/** @deprecated Use REVERTED instead. */
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
40
|
+
TEARDOWN_REVERTED = 'reverted',
|
|
41
|
+
/** @deprecated Use REVERTED instead. */
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
43
|
+
BOTH_REVERTED = 'reverted',
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
/**
|
|
@@ -58,6 +65,8 @@ export class TxReceipt {
|
|
|
58
65
|
public blockHash?: BlockHash,
|
|
59
66
|
/** The block number in which the transaction was included. */
|
|
60
67
|
public blockNumber?: BlockNumber,
|
|
68
|
+
/** The epoch number in which the transaction was included. */
|
|
69
|
+
public epochNumber?: EpochNumber,
|
|
61
70
|
/**
|
|
62
71
|
* Debug logs collected during public function execution. Served only when the node is in test mode and placed on
|
|
63
72
|
* the receipt only because it's a convenient place for it (the logs are printed out by the wallet when a mined
|
|
@@ -109,6 +118,7 @@ export class TxReceipt {
|
|
|
109
118
|
error: z.string().optional(),
|
|
110
119
|
blockHash: BlockHash.schema.optional(),
|
|
111
120
|
blockNumber: BlockNumberSchema.optional(),
|
|
121
|
+
epochNumber: EpochNumberSchema.optional(),
|
|
112
122
|
transactionFee: schemas.BigInt.optional(),
|
|
113
123
|
debugLogs: z.array(DebugLog.schema).optional(),
|
|
114
124
|
})
|
|
@@ -123,6 +133,7 @@ export class TxReceipt {
|
|
|
123
133
|
transactionFee?: bigint;
|
|
124
134
|
blockHash?: BlockHash;
|
|
125
135
|
blockNumber?: BlockNumber;
|
|
136
|
+
epochNumber?: EpochNumber;
|
|
126
137
|
debugLogs?: DebugLog[];
|
|
127
138
|
}) {
|
|
128
139
|
return new TxReceipt(
|
|
@@ -133,21 +144,12 @@ export class TxReceipt {
|
|
|
133
144
|
fields.transactionFee,
|
|
134
145
|
fields.blockHash,
|
|
135
146
|
fields.blockNumber,
|
|
147
|
+
fields.epochNumber,
|
|
136
148
|
fields.debugLogs,
|
|
137
149
|
);
|
|
138
150
|
}
|
|
139
151
|
|
|
140
152
|
public static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult {
|
|
141
|
-
|
|
142
|
-
return TxExecutionResult.SUCCESS;
|
|
143
|
-
} else if (revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
|
|
144
|
-
return TxExecutionResult.APP_LOGIC_REVERTED;
|
|
145
|
-
} else if (revertCode.equals(RevertCode.TEARDOWN_REVERTED)) {
|
|
146
|
-
return TxExecutionResult.TEARDOWN_REVERTED;
|
|
147
|
-
} else if (revertCode.equals(RevertCode.BOTH_REVERTED)) {
|
|
148
|
-
return TxExecutionResult.BOTH_REVERTED;
|
|
149
|
-
} else {
|
|
150
|
-
throw new Error(`Unknown revert code: ${revertCode.getCode()}`);
|
|
151
|
-
}
|
|
153
|
+
return revertCode.isOK() ? TxExecutionResult.SUCCESS : TxExecutionResult.REVERTED;
|
|
152
154
|
}
|
|
153
155
|
}
|
|
@@ -41,5 +41,13 @@ export const TX_ERROR_SIZE_ABOVE_LIMIT = 'Transaction size above size limit';
|
|
|
41
41
|
// Block header
|
|
42
42
|
export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
|
|
43
43
|
|
|
44
|
+
// Contract instance
|
|
45
|
+
export const TX_ERROR_INCORRECT_CONTRACT_ADDRESS = 'Incorrect contract instance deployment address';
|
|
46
|
+
export const TX_ERROR_MALFORMED_CONTRACT_INSTANCE_LOG = 'Failed to parse contract instance deployment log';
|
|
47
|
+
|
|
48
|
+
// Contract class
|
|
49
|
+
export const TX_ERROR_INCORRECT_CONTRACT_CLASS_ID = 'Incorrect contract class id';
|
|
50
|
+
export const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = 'Failed to parse contract class registration log';
|
|
51
|
+
|
|
44
52
|
// General
|
|
45
53
|
export const TX_ERROR_DURING_VALIDATION = 'Unexpected error during validation';
|
|
@@ -3,15 +3,28 @@ import { fileURLToPath } from '@aztec/foundation/url';
|
|
|
3
3
|
import { readFileSync } from 'fs';
|
|
4
4
|
import { dirname, resolve } from 'path';
|
|
5
5
|
|
|
6
|
-
/** Returns the package version from the release-please manifest, or undefined if not found. */
|
|
6
|
+
/** Returns the package version from the release-please manifest or the package.json, or undefined if not found. */
|
|
7
7
|
export function getPackageVersion(): string | undefined {
|
|
8
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
// Try the release-please manifest first (works in dev/repo checkout).
|
|
8
11
|
try {
|
|
9
|
-
const releasePleaseManifestPath = resolve(
|
|
10
|
-
dirname(fileURLToPath(import.meta.url)),
|
|
11
|
-
'../../../../.release-please-manifest.json',
|
|
12
|
-
);
|
|
12
|
+
const releasePleaseManifestPath = resolve(dir, '../../../../.release-please-manifest.json');
|
|
13
13
|
return JSON.parse(readFileSync(releasePleaseManifestPath).toString())['.'];
|
|
14
14
|
} catch {
|
|
15
|
-
|
|
15
|
+
// Not in a repo checkout, fall through.
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Fall back to the stdlib package.json version (works in npm-installed packages).
|
|
19
|
+
try {
|
|
20
|
+
const packageJsonPath = resolve(dir, '../../package.json');
|
|
21
|
+
const version = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
22
|
+
if (version && version !== '0.1.0') {
|
|
23
|
+
return version;
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
// No package.json found either.
|
|
16
27
|
}
|
|
28
|
+
|
|
29
|
+
return undefined;
|
|
17
30
|
}
|
package/src/validators/errors.ts
CHANGED
|
@@ -36,6 +36,15 @@ export class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
export class ReExInitialStateMismatchError extends ValidatorError {
|
|
40
|
+
constructor(
|
|
41
|
+
public readonly expectedArchiveRoot: Fr,
|
|
42
|
+
public readonly actualArchiveRoot: Fr,
|
|
43
|
+
) {
|
|
44
|
+
super('Re-execution initial state mismatch');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
export class ReExStateMismatchError extends ValidatorError {
|
|
40
49
|
constructor(
|
|
41
50
|
public readonly expectedArchiveRoot: Fr,
|
|
@@ -115,7 +115,7 @@ export function validatePartialComponentVersionsMatch(
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/** Returns a Koa middleware that injects the versioning info as headers. */
|
|
118
|
-
export function getVersioningMiddleware(versions: Partial<ComponentsVersions
|
|
118
|
+
export function getVersioningMiddleware(versions: Partial<ComponentsVersions>, opts?: { packageVersion?: string }) {
|
|
119
119
|
return async (ctx: Koa.Context, next: () => Promise<void>) => {
|
|
120
120
|
try {
|
|
121
121
|
await next();
|
|
@@ -128,6 +128,9 @@ export function getVersioningMiddleware(versions: Partial<ComponentsVersions>) {
|
|
|
128
128
|
ctx.set(`x-aztec-${key}`, value.toString());
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
if (opts?.packageVersion) {
|
|
132
|
+
ctx.set('x-aztec-packageVersion', opts.packageVersion);
|
|
133
|
+
}
|
|
131
134
|
}
|
|
132
135
|
};
|
|
133
136
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type ContractArtifact, FunctionSelector } from '../abi/index.js';
|
|
2
|
-
import type { ContractClassPublic, ExecutablePrivateFunctionWithMembershipProof, PrivateFunctionMembershipProof } from './interfaces/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a membership proof for a private function in a contract class, to be verified via `isValidPrivateFunctionMembershipProof`.
|
|
5
|
-
* @param selector - Selector of the function to create the proof for.
|
|
6
|
-
* @param artifact - Artifact of the contract class where the function is defined.
|
|
7
|
-
*/
|
|
8
|
-
export declare function createPrivateFunctionMembershipProof(selector: FunctionSelector, artifact: ContractArtifact): Promise<PrivateFunctionMembershipProof>;
|
|
9
|
-
/**
|
|
10
|
-
* Verifies that a private function with a membership proof as emitted by the ClassRegistry contract is valid,
|
|
11
|
-
* as defined in the protocol specs at contract-deployment/classes:
|
|
12
|
-
*
|
|
13
|
-
* ```
|
|
14
|
-
* // Load contract class from local db
|
|
15
|
-
* contract_class = db.get_contract_class(contract_class_id)
|
|
16
|
-
*
|
|
17
|
-
* // Compute function leaf and assert it belongs to the private functions tree
|
|
18
|
-
* function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
|
|
19
|
-
* computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
|
|
20
|
-
* assert computed_private_function_tree_root == contract_class.private_functions_root
|
|
21
|
-
*
|
|
22
|
-
* // Compute artifact leaf and assert it belongs to the artifact
|
|
23
|
-
* artifact_function_leaf = sha256(selector, metadata_hash, sha256(bytecode))
|
|
24
|
-
* computed_artifact_private_function_tree_root = compute_root(artifact_function_leaf, artifact_function_tree_sibling_path)
|
|
25
|
-
* computed_artifact_hash = sha256(computed_artifact_private_function_tree_root, utility_functions_artifact_tree_root, artifact_metadata_hash)
|
|
26
|
-
* assert computed_artifact_hash == contract_class.artifact_hash
|
|
27
|
-
* ```
|
|
28
|
-
* @param fn - Function to check membership proof for.
|
|
29
|
-
* @param contractClass - In which contract class the function is expected to be.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isValidPrivateFunctionMembershipProof(fn: ExecutablePrivateFunctionWithMembershipProof, contractClass: Pick<ContractClassPublic, 'privateFunctionsRoot' | 'artifactHash'>): Promise<boolean>;
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbl9tZW1iZXJzaGlwX3Byb29mLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3QvcHJpdmF0ZV9mdW5jdGlvbl9tZW1iZXJzaGlwX3Byb29mLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUFFLGdCQUFnQixFQUFnQixNQUFNLGlCQUFpQixDQUFDO0FBVXhGLE9BQU8sS0FBSyxFQUNWLG1CQUFtQixFQUNuQiw0Q0FBNEMsRUFDNUMsOEJBQThCLEVBQy9CLE1BQU0sdUJBQXVCLENBQUM7QUFHL0I7Ozs7R0FJRztBQUNILHdCQUFzQixvQ0FBb0MsQ0FDeEQsUUFBUSxFQUFFLGdCQUFnQixFQUMxQixRQUFRLEVBQUUsZ0JBQWdCLEdBQ3pCLE9BQU8sQ0FBQyw4QkFBOEIsQ0FBQyxDQTREekM7QUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBQ0gsd0JBQXNCLHFDQUFxQyxDQUN6RCxFQUFFLEVBQUUsNENBQTRDLEVBQ2hELGFBQWEsRUFBRSxJQUFJLENBQUMsbUJBQW1CLEVBQUUsc0JBQXNCLEdBQUcsY0FBYyxDQUFDLG9CQWtEbEYifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"private_function_membership_proof.d.ts","sourceRoot":"","sources":["../../src/contract/private_function_membership_proof.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,iBAAiB,CAAC;AAUxF,OAAO,KAAK,EACV,mBAAmB,EACnB,4CAA4C,EAC5C,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAG/B;;;;GAIG;AACH,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,8BAA8B,CAAC,CA4DzC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,qCAAqC,CACzD,EAAE,EAAE,4CAA4C,EAChD,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAE,sBAAsB,GAAG,cAAc,CAAC,oBAkDlF"}
|