@aztec/simulator 0.31.0 → 0.32.1
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/acvm/acvm.d.ts +5 -5
- package/dest/acvm/acvm.d.ts.map +1 -1
- package/dest/acvm/acvm_types.d.ts +1 -1
- package/dest/acvm/acvm_types.d.ts.map +1 -1
- package/dest/acvm/deserialize.d.ts +1 -1
- package/dest/acvm/deserialize.d.ts.map +1 -1
- package/dest/acvm/oracle/debug.d.ts +2 -2
- package/dest/acvm/oracle/debug.d.ts.map +1 -1
- package/dest/acvm/oracle/index.d.ts +1 -1
- package/dest/acvm/oracle/index.d.ts.map +1 -1
- package/dest/acvm/oracle/oracle.d.ts +2 -2
- package/dest/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/typed_oracle.d.ts +6 -6
- package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/acvm/serialize.d.ts +4 -4
- package/dest/acvm/serialize.d.ts.map +1 -1
- package/dest/acvm/serialize.js +1 -1
- package/dest/avm/avm_context.d.ts +4 -4
- package/dest/avm/avm_context.d.ts.map +1 -1
- package/dest/avm/avm_context.js +1 -1
- package/dest/avm/avm_execution_environment.d.ts +4 -4
- package/dest/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/avm/avm_execution_environment.js +3 -3
- package/dest/avm/avm_gas_cost.d.ts +307 -3
- package/dest/avm/avm_gas_cost.d.ts.map +1 -1
- package/dest/avm/avm_gas_cost.js +42 -8
- package/dest/avm/avm_machine_state.d.ts +2 -2
- package/dest/avm/avm_machine_state.d.ts.map +1 -1
- package/dest/avm/avm_machine_state.js +1 -1
- package/dest/avm/avm_memory_types.d.ts +1 -1
- package/dest/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/avm/avm_memory_types.js +1 -1
- package/dest/avm/avm_message_call_result.d.ts +1 -1
- package/dest/avm/avm_message_call_result.d.ts.map +1 -1
- package/dest/avm/avm_simulator.js +1 -1
- package/dest/avm/errors.d.ts +1 -1
- package/dest/avm/errors.d.ts.map +1 -1
- package/dest/avm/fixtures/index.d.ts +1 -1
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +5 -5
- package/dest/avm/journal/host_storage.d.ts +1 -1
- package/dest/avm/journal/host_storage.d.ts.map +1 -1
- package/dest/avm/journal/journal.d.ts +2 -2
- package/dest/avm/journal/journal.d.ts.map +1 -1
- package/dest/avm/journal/trace.d.ts +1 -1
- package/dest/avm/journal/trace.d.ts.map +1 -1
- package/dest/avm/journal/trace_types.d.ts +1 -1
- package/dest/avm/journal/trace_types.d.ts.map +1 -1
- package/dest/avm/opcodes/addressing_mode.d.ts +2 -2
- package/dest/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/avm/opcodes/addressing_mode.js +1 -1
- package/dest/avm/opcodes/arithmetic.d.ts +15 -12
- package/dest/avm/opcodes/arithmetic.d.ts.map +1 -1
- package/dest/avm/opcodes/arithmetic.js +25 -36
- package/dest/avm/opcodes/environment_getters.d.ts +1 -1
- package/dest/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/avm/opcodes/hashing.d.ts +1 -1
- package/dest/avm/opcodes/hashing.d.ts.map +1 -1
- package/dest/avm/opcodes/hashing.js +2 -2
- package/dest/avm/opcodes/instruction.d.ts +4 -4
- package/dest/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/avm/opcodes/instruction.js +7 -3
- package/dest/avm/opcodes/memory.d.ts +3 -0
- package/dest/avm/opcodes/memory.d.ts.map +1 -1
- package/dest/avm/opcodes/memory.js +8 -1
- package/dest/avm/temporary_executor_migration.d.ts +4 -4
- package/dest/avm/temporary_executor_migration.d.ts.map +1 -1
- package/dest/avm/temporary_executor_migration.js +3 -3
- package/dest/client/client_execution_context.d.ts +13 -13
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +5 -5
- package/dest/client/db_oracle.d.ts +9 -9
- package/dest/client/db_oracle.d.ts.map +1 -1
- package/dest/client/db_oracle.js +1 -1
- package/dest/client/execution_note_cache.d.ts +2 -2
- package/dest/client/execution_note_cache.d.ts.map +1 -1
- package/dest/client/execution_result.d.ts +9 -9
- package/dest/client/execution_result.d.ts.map +1 -1
- package/dest/client/execution_result.js +1 -1
- package/dest/client/pick_notes.d.ts +1 -1
- package/dest/client/pick_notes.d.ts.map +1 -1
- package/dest/client/pick_notes.js +1 -1
- package/dest/client/private_execution.d.ts +5 -5
- package/dest/client/private_execution.d.ts.map +1 -1
- package/dest/client/private_execution.js +1 -1
- package/dest/client/simulator.d.ts +6 -6
- package/dest/client/simulator.d.ts.map +1 -1
- package/dest/client/simulator.js +1 -1
- package/dest/client/unconstrained_execution.d.ts +5 -5
- package/dest/client/unconstrained_execution.d.ts.map +1 -1
- package/dest/client/unconstrained_execution.js +1 -1
- package/dest/client/view_data_oracle.d.ts +6 -6
- package/dest/client/view_data_oracle.d.ts.map +1 -1
- package/dest/client/view_data_oracle.js +1 -1
- package/dest/common/errors.d.ts +1 -1
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/errors.js +1 -1
- package/dest/public/db.d.ts +6 -6
- package/dest/public/db.d.ts.map +1 -1
- package/dest/public/execution.d.ts +4 -4
- package/dest/public/execution.d.ts.map +1 -1
- package/dest/public/execution.js +1 -1
- package/dest/public/executor.d.ts +3 -3
- package/dest/public/executor.d.ts.map +1 -1
- package/dest/public/executor.js +3 -3
- package/dest/public/public_execution_context.d.ts +8 -8
- package/dest/public/public_execution_context.d.ts.map +1 -1
- package/dest/public/public_execution_context.js +4 -4
- package/dest/public/state_actions.d.ts +2 -2
- package/dest/public/state_actions.d.ts.map +1 -1
- package/dest/simulator/acvm_native.d.ts +3 -3
- package/dest/simulator/acvm_native.d.ts.map +1 -1
- package/dest/simulator/acvm_wasm.d.ts +3 -3
- package/dest/simulator/acvm_wasm.d.ts.map +1 -1
- package/dest/simulator/acvm_wasm.js +2 -2
- package/dest/simulator/simulation_provider.d.ts +2 -2
- package/dest/simulator/simulation_provider.d.ts.map +1 -1
- package/dest/test/utils.d.ts +1 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +2 -3
- package/dest/utils.d.ts +1 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +2 -2
- package/package.json +5 -5
- package/src/acvm/acvm.ts +8 -8
- package/src/acvm/acvm_types.ts +1 -1
- package/src/acvm/deserialize.ts +1 -1
- package/src/acvm/oracle/debug.ts +2 -2
- package/src/acvm/oracle/index.ts +1 -1
- package/src/acvm/oracle/oracle.ts +2 -2
- package/src/acvm/oracle/typed_oracle.ts +18 -18
- package/src/acvm/serialize.ts +4 -4
- package/src/avm/avm_context.ts +4 -4
- package/src/avm/avm_execution_environment.ts +6 -9
- package/src/avm/avm_gas_cost.ts +46 -8
- package/src/avm/avm_machine_state.ts +2 -2
- package/src/avm/avm_memory_types.ts +1 -1
- package/src/avm/avm_message_call_result.ts +1 -1
- package/src/avm/avm_simulator.ts +1 -1
- package/src/avm/errors.ts +1 -1
- package/src/avm/fixtures/index.ts +9 -4
- package/src/avm/journal/host_storage.ts +1 -1
- package/src/avm/journal/journal.ts +2 -2
- package/src/avm/journal/trace.ts +1 -1
- package/src/avm/journal/trace_types.ts +1 -1
- package/src/avm/opcodes/addressing_mode.ts +2 -2
- package/src/avm/opcodes/arithmetic.ts +34 -47
- package/src/avm/opcodes/bitwise.ts +1 -1
- package/src/avm/opcodes/control_flow.ts +1 -1
- package/src/avm/opcodes/environment_getters.ts +1 -1
- package/src/avm/opcodes/hashing.ts +2 -2
- package/src/avm/opcodes/instruction.ts +9 -5
- package/src/avm/opcodes/memory.ts +9 -0
- package/src/avm/temporary_executor_migration.ts +8 -8
- package/src/client/client_execution_context.ts +22 -20
- package/src/client/db_oracle.ts +16 -10
- package/src/client/execution_note_cache.ts +2 -2
- package/src/client/execution_result.ts +13 -9
- package/src/client/pick_notes.ts +1 -1
- package/src/client/private_execution.ts +5 -5
- package/src/client/simulator.ts +8 -8
- package/src/client/unconstrained_execution.ts +5 -5
- package/src/client/view_data_oracle.ts +11 -11
- package/src/common/errors.ts +1 -1
- package/src/public/db.ts +6 -6
- package/src/public/execution.ts +12 -12
- package/src/public/executor.ts +5 -5
- package/src/public/public_execution_context.ts +18 -8
- package/src/public/state_actions.ts +2 -2
- package/src/simulator/acvm_native.ts +3 -3
- package/src/simulator/acvm_wasm.ts +8 -4
- package/src/simulator/simulation_provider.ts +2 -2
- package/src/test/utils.ts +2 -3
- package/src/utils.ts +2 -2
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type EncryptedFunctionL2Logs, type Note, type UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
|
+
import {
|
|
3
|
+
type NoteHashReadRequestMembershipWitness,
|
|
4
|
+
type PrivateCallStackItem,
|
|
5
|
+
type PublicCallRequest,
|
|
6
|
+
} from '@aztec/circuits.js';
|
|
7
|
+
import { type DecodedReturn } from '@aztec/foundation/abi';
|
|
8
|
+
import { type Fr } from '@aztec/foundation/fields';
|
|
5
9
|
|
|
6
|
-
import { ACVMField } from '../acvm/index.js';
|
|
10
|
+
import { type ACVMField } from '../acvm/index.js';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* The contents of a new note.
|
|
@@ -46,12 +50,12 @@ export interface ExecutionResult {
|
|
|
46
50
|
* Encrypted logs emitted during execution of this function call.
|
|
47
51
|
* Note: These are preimages to `encryptedLogsHash`.
|
|
48
52
|
*/
|
|
49
|
-
encryptedLogs:
|
|
53
|
+
encryptedLogs: EncryptedFunctionL2Logs;
|
|
50
54
|
/**
|
|
51
55
|
* Unencrypted logs emitted during execution of this function call.
|
|
52
56
|
* Note: These are preimages to `unencryptedLogsHash`.
|
|
53
57
|
*/
|
|
54
|
-
unencryptedLogs:
|
|
58
|
+
unencryptedLogs: UnencryptedFunctionL2Logs;
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
/**
|
|
@@ -59,7 +63,7 @@ export interface ExecutionResult {
|
|
|
59
63
|
* @param execResult - The topmost execution result.
|
|
60
64
|
* @returns All encrypted logs.
|
|
61
65
|
*/
|
|
62
|
-
export function collectEncryptedLogs(execResult: ExecutionResult):
|
|
66
|
+
export function collectEncryptedLogs(execResult: ExecutionResult): EncryptedFunctionL2Logs[] {
|
|
63
67
|
// without the .reverse(), the logs will be in a queue like fashion which is wrong as the kernel processes it like a stack.
|
|
64
68
|
return [execResult.encryptedLogs, ...[...execResult.nestedExecutions].reverse().flatMap(collectEncryptedLogs)];
|
|
65
69
|
}
|
|
@@ -69,7 +73,7 @@ export function collectEncryptedLogs(execResult: ExecutionResult): FunctionL2Log
|
|
|
69
73
|
* @param execResult - The topmost execution result.
|
|
70
74
|
* @returns All unencrypted logs.
|
|
71
75
|
*/
|
|
72
|
-
export function collectUnencryptedLogs(execResult: ExecutionResult):
|
|
76
|
+
export function collectUnencryptedLogs(execResult: ExecutionResult): UnencryptedFunctionL2Logs[] {
|
|
73
77
|
// without the .reverse(), the logs will be in a queue like fashion which is wrong as the kernel processes it like a stack.
|
|
74
78
|
return [execResult.unencryptedLogs, ...[...execResult.nestedExecutions].reverse().flatMap(collectUnencryptedLogs)];
|
|
75
79
|
}
|
package/src/client/pick_notes.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { FunctionData, PrivateCallStackItem, PrivateCircuitPublicInputs } from '@aztec/circuits.js';
|
|
2
|
-
import { FunctionArtifactWithDebugMetadata, decodeReturnValues } from '@aztec/foundation/abi';
|
|
3
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
1
|
+
import { type FunctionData, PrivateCallStackItem, PrivateCircuitPublicInputs } from '@aztec/circuits.js';
|
|
2
|
+
import { type FunctionArtifactWithDebugMetadata, decodeReturnValues } from '@aztec/foundation/abi';
|
|
3
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
6
6
|
|
|
7
7
|
import { extractReturnWitness } from '../acvm/deserialize.js';
|
|
8
8
|
import { Oracle, acvm, extractCallStack } from '../acvm/index.js';
|
|
9
9
|
import { ExecutionError } from '../common/errors.js';
|
|
10
|
-
import { ClientExecutionContext } from './client_execution_context.js';
|
|
11
|
-
import { ExecutionResult } from './execution_result.js';
|
|
10
|
+
import { type ClientExecutionContext } from './client_execution_context.js';
|
|
11
|
+
import { type ExecutionResult } from './execution_result.js';
|
|
12
12
|
import { AcirSimulator } from './simulator.js';
|
|
13
13
|
|
|
14
14
|
/**
|
package/src/client/simulator.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { AztecNode, FunctionCall, Note, TxExecutionRequest } from '@aztec/circuit-types';
|
|
1
|
+
import { type AztecNode, type FunctionCall, type Note, type TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
2
|
import { CallContext, FunctionData } from '@aztec/circuits.js';
|
|
3
3
|
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
|
|
4
4
|
import {
|
|
5
|
-
ArrayType,
|
|
6
|
-
FunctionArtifactWithDebugMetadata,
|
|
5
|
+
type ArrayType,
|
|
6
|
+
type FunctionArtifactWithDebugMetadata,
|
|
7
7
|
FunctionSelector,
|
|
8
8
|
FunctionType,
|
|
9
9
|
encodeArguments,
|
|
10
10
|
} from '@aztec/foundation/abi';
|
|
11
11
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
12
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
|
+
import { type EthAddress } from '@aztec/foundation/eth-address';
|
|
13
13
|
import { Fr } from '@aztec/foundation/fields';
|
|
14
|
-
import { DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
14
|
+
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
15
15
|
|
|
16
|
-
import { WasmBlackBoxFunctionSolver, createBlackBoxSolver } from '@noir-lang/acvm_js';
|
|
16
|
+
import { type WasmBlackBoxFunctionSolver, createBlackBoxSolver } from '@noir-lang/acvm_js';
|
|
17
17
|
|
|
18
18
|
import { createSimulationError } from '../common/errors.js';
|
|
19
19
|
import { PackedArgsCache } from '../common/packed_args_cache.js';
|
|
20
20
|
import { ClientExecutionContext } from './client_execution_context.js';
|
|
21
|
-
import { DBOracle } from './db_oracle.js';
|
|
21
|
+
import { type DBOracle } from './db_oracle.js';
|
|
22
22
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
23
|
-
import { ExecutionResult } from './execution_result.js';
|
|
23
|
+
import { type ExecutionResult } from './execution_result.js';
|
|
24
24
|
import { executePrivateFunction } from './private_execution.js';
|
|
25
25
|
import { executeUnconstrainedFunction } from './unconstrained_execution.js';
|
|
26
26
|
import { ViewDataOracle } from './view_data_oracle.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { FunctionData } from '@aztec/circuits.js';
|
|
2
|
-
import { DecodedReturn, FunctionArtifactWithDebugMetadata, decodeReturnValues } from '@aztec/foundation/abi';
|
|
3
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
1
|
+
import { type FunctionData } from '@aztec/circuits.js';
|
|
2
|
+
import { type DecodedReturn, type FunctionArtifactWithDebugMetadata, decodeReturnValues } from '@aztec/foundation/abi';
|
|
3
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
|
+
import { type Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
6
6
|
|
|
7
7
|
import { extractReturnWitness } from '../acvm/deserialize.js';
|
|
8
8
|
import { Oracle, acvm, extractCallStack, toACVMWitness } from '../acvm/index.js';
|
|
9
9
|
import { ExecutionError } from '../common/errors.js';
|
|
10
10
|
import { AcirSimulator } from './simulator.js';
|
|
11
|
-
import { ViewDataOracle } from './view_data_oracle.js';
|
|
11
|
+
import { type ViewDataOracle } from './view_data_oracle.js';
|
|
12
12
|
|
|
13
13
|
// docs:start:execute_unconstrained_function
|
|
14
14
|
/**
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AuthWitness,
|
|
3
|
-
AztecNode,
|
|
4
|
-
CompleteAddress,
|
|
2
|
+
type AuthWitness,
|
|
3
|
+
type AztecNode,
|
|
4
|
+
type CompleteAddress,
|
|
5
5
|
MerkleTreeId,
|
|
6
|
-
NoteStatus,
|
|
7
|
-
NullifierMembershipWitness,
|
|
8
|
-
PublicDataWitness,
|
|
6
|
+
type NoteStatus,
|
|
7
|
+
type NullifierMembershipWitness,
|
|
8
|
+
type PublicDataWitness,
|
|
9
9
|
} from '@aztec/circuit-types';
|
|
10
|
-
import { Header } from '@aztec/circuits.js';
|
|
10
|
+
import { type Header } from '@aztec/circuits.js';
|
|
11
11
|
import { siloNullifier } from '@aztec/circuits.js/hash';
|
|
12
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
12
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
13
13
|
import { Fr } from '@aztec/foundation/fields';
|
|
14
14
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
15
|
-
import { ContractInstance } from '@aztec/types/contracts';
|
|
15
|
+
import { type ContractInstance } from '@aztec/types/contracts';
|
|
16
16
|
|
|
17
|
-
import { NoteData, TypedOracle } from '../acvm/index.js';
|
|
18
|
-
import { DBOracle } from './db_oracle.js';
|
|
17
|
+
import { type NoteData, TypedOracle } from '../acvm/index.js';
|
|
18
|
+
import { type DBOracle } from './db_oracle.js';
|
|
19
19
|
import { pickNotes } from './pick_notes.js';
|
|
20
20
|
|
|
21
21
|
/**
|
package/src/common/errors.ts
CHANGED
package/src/public/db.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { NullifierMembershipWitness } from '@aztec/circuit-types';
|
|
2
|
-
import { EthAddress, FunctionSelector, L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/circuits.js';
|
|
3
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import { ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
1
|
+
import { type NullifierMembershipWitness } from '@aztec/circuit-types';
|
|
2
|
+
import { type EthAddress, type FunctionSelector, type L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/circuits.js';
|
|
3
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
|
+
import { type Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { type ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
6
6
|
|
|
7
|
-
import { MessageLoadOracleInputs } from '../acvm/index.js';
|
|
7
|
+
import { type MessageLoadOracleInputs } from '../acvm/index.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Database interface for providing access to public state.
|
package/src/public/execution.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type SimulationError, type UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
|
-
AztecAddress,
|
|
4
|
-
ContractStorageRead,
|
|
5
|
-
ContractStorageUpdateRequest,
|
|
6
|
-
Fr,
|
|
7
|
-
L2ToL1Message,
|
|
8
|
-
PublicCallRequest,
|
|
3
|
+
type AztecAddress,
|
|
4
|
+
type ContractStorageRead,
|
|
5
|
+
type ContractStorageUpdateRequest,
|
|
6
|
+
type Fr,
|
|
7
|
+
type L2ToL1Message,
|
|
8
|
+
type PublicCallRequest,
|
|
9
9
|
PublicDataRead,
|
|
10
10
|
PublicDataUpdateRequest,
|
|
11
|
-
ReadRequest,
|
|
12
|
-
SideEffect,
|
|
13
|
-
SideEffectLinkedToNoteHash,
|
|
11
|
+
type ReadRequest,
|
|
12
|
+
type SideEffect,
|
|
13
|
+
type SideEffectLinkedToNoteHash,
|
|
14
14
|
} from '@aztec/circuits.js';
|
|
15
15
|
import { computePublicDataTreeLeafSlot, computePublicDataTreeValue } from '@aztec/circuits.js/hash';
|
|
16
16
|
|
|
@@ -46,7 +46,7 @@ export interface PublicExecutionResult {
|
|
|
46
46
|
* Unencrypted logs emitted during execution of this function call.
|
|
47
47
|
* Note: These are preimages to `unencryptedLogsHash`.
|
|
48
48
|
*/
|
|
49
|
-
unencryptedLogs:
|
|
49
|
+
unencryptedLogs: UnencryptedFunctionL2Logs;
|
|
50
50
|
/**
|
|
51
51
|
* Whether the execution reverted.
|
|
52
52
|
*/
|
|
@@ -154,7 +154,7 @@ export function checkValidStaticCall(
|
|
|
154
154
|
newNullifiers: SideEffectLinkedToNoteHash[],
|
|
155
155
|
contractStorageUpdateRequests: ContractStorageUpdateRequest[],
|
|
156
156
|
newL2ToL1Messages: L2ToL1Message[],
|
|
157
|
-
unencryptedLogs:
|
|
157
|
+
unencryptedLogs: UnencryptedFunctionL2Logs,
|
|
158
158
|
) {
|
|
159
159
|
if (
|
|
160
160
|
contractStorageUpdateRequests.length > 0 ||
|
package/src/public/executor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr, GlobalVariables, Header, PublicCircuitPublicInputs } from '@aztec/circuits.js';
|
|
1
|
+
import { UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
|
+
import { Fr, type GlobalVariables, type Header, PublicCircuitPublicInputs } from '@aztec/circuits.js';
|
|
3
3
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
5
|
import { spawn } from 'child_process';
|
|
@@ -20,8 +20,8 @@ import { AcirSimulator } from '../client/simulator.js';
|
|
|
20
20
|
import { ExecutionError, createSimulationError } from '../common/errors.js';
|
|
21
21
|
import { SideEffectCounter } from '../common/index.js';
|
|
22
22
|
import { PackedArgsCache } from '../common/packed_args_cache.js';
|
|
23
|
-
import { CommitmentsDB, PublicContractsDB, PublicStateDB } from './db.js';
|
|
24
|
-
import { PublicExecution, PublicExecutionResult, checkValidStaticCall } from './execution.js';
|
|
23
|
+
import { type CommitmentsDB, type PublicContractsDB, type PublicStateDB } from './db.js';
|
|
24
|
+
import { type PublicExecution, type PublicExecutionResult, checkValidStaticCall } from './execution.js';
|
|
25
25
|
import { PublicExecutionContext } from './public_execution_context.js';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -92,7 +92,7 @@ export async function executePublicFunction(
|
|
|
92
92
|
contractStorageReads: [],
|
|
93
93
|
contractStorageUpdateRequests: [],
|
|
94
94
|
nestedExecutions: [],
|
|
95
|
-
unencryptedLogs:
|
|
95
|
+
unencryptedLogs: UnencryptedFunctionL2Logs.empty(),
|
|
96
96
|
reverted,
|
|
97
97
|
revertReason,
|
|
98
98
|
};
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
type NullifierMembershipWitness,
|
|
3
|
+
UnencryptedFunctionL2Logs,
|
|
4
|
+
type UnencryptedL2Log,
|
|
5
|
+
} from '@aztec/circuit-types';
|
|
6
|
+
import {
|
|
7
|
+
CallContext,
|
|
8
|
+
FunctionData,
|
|
9
|
+
type FunctionSelector,
|
|
10
|
+
type GlobalVariables,
|
|
11
|
+
type Header,
|
|
12
|
+
} from '@aztec/circuits.js';
|
|
13
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
14
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
15
|
import { Fr } from '@aztec/foundation/fields';
|
|
6
16
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
7
|
-
import { ContractInstance } from '@aztec/types/contracts';
|
|
17
|
+
import { type ContractInstance } from '@aztec/types/contracts';
|
|
8
18
|
|
|
9
19
|
import { TypedOracle, toACVMWitness } from '../acvm/index.js';
|
|
10
|
-
import { PackedArgsCache, SideEffectCounter } from '../common/index.js';
|
|
11
|
-
import { CommitmentsDB, PublicContractsDB, PublicStateDB } from './db.js';
|
|
12
|
-
import { PublicExecution, PublicExecutionResult, checkValidStaticCall } from './execution.js';
|
|
20
|
+
import { type PackedArgsCache, type SideEffectCounter } from '../common/index.js';
|
|
21
|
+
import { type CommitmentsDB, type PublicContractsDB, type PublicStateDB } from './db.js';
|
|
22
|
+
import { type PublicExecution, type PublicExecutionResult, checkValidStaticCall } from './execution.js';
|
|
13
23
|
import { executePublicFunction } from './executor.js';
|
|
14
24
|
import { ContractStorageActionsCollector } from './state_actions.js';
|
|
15
25
|
|
|
@@ -72,7 +82,7 @@ export class PublicExecutionContext extends TypedOracle {
|
|
|
72
82
|
* Return the encrypted logs emitted during this execution.
|
|
73
83
|
*/
|
|
74
84
|
public getUnencryptedLogs() {
|
|
75
|
-
return new
|
|
85
|
+
return new UnencryptedFunctionL2Logs(this.unencryptedLogs);
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ContractStorageRead, ContractStorageUpdateRequest } from '@aztec/circuits.js';
|
|
2
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
2
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
|
|
5
|
-
import { PublicStateDB } from './db.js';
|
|
5
|
+
import { type PublicStateDB } from './db.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Implements read/write operations on a contract public storage, collecting
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
|
-
import { NoirCompiledCircuit } from '@aztec/types/noir';
|
|
2
|
+
import { type NoirCompiledCircuit } from '@aztec/types/noir';
|
|
3
3
|
|
|
4
|
-
import { WitnessMap } from '@noir-lang/types';
|
|
4
|
+
import { type WitnessMap } from '@noir-lang/types';
|
|
5
5
|
import * as proc from 'child_process';
|
|
6
6
|
import fs from 'fs/promises';
|
|
7
7
|
|
|
8
|
-
import { SimulationProvider } from './simulation_provider.js';
|
|
8
|
+
import { type SimulationProvider } from './simulation_provider.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Parses a TOML format witness map string into a Map structure
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { NoirCompiledCircuit } from '@aztec/types/noir';
|
|
1
|
+
import { type NoirCompiledCircuit } from '@aztec/types/noir';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
type WasmBlackBoxFunctionSolver,
|
|
5
|
+
createBlackBoxSolver,
|
|
6
|
+
executeCircuitWithBlackBoxSolver,
|
|
7
|
+
} from '@noir-lang/acvm_js';
|
|
8
|
+
import { type WitnessMap } from '@noir-lang/types';
|
|
5
9
|
|
|
6
|
-
import { SimulationProvider } from './simulation_provider.js';
|
|
10
|
+
import { type SimulationProvider } from './simulation_provider.js';
|
|
7
11
|
|
|
8
12
|
let solver: Promise<WasmBlackBoxFunctionSolver>;
|
|
9
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NoirCompiledCircuit } from '@aztec/types/noir';
|
|
1
|
+
import { type NoirCompiledCircuit } from '@aztec/types/noir';
|
|
2
2
|
|
|
3
|
-
import { WitnessMap } from '@noir-lang/types';
|
|
3
|
+
import { type WitnessMap } from '@noir-lang/types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Low level simulation interface
|
package/src/test/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L1Actor, L1ToL2Message, L2Actor } from '@aztec/circuit-types';
|
|
2
|
-
import { AztecAddress, EthAddress, Fr } from '@aztec/circuits.js';
|
|
2
|
+
import { type AztecAddress, EthAddress, type Fr } from '@aztec/circuits.js';
|
|
3
3
|
import { computeMessageSecretHash } from '@aztec/circuits.js/hash';
|
|
4
4
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
5
5
|
|
|
@@ -20,8 +20,7 @@ export const buildL1ToL2Message = (
|
|
|
20
20
|
// Write the selector into a buffer.
|
|
21
21
|
const selectorBuf = Buffer.from(selector, 'hex');
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
const content = sha256ToField(contentBuf);
|
|
23
|
+
const content = sha256ToField([selectorBuf, ...contentPreimage]);
|
|
25
24
|
const secretHash = computeMessageSecretHash(secret);
|
|
26
25
|
|
|
27
26
|
// Eventually the kernel will need to prove the kernel portal pair exists within the contract tree,
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { type Fr } from '@aztec/foundation/fields';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Computes the resulting storage slot for an entry in a mapping.
|
|
@@ -14,5 +14,5 @@ export function computeSlotForMapping(
|
|
|
14
14
|
toField: () => Fr;
|
|
15
15
|
},
|
|
16
16
|
) {
|
|
17
|
-
return pedersenHash([mappingSlot, key.toField()]
|
|
17
|
+
return pedersenHash([mappingSlot, key.toField()]);
|
|
18
18
|
}
|