@aztec/stdlib 0.86.0-nightly.20250428 → 0.86.0-nightly.20250429
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/proofs/proof.js +5 -5
- package/dest/tests/mocks.d.ts +6 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +7 -2
- package/dest/tx/validator/error_texts.d.ts +3 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +3 -1
- package/package.json +7 -7
- package/src/proofs/proof.ts +5 -5
- package/src/tests/mocks.ts +14 -2
- package/src/tx/validator/error_texts.ts +3 -1
package/dest/proofs/proof.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PAIRING_POINTS_SIZE } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
@@ -57,8 +57,8 @@ const EMPTY_PROOF_SIZE = 42;
|
|
|
57
57
|
// We are indexing to this particular size because we are assuming the proof buffer looks like:
|
|
58
58
|
// [binary public inputs, binary proof]
|
|
59
59
|
// Here, we are assuming the pairing point object is the last 16 fields of the public inputs.
|
|
60
|
-
assert(this.numPublicInputs >=
|
|
61
|
-
const proofStart = Fr.SIZE_IN_BYTES * (this.numPublicInputs -
|
|
60
|
+
assert(this.numPublicInputs >= PAIRING_POINTS_SIZE, 'Proof does not contain an aggregation object');
|
|
61
|
+
const proofStart = Fr.SIZE_IN_BYTES * (this.numPublicInputs - PAIRING_POINTS_SIZE);
|
|
62
62
|
assert(this.buffer.length >= proofStart, 'Proof buffer is not appropriately sized to call withoutPublicInputs()');
|
|
63
63
|
return this.buffer.subarray(proofStart);
|
|
64
64
|
}
|
|
@@ -70,8 +70,8 @@ const EMPTY_PROOF_SIZE = 42;
|
|
|
70
70
|
// return array of this.numPublicInputs 0s
|
|
71
71
|
return new Array(this.numPublicInputs).fill(Fr.zero());
|
|
72
72
|
}
|
|
73
|
-
assert(this.numPublicInputs >=
|
|
74
|
-
const numInnerPublicInputs = this.numPublicInputs -
|
|
73
|
+
assert(this.numPublicInputs >= PAIRING_POINTS_SIZE, 'Proof does not contain an aggregation object');
|
|
74
|
+
const numInnerPublicInputs = this.numPublicInputs - PAIRING_POINTS_SIZE;
|
|
75
75
|
const reader = BufferReader.asReader(this.buffer.subarray(0, Fr.SIZE_IN_BYTES * numInnerPublicInputs));
|
|
76
76
|
const publicInputs = reader.readArray(numInnerPublicInputs, Fr);
|
|
77
77
|
return publicInputs;
|
package/dest/tests/mocks.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { TxHash } from '../tx/tx_hash.js';
|
|
|
14
14
|
export declare const randomTxHash: () => TxHash;
|
|
15
15
|
export declare const randomExtendedNote: ({ note, recipient, contractAddress, txHash, storageSlot, }?: Partial<ExtendedNote>) => Promise<ExtendedNote>;
|
|
16
16
|
export declare const randomUniqueNote: ({ note, recipient, contractAddress, txHash, storageSlot, nonce, }?: Partial<UniqueNote>) => Promise<UniqueNote>;
|
|
17
|
-
export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, maxPriorityFeesPerGas, }?: {
|
|
17
|
+
export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, maxPriorityFeesPerGas, chainId, version, vkTreeRoot, protocolContractTreeRoot, }?: {
|
|
18
18
|
numberOfNonRevertiblePublicCallRequests?: number;
|
|
19
19
|
numberOfRevertiblePublicCallRequests?: number;
|
|
20
20
|
numberOfRevertibleNullifiers?: number;
|
|
@@ -23,8 +23,12 @@ export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRe
|
|
|
23
23
|
feePayer?: AztecAddress;
|
|
24
24
|
clientIvcProof?: ClientIvcProof;
|
|
25
25
|
maxPriorityFeesPerGas?: GasFees;
|
|
26
|
+
chainId?: Fr;
|
|
27
|
+
version?: Fr;
|
|
28
|
+
vkTreeRoot?: Fr;
|
|
29
|
+
protocolContractTreeRoot?: Fr;
|
|
26
30
|
}) => Promise<Tx>;
|
|
27
|
-
export declare const mockTxForRollup: (seed?: number) => Promise<Tx>;
|
|
31
|
+
export declare const mockTxForRollup: (seed?: number, opts?: Parameters<typeof mockTx>[1]) => Promise<Tx>;
|
|
28
32
|
export declare const mockSimulatedTx: (seed?: number) => Promise<TxSimulationResult>;
|
|
29
33
|
export declare const randomContractArtifact: () => ContractArtifact;
|
|
30
34
|
export declare const randomContractInstanceWithAddress: (opts?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EACL,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AC;AAGF,eAAO,MAAM,oBAAoB,aAAc,2BAA2B,KAAG,gBAM5E,CAAC"}
|
package/dest/tests/mocks.js
CHANGED
|
@@ -32,7 +32,7 @@ export const randomExtendedNote = async ({ note = Note.random(), recipient = und
|
|
|
32
32
|
export const randomUniqueNote = async ({ note = Note.random(), recipient = undefined, contractAddress = undefined, txHash = randomTxHash(), storageSlot = Fr.random(), nonce = Fr.random() } = {})=>{
|
|
33
33
|
return new UniqueNote(note, recipient ?? await AztecAddress.random(), contractAddress ?? await AztecAddress.random(), storageSlot, txHash, nonce);
|
|
34
34
|
};
|
|
35
|
-
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.empty(), maxPriorityFeesPerGas } = {})=>{
|
|
35
|
+
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.empty(), maxPriorityFeesPerGas, chainId = Fr.ZERO, version = Fr.ZERO, vkTreeRoot = Fr.ZERO, protocolContractTreeRoot = Fr.ZERO } = {})=>{
|
|
36
36
|
const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
|
|
37
37
|
const isForPublic = totalPublicCallRequests > 0;
|
|
38
38
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
@@ -42,6 +42,10 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
|
|
|
42
42
|
maxPriorityFeesPerGas
|
|
43
43
|
});
|
|
44
44
|
data.feePayer = feePayer ?? await AztecAddress.random();
|
|
45
|
+
data.constants.txContext.chainId = chainId;
|
|
46
|
+
data.constants.txContext.version = version;
|
|
47
|
+
data.constants.vkTreeRoot = vkTreeRoot;
|
|
48
|
+
data.constants.protocolContractTreeRoot = protocolContractTreeRoot;
|
|
45
49
|
const publicFunctionCalldata = [];
|
|
46
50
|
if (!isForPublic) {
|
|
47
51
|
data.forRollup.end.nullifiers[0] = firstNullifier.value;
|
|
@@ -69,7 +73,8 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
|
|
|
69
73
|
}
|
|
70
74
|
return new Tx(data, clientIvcProof, [], publicFunctionCalldata);
|
|
71
75
|
};
|
|
72
|
-
export const mockTxForRollup = (seed = 1)=>mockTx(seed, {
|
|
76
|
+
export const mockTxForRollup = (seed = 1, opts = {})=>mockTx(seed, {
|
|
77
|
+
...opts,
|
|
73
78
|
numberOfNonRevertiblePublicCallRequests: 0,
|
|
74
79
|
numberOfRevertiblePublicCallRequests: 0
|
|
75
80
|
});
|
|
@@ -5,8 +5,10 @@ export declare const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = "Setup function not o
|
|
|
5
5
|
export declare const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = "Duplicate nullifier in tx";
|
|
6
6
|
export declare const TX_ERROR_EXISTING_NULLIFIER = "Existing nullifier";
|
|
7
7
|
export declare const TX_ERROR_INVALID_BLOCK_NUMBER = "Invalid block number";
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const TX_ERROR_INCORRECT_L1_CHAIN_ID = "Incorrect L1 chain id";
|
|
9
9
|
export declare const TX_ERROR_INCORRECT_ROLLUP_VERSION = "Incorrect rollup version";
|
|
10
|
+
export declare const TX_ERROR_INCORRECT_VK_TREE_ROOT = "Incorrect protocol circuits tree root";
|
|
11
|
+
export declare const TX_ERROR_INCORRECT_PROTOCOL_CONTRACT_TREE_ROOT = "Incorrect protocol contracts tree root";
|
|
10
12
|
export declare const TX_ERROR_INVALID_PROOF = "Invalid proof";
|
|
11
13
|
export declare const TX_ERROR_INCORRECT_CALLDATA = "Incorrect calldata for public call";
|
|
12
14
|
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;AAG3F,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AAGtF,eAAO,MAAM,kCAAkC,8BAA8B,CAAC;AAC9E,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AACpE,eAAO,MAAM,
|
|
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;AAG3F,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AAGtF,eAAO,MAAM,kCAAkC,8BAA8B,CAAC;AAC9E,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AACpE,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AACtE,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,+BAA+B,0CAA0C,CAAC;AACvF,eAAO,MAAM,8CAA8C,2CAA2C,CAAC;AAGvG,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAGtD,eAAO,MAAM,2BAA2B,uCAAuC,CAAC;AAChF,eAAO,MAAM,gCAAgC,8CAA8C,CAAC;AAC5F,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAC5F,eAAO,MAAM,kCAAkC,0CAA0C,CAAC;AAC1F,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,2CAA2C,CAAC;AAG5F,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
|
|
@@ -9,8 +9,10 @@ export const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = 'Duplicate nullifier in tx';
|
|
|
9
9
|
export const TX_ERROR_EXISTING_NULLIFIER = 'Existing nullifier';
|
|
10
10
|
// Metadata
|
|
11
11
|
export const TX_ERROR_INVALID_BLOCK_NUMBER = 'Invalid block number';
|
|
12
|
-
export const
|
|
12
|
+
export const TX_ERROR_INCORRECT_L1_CHAIN_ID = 'Incorrect L1 chain id';
|
|
13
13
|
export const TX_ERROR_INCORRECT_ROLLUP_VERSION = 'Incorrect rollup version';
|
|
14
|
+
export const TX_ERROR_INCORRECT_VK_TREE_ROOT = 'Incorrect protocol circuits tree root';
|
|
15
|
+
export const TX_ERROR_INCORRECT_PROTOCOL_CONTRACT_TREE_ROOT = 'Incorrect protocol contracts tree root';
|
|
14
16
|
// Proof
|
|
15
17
|
export const TX_ERROR_INVALID_PROOF = 'Invalid proof';
|
|
16
18
|
//Data
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.86.0-nightly.
|
|
3
|
+
"version": "0.86.0-nightly.20250429",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/bb.js": "0.86.0-nightly.
|
|
70
|
-
"@aztec/blob-lib": "0.86.0-nightly.
|
|
71
|
-
"@aztec/constants": "0.86.0-nightly.
|
|
72
|
-
"@aztec/ethereum": "0.86.0-nightly.
|
|
73
|
-
"@aztec/foundation": "0.86.0-nightly.
|
|
74
|
-
"@aztec/noir-noirc_abi": "0.86.0-nightly.
|
|
69
|
+
"@aztec/bb.js": "0.86.0-nightly.20250429",
|
|
70
|
+
"@aztec/blob-lib": "0.86.0-nightly.20250429",
|
|
71
|
+
"@aztec/constants": "0.86.0-nightly.20250429",
|
|
72
|
+
"@aztec/ethereum": "0.86.0-nightly.20250429",
|
|
73
|
+
"@aztec/foundation": "0.86.0-nightly.20250429",
|
|
74
|
+
"@aztec/noir-noirc_abi": "0.86.0-nightly.20250429",
|
|
75
75
|
"@google-cloud/storage": "^7.15.0",
|
|
76
76
|
"lodash.chunk": "^4.2.0",
|
|
77
77
|
"lodash.isequal": "^4.5.0",
|
package/src/proofs/proof.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PAIRING_POINTS_SIZE } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
@@ -70,8 +70,8 @@ export class Proof {
|
|
|
70
70
|
// We are indexing to this particular size because we are assuming the proof buffer looks like:
|
|
71
71
|
// [binary public inputs, binary proof]
|
|
72
72
|
// Here, we are assuming the pairing point object is the last 16 fields of the public inputs.
|
|
73
|
-
assert(this.numPublicInputs >=
|
|
74
|
-
const proofStart = Fr.SIZE_IN_BYTES * (this.numPublicInputs -
|
|
73
|
+
assert(this.numPublicInputs >= PAIRING_POINTS_SIZE, 'Proof does not contain an aggregation object');
|
|
74
|
+
const proofStart = Fr.SIZE_IN_BYTES * (this.numPublicInputs - PAIRING_POINTS_SIZE);
|
|
75
75
|
assert(this.buffer.length >= proofStart, 'Proof buffer is not appropriately sized to call withoutPublicInputs()');
|
|
76
76
|
return this.buffer.subarray(proofStart);
|
|
77
77
|
}
|
|
@@ -84,8 +84,8 @@ export class Proof {
|
|
|
84
84
|
// return array of this.numPublicInputs 0s
|
|
85
85
|
return new Array(this.numPublicInputs).fill(Fr.zero());
|
|
86
86
|
}
|
|
87
|
-
assert(this.numPublicInputs >=
|
|
88
|
-
const numInnerPublicInputs = this.numPublicInputs -
|
|
87
|
+
assert(this.numPublicInputs >= PAIRING_POINTS_SIZE, 'Proof does not contain an aggregation object');
|
|
88
|
+
const numInnerPublicInputs = this.numPublicInputs - PAIRING_POINTS_SIZE;
|
|
89
89
|
const reader = BufferReader.asReader(this.buffer.subarray(0, Fr.SIZE_IN_BYTES * numInnerPublicInputs));
|
|
90
90
|
const publicInputs = reader.readArray(numInnerPublicInputs, Fr);
|
|
91
91
|
return publicInputs;
|
package/src/tests/mocks.ts
CHANGED
|
@@ -86,6 +86,10 @@ export const mockTx = async (
|
|
|
86
86
|
feePayer,
|
|
87
87
|
clientIvcProof = ClientIvcProof.empty(),
|
|
88
88
|
maxPriorityFeesPerGas,
|
|
89
|
+
chainId = Fr.ZERO,
|
|
90
|
+
version = Fr.ZERO,
|
|
91
|
+
vkTreeRoot = Fr.ZERO,
|
|
92
|
+
protocolContractTreeRoot = Fr.ZERO,
|
|
89
93
|
}: {
|
|
90
94
|
numberOfNonRevertiblePublicCallRequests?: number;
|
|
91
95
|
numberOfRevertiblePublicCallRequests?: number;
|
|
@@ -95,6 +99,10 @@ export const mockTx = async (
|
|
|
95
99
|
feePayer?: AztecAddress;
|
|
96
100
|
clientIvcProof?: ClientIvcProof;
|
|
97
101
|
maxPriorityFeesPerGas?: GasFees;
|
|
102
|
+
chainId?: Fr;
|
|
103
|
+
version?: Fr;
|
|
104
|
+
vkTreeRoot?: Fr;
|
|
105
|
+
protocolContractTreeRoot?: Fr;
|
|
98
106
|
} = {},
|
|
99
107
|
) => {
|
|
100
108
|
const totalPublicCallRequests =
|
|
@@ -109,6 +117,10 @@ export const mockTx = async (
|
|
|
109
117
|
maxPriorityFeesPerGas,
|
|
110
118
|
});
|
|
111
119
|
data.feePayer = feePayer ?? (await AztecAddress.random());
|
|
120
|
+
data.constants.txContext.chainId = chainId;
|
|
121
|
+
data.constants.txContext.version = version;
|
|
122
|
+
data.constants.vkTreeRoot = vkTreeRoot;
|
|
123
|
+
data.constants.protocolContractTreeRoot = protocolContractTreeRoot;
|
|
112
124
|
|
|
113
125
|
const publicFunctionCalldata: HashedValues[] = [];
|
|
114
126
|
if (!isForPublic) {
|
|
@@ -150,8 +162,8 @@ export const mockTx = async (
|
|
|
150
162
|
return new Tx(data, clientIvcProof, [], publicFunctionCalldata);
|
|
151
163
|
};
|
|
152
164
|
|
|
153
|
-
export const mockTxForRollup = (seed = 1) =>
|
|
154
|
-
mockTx(seed, { numberOfNonRevertiblePublicCallRequests: 0, numberOfRevertiblePublicCallRequests: 0 });
|
|
165
|
+
export const mockTxForRollup = (seed = 1, opts: Parameters<typeof mockTx>[1] = {}) =>
|
|
166
|
+
mockTx(seed, { ...opts, numberOfNonRevertiblePublicCallRequests: 0, numberOfRevertiblePublicCallRequests: 0 });
|
|
155
167
|
|
|
156
168
|
const emptyPrivateCallExecutionResult = () =>
|
|
157
169
|
new PrivateCallExecutionResult(
|
|
@@ -12,8 +12,10 @@ export const TX_ERROR_EXISTING_NULLIFIER = 'Existing nullifier';
|
|
|
12
12
|
|
|
13
13
|
// Metadata
|
|
14
14
|
export const TX_ERROR_INVALID_BLOCK_NUMBER = 'Invalid block number';
|
|
15
|
-
export const
|
|
15
|
+
export const TX_ERROR_INCORRECT_L1_CHAIN_ID = 'Incorrect L1 chain id';
|
|
16
16
|
export const TX_ERROR_INCORRECT_ROLLUP_VERSION = 'Incorrect rollup version';
|
|
17
|
+
export const TX_ERROR_INCORRECT_VK_TREE_ROOT = 'Incorrect protocol circuits tree root';
|
|
18
|
+
export const TX_ERROR_INCORRECT_PROTOCOL_CONTRACT_TREE_ROOT = 'Incorrect protocol contracts tree root';
|
|
17
19
|
|
|
18
20
|
// Proof
|
|
19
21
|
export const TX_ERROR_INVALID_PROOF = 'Invalid proof';
|