@aztec/stdlib 1.0.0-nightly.20250613 → 1.0.0-nightly.20250615
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/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +67 -1
- package/dest/abi/utils.d.ts +6 -0
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +7 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +4 -1
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/logs/message_context.d.ts +1 -4
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +1 -6
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +2 -0
- package/package.json +7 -8
- package/src/abi/encoder.ts +83 -1
- package/src/abi/utils.ts +15 -0
- package/src/interfaces/merkle_tree_operations.ts +1 -1
- package/src/logs/message_context.ts +1 -6
- package/src/tx/profiling.ts +2 -1
- package/dest/network/index.d.ts +0 -32
- package/dest/network/index.d.ts.map +0 -1
- package/dest/network/index.js +0 -30
- package/src/network/index.ts +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/abi/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/abi/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,UAAU,CAAC;AAkOrD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,QAE5D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,UAElD"}
|
package/dest/abi/encoder.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { isAddressStruct, isFunctionSelectorStruct, isWrappedFieldStruct } from './utils.js';
|
|
2
|
+
import { isAddressStruct, isBoundedVecStruct, isFunctionSelectorStruct, isWrappedFieldStruct } from './utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* Encodes arguments for a function call.
|
|
5
5
|
* Missing support for integer and string.
|
|
@@ -119,6 +119,10 @@ import { isAddressStruct, isFunctionSelectorStruct, isWrappedFieldStruct } from
|
|
|
119
119
|
}, arg.inner ?? arg, `${name}.inner`);
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
|
+
if (isBoundedVecStruct(abiType)) {
|
|
123
|
+
this.#encodeBoundedVec(abiType, arg, name);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
122
126
|
for (const field of abiType.fields){
|
|
123
127
|
this.encodeArgument(field.type, arg[field.name], `${name}.${field.name}`);
|
|
124
128
|
}
|
|
@@ -146,6 +150,68 @@ import { isAddressStruct, isFunctionSelectorStruct, isWrappedFieldStruct } from
|
|
|
146
150
|
}
|
|
147
151
|
return this.flattened;
|
|
148
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Encodes an array as a BoundedVec struct.
|
|
155
|
+
* @dev BoundedVec is handled as a special case rather than a generic struct for two reasons:
|
|
156
|
+
* 1. It is a commonly used type
|
|
157
|
+
* 2. Manual encoding it is cumbersome
|
|
158
|
+
* Therefore, the input is simplified to accept a plain array of type T.
|
|
159
|
+
* @param abiType - The ABI type definition.
|
|
160
|
+
* @param arg - An array of items to encode.
|
|
161
|
+
* @param name - The name of the parameter.
|
|
162
|
+
*
|
|
163
|
+
* The BoundedVec struct is defined in Noir as:
|
|
164
|
+
*
|
|
165
|
+
* ```noir
|
|
166
|
+
* pub struct BoundedVec<T, let MaxLen: u32> {
|
|
167
|
+
* storage: [T; MaxLen],
|
|
168
|
+
* len: u32,
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* The encoding follows Noir's serialization format:
|
|
173
|
+
* 1. The storage array is encoded first
|
|
174
|
+
* 2. The length field is encoded second
|
|
175
|
+
*/ #encodeBoundedVec(abiType, arg, name) {
|
|
176
|
+
// First we encode the storage array
|
|
177
|
+
{
|
|
178
|
+
// Get the storage array type from the BoundedVec struct
|
|
179
|
+
const storageField = abiType.fields.find((f)=>f.name === 'storage');
|
|
180
|
+
const maxLength = storageField.type.length;
|
|
181
|
+
if (arg.length > maxLength) {
|
|
182
|
+
// Create a preview of the array for the error message, limiting to first few elements
|
|
183
|
+
const preview = arg.slice(0, 3).map((x)=>{
|
|
184
|
+
if (typeof x === 'object' && x !== null) {
|
|
185
|
+
if (Array.isArray(x)) {
|
|
186
|
+
return `[${x.join(', ')}]`;
|
|
187
|
+
}
|
|
188
|
+
// Convert object to string representation of its key-value pairs
|
|
189
|
+
return `{${Object.entries(x).map(([k, v])=>`${k}: ${v}`).join(', ')}}`;
|
|
190
|
+
}
|
|
191
|
+
return `${x}`;
|
|
192
|
+
}).join(', ');
|
|
193
|
+
const suffix = arg.length > 3 ? ', ...' : '';
|
|
194
|
+
throw new Error(`Error encoding param '${name ?? 'unnamed'}': ` + `expected an array of maximum length ${maxLength} and got ${arg.length} instead: [ ${preview}${suffix} ]`);
|
|
195
|
+
}
|
|
196
|
+
const storageArrayItemType = storageField.type.type;
|
|
197
|
+
// Now we encode each item in the input array
|
|
198
|
+
for(let i = 0; i < arg.length; i++){
|
|
199
|
+
this.encodeArgument(storageArrayItemType, arg[i], `storage[${i}]`);
|
|
200
|
+
}
|
|
201
|
+
// Then we pad the storage array with zeros such that the BoundedVec max length is correct.
|
|
202
|
+
const numItemsToPad = maxLength - arg.length;
|
|
203
|
+
if (numItemsToPad > 0) {
|
|
204
|
+
const numFieldsToPad = numItemsToPad * ArgumentEncoder.typeSize(storageArrayItemType);
|
|
205
|
+
const paddingFields = new Array(numFieldsToPad).fill(Fr.ZERO);
|
|
206
|
+
this.flattened.push(...paddingFields);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// At last we encode the length field
|
|
210
|
+
{
|
|
211
|
+
const lenField = abiType.fields.find((f)=>f.name === 'len');
|
|
212
|
+
this.encodeArgument(lenField.type, arg.length, 'len');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
149
215
|
}
|
|
150
216
|
/**
|
|
151
217
|
* Encodes all the arguments for a function call.
|
package/dest/abi/utils.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ export declare function isFunctionSelectorStruct(abiType: AbiType): boolean;
|
|
|
28
28
|
* @param abiType - Type to check.
|
|
29
29
|
*/
|
|
30
30
|
export declare function isWrappedFieldStruct(abiType: AbiType): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Returns whether the ABI type is a BoundedVec struct from Noir's std::collections::bounded_vec.
|
|
33
|
+
* @param abiType - Type to check.
|
|
34
|
+
* @returns A boolean indicating whether the ABI type is a BoundedVec struct.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isBoundedVecStruct(abiType: AbiType): boolean;
|
|
31
37
|
/**
|
|
32
38
|
* Returns a bigint by parsing a serialized 2's complement signed int.
|
|
33
39
|
* @param b - The signed int as a buffer
|
package/dest/abi/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/abi/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,WAE/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,WAElD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,WAEpD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,WAExD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,WAOpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAqBvD"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/abi/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,WAE/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,WAElD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,WAEpD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,WAExD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,WAOpD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,WAQlD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAqBvD"}
|
package/dest/abi/utils.js
CHANGED
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
*/ export function isWrappedFieldStruct(abiType) {
|
|
33
33
|
return abiType.kind === 'struct' && abiType.fields.length === 1 && abiType.fields[0].name === 'inner' && abiType.fields[0].type.kind === 'field';
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns whether the ABI type is a BoundedVec struct from Noir's std::collections::bounded_vec.
|
|
37
|
+
* @param abiType - Type to check.
|
|
38
|
+
* @returns A boolean indicating whether the ABI type is a BoundedVec struct.
|
|
39
|
+
*/ export function isBoundedVecStruct(abiType) {
|
|
40
|
+
return abiType.kind === 'struct' && abiType.path === 'std::collections::bounded_vec::BoundedVec' && abiType.fields.length === 2 && abiType.fields[0].name === 'storage' && abiType.fields[1].name === 'len';
|
|
41
|
+
}
|
|
35
42
|
/**
|
|
36
43
|
* Returns a bigint by parsing a serialized 2's complement signed int.
|
|
37
44
|
* @param b - The signed int as a buffer
|
|
@@ -153,7 +153,10 @@ export interface MerkleTreeReadOperations {
|
|
|
153
153
|
* @param treeId - The tree for which the index should be returned.
|
|
154
154
|
* @param values - The values to search for in the tree.
|
|
155
155
|
*/
|
|
156
|
-
findSiblingPaths<ID extends MerkleTreeId, N extends number>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(
|
|
156
|
+
findSiblingPaths<ID extends MerkleTreeId, N extends number>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<({
|
|
157
|
+
path: SiblingPath<N>;
|
|
158
|
+
index: bigint;
|
|
159
|
+
} | undefined)[]>;
|
|
157
160
|
/**
|
|
158
161
|
* Returns the first index containing a leaf value after `startIndex`.
|
|
159
162
|
* @param treeId - The tree for which the index should be returned.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merkle_tree_operations.d.ts","sourceRoot":"","sources":["../../src/interfaces/merkle_tree_operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,uBAAuB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;GAEG;AACH,MA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C5B,MAAM,EAAE,YAAY,EACpB,GAAG,yCAAqC,iBAUzC"}
|
|
@@ -20,10 +20,7 @@ export declare class MessageContext {
|
|
|
20
20
|
toFields(): Fr[];
|
|
21
21
|
toNoirStruct(): {
|
|
22
22
|
tx_hash: Fr;
|
|
23
|
-
unique_note_hashes_in_tx:
|
|
24
|
-
storage: Fr[];
|
|
25
|
-
len: number;
|
|
26
|
-
};
|
|
23
|
+
unique_note_hashes_in_tx: Fr[];
|
|
27
24
|
first_nullifier_in_tx: Fr;
|
|
28
25
|
recipient: AztecAddress;
|
|
29
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_context.d.ts","sourceRoot":"","sources":["../../src/logs/message_context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAEhB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,SAAS,EAAE,YAAY;gBAHvB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE,EACtB,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,EAAE,EAAE;IAShB,YAAY
|
|
1
|
+
{"version":3,"file":"message_context.d.ts","sourceRoot":"","sources":["../../src/logs/message_context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAEhB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,SAAS,EAAE,YAAY;gBAHvB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE,EACtB,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,EAAE,EAAE;IAShB,YAAY;;;;;;IAWZ,MAAM,CAAC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,GAAG,cAAc;CAG7F"}
|
|
@@ -30,12 +30,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
30
30
|
toNoirStruct() {
|
|
31
31
|
/* eslint-disable camelcase */ return {
|
|
32
32
|
tx_hash: this.txHash.hash,
|
|
33
|
-
|
|
34
|
-
// https://github.com/AztecProtocol/aztec-packages/pull/14891
|
|
35
|
-
unique_note_hashes_in_tx: {
|
|
36
|
-
storage: serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX).slice(0, -1),
|
|
37
|
-
len: this.uniqueNoteHashesInTx.length
|
|
38
|
-
},
|
|
33
|
+
unique_note_hashes_in_tx: this.uniqueNoteHashesInTx,
|
|
39
34
|
first_nullifier_in_tx: this.firstNullifierInTx,
|
|
40
35
|
recipient: this.recipient
|
|
41
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/tx/profiling.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD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uBAAuB;IAEzB,MAAM,EAAE,UAAU;IAClB,KAAK,CAAC,EAAE,eAAe;gBADvB,MAAM,EAAE,UAAU,EAClB,KAAK,CAAC,EAAE,eAAe,YAAA;IAGhC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,uBAAuB,CAAC,CAOnD;IAED,MAAM,CAAC,MAAM,IAAI,uBAAuB;CAkBzC"}
|
package/dest/tx/profiling.js
CHANGED
|
@@ -36,6 +36,7 @@ export const SimulationStatsSchema = z.object({
|
|
|
36
36
|
timings: SimulationTimingsSchema,
|
|
37
37
|
nodeRPCCalls: NodeStatsSchema
|
|
38
38
|
});
|
|
39
|
+
// docs:start:tx-profile-result
|
|
39
40
|
export class TxProfileResult {
|
|
40
41
|
executionSteps;
|
|
41
42
|
stats;
|
|
@@ -43,6 +44,7 @@ export class TxProfileResult {
|
|
|
43
44
|
this.executionSteps = executionSteps;
|
|
44
45
|
this.stats = stats;
|
|
45
46
|
}
|
|
47
|
+
// docs:end:tx-profile-result
|
|
46
48
|
static get schema() {
|
|
47
49
|
return z.object({
|
|
48
50
|
executionSteps: z.array(PrivateExecutionStepSchema),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "1.0.0-nightly.
|
|
3
|
+
"version": "1.0.0-nightly.20250615",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"./keys": "./dest/keys/index.js",
|
|
14
14
|
"./testing": "./dest/tests/index.js",
|
|
15
15
|
"./testing/fixtures": "./dest/tests/fixtures.js",
|
|
16
|
-
"./network": "./dest/network/index.js",
|
|
17
16
|
"./utils": "./dest/utils/index.js",
|
|
18
17
|
"./types": "./dest/types/index.js",
|
|
19
18
|
"./contract": "./dest/contract/index.js",
|
|
@@ -68,12 +67,12 @@
|
|
|
68
67
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
69
68
|
},
|
|
70
69
|
"dependencies": {
|
|
71
|
-
"@aztec/bb.js": "1.0.0-nightly.
|
|
72
|
-
"@aztec/blob-lib": "1.0.0-nightly.
|
|
73
|
-
"@aztec/constants": "1.0.0-nightly.
|
|
74
|
-
"@aztec/ethereum": "1.0.0-nightly.
|
|
75
|
-
"@aztec/foundation": "1.0.0-nightly.
|
|
76
|
-
"@aztec/noir-noirc_abi": "1.0.0-nightly.
|
|
70
|
+
"@aztec/bb.js": "1.0.0-nightly.20250615",
|
|
71
|
+
"@aztec/blob-lib": "1.0.0-nightly.20250615",
|
|
72
|
+
"@aztec/constants": "1.0.0-nightly.20250615",
|
|
73
|
+
"@aztec/ethereum": "1.0.0-nightly.20250615",
|
|
74
|
+
"@aztec/foundation": "1.0.0-nightly.20250615",
|
|
75
|
+
"@aztec/noir-noirc_abi": "1.0.0-nightly.20250615",
|
|
77
76
|
"@google-cloud/storage": "^7.15.0",
|
|
78
77
|
"axios": "^1.9.0",
|
|
79
78
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/encoder.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
|
|
3
3
|
import type { AbiType, FunctionAbi } from './abi.js';
|
|
4
|
-
import { isAddressStruct, isFunctionSelectorStruct, isWrappedFieldStruct } from './utils.js';
|
|
4
|
+
import { isAddressStruct, isBoundedVecStruct, isFunctionSelectorStruct, isWrappedFieldStruct } from './utils.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Encodes arguments for a function call.
|
|
@@ -113,6 +113,11 @@ class ArgumentEncoder {
|
|
|
113
113
|
this.encodeArgument({ kind: 'field' }, arg.inner ?? arg, `${name}.inner`);
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
|
+
if (isBoundedVecStruct(abiType)) {
|
|
117
|
+
this.#encodeBoundedVec(abiType, arg, name);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
116
121
|
for (const field of abiType.fields) {
|
|
117
122
|
this.encodeArgument(field.type, arg[field.name], `${name}.${field.name}`);
|
|
118
123
|
}
|
|
@@ -142,6 +147,83 @@ class ArgumentEncoder {
|
|
|
142
147
|
}
|
|
143
148
|
return this.flattened;
|
|
144
149
|
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Encodes an array as a BoundedVec struct.
|
|
153
|
+
* @dev BoundedVec is handled as a special case rather than a generic struct for two reasons:
|
|
154
|
+
* 1. It is a commonly used type
|
|
155
|
+
* 2. Manual encoding it is cumbersome
|
|
156
|
+
* Therefore, the input is simplified to accept a plain array of type T.
|
|
157
|
+
* @param abiType - The ABI type definition.
|
|
158
|
+
* @param arg - An array of items to encode.
|
|
159
|
+
* @param name - The name of the parameter.
|
|
160
|
+
*
|
|
161
|
+
* The BoundedVec struct is defined in Noir as:
|
|
162
|
+
*
|
|
163
|
+
* ```noir
|
|
164
|
+
* pub struct BoundedVec<T, let MaxLen: u32> {
|
|
165
|
+
* storage: [T; MaxLen],
|
|
166
|
+
* len: u32,
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* The encoding follows Noir's serialization format:
|
|
171
|
+
* 1. The storage array is encoded first
|
|
172
|
+
* 2. The length field is encoded second
|
|
173
|
+
*/
|
|
174
|
+
#encodeBoundedVec(abiType: AbiType, arg: any, name?: string) {
|
|
175
|
+
// First we encode the storage array
|
|
176
|
+
{
|
|
177
|
+
// Get the storage array type from the BoundedVec struct
|
|
178
|
+
const storageField = (abiType as unknown as any).fields.find((f: any) => f.name === 'storage')!;
|
|
179
|
+
const maxLength = storageField.type.length;
|
|
180
|
+
|
|
181
|
+
if (arg.length > maxLength) {
|
|
182
|
+
// Create a preview of the array for the error message, limiting to first few elements
|
|
183
|
+
const preview = arg
|
|
184
|
+
.slice(0, 3)
|
|
185
|
+
.map((x: any) => {
|
|
186
|
+
if (typeof x === 'object' && x !== null) {
|
|
187
|
+
if (Array.isArray(x)) {
|
|
188
|
+
return `[${x.join(', ')}]`;
|
|
189
|
+
}
|
|
190
|
+
// Convert object to string representation of its key-value pairs
|
|
191
|
+
return `{${Object.entries(x)
|
|
192
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
193
|
+
.join(', ')}}`;
|
|
194
|
+
}
|
|
195
|
+
return `${x}`;
|
|
196
|
+
})
|
|
197
|
+
.join(', ');
|
|
198
|
+
const suffix = arg.length > 3 ? ', ...' : '';
|
|
199
|
+
throw new Error(
|
|
200
|
+
`Error encoding param '${name ?? 'unnamed'}': ` +
|
|
201
|
+
`expected an array of maximum length ${maxLength} and got ${arg.length} instead: [ ${preview}${suffix} ]`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const storageArrayItemType = storageField.type.type;
|
|
206
|
+
|
|
207
|
+
// Now we encode each item in the input array
|
|
208
|
+
for (let i = 0; i < arg.length; i++) {
|
|
209
|
+
this.encodeArgument(storageArrayItemType, arg[i], `storage[${i}]`);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Then we pad the storage array with zeros such that the BoundedVec max length is correct.
|
|
213
|
+
const numItemsToPad = maxLength - arg.length;
|
|
214
|
+
if (numItemsToPad > 0) {
|
|
215
|
+
const numFieldsToPad = numItemsToPad * ArgumentEncoder.typeSize(storageArrayItemType);
|
|
216
|
+
const paddingFields = new Array(numFieldsToPad).fill(Fr.ZERO);
|
|
217
|
+
this.flattened.push(...paddingFields);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// At last we encode the length field
|
|
222
|
+
{
|
|
223
|
+
const lenField = (abiType as unknown as any).fields.find((f: any) => f.name === 'len')!;
|
|
224
|
+
this.encodeArgument(lenField.type, arg.length, 'len');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
145
227
|
}
|
|
146
228
|
|
|
147
229
|
/**
|
package/src/abi/utils.ts
CHANGED
|
@@ -49,6 +49,21 @@ export function isWrappedFieldStruct(abiType: AbiType) {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Returns whether the ABI type is a BoundedVec struct from Noir's std::collections::bounded_vec.
|
|
54
|
+
* @param abiType - Type to check.
|
|
55
|
+
* @returns A boolean indicating whether the ABI type is a BoundedVec struct.
|
|
56
|
+
*/
|
|
57
|
+
export function isBoundedVecStruct(abiType: AbiType) {
|
|
58
|
+
return (
|
|
59
|
+
abiType.kind === 'struct' &&
|
|
60
|
+
abiType.path === 'std::collections::bounded_vec::BoundedVec' &&
|
|
61
|
+
abiType.fields.length === 2 &&
|
|
62
|
+
abiType.fields[0].name === 'storage' &&
|
|
63
|
+
abiType.fields[1].name === 'len'
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
52
67
|
/**
|
|
53
68
|
* Returns a bigint by parsing a serialized 2's complement signed int.
|
|
54
69
|
* @param b - The signed int as a buffer
|
|
@@ -186,7 +186,7 @@ export interface MerkleTreeReadOperations {
|
|
|
186
186
|
findSiblingPaths<ID extends MerkleTreeId, N extends number>(
|
|
187
187
|
treeId: ID,
|
|
188
188
|
values: MerkleTreeLeafType<ID>[],
|
|
189
|
-
): Promise<(SiblingPath<N
|
|
189
|
+
): Promise<({ path: SiblingPath<N>; index: bigint } | undefined)[]>;
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
192
|
* Returns the first index containing a leaf value after `startIndex`.
|
|
@@ -35,12 +35,7 @@ export class MessageContext {
|
|
|
35
35
|
/* eslint-disable camelcase */
|
|
36
36
|
return {
|
|
37
37
|
tx_hash: this.txHash.hash,
|
|
38
|
-
|
|
39
|
-
// https://github.com/AztecProtocol/aztec-packages/pull/14891
|
|
40
|
-
unique_note_hashes_in_tx: {
|
|
41
|
-
storage: serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX).slice(0, -1),
|
|
42
|
-
len: this.uniqueNoteHashesInTx.length,
|
|
43
|
-
},
|
|
38
|
+
unique_note_hashes_in_tx: this.uniqueNoteHashesInTx,
|
|
44
39
|
first_nullifier_in_tx: this.firstNullifierInTx,
|
|
45
40
|
recipient: this.recipient,
|
|
46
41
|
};
|
package/src/tx/profiling.ts
CHANGED
|
@@ -78,12 +78,13 @@ export const SimulationStatsSchema = z.object({
|
|
|
78
78
|
nodeRPCCalls: NodeStatsSchema,
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
+
// docs:start:tx-profile-result
|
|
81
82
|
export class TxProfileResult {
|
|
82
83
|
constructor(
|
|
83
84
|
public executionSteps: PrivateExecutionStep[],
|
|
84
85
|
public stats: ProvingStats,
|
|
85
86
|
) {}
|
|
86
|
-
|
|
87
|
+
// docs:end:tx-profile-result
|
|
87
88
|
static get schema(): ZodFor<TxProfileResult> {
|
|
88
89
|
return z
|
|
89
90
|
.object({
|
package/dest/network/index.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deployed aztec networks & their names.
|
|
3
|
-
*/
|
|
4
|
-
export declare enum Network {
|
|
5
|
-
DEVNET = "devnet",
|
|
6
|
-
PROVERNET = "provernet",
|
|
7
|
-
ALPHANET = "alphanet"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Map of basic contracts deployed for each network.
|
|
11
|
-
*/
|
|
12
|
-
export declare const L2BasicContractsMap: {
|
|
13
|
-
devnet: {
|
|
14
|
-
devCoin: string;
|
|
15
|
-
devCoinBridge: string;
|
|
16
|
-
devCoinFpc: string;
|
|
17
|
-
counter: string;
|
|
18
|
-
};
|
|
19
|
-
provernet: {
|
|
20
|
-
devCoin: string;
|
|
21
|
-
devCoinBridge: string;
|
|
22
|
-
devCoinFpc: string;
|
|
23
|
-
counter: string;
|
|
24
|
-
};
|
|
25
|
-
alphanet: {
|
|
26
|
-
devCoin: string;
|
|
27
|
-
devCoinBridge: string;
|
|
28
|
-
devCoinFpc: string;
|
|
29
|
-
counter: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,OAAO;IACjB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;CAmB/B,CAAC"}
|
package/dest/network/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deployed aztec networks & their names.
|
|
3
|
-
*/ export var Network = /*#__PURE__*/ function(Network) {
|
|
4
|
-
Network["DEVNET"] = "devnet";
|
|
5
|
-
Network["PROVERNET"] = "provernet";
|
|
6
|
-
Network["ALPHANET"] = "alphanet";
|
|
7
|
-
return Network;
|
|
8
|
-
}({});
|
|
9
|
-
/**
|
|
10
|
-
* Map of basic contracts deployed for each network.
|
|
11
|
-
*/ export const L2BasicContractsMap = {
|
|
12
|
-
["devnet"]: {
|
|
13
|
-
devCoin: 'TokenContract',
|
|
14
|
-
devCoinBridge: 'TokenBridgeContract',
|
|
15
|
-
devCoinFpc: 'FPCContract',
|
|
16
|
-
counter: 'CounterContract'
|
|
17
|
-
},
|
|
18
|
-
["provernet"]: {
|
|
19
|
-
devCoin: 'TokenContract',
|
|
20
|
-
devCoinBridge: 'TokenBridgeContract',
|
|
21
|
-
devCoinFpc: 'FPCContract',
|
|
22
|
-
counter: 'CounterContract'
|
|
23
|
-
},
|
|
24
|
-
["alphanet"]: {
|
|
25
|
-
devCoin: 'TokenContract',
|
|
26
|
-
devCoinBridge: 'TokenBridgeContract',
|
|
27
|
-
devCoinFpc: 'FPCContract',
|
|
28
|
-
counter: 'CounterContract'
|
|
29
|
-
}
|
|
30
|
-
};
|
package/src/network/index.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deployed aztec networks & their names.
|
|
3
|
-
*/
|
|
4
|
-
export enum Network {
|
|
5
|
-
DEVNET = 'devnet',
|
|
6
|
-
PROVERNET = 'provernet',
|
|
7
|
-
ALPHANET = 'alphanet',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Map of basic contracts deployed for each network.
|
|
12
|
-
*/
|
|
13
|
-
export const L2BasicContractsMap = {
|
|
14
|
-
[Network.DEVNET]: {
|
|
15
|
-
devCoin: 'TokenContract',
|
|
16
|
-
devCoinBridge: 'TokenBridgeContract',
|
|
17
|
-
devCoinFpc: 'FPCContract',
|
|
18
|
-
counter: 'CounterContract',
|
|
19
|
-
},
|
|
20
|
-
[Network.PROVERNET]: {
|
|
21
|
-
devCoin: 'TokenContract',
|
|
22
|
-
devCoinBridge: 'TokenBridgeContract',
|
|
23
|
-
devCoinFpc: 'FPCContract',
|
|
24
|
-
counter: 'CounterContract',
|
|
25
|
-
},
|
|
26
|
-
[Network.ALPHANET]: {
|
|
27
|
-
devCoin: 'TokenContract',
|
|
28
|
-
devCoinBridge: 'TokenBridgeContract',
|
|
29
|
-
devCoinFpc: 'FPCContract',
|
|
30
|
-
counter: 'CounterContract',
|
|
31
|
-
},
|
|
32
|
-
};
|