@aztec/native 3.0.0-nightly.20251104 → 3.0.0-nightly.20251105
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/build/amd64-linux/nodejs_module.node +0 -0
- package/build/amd64-macos/nodejs_module.node +0 -0
- package/build/arm64-linux/nodejs_module.node +0 -0
- package/build/arm64-macos/nodejs_module.node +0 -0
- package/dest/native_module.d.ts +62 -0
- package/dest/native_module.d.ts.map +1 -1
- package/dest/native_module.js +8 -0
- package/package.json +2 -2
- package/src/native_module.ts +77 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dest/native_module.d.ts
CHANGED
|
@@ -4,6 +4,68 @@ interface NativeClassCtor {
|
|
|
4
4
|
}
|
|
5
5
|
export declare const NativeWorldState: NativeClassCtor;
|
|
6
6
|
export declare const NativeLMDBStore: NativeClassCtor;
|
|
7
|
+
/**
|
|
8
|
+
* Contract provider interface for callbacks to fetch contract data.
|
|
9
|
+
* These callbacks are invoked by C++ during simulation when contract data is needed.
|
|
10
|
+
*/
|
|
11
|
+
export interface ContractProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Fetch a contract instance by address.
|
|
14
|
+
* @param address - The contract address as a string (hex format)
|
|
15
|
+
* @returns Promise resolving to msgpack-serialized ContractInstanceHint buffer, or undefined if not found
|
|
16
|
+
*/
|
|
17
|
+
getContractInstance(address: string): Promise<Buffer | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Fetch a contract class by class ID.
|
|
20
|
+
* @param classId - The contract class ID as a string (hex format)
|
|
21
|
+
* @returns Promise resolving to msgpack-serialized ContractClassHint buffer, or undefined if not found
|
|
22
|
+
*/
|
|
23
|
+
getContractClass(classId: string): Promise<Buffer | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Add contracts from deployment data.
|
|
26
|
+
* @param contractDeploymentData - Msgpack-serialized ContractDeploymentData buffer
|
|
27
|
+
* @returns Promise that resolves when contracts are added
|
|
28
|
+
*/
|
|
29
|
+
addContracts(contractDeploymentData: Buffer): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch the bytecode commitment for a contract class.
|
|
32
|
+
* @param classId - The contract class ID as a string (hex format)
|
|
33
|
+
* @returns Promise resolving to msgpack-serialized Fr buffer, or undefined if not found
|
|
34
|
+
*/
|
|
35
|
+
getBytecodeCommitment(classId: string): Promise<Buffer | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch the debug function name for a contract function.
|
|
38
|
+
* @param address - The contract address as a string (hex format)
|
|
39
|
+
* @param selector - The function selector as a string (hex format)
|
|
40
|
+
* @returns Promise resolving to function name string, or undefined if not found
|
|
41
|
+
*/
|
|
42
|
+
getDebugFunctionName(address: string, selector: string): Promise<string | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a new checkpoint for the contract database state.
|
|
45
|
+
* Enables rollback to current state in case of a revert.
|
|
46
|
+
* @returns Promise that resolves when checkpoint is created
|
|
47
|
+
*/
|
|
48
|
+
createCheckpoint(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Commit the current checkpoint, accepting its state as latest.
|
|
51
|
+
* @returns Promise that resolves when checkpoint is committed
|
|
52
|
+
*/
|
|
53
|
+
commitCheckpoint(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Revert the current checkpoint, discarding its state and rolling back.
|
|
56
|
+
* @returns Promise that resolves when checkpoint is reverted
|
|
57
|
+
*/
|
|
58
|
+
revertCheckpoint(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* AVM simulation function that takes serialized inputs and a contract provider.
|
|
62
|
+
* The contract provider enables C++ to callback to TypeScript for contract data during simulation.
|
|
63
|
+
* @param inputs - Msgpack-serialized AvmFastSimulationInputs buffer
|
|
64
|
+
* @param contractProvider - Object with callbacks for fetching contract instances and classes
|
|
65
|
+
* @param worldStateHandle - Native handle to WorldState instance
|
|
66
|
+
* @returns Promise resolving to msgpack-serialized AvmCircuitPublicInputs buffer
|
|
67
|
+
*/
|
|
68
|
+
export declare const avmSimulate: (inputs: Buffer, contractProvider: ContractProvider, worldStateHandle: any) => Promise<Buffer>;
|
|
7
69
|
/**
|
|
8
70
|
* AVM simulation function that uses pre-collected hints from TypeScript simulation.
|
|
9
71
|
* All contract data and merkle tree hints are included in the AvmCircuitInputs, so no runtime
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native_module.d.ts","sourceRoot":"","sources":["../src/native_module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,eAAe;IACvB,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC;CAC3C;AA2BD,eAAO,MAAM,gBAAgB,EAAE,eAA4D,CAAC;AAC5F,eAAO,MAAM,eAAe,EAAE,eAA2D,CAAC;AAE1F;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAErD,CAAC"}
|
|
1
|
+
{"version":3,"file":"native_module.d.ts","sourceRoot":"","sources":["../src/native_module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,eAAe;IACvB,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC;CAC3C;AA2BD,eAAO,MAAM,gBAAgB,EAAE,eAA4D,CAAC;AAC5F,eAAO,MAAM,eAAe,EAAE,eAA2D,CAAC;AAE1F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClE;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE/D;;;;OAIG;IACH,YAAY,CAAC,sBAAsB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;;OAIG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAEpE;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAErF;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,CACxB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,GAAG,KAClB,OAAO,CAAC,MAAM,CAIC,CAAC;AACrB;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAErD,CAAC"}
|
package/dest/native_module.js
CHANGED
|
@@ -19,6 +19,14 @@ function loadNativeModule() {
|
|
|
19
19
|
const nativeModule = loadNativeModule();
|
|
20
20
|
export const NativeWorldState = nativeModule.WorldState;
|
|
21
21
|
export const NativeLMDBStore = nativeModule.LMDBStore;
|
|
22
|
+
/**
|
|
23
|
+
* AVM simulation function that takes serialized inputs and a contract provider.
|
|
24
|
+
* The contract provider enables C++ to callback to TypeScript for contract data during simulation.
|
|
25
|
+
* @param inputs - Msgpack-serialized AvmFastSimulationInputs buffer
|
|
26
|
+
* @param contractProvider - Object with callbacks for fetching contract instances and classes
|
|
27
|
+
* @param worldStateHandle - Native handle to WorldState instance
|
|
28
|
+
* @returns Promise resolving to msgpack-serialized AvmCircuitPublicInputs buffer
|
|
29
|
+
*/ export const avmSimulate = nativeModule.avmSimulate;
|
|
22
30
|
/**
|
|
23
31
|
* AVM simulation function that uses pre-collected hints from TypeScript simulation.
|
|
24
32
|
* All contract data and merkle tree hints are included in the AvmCircuitInputs, so no runtime
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/native",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"./package.local.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
22
|
+
"@aztec/foundation": "3.0.0-nightly.20251105",
|
|
23
23
|
"msgpackr": "^1.11.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
package/src/native_module.ts
CHANGED
|
@@ -36,6 +36,83 @@ const nativeModule: Record<string, NativeClassCtor | Function> = loadNativeModul
|
|
|
36
36
|
export const NativeWorldState: NativeClassCtor = nativeModule.WorldState as NativeClassCtor;
|
|
37
37
|
export const NativeLMDBStore: NativeClassCtor = nativeModule.LMDBStore as NativeClassCtor;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Contract provider interface for callbacks to fetch contract data.
|
|
41
|
+
* These callbacks are invoked by C++ during simulation when contract data is needed.
|
|
42
|
+
*/
|
|
43
|
+
export interface ContractProvider {
|
|
44
|
+
/**
|
|
45
|
+
* Fetch a contract instance by address.
|
|
46
|
+
* @param address - The contract address as a string (hex format)
|
|
47
|
+
* @returns Promise resolving to msgpack-serialized ContractInstanceHint buffer, or undefined if not found
|
|
48
|
+
*/
|
|
49
|
+
getContractInstance(address: string): Promise<Buffer | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetch a contract class by class ID.
|
|
52
|
+
* @param classId - The contract class ID as a string (hex format)
|
|
53
|
+
* @returns Promise resolving to msgpack-serialized ContractClassHint buffer, or undefined if not found
|
|
54
|
+
*/
|
|
55
|
+
getContractClass(classId: string): Promise<Buffer | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Add contracts from deployment data.
|
|
59
|
+
* @param contractDeploymentData - Msgpack-serialized ContractDeploymentData buffer
|
|
60
|
+
* @returns Promise that resolves when contracts are added
|
|
61
|
+
*/
|
|
62
|
+
addContracts(contractDeploymentData: Buffer): Promise<void>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Fetch the bytecode commitment for a contract class.
|
|
66
|
+
* @param classId - The contract class ID as a string (hex format)
|
|
67
|
+
* @returns Promise resolving to msgpack-serialized Fr buffer, or undefined if not found
|
|
68
|
+
*/
|
|
69
|
+
getBytecodeCommitment(classId: string): Promise<Buffer | undefined>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Fetch the debug function name for a contract function.
|
|
73
|
+
* @param address - The contract address as a string (hex format)
|
|
74
|
+
* @param selector - The function selector as a string (hex format)
|
|
75
|
+
* @returns Promise resolving to function name string, or undefined if not found
|
|
76
|
+
*/
|
|
77
|
+
getDebugFunctionName(address: string, selector: string): Promise<string | undefined>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Create a new checkpoint for the contract database state.
|
|
81
|
+
* Enables rollback to current state in case of a revert.
|
|
82
|
+
* @returns Promise that resolves when checkpoint is created
|
|
83
|
+
*/
|
|
84
|
+
createCheckpoint(): Promise<void>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Commit the current checkpoint, accepting its state as latest.
|
|
88
|
+
* @returns Promise that resolves when checkpoint is committed
|
|
89
|
+
*/
|
|
90
|
+
commitCheckpoint(): Promise<void>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Revert the current checkpoint, discarding its state and rolling back.
|
|
94
|
+
* @returns Promise that resolves when checkpoint is reverted
|
|
95
|
+
*/
|
|
96
|
+
revertCheckpoint(): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* AVM simulation function that takes serialized inputs and a contract provider.
|
|
101
|
+
* The contract provider enables C++ to callback to TypeScript for contract data during simulation.
|
|
102
|
+
* @param inputs - Msgpack-serialized AvmFastSimulationInputs buffer
|
|
103
|
+
* @param contractProvider - Object with callbacks for fetching contract instances and classes
|
|
104
|
+
* @param worldStateHandle - Native handle to WorldState instance
|
|
105
|
+
* @returns Promise resolving to msgpack-serialized AvmCircuitPublicInputs buffer
|
|
106
|
+
*/
|
|
107
|
+
export const avmSimulate: (
|
|
108
|
+
inputs: Buffer,
|
|
109
|
+
contractProvider: ContractProvider,
|
|
110
|
+
worldStateHandle: any,
|
|
111
|
+
) => Promise<Buffer> = nativeModule.avmSimulate as (
|
|
112
|
+
inputs: Buffer,
|
|
113
|
+
contractProvider: ContractProvider,
|
|
114
|
+
worldStateHandle: any,
|
|
115
|
+
) => Promise<Buffer>;
|
|
39
116
|
/**
|
|
40
117
|
* AVM simulation function that uses pre-collected hints from TypeScript simulation.
|
|
41
118
|
* All contract data and merkle tree hints are included in the AvmCircuitInputs, so no runtime
|