@aztec/stdlib 3.0.0-nightly.20251005 → 3.0.0-nightly.20251008
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/avm/avm.d.ts +62 -78
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +8 -22
- package/dest/avm/avm_circuit_public_inputs.d.ts +19 -6
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +12 -11
- package/dest/avm/avm_proving_request.d.ts +49 -40
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/file-store/interface.d.ts +8 -2
- package/dest/file-store/interface.d.ts.map +1 -1
- package/dest/file-store/s3.d.ts +1 -0
- package/dest/file-store/s3.d.ts.map +1 -1
- package/dest/file-store/s3.js +81 -16
- package/dest/interfaces/aztec-node-admin.d.ts +3 -0
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +5 -0
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/proving-job.d.ts +49 -40
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +1 -1
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -2
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/nullifier_read_request_hints.d.ts +4 -3
- package/dest/kernel/hints/nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/private_call_data.d.ts +4 -24
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +4 -16
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +3 -3
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +5 -4
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +7 -6
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +1 -1
- package/dest/p2p/block_proposal.d.ts +2 -0
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/rollup/block_constant_data.d.ts +4 -4
- package/dest/rollup/block_constant_data.d.ts.map +1 -1
- package/dest/rollup/block_constant_data.js +4 -4
- package/dest/rollup/checkpoint_constant_data.d.ts +4 -4
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +4 -4
- package/dest/rollup/epoch_constant_data.d.ts +4 -4
- package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
- package/dest/rollup/epoch_constant_data.js +5 -5
- package/dest/snapshots/download.d.ts.map +1 -1
- package/dest/snapshots/download.js +58 -2
- package/dest/snapshots/upload.d.ts.map +1 -1
- package/dest/snapshots/upload.js +1 -0
- package/dest/tests/factories.d.ts +5 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +11 -10
- package/dest/tests/mocks.d.ts +2 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +2 -2
- package/dest/trees/index.d.ts +0 -1
- package/dest/trees/index.d.ts.map +1 -1
- package/dest/trees/index.js +0 -1
- package/dest/tx/index.d.ts +2 -0
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +2 -0
- package/dest/tx/private_tx_constant_data.d.ts +60 -0
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -0
- package/dest/tx/private_tx_constant_data.js +69 -0
- package/dest/tx/protocol_contracts.d.ts +29 -0
- package/dest/tx/protocol_contracts.d.ts.map +1 -0
- package/dest/tx/protocol_contracts.js +49 -0
- package/dest/tx/tx_constant_data.d.ts +5 -37
- package/dest/tx/tx_constant_data.d.ts.map +1 -1
- package/dest/tx/tx_constant_data.js +8 -17
- package/dest/tx/validator/error_texts.d.ts +1 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -1
- package/dest/versioning/versioning.d.ts +2 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +8 -8
- package/package.json +8 -8
- package/src/avm/avm.ts +13 -24
- package/src/avm/avm_circuit_public_inputs.ts +11 -10
- package/src/file-store/interface.ts +8 -2
- package/src/file-store/s3.ts +83 -15
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/validator.ts +1 -1
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +3 -2
- package/src/kernel/hints/nullifier_read_request_hints.ts +3 -3
- package/src/kernel/private_call_data.ts +2 -21
- package/src/kernel/private_kernel_circuit_public_inputs.ts +4 -4
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +5 -4
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +1 -1
- package/src/p2p/block_proposal.ts +2 -0
- package/src/rollup/block_constant_data.ts +3 -3
- package/src/rollup/checkpoint_constant_data.ts +3 -3
- package/src/rollup/epoch_constant_data.ts +3 -9
- package/src/snapshots/download.ts +66 -2
- package/src/snapshots/upload.ts +1 -0
- package/src/tests/factories.ts +12 -19
- package/src/tests/mocks.ts +3 -3
- package/src/trees/index.ts +0 -1
- package/src/tx/index.ts +2 -0
- package/src/tx/private_tx_constant_data.ts +94 -0
- package/src/tx/protocol_contracts.ts +70 -0
- package/src/tx/tx_constant_data.ts +6 -19
- package/src/tx/validator/error_texts.ts +1 -1
- package/src/versioning/versioning.ts +10 -10
- package/dest/trees/protocol_contract_leaf.d.ts +0 -84
- package/dest/trees/protocol_contract_leaf.d.ts.map +0 -1
- package/dest/trees/protocol_contract_leaf.js +0 -100
- package/src/trees/protocol_contract_leaf.ts +0 -128
package/dest/tests/mocks.js
CHANGED
|
@@ -36,7 +36,7 @@ export const randomExtendedNote = async ({ note = Note.random(), recipient = und
|
|
|
36
36
|
export const randomUniqueNote = async ({ note = Note.random(), recipient = undefined, contractAddress = undefined, txHash = randomTxHash(), storageSlot = Fr.random(), noteNonce = Fr.random() } = {})=>{
|
|
37
37
|
return new UniqueNote(note, recipient ?? await AztecAddress.random(), contractAddress ?? await AztecAddress.random(), storageSlot, txHash, noteNonce);
|
|
38
38
|
};
|
|
39
|
-
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertibleNullifiers = 0, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.random(), maxPriorityFeesPerGas, chainId = Fr.ZERO, version = Fr.ZERO, vkTreeRoot = Fr.ZERO,
|
|
39
|
+
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertibleNullifiers = 0, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.random(), maxPriorityFeesPerGas, chainId = Fr.ZERO, version = Fr.ZERO, vkTreeRoot = Fr.ZERO, protocolContractsHash = Fr.ZERO } = {})=>{
|
|
40
40
|
const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
|
|
41
41
|
const isForPublic = totalPublicCallRequests > 0;
|
|
42
42
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
@@ -49,7 +49,7 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
|
|
|
49
49
|
data.constants.txContext.chainId = chainId;
|
|
50
50
|
data.constants.txContext.version = version;
|
|
51
51
|
data.constants.vkTreeRoot = vkTreeRoot;
|
|
52
|
-
data.constants.
|
|
52
|
+
data.constants.protocolContractsHash = protocolContractsHash;
|
|
53
53
|
// Set includeByTimestamp to the maximum allowed duration from the current time.
|
|
54
54
|
data.includeByTimestamp = BigInt(Math.floor(Date.now() / 1000) + MAX_INCLUDE_BY_TIMESTAMP_DURATION);
|
|
55
55
|
const publicFunctionCalldata = [];
|
package/dest/trees/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trees/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trees/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC"}
|
package/dest/trees/index.js
CHANGED
package/dest/tx/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './state_reference.js';
|
|
|
6
6
|
export * from './partial_state_reference.js';
|
|
7
7
|
export * from './function_data.js';
|
|
8
8
|
export * from './tree_snapshots.js';
|
|
9
|
+
export * from './private_tx_constant_data.js';
|
|
9
10
|
export * from './tx_constant_data.js';
|
|
10
11
|
export * from './tx_context.js';
|
|
11
12
|
export * from './tx_request.js';
|
|
@@ -29,4 +30,5 @@ export * from './hashed_values.js';
|
|
|
29
30
|
export * from './indexed_tx_effect.js';
|
|
30
31
|
export * from './offchain_effect.js';
|
|
31
32
|
export * from './profiling.js';
|
|
33
|
+
export * from './protocol_contracts.js';
|
|
32
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dest/tx/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tx/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,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wCAAwC,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
|
package/dest/tx/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './state_reference.js';
|
|
|
6
6
|
export * from './partial_state_reference.js';
|
|
7
7
|
export * from './function_data.js';
|
|
8
8
|
export * from './tree_snapshots.js';
|
|
9
|
+
export * from './private_tx_constant_data.js';
|
|
9
10
|
export * from './tx_constant_data.js';
|
|
10
11
|
export * from './tx_context.js';
|
|
11
12
|
export * from './tx_request.js';
|
|
@@ -29,3 +30,4 @@ export * from './hashed_values.js';
|
|
|
29
30
|
export * from './indexed_tx_effect.js';
|
|
30
31
|
export * from './offchain_effect.js';
|
|
31
32
|
export * from './profiling.js';
|
|
33
|
+
export * from './protocol_contracts.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
+
import { BlockHeader } from './block_header.js';
|
|
5
|
+
import { ProtocolContracts } from './protocol_contracts.js';
|
|
6
|
+
import { TxContext } from './tx_context.js';
|
|
7
|
+
/**
|
|
8
|
+
* Data that is constant/not modified by neither of the kernels.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PrivateTxConstantData {
|
|
11
|
+
/** Header of a block whose state is used during execution (not the block the transaction is included in). */
|
|
12
|
+
anchorBlockHeader: BlockHeader;
|
|
13
|
+
/**
|
|
14
|
+
* Context of the transaction.
|
|
15
|
+
*
|
|
16
|
+
* Note: `chainId` and `version` in txContext are not redundant to the values in
|
|
17
|
+
* self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
|
|
18
|
+
* a situation we could be using header from a block before the upgrade took place but be using the updated
|
|
19
|
+
* protocol to execute and prove the transaction.
|
|
20
|
+
*/
|
|
21
|
+
txContext: TxContext;
|
|
22
|
+
/**
|
|
23
|
+
* Root of the vk tree for the protocol circuits.
|
|
24
|
+
*/
|
|
25
|
+
vkTreeRoot: Fr;
|
|
26
|
+
/**
|
|
27
|
+
* List of protocol contracts.
|
|
28
|
+
*/
|
|
29
|
+
protocolContracts: ProtocolContracts;
|
|
30
|
+
constructor(
|
|
31
|
+
/** Header of a block whose state is used during execution (not the block the transaction is included in). */
|
|
32
|
+
anchorBlockHeader: BlockHeader,
|
|
33
|
+
/**
|
|
34
|
+
* Context of the transaction.
|
|
35
|
+
*
|
|
36
|
+
* Note: `chainId` and `version` in txContext are not redundant to the values in
|
|
37
|
+
* self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
|
|
38
|
+
* a situation we could be using header from a block before the upgrade took place but be using the updated
|
|
39
|
+
* protocol to execute and prove the transaction.
|
|
40
|
+
*/
|
|
41
|
+
txContext: TxContext,
|
|
42
|
+
/**
|
|
43
|
+
* Root of the vk tree for the protocol circuits.
|
|
44
|
+
*/
|
|
45
|
+
vkTreeRoot: Fr,
|
|
46
|
+
/**
|
|
47
|
+
* List of protocol contracts.
|
|
48
|
+
*/
|
|
49
|
+
protocolContracts: ProtocolContracts);
|
|
50
|
+
static from(fields: FieldsOf<PrivateTxConstantData>): PrivateTxConstantData;
|
|
51
|
+
static getFields(fields: FieldsOf<PrivateTxConstantData>): readonly [BlockHeader, TxContext, Fr, ProtocolContracts];
|
|
52
|
+
static fromFields(fields: Fr[] | FieldReader): PrivateTxConstantData;
|
|
53
|
+
toFields(): Fr[];
|
|
54
|
+
static fromBuffer(buffer: Buffer | BufferReader): PrivateTxConstantData;
|
|
55
|
+
toBuffer(): Buffer<ArrayBufferLike>;
|
|
56
|
+
static empty(): PrivateTxConstantData;
|
|
57
|
+
getSize(): number;
|
|
58
|
+
clone(): PrivateTxConstantData;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=private_tx_constant_data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_tx_constant_data.d.ts","sourceRoot":"","sources":["../../src/tx/private_tx_constant_data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAC9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,qBAAa,qBAAqB;IAE9B,6GAA6G;IACtG,iBAAiB,EAAE,WAAW;IACrC;;;;;;;OAOG;IACI,SAAS,EAAE,SAAS;IAC3B;;OAEG;IACI,UAAU,EAAE,EAAE;IACrB;;OAEG;IACI,iBAAiB,EAAE,iBAAiB;;IAlB3C,6GAA6G;IACtG,iBAAiB,EAAE,WAAW;IACrC;;;;;;;OAOG;IACI,SAAS,EAAE,SAAS;IAC3B;;OAEG;IACI,UAAU,EAAE,EAAE;IACrB;;OAEG;IACI,iBAAiB,EAAE,iBAAiB;IAG7C,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC;IAInD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC;IAIxD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,qBAAqB;IAUpE,QAAQ,IAAI,EAAE,EAAE;IAUhB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,qBAAqB;IAUvE,QAAQ;IAIR,MAAM,CAAC,KAAK;IAIZ,OAAO;IASP,KAAK,IAAI,qBAAqB;CAG/B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TX_CONSTANT_DATA_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
4
|
+
import { BlockHeader } from './block_header.js';
|
|
5
|
+
import { ProtocolContracts } from './protocol_contracts.js';
|
|
6
|
+
import { TxContext } from './tx_context.js';
|
|
7
|
+
/**
|
|
8
|
+
* Data that is constant/not modified by neither of the kernels.
|
|
9
|
+
*/ export class PrivateTxConstantData {
|
|
10
|
+
anchorBlockHeader;
|
|
11
|
+
txContext;
|
|
12
|
+
vkTreeRoot;
|
|
13
|
+
protocolContracts;
|
|
14
|
+
constructor(/** Header of a block whose state is used during execution (not the block the transaction is included in). */ anchorBlockHeader, /**
|
|
15
|
+
* Context of the transaction.
|
|
16
|
+
*
|
|
17
|
+
* Note: `chainId` and `version` in txContext are not redundant to the values in
|
|
18
|
+
* self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
|
|
19
|
+
* a situation we could be using header from a block before the upgrade took place but be using the updated
|
|
20
|
+
* protocol to execute and prove the transaction.
|
|
21
|
+
*/ txContext, /**
|
|
22
|
+
* Root of the vk tree for the protocol circuits.
|
|
23
|
+
*/ vkTreeRoot, /**
|
|
24
|
+
* List of protocol contracts.
|
|
25
|
+
*/ protocolContracts){
|
|
26
|
+
this.anchorBlockHeader = anchorBlockHeader;
|
|
27
|
+
this.txContext = txContext;
|
|
28
|
+
this.vkTreeRoot = vkTreeRoot;
|
|
29
|
+
this.protocolContracts = protocolContracts;
|
|
30
|
+
}
|
|
31
|
+
static from(fields) {
|
|
32
|
+
return new PrivateTxConstantData(...PrivateTxConstantData.getFields(fields));
|
|
33
|
+
}
|
|
34
|
+
static getFields(fields) {
|
|
35
|
+
return [
|
|
36
|
+
fields.anchorBlockHeader,
|
|
37
|
+
fields.txContext,
|
|
38
|
+
fields.vkTreeRoot,
|
|
39
|
+
fields.protocolContracts
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
static fromFields(fields) {
|
|
43
|
+
const reader = FieldReader.asReader(fields);
|
|
44
|
+
return new PrivateTxConstantData(reader.readObject(BlockHeader), reader.readObject(TxContext), reader.readField(), reader.readObject(ProtocolContracts));
|
|
45
|
+
}
|
|
46
|
+
toFields() {
|
|
47
|
+
const fields = serializeToFields(...PrivateTxConstantData.getFields(this));
|
|
48
|
+
if (fields.length !== TX_CONSTANT_DATA_LENGTH) {
|
|
49
|
+
throw new Error(`Invalid number of fields for PrivateTxConstantData. Expected ${TX_CONSTANT_DATA_LENGTH}, got ${fields.length}`);
|
|
50
|
+
}
|
|
51
|
+
return fields;
|
|
52
|
+
}
|
|
53
|
+
static fromBuffer(buffer) {
|
|
54
|
+
const reader = BufferReader.asReader(buffer);
|
|
55
|
+
return new PrivateTxConstantData(reader.readObject(BlockHeader), reader.readObject(TxContext), Fr.fromBuffer(reader), reader.readObject(ProtocolContracts));
|
|
56
|
+
}
|
|
57
|
+
toBuffer() {
|
|
58
|
+
return serializeToBuffer(...PrivateTxConstantData.getFields(this));
|
|
59
|
+
}
|
|
60
|
+
static empty() {
|
|
61
|
+
return new PrivateTxConstantData(BlockHeader.empty(), TxContext.empty(), Fr.ZERO, ProtocolContracts.empty());
|
|
62
|
+
}
|
|
63
|
+
getSize() {
|
|
64
|
+
return this.anchorBlockHeader.getSize() + this.txContext.getSize() + this.vkTreeRoot.size + this.protocolContracts.getSize();
|
|
65
|
+
}
|
|
66
|
+
clone() {
|
|
67
|
+
return PrivateTxConstantData.fromBuffer(this.toBuffer());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MAX_PROTOCOL_CONTRACTS } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { BufferReader, FieldReader, type Tuple } from '@aztec/foundation/serialize';
|
|
4
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
+
export declare class ProtocolContracts {
|
|
8
|
+
derivedAddresses: Tuple<AztecAddress, typeof MAX_PROTOCOL_CONTRACTS>;
|
|
9
|
+
constructor(derivedAddresses: Tuple<AztecAddress, typeof MAX_PROTOCOL_CONTRACTS>);
|
|
10
|
+
static from(fields: FieldsOf<ProtocolContracts>): ProtocolContracts;
|
|
11
|
+
static getFields(fields: FieldsOf<ProtocolContracts>): readonly [[AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress, AztecAddress]];
|
|
12
|
+
static fromFields(fields: Fr[] | FieldReader): ProtocolContracts;
|
|
13
|
+
toFields(): Fr[];
|
|
14
|
+
static fromBuffer(buffer: Buffer | BufferReader): ProtocolContracts;
|
|
15
|
+
toBuffer(): Buffer<ArrayBufferLike>;
|
|
16
|
+
static empty(): ProtocolContracts;
|
|
17
|
+
getSize(): number;
|
|
18
|
+
hash(): Promise<Fr>;
|
|
19
|
+
static get schema(): z.ZodEffects<z.ZodObject<{
|
|
20
|
+
derivedAddresses: z.ZodArray<import("@aztec/foundation/schemas").ZodFor<AztecAddress>, "many">;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
derivedAddresses: AztecAddress[];
|
|
23
|
+
}, {
|
|
24
|
+
derivedAddresses: any[];
|
|
25
|
+
}>, ProtocolContracts, {
|
|
26
|
+
derivedAddresses: any[];
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=protocol_contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/tx/protocol_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI1E,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,KAAK,KAAK,EAIX,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,qBAAa,iBAAiB;IACT,gBAAgB,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,sBAAsB,CAAC;gBAApE,gBAAgB,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,sBAAsB,CAAC;IAEvF,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IAI/C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IAIpD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,iBAAiB;IAKhE,QAAQ,IAAI,EAAE,EAAE;IAIhB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,iBAAiB;IAKnE,QAAQ;IAIR,MAAM,CAAC,KAAK;IAIZ,OAAO;IAIP,IAAI;IAIJ,MAAM,KAAK,MAAM;;;;;;;;OAQhB;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GeneratorIndex, MAX_PROTOCOL_CONTRACTS } from '@aztec/constants';
|
|
2
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
+
import { arraySerializedSizeOfNonEmpty } from '@aztec/foundation/collection';
|
|
4
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
5
|
+
import { BufferReader, FieldReader, assertLength, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
8
|
+
export class ProtocolContracts {
|
|
9
|
+
derivedAddresses;
|
|
10
|
+
constructor(derivedAddresses){
|
|
11
|
+
this.derivedAddresses = derivedAddresses;
|
|
12
|
+
}
|
|
13
|
+
static from(fields) {
|
|
14
|
+
return new ProtocolContracts(...ProtocolContracts.getFields(fields));
|
|
15
|
+
}
|
|
16
|
+
static getFields(fields) {
|
|
17
|
+
return [
|
|
18
|
+
fields.derivedAddresses
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
static fromFields(fields) {
|
|
22
|
+
const reader = FieldReader.asReader(fields);
|
|
23
|
+
return new ProtocolContracts(reader.readArray(MAX_PROTOCOL_CONTRACTS, AztecAddress));
|
|
24
|
+
}
|
|
25
|
+
toFields() {
|
|
26
|
+
return serializeToFields(...ProtocolContracts.getFields(this));
|
|
27
|
+
}
|
|
28
|
+
static fromBuffer(buffer) {
|
|
29
|
+
const reader = BufferReader.asReader(buffer);
|
|
30
|
+
return new ProtocolContracts(reader.readArray(MAX_PROTOCOL_CONTRACTS, AztecAddress));
|
|
31
|
+
}
|
|
32
|
+
toBuffer() {
|
|
33
|
+
return serializeToBuffer(...ProtocolContracts.getFields(this));
|
|
34
|
+
}
|
|
35
|
+
static empty() {
|
|
36
|
+
return new ProtocolContracts(makeTuple(MAX_PROTOCOL_CONTRACTS, ()=>AztecAddress.zero()));
|
|
37
|
+
}
|
|
38
|
+
getSize() {
|
|
39
|
+
return arraySerializedSizeOfNonEmpty(this.derivedAddresses);
|
|
40
|
+
}
|
|
41
|
+
hash() {
|
|
42
|
+
return poseidon2HashWithSeparator(this.derivedAddresses, GeneratorIndex.PROTOCOL_CONTRACTS);
|
|
43
|
+
}
|
|
44
|
+
static get schema() {
|
|
45
|
+
return z.object({
|
|
46
|
+
derivedAddresses: AztecAddress.schema.array().min(MAX_PROTOCOL_CONTRACTS).max(MAX_PROTOCOL_CONTRACTS)
|
|
47
|
+
}).transform(({ derivedAddresses })=>new ProtocolContracts(assertLength(derivedAddresses, MAX_PROTOCOL_CONTRACTS)));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -4,48 +4,16 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
4
4
|
import { BlockHeader } from './block_header.js';
|
|
5
5
|
import { TxContext } from './tx_context.js';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Version of `PrivateTxConstantData` exposed by the tail circuits
|
|
8
|
+
* It compresses the protocol contracts list to a hash to minimize the number of public inputs.
|
|
9
|
+
* Refer to `PrivateTxConstantData` for more details.
|
|
8
10
|
*/
|
|
9
11
|
export declare class TxConstantData {
|
|
10
|
-
/** Header of a block whose state is used during execution (not the block the transaction is included in). */
|
|
11
12
|
anchorBlockHeader: BlockHeader;
|
|
12
|
-
/**
|
|
13
|
-
* Context of the transaction.
|
|
14
|
-
*
|
|
15
|
-
* Note: `chainId` and `version` in txContext are not redundant to the values in
|
|
16
|
-
* self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
|
|
17
|
-
* a situation we could be using header from a block before the upgrade took place but be using the updated
|
|
18
|
-
* protocol to execute and prove the transaction.
|
|
19
|
-
*/
|
|
20
13
|
txContext: TxContext;
|
|
21
|
-
/**
|
|
22
|
-
* Root of the vk tree for the protocol circuits.
|
|
23
|
-
*/
|
|
24
14
|
vkTreeRoot: Fr;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
protocolContractTreeRoot: Fr;
|
|
29
|
-
constructor(
|
|
30
|
-
/** Header of a block whose state is used during execution (not the block the transaction is included in). */
|
|
31
|
-
anchorBlockHeader: BlockHeader,
|
|
32
|
-
/**
|
|
33
|
-
* Context of the transaction.
|
|
34
|
-
*
|
|
35
|
-
* Note: `chainId` and `version` in txContext are not redundant to the values in
|
|
36
|
-
* self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
|
|
37
|
-
* a situation we could be using header from a block before the upgrade took place but be using the updated
|
|
38
|
-
* protocol to execute and prove the transaction.
|
|
39
|
-
*/
|
|
40
|
-
txContext: TxContext,
|
|
41
|
-
/**
|
|
42
|
-
* Root of the vk tree for the protocol circuits.
|
|
43
|
-
*/
|
|
44
|
-
vkTreeRoot: Fr,
|
|
45
|
-
/**
|
|
46
|
-
* Root of the tree for the protocol contracts.
|
|
47
|
-
*/
|
|
48
|
-
protocolContractTreeRoot: Fr);
|
|
15
|
+
protocolContractsHash: Fr;
|
|
16
|
+
constructor(anchorBlockHeader: BlockHeader, txContext: TxContext, vkTreeRoot: Fr, protocolContractsHash: Fr);
|
|
49
17
|
static from(fields: FieldsOf<TxConstantData>): TxConstantData;
|
|
50
18
|
static getFields(fields: FieldsOf<TxConstantData>): readonly [BlockHeader, TxContext, Fr, Fr];
|
|
51
19
|
static fromFields(fields: Fr[] | FieldReader): TxConstantData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_constant_data.d.ts","sourceRoot":"","sources":["../../src/tx/tx_constant_data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAC9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"tx_constant_data.d.ts","sourceRoot":"","sources":["../../src/tx/tx_constant_data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAC9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,cAAc;IAEhB,iBAAiB,EAAE,WAAW;IAC9B,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,EAAE;IACd,qBAAqB,EAAE,EAAE;gBAHzB,iBAAiB,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,EAAE,EACd,qBAAqB,EAAE,EAAE;IAGlC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;IAI5C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;IAIjD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,cAAc;IAU7D,QAAQ,IAAI,EAAE,EAAE;IAUhB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,cAAc;IAUhE,QAAQ;IAIR,MAAM,CAAC,KAAK;IAIZ,OAAO;IASP,KAAK,IAAI,cAAc;CAGxB"}
|
|
@@ -4,28 +4,19 @@ import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from
|
|
|
4
4
|
import { BlockHeader } from './block_header.js';
|
|
5
5
|
import { TxContext } from './tx_context.js';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Version of `PrivateTxConstantData` exposed by the tail circuits
|
|
8
|
+
* It compresses the protocol contracts list to a hash to minimize the number of public inputs.
|
|
9
|
+
* Refer to `PrivateTxConstantData` for more details.
|
|
8
10
|
*/ export class TxConstantData {
|
|
9
11
|
anchorBlockHeader;
|
|
10
12
|
txContext;
|
|
11
13
|
vkTreeRoot;
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
* Context of the transaction.
|
|
15
|
-
*
|
|
16
|
-
* Note: `chainId` and `version` in txContext are not redundant to the values in
|
|
17
|
-
* self.anchor_block_header.global_variables because they can be different in case of a protocol upgrade. In such
|
|
18
|
-
* a situation we could be using header from a block before the upgrade took place but be using the updated
|
|
19
|
-
* protocol to execute and prove the transaction.
|
|
20
|
-
*/ txContext, /**
|
|
21
|
-
* Root of the vk tree for the protocol circuits.
|
|
22
|
-
*/ vkTreeRoot, /**
|
|
23
|
-
* Root of the tree for the protocol contracts.
|
|
24
|
-
*/ protocolContractTreeRoot){
|
|
14
|
+
protocolContractsHash;
|
|
15
|
+
constructor(anchorBlockHeader, txContext, vkTreeRoot, protocolContractsHash){
|
|
25
16
|
this.anchorBlockHeader = anchorBlockHeader;
|
|
26
17
|
this.txContext = txContext;
|
|
27
18
|
this.vkTreeRoot = vkTreeRoot;
|
|
28
|
-
this.
|
|
19
|
+
this.protocolContractsHash = protocolContractsHash;
|
|
29
20
|
}
|
|
30
21
|
static from(fields) {
|
|
31
22
|
return new TxConstantData(...TxConstantData.getFields(fields));
|
|
@@ -35,7 +26,7 @@ import { TxContext } from './tx_context.js';
|
|
|
35
26
|
fields.anchorBlockHeader,
|
|
36
27
|
fields.txContext,
|
|
37
28
|
fields.vkTreeRoot,
|
|
38
|
-
fields.
|
|
29
|
+
fields.protocolContractsHash
|
|
39
30
|
];
|
|
40
31
|
}
|
|
41
32
|
static fromFields(fields) {
|
|
@@ -60,7 +51,7 @@ import { TxContext } from './tx_context.js';
|
|
|
60
51
|
return new TxConstantData(BlockHeader.empty(), TxContext.empty(), Fr.ZERO, Fr.ZERO);
|
|
61
52
|
}
|
|
62
53
|
getSize() {
|
|
63
|
-
return this.anchorBlockHeader.getSize() + this.txContext.getSize() + this.vkTreeRoot.size + this.
|
|
54
|
+
return this.anchorBlockHeader.getSize() + this.txContext.getSize() + this.vkTreeRoot.size + this.protocolContractsHash.size;
|
|
64
55
|
}
|
|
65
56
|
clone() {
|
|
66
57
|
return TxConstantData.fromBuffer(this.toBuffer());
|
|
@@ -9,7 +9,7 @@ export declare const TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP = "Invalid expiration
|
|
|
9
9
|
export declare const TX_ERROR_INCORRECT_L1_CHAIN_ID = "Incorrect L1 chain id";
|
|
10
10
|
export declare const TX_ERROR_INCORRECT_ROLLUP_VERSION = "Incorrect rollup version";
|
|
11
11
|
export declare const TX_ERROR_INCORRECT_VK_TREE_ROOT = "Incorrect verification keys tree root";
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const TX_ERROR_INCORRECT_PROTOCOL_CONTRACTS_HASH = "Incorrect protocol contracts hash";
|
|
13
13
|
export declare const TX_ERROR_INVALID_PROOF = "Invalid proof";
|
|
14
14
|
export declare const TX_ERROR_INCORRECT_CALLDATA = "Incorrect calldata for public call";
|
|
15
15
|
export declare const TX_ERROR_CALLDATA_COUNT_MISMATCH = "Wrong number of calldata for public calls";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,wEAAwE,CAAC;AAGjH,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AAGtF,eAAO,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MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
|
|
@@ -13,7 +13,7 @@ export const TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP = 'Invalid expiration timesta
|
|
|
13
13
|
export const TX_ERROR_INCORRECT_L1_CHAIN_ID = 'Incorrect L1 chain id';
|
|
14
14
|
export const TX_ERROR_INCORRECT_ROLLUP_VERSION = 'Incorrect rollup version';
|
|
15
15
|
export const TX_ERROR_INCORRECT_VK_TREE_ROOT = 'Incorrect verification keys tree root';
|
|
16
|
-
export const
|
|
16
|
+
export const TX_ERROR_INCORRECT_PROTOCOL_CONTRACTS_HASH = 'Incorrect protocol contracts hash';
|
|
17
17
|
// Proof
|
|
18
18
|
export const TX_ERROR_INVALID_PROOF = 'Invalid proof';
|
|
19
19
|
//Data
|
|
@@ -7,11 +7,11 @@ export type ComponentsVersions = {
|
|
|
7
7
|
l1ChainId: number;
|
|
8
8
|
l1RollupAddress: EthAddress;
|
|
9
9
|
rollupVersion: number;
|
|
10
|
-
|
|
10
|
+
l2ProtocolContractsHash: string;
|
|
11
11
|
l2CircuitsVkTreeRoot: string;
|
|
12
12
|
};
|
|
13
13
|
/** Returns components versions from chain config. */
|
|
14
|
-
export declare function getComponentsVersionsFromConfig(config: ChainConfig,
|
|
14
|
+
export declare function getComponentsVersionsFromConfig(config: ChainConfig, l2ProtocolContractsHash: string | Fr, l2CircuitsVkTreeRoot: string | Fr): ComponentsVersions;
|
|
15
15
|
/** Returns a compressed string representation of the version (around 32 chars). Used in p2p ENRs. */
|
|
16
16
|
export declare function compressComponentVersions(versions: ComponentsVersions): string;
|
|
17
17
|
export declare class ComponentsVersionsError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../../src/versioning/versioning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAA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MAAM,EAAE,QAAQ,EAAE,kBAAkB,QA6B/F;AAED,8EAA8E;AAC9E,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,QAiBpC;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAC7D,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,MAAM,OAAO,CAAC,IAAI,CAAC,mBAS1D;AAED,0FAA0F;AAC1F,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,IACxE,aAAa;IAAE,OAAO,EAAE;QAAE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,mBAYzF"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
|
-
/** Returns components versions from chain config. */ export function getComponentsVersionsFromConfig(config,
|
|
2
|
+
/** Returns components versions from chain config. */ export function getComponentsVersionsFromConfig(config, l2ProtocolContractsHash, l2CircuitsVkTreeRoot) {
|
|
3
3
|
return {
|
|
4
4
|
l1ChainId: config.l1ChainId,
|
|
5
5
|
l1RollupAddress: config.l1Contracts?.rollupAddress,
|
|
6
6
|
rollupVersion: config.rollupVersion,
|
|
7
|
-
|
|
7
|
+
l2ProtocolContractsHash: l2ProtocolContractsHash.toString(),
|
|
8
8
|
l2CircuitsVkTreeRoot: l2CircuitsVkTreeRoot.toString()
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
/** Returns a compressed string representation of the version (around 32 chars). Used in p2p ENRs. */ export function compressComponentVersions(versions) {
|
|
12
|
-
if (versions.l1RollupAddress === undefined || versions.
|
|
12
|
+
if (versions.l1RollupAddress === undefined || versions.l2ProtocolContractsHash === undefined || versions.l2CircuitsVkTreeRoot === undefined) {
|
|
13
13
|
throw new Error(`Component versions are not set: ${jsonStringify(versions)}`);
|
|
14
14
|
}
|
|
15
15
|
return [
|
|
@@ -17,7 +17,7 @@ import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
|
17
17
|
versions.l1ChainId,
|
|
18
18
|
versions.l1RollupAddress.toString().slice(2, 10),
|
|
19
19
|
versions.rollupVersion,
|
|
20
|
-
versions.
|
|
20
|
+
versions.l2ProtocolContractsHash.toString().slice(2, 10),
|
|
21
21
|
versions.l2CircuitsVkTreeRoot.toString().slice(2, 10)
|
|
22
22
|
].join('-');
|
|
23
23
|
}
|
|
@@ -28,7 +28,7 @@ export class ComponentsVersionsError extends Error {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
/** Checks if the compressed string matches against the expected versions. Throws on mismatch. */ export function checkCompressedComponentVersion(compressed, expected) {
|
|
31
|
-
const [versionVersion, l1ChainId, l1RollupAddress, rollupVersion,
|
|
31
|
+
const [versionVersion, l1ChainId, l1RollupAddress, rollupVersion, l2ProtocolContractsHash, l2CircuitsVkTreeRoot] = compressed.split('-');
|
|
32
32
|
if (versionVersion !== '00') {
|
|
33
33
|
throw new ComponentsVersionsError('version', '00', versionVersion);
|
|
34
34
|
}
|
|
@@ -41,8 +41,8 @@ export class ComponentsVersionsError extends Error {
|
|
|
41
41
|
if (rollupVersion !== expected.rollupVersion.toString()) {
|
|
42
42
|
throw new ComponentsVersionsError('L2 chain version', expected.rollupVersion.toString(), rollupVersion);
|
|
43
43
|
}
|
|
44
|
-
if (
|
|
45
|
-
throw new ComponentsVersionsError(`L2 protocol contracts vk tree root`, expected.
|
|
44
|
+
if (l2ProtocolContractsHash !== expected.l2ProtocolContractsHash.toString().slice(2, 10)) {
|
|
45
|
+
throw new ComponentsVersionsError(`L2 protocol contracts vk tree root`, expected.l2ProtocolContractsHash.toString(), l2ProtocolContractsHash);
|
|
46
46
|
}
|
|
47
47
|
if (l2CircuitsVkTreeRoot !== expected.l2CircuitsVkTreeRoot.toString().slice(2, 10)) {
|
|
48
48
|
throw new ComponentsVersionsError('L2 circuits vk tree root', expected.l2CircuitsVkTreeRoot.toString(), l2CircuitsVkTreeRoot);
|
|
@@ -51,7 +51,7 @@ export class ComponentsVersionsError extends Error {
|
|
|
51
51
|
/** Checks that two component versions match. Undefined fields are ignored. */ export function validatePartialComponentVersionsMatch(expected, actual) {
|
|
52
52
|
for (const key of [
|
|
53
53
|
'l1RollupAddress',
|
|
54
|
-
'
|
|
54
|
+
'l2ProtocolContractsHash',
|
|
55
55
|
'l2CircuitsVkTreeRoot',
|
|
56
56
|
'l1ChainId',
|
|
57
57
|
'rollupVersion'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251008",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
73
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
74
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
75
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
76
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
77
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
78
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
79
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
73
|
+
"@aztec/bb.js": "3.0.0-nightly.20251008",
|
|
74
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251008",
|
|
75
|
+
"@aztec/constants": "3.0.0-nightly.20251008",
|
|
76
|
+
"@aztec/ethereum": "3.0.0-nightly.20251008",
|
|
77
|
+
"@aztec/foundation": "3.0.0-nightly.20251008",
|
|
78
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251008",
|
|
79
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251008",
|
|
80
80
|
"@google-cloud/storage": "^7.15.0",
|
|
81
81
|
"axios": "^1.12.0",
|
|
82
82
|
"json-stringify-deterministic": "1.0.12",
|
package/src/avm/avm.ts
CHANGED
|
@@ -15,7 +15,13 @@ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
|
15
15
|
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
16
16
|
import { NullifierLeafPreimage } from '../trees/nullifier_leaf.js';
|
|
17
17
|
import { PublicDataTreeLeafPreimage } from '../trees/public_data_leaf.js';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
GlobalVariables,
|
|
20
|
+
ProtocolContracts,
|
|
21
|
+
PublicCallRequestWithCalldata,
|
|
22
|
+
TreeSnapshots,
|
|
23
|
+
type Tx,
|
|
24
|
+
} from '../tx/index.js';
|
|
19
25
|
import { AvmCircuitPublicInputs } from './avm_circuit_public_inputs.js';
|
|
20
26
|
import { serializeWithMessagePack } from './message_pack.js';
|
|
21
27
|
|
|
@@ -106,23 +112,6 @@ export class AvmContractInstanceHint {
|
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
114
|
|
|
109
|
-
export class AvmProtocolContractAddressHint {
|
|
110
|
-
constructor(
|
|
111
|
-
public readonly canonicalAddress: AztecAddress,
|
|
112
|
-
public readonly derivedAddress: AztecAddress,
|
|
113
|
-
) {}
|
|
114
|
-
static get schema() {
|
|
115
|
-
return z
|
|
116
|
-
.object({
|
|
117
|
-
canonicalAddress: AztecAddress.schema,
|
|
118
|
-
derivedAddress: AztecAddress.schema,
|
|
119
|
-
})
|
|
120
|
-
.transform(
|
|
121
|
-
({ canonicalAddress, derivedAddress }) => new AvmProtocolContractAddressHint(canonicalAddress, derivedAddress),
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
115
|
////////////////////////////////////////////////////////////////////////////
|
|
127
116
|
// Hints (merkle db)
|
|
128
117
|
////////////////////////////////////////////////////////////////////////////
|
|
@@ -527,8 +516,8 @@ export class AvmExecutionHints {
|
|
|
527
516
|
constructor(
|
|
528
517
|
public readonly globalVariables: GlobalVariables,
|
|
529
518
|
public tx: AvmTxHint,
|
|
530
|
-
// Protocol
|
|
531
|
-
public
|
|
519
|
+
// Protocol contracts.
|
|
520
|
+
public protocolContracts: ProtocolContracts,
|
|
532
521
|
// Contract hints.
|
|
533
522
|
public readonly contractInstances: AvmContractInstanceHint[] = [],
|
|
534
523
|
public readonly contractClasses: AvmContractClassHint[] = [],
|
|
@@ -549,7 +538,7 @@ export class AvmExecutionHints {
|
|
|
549
538
|
) {}
|
|
550
539
|
|
|
551
540
|
static empty() {
|
|
552
|
-
return new AvmExecutionHints(GlobalVariables.empty(), AvmTxHint.empty());
|
|
541
|
+
return new AvmExecutionHints(GlobalVariables.empty(), AvmTxHint.empty(), ProtocolContracts.empty());
|
|
553
542
|
}
|
|
554
543
|
|
|
555
544
|
static get schema() {
|
|
@@ -557,7 +546,7 @@ export class AvmExecutionHints {
|
|
|
557
546
|
.object({
|
|
558
547
|
globalVariables: GlobalVariables.schema,
|
|
559
548
|
tx: AvmTxHint.schema,
|
|
560
|
-
|
|
549
|
+
protocolContracts: ProtocolContracts.schema,
|
|
561
550
|
contractInstances: AvmContractInstanceHint.schema.array(),
|
|
562
551
|
contractClasses: AvmContractClassHint.schema.array(),
|
|
563
552
|
bytecodeCommitments: AvmBytecodeCommitmentHint.schema.array(),
|
|
@@ -578,7 +567,7 @@ export class AvmExecutionHints {
|
|
|
578
567
|
({
|
|
579
568
|
globalVariables,
|
|
580
569
|
tx,
|
|
581
|
-
|
|
570
|
+
protocolContracts,
|
|
582
571
|
contractInstances,
|
|
583
572
|
contractClasses,
|
|
584
573
|
bytecodeCommitments,
|
|
@@ -598,7 +587,7 @@ export class AvmExecutionHints {
|
|
|
598
587
|
new AvmExecutionHints(
|
|
599
588
|
globalVariables,
|
|
600
589
|
tx,
|
|
601
|
-
|
|
590
|
+
protocolContracts,
|
|
602
591
|
contractInstances,
|
|
603
592
|
contractClasses,
|
|
604
593
|
bytecodeCommitments,
|