@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.
Files changed (52) hide show
  1. package/dest/avm/avm_execution_environment.d.ts.map +1 -1
  2. package/dest/avm/avm_execution_environment.js +3 -3
  3. package/dest/avm/avm_gas_cost.d.ts +307 -3
  4. package/dest/avm/avm_gas_cost.d.ts.map +1 -1
  5. package/dest/avm/avm_gas_cost.js +42 -8
  6. package/dest/avm/fixtures/index.js +4 -4
  7. package/dest/avm/opcodes/addressing_mode.d.ts +1 -1
  8. package/dest/avm/opcodes/addressing_mode.d.ts.map +1 -1
  9. package/dest/avm/opcodes/addressing_mode.js +1 -1
  10. package/dest/avm/opcodes/arithmetic.d.ts +15 -12
  11. package/dest/avm/opcodes/arithmetic.d.ts.map +1 -1
  12. package/dest/avm/opcodes/arithmetic.js +25 -36
  13. package/dest/avm/opcodes/hashing.js +2 -2
  14. package/dest/avm/opcodes/instruction.d.ts +1 -1
  15. package/dest/avm/opcodes/instruction.d.ts.map +1 -1
  16. package/dest/avm/opcodes/instruction.js +7 -3
  17. package/dest/avm/opcodes/memory.d.ts +3 -0
  18. package/dest/avm/opcodes/memory.d.ts.map +1 -1
  19. package/dest/avm/opcodes/memory.js +8 -1
  20. package/dest/avm/temporary_executor_migration.js +3 -3
  21. package/dest/client/client_execution_context.d.ts +3 -3
  22. package/dest/client/client_execution_context.d.ts.map +1 -1
  23. package/dest/client/client_execution_context.js +5 -5
  24. package/dest/client/execution_result.d.ts +5 -5
  25. package/dest/client/execution_result.d.ts.map +1 -1
  26. package/dest/public/execution.d.ts +3 -3
  27. package/dest/public/execution.d.ts.map +1 -1
  28. package/dest/public/execution.js +1 -1
  29. package/dest/public/executor.js +3 -3
  30. package/dest/public/public_execution_context.d.ts +2 -2
  31. package/dest/public/public_execution_context.d.ts.map +1 -1
  32. package/dest/public/public_execution_context.js +3 -3
  33. package/dest/test/utils.d.ts.map +1 -1
  34. package/dest/test/utils.js +2 -3
  35. package/dest/utils.js +2 -2
  36. package/package.json +5 -5
  37. package/src/avm/avm_execution_environment.ts +2 -5
  38. package/src/avm/avm_gas_cost.ts +46 -8
  39. package/src/avm/fixtures/index.ts +3 -3
  40. package/src/avm/opcodes/addressing_mode.ts +1 -1
  41. package/src/avm/opcodes/arithmetic.ts +34 -47
  42. package/src/avm/opcodes/hashing.ts +1 -1
  43. package/src/avm/opcodes/instruction.ts +7 -3
  44. package/src/avm/opcodes/memory.ts +9 -0
  45. package/src/avm/temporary_executor_migration.ts +2 -2
  46. package/src/client/client_execution_context.ts +7 -5
  47. package/src/client/execution_result.ts +5 -5
  48. package/src/public/execution.ts +3 -3
  49. package/src/public/executor.ts +2 -2
  50. package/src/public/public_execution_context.ts +2 -2
  51. package/src/test/utils.ts +1 -2
  52. package/src/utils.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { FunctionL2Logs, Note } from '@aztec/circuit-types';
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: FunctionL2Logs;
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: FunctionL2Logs;
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): FunctionL2Logs[] {
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): FunctionL2Logs[] {
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
  }
@@ -1,4 +1,4 @@
1
- import { FunctionL2Logs, SimulationError } from '@aztec/circuit-types';
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: FunctionL2Logs;
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: FunctionL2Logs,
157
+ unencryptedLogs: UnencryptedFunctionL2Logs,
158
158
  ) {
159
159
  if (
160
160
  contractStorageUpdateRequests.length > 0 ||
@@ -1,4 +1,4 @@
1
- import { FunctionL2Logs } from '@aztec/circuit-types';
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: FunctionL2Logs.empty(),
95
+ unencryptedLogs: UnencryptedFunctionL2Logs.empty(),
96
96
  reverted,
97
97
  revertReason,
98
98
  };
@@ -1,4 +1,4 @@
1
- import { FunctionL2Logs, NullifierMembershipWitness, UnencryptedL2Log } from '@aztec/circuit-types';
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 FunctionL2Logs(this.unencryptedLogs.map(log => log.toBuffer()));
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 contentBuf = Buffer.concat([selectorBuf, ...contentPreimage.map(field => field.toBuffer())]);
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
@@ -14,5 +14,5 @@ export function computeSlotForMapping(
14
14
  toField: () => Fr;
15
15
  },
16
16
  ) {
17
- return pedersenHash([mappingSlot, key.toField()].map(field => field.toBuffer()));
17
+ return pedersenHash([mappingSlot, key.toField()]);
18
18
  }