@aztec/simulator 0.31.0 → 0.32.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/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/fixtures/index.js +4 -4
- package/dest/avm/opcodes/addressing_mode.d.ts +1 -1
- 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/hashing.js +2 -2
- package/dest/avm/opcodes/instruction.d.ts +1 -1
- 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.js +3 -3
- package/dest/client/client_execution_context.d.ts +3 -3
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +5 -5
- package/dest/client/execution_result.d.ts +5 -5
- package/dest/client/execution_result.d.ts.map +1 -1
- package/dest/public/execution.d.ts +3 -3
- package/dest/public/execution.d.ts.map +1 -1
- package/dest/public/execution.js +1 -1
- package/dest/public/executor.js +3 -3
- package/dest/public/public_execution_context.d.ts +2 -2
- package/dest/public/public_execution_context.d.ts.map +1 -1
- package/dest/public/public_execution_context.js +3 -3
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +2 -3
- package/dest/utils.js +2 -2
- package/package.json +5 -5
- package/src/avm/avm_execution_environment.ts +2 -5
- package/src/avm/avm_gas_cost.ts +46 -8
- package/src/avm/fixtures/index.ts +3 -3
- package/src/avm/opcodes/addressing_mode.ts +1 -1
- package/src/avm/opcodes/arithmetic.ts +34 -47
- package/src/avm/opcodes/hashing.ts +1 -1
- package/src/avm/opcodes/instruction.ts +7 -3
- package/src/avm/opcodes/memory.ts +9 -0
- package/src/avm/temporary_executor_migration.ts +2 -2
- package/src/client/client_execution_context.ts +7 -5
- package/src/client/execution_result.ts +5 -5
- package/src/public/execution.ts +3 -3
- package/src/public/executor.ts +2 -2
- package/src/public/public_execution_context.ts +2 -2
- package/src/test/utils.ts +1 -2
- package/src/utils.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EncryptedFunctionL2Logs, Note, UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
2
|
import { NoteHashReadRequestMembershipWitness, PrivateCallStackItem, PublicCallRequest } from '@aztec/circuits.js';
|
|
3
3
|
import { DecodedReturn } from '@aztec/foundation/abi';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -46,12 +46,12 @@ export interface ExecutionResult {
|
|
|
46
46
|
* Encrypted logs emitted during execution of this function call.
|
|
47
47
|
* Note: These are preimages to `encryptedLogsHash`.
|
|
48
48
|
*/
|
|
49
|
-
encryptedLogs:
|
|
49
|
+
encryptedLogs: EncryptedFunctionL2Logs;
|
|
50
50
|
/**
|
|
51
51
|
* Unencrypted logs emitted during execution of this function call.
|
|
52
52
|
* Note: These are preimages to `unencryptedLogsHash`.
|
|
53
53
|
*/
|
|
54
|
-
unencryptedLogs:
|
|
54
|
+
unencryptedLogs: UnencryptedFunctionL2Logs;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -59,7 +59,7 @@ export interface ExecutionResult {
|
|
|
59
59
|
* @param execResult - The topmost execution result.
|
|
60
60
|
* @returns All encrypted logs.
|
|
61
61
|
*/
|
|
62
|
-
export function collectEncryptedLogs(execResult: ExecutionResult):
|
|
62
|
+
export function collectEncryptedLogs(execResult: ExecutionResult): EncryptedFunctionL2Logs[] {
|
|
63
63
|
// without the .reverse(), the logs will be in a queue like fashion which is wrong as the kernel processes it like a stack.
|
|
64
64
|
return [execResult.encryptedLogs, ...[...execResult.nestedExecutions].reverse().flatMap(collectEncryptedLogs)];
|
|
65
65
|
}
|
|
@@ -69,7 +69,7 @@ export function collectEncryptedLogs(execResult: ExecutionResult): FunctionL2Log
|
|
|
69
69
|
* @param execResult - The topmost execution result.
|
|
70
70
|
* @returns All unencrypted logs.
|
|
71
71
|
*/
|
|
72
|
-
export function collectUnencryptedLogs(execResult: ExecutionResult):
|
|
72
|
+
export function collectUnencryptedLogs(execResult: ExecutionResult): UnencryptedFunctionL2Logs[] {
|
|
73
73
|
// without the .reverse(), the logs will be in a queue like fashion which is wrong as the kernel processes it like a stack.
|
|
74
74
|
return [execResult.unencryptedLogs, ...[...execResult.nestedExecutions].reverse().flatMap(collectUnencryptedLogs)];
|
|
75
75
|
}
|
package/src/public/execution.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SimulationError, UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
AztecAddress,
|
|
4
4
|
ContractStorageRead,
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UnencryptedFunctionL2Logs } from '@aztec/circuit-types';
|
|
2
2
|
import { Fr, GlobalVariables, Header, PublicCircuitPublicInputs } from '@aztec/circuits.js';
|
|
3
3
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
4
|
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NullifierMembershipWitness, UnencryptedFunctionL2Logs, UnencryptedL2Log } from '@aztec/circuit-types';
|
|
2
2
|
import { CallContext, FunctionData, FunctionSelector, GlobalVariables, Header } from '@aztec/circuits.js';
|
|
3
3
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -72,7 +72,7 @@ export class PublicExecutionContext extends TypedOracle {
|
|
|
72
72
|
* Return the encrypted logs emitted during this execution.
|
|
73
73
|
*/
|
|
74
74
|
public getUnencryptedLogs() {
|
|
75
|
-
return new
|
|
75
|
+
return new UnencryptedFunctionL2Logs(this.unencryptedLogs);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
package/src/test/utils.ts
CHANGED
|
@@ -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