@aztec/txe 0.86.0 → 0.87.0
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/oracle/txe_oracle.d.ts +11 -6
- package/dest/oracle/txe_oracle.d.ts.map +1 -1
- package/dest/oracle/txe_oracle.js +209 -38
- package/dest/state_machine/archiver.d.ts +53 -0
- package/dest/state_machine/archiver.d.ts.map +1 -0
- package/dest/state_machine/archiver.js +100 -0
- package/dest/state_machine/dummy_p2p_client.d.ts +48 -0
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -0
- package/dest/state_machine/dummy_p2p_client.js +122 -0
- package/dest/state_machine/global_variable_builder.d.ts +23 -0
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -0
- package/dest/state_machine/global_variable_builder.js +29 -0
- package/dest/state_machine/index.d.ts +16 -0
- package/dest/state_machine/index.d.ts.map +1 -0
- package/dest/state_machine/index.js +48 -0
- package/dest/state_machine/synchronizer.d.ts +32 -0
- package/dest/state_machine/synchronizer.d.ts.map +1 -0
- package/dest/state_machine/synchronizer.js +58 -0
- package/dest/txe_service/txe_service.d.ts +12 -3
- package/dest/txe_service/txe_service.d.ts.map +1 -1
- package/dest/txe_service/txe_service.js +221 -37
- package/dest/util/encoding.d.ts +11 -4
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/encoding.js +38 -2
- package/package.json +18 -15
- package/src/oracle/txe_oracle.ts +387 -40
- package/src/state_machine/archiver.ts +132 -0
- package/src/state_machine/dummy_p2p_client.ts +167 -0
- package/src/state_machine/global_variable_builder.ts +55 -0
- package/src/state_machine/index.ts +71 -0
- package/src/state_machine/synchronizer.ts +87 -0
- package/src/txe_service/txe_service.ts +427 -31
- package/src/util/encoding.ts +51 -2
- package/dest/node/txe_node.d.ts +0 -320
- package/dest/node/txe_node.d.ts.map +0 -1
- package/dest/node/txe_node.js +0 -481
- package/src/node/txe_node.ts +0 -703
package/dest/util/encoding.js
CHANGED
|
@@ -40,8 +40,20 @@ export function fromArray(obj) {
|
|
|
40
40
|
const boundedStorage = storage.slice(0, fromSingle(length).toNumber());
|
|
41
41
|
return Buffer.concat(boundedStorage.map((str)=>hexToBuffer(str).slice(-uintByteSize)));
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// Just like toACVMField in yarn-project/simulator/src/private/acvm/serialize.ts but returns a ForeignCallSingle
|
|
44
|
+
// instead of an ACVMField.
|
|
45
|
+
export function toSingle(value) {
|
|
46
|
+
let valueAsField;
|
|
47
|
+
if (Buffer.isBuffer(value)) {
|
|
48
|
+
valueAsField = Fr.fromBuffer(value);
|
|
49
|
+
} else if (typeof value === 'boolean' || typeof value === 'number' || typeof value === 'bigint') {
|
|
50
|
+
valueAsField = new Fr(value);
|
|
51
|
+
} else if (typeof value === 'string') {
|
|
52
|
+
valueAsField = Fr.fromHexString(value);
|
|
53
|
+
} else {
|
|
54
|
+
valueAsField = value;
|
|
55
|
+
}
|
|
56
|
+
return valueAsField.toString().slice(2);
|
|
45
57
|
}
|
|
46
58
|
export function toArray(objs) {
|
|
47
59
|
return objs.map((obj)=>obj.toString());
|
|
@@ -74,6 +86,30 @@ export function bufferToU8Array(buffer) {
|
|
|
74
86
|
len
|
|
75
87
|
];
|
|
76
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Converts an array of arrays representing Noir BoundedVec of nested arrays into its Noir serialized form.
|
|
91
|
+
* @param bVecStorage - The array underlying the BoundedVec.
|
|
92
|
+
* @param maxLen - The max length of the BoundedVec (max num of the nested arrays in the BoundedVec).
|
|
93
|
+
* @param nestedArrayLength - The length of the nested arrays (each nested array has to have the same length).
|
|
94
|
+
* @returns Serialized BoundedVec following Noir intrinsic serialization.
|
|
95
|
+
*/ export function arrayOfArraysToBoundedVecOfArrays(bVecStorage, maxLen, nestedArrayLength) {
|
|
96
|
+
if (bVecStorage.length > maxLen) {
|
|
97
|
+
throw new Error(`Array of length ${bVecStorage.length} larger than maxLen ${maxLen}`);
|
|
98
|
+
}
|
|
99
|
+
// Check that all nested arrays have length nestedArrayLength
|
|
100
|
+
if (!bVecStorage.every((nestedArray)=>nestedArray.length === nestedArrayLength)) {
|
|
101
|
+
throw new Error(`Nested array length passed in from Noir does not correspond to the length obtained in TS: ${nestedArrayLength} !== ${bVecStorage[0].length}`);
|
|
102
|
+
}
|
|
103
|
+
const flattenedStorage = bVecStorage.flat();
|
|
104
|
+
const numFieldsToPad = maxLen * nestedArrayLength - flattenedStorage.length;
|
|
105
|
+
const flattenedStorageWithPadding = flattenedStorage.concat(Array(numFieldsToPad).fill(new Fr(0)));
|
|
106
|
+
// At last we get the actual length of the BoundedVec and return the values.
|
|
107
|
+
const len = toSingle(new Fr(bVecStorage.length));
|
|
108
|
+
return [
|
|
109
|
+
flattenedStorageWithPadding,
|
|
110
|
+
len
|
|
111
|
+
];
|
|
112
|
+
}
|
|
77
113
|
export function toForeignCallResult(obj) {
|
|
78
114
|
return {
|
|
79
115
|
values: obj
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -57,27 +57,30 @@
|
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@aztec/accounts": "0.
|
|
61
|
-
"@aztec/
|
|
62
|
-
"@aztec/
|
|
63
|
-
"@aztec/
|
|
64
|
-
"@aztec/
|
|
65
|
-
"@aztec/
|
|
66
|
-
"@aztec/
|
|
67
|
-
"@aztec/
|
|
68
|
-
"@aztec/
|
|
69
|
-
"@aztec/
|
|
70
|
-
"@aztec/
|
|
60
|
+
"@aztec/accounts": "0.87.0",
|
|
61
|
+
"@aztec/archiver": "0.87.0",
|
|
62
|
+
"@aztec/aztec-node": "0.87.0",
|
|
63
|
+
"@aztec/aztec.js": "0.87.0",
|
|
64
|
+
"@aztec/bb-prover": "0.87.0",
|
|
65
|
+
"@aztec/constants": "0.87.0",
|
|
66
|
+
"@aztec/foundation": "0.87.0",
|
|
67
|
+
"@aztec/key-store": "0.87.0",
|
|
68
|
+
"@aztec/kv-store": "0.87.0",
|
|
69
|
+
"@aztec/protocol-contracts": "0.87.0",
|
|
70
|
+
"@aztec/pxe": "0.87.0",
|
|
71
|
+
"@aztec/simulator": "0.87.0",
|
|
72
|
+
"@aztec/stdlib": "0.87.0",
|
|
73
|
+
"@aztec/world-state": "0.87.0",
|
|
71
74
|
"zod": "^3.23.8"
|
|
72
75
|
},
|
|
73
76
|
"devDependencies": {
|
|
74
77
|
"@jest/globals": "^29.5.0",
|
|
75
78
|
"@types/jest": "^29.5.0",
|
|
76
|
-
"@types/node": "^
|
|
79
|
+
"@types/node": "^22.15.17",
|
|
77
80
|
"jest": "^29.5.0",
|
|
78
81
|
"jest-mock-extended": "^3.0.3",
|
|
79
82
|
"ts-node": "^10.9.1",
|
|
80
|
-
"typescript": "^5.
|
|
83
|
+
"typescript": "^5.3.3"
|
|
81
84
|
},
|
|
82
85
|
"files": [
|
|
83
86
|
"dest",
|
|
@@ -86,6 +89,6 @@
|
|
|
86
89
|
],
|
|
87
90
|
"types": "./dest/index.d.ts",
|
|
88
91
|
"engines": {
|
|
89
|
-
"node": ">=
|
|
92
|
+
"node": ">=20.10"
|
|
90
93
|
}
|
|
91
94
|
}
|