@aztec/stdlib 0.0.1-commit.88e6f9396 → 0.0.1-commit.8c0b8ff

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 (216) hide show
  1. package/dest/abi/abi.d.ts +26 -191
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +45 -4
  4. package/dest/abi/buffer.d.ts +14 -4
  5. package/dest/abi/buffer.d.ts.map +1 -1
  6. package/dest/abi/buffer.js +25 -4
  7. package/dest/abi/decoder.d.ts +5 -44
  8. package/dest/abi/decoder.d.ts.map +1 -1
  9. package/dest/abi/decoder.js +12 -67
  10. package/dest/abi/function_selector.js +1 -1
  11. package/dest/abi/function_signature_decoder.d.ts +43 -0
  12. package/dest/abi/function_signature_decoder.d.ts.map +1 -0
  13. package/dest/abi/function_signature_decoder.js +66 -0
  14. package/dest/abi/index.d.ts +2 -1
  15. package/dest/abi/index.d.ts.map +1 -1
  16. package/dest/abi/index.js +1 -0
  17. package/dest/abi/selector.d.ts +2 -2
  18. package/dest/abi/selector.d.ts.map +1 -1
  19. package/dest/abi/selector.js +1 -1
  20. package/dest/avm/avm_accumulated_data.js +2 -2
  21. package/dest/avm/avm_circuit_public_inputs.js +2 -2
  22. package/dest/avm/revert_code.d.ts +8 -18
  23. package/dest/avm/revert_code.d.ts.map +1 -1
  24. package/dest/avm/revert_code.js +15 -30
  25. package/dest/block/l2_block_source.d.ts +5 -3
  26. package/dest/block/l2_block_source.d.ts.map +1 -1
  27. package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
  28. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  29. package/dest/config/index.d.ts +1 -2
  30. package/dest/config/index.d.ts.map +1 -1
  31. package/dest/config/index.js +0 -1
  32. package/dest/config/sequencer-config.d.ts +1 -3
  33. package/dest/config/sequencer-config.d.ts.map +1 -1
  34. package/dest/config/sequencer-config.js +0 -1
  35. package/dest/contract/contract_address.d.ts +3 -3
  36. package/dest/contract/contract_address.js +3 -3
  37. package/dest/contract/contract_class_id.d.ts +2 -2
  38. package/dest/contract/contract_class_id.js +2 -2
  39. package/dest/epoch-helpers/index.d.ts +5 -1
  40. package/dest/epoch-helpers/index.d.ts.map +1 -1
  41. package/dest/epoch-helpers/index.js +9 -0
  42. package/dest/gas/gas_settings.d.ts +40 -3
  43. package/dest/gas/gas_settings.d.ts.map +1 -1
  44. package/dest/gas/gas_settings.js +50 -6
  45. package/dest/hash/hash.d.ts +4 -1
  46. package/dest/hash/hash.d.ts.map +1 -1
  47. package/dest/hash/hash.js +5 -0
  48. package/dest/interfaces/aztec-node-admin.d.ts +4 -13
  49. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  50. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  51. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  52. package/dest/interfaces/aztec-node-debug.js +18 -0
  53. package/dest/interfaces/client.d.ts +2 -1
  54. package/dest/interfaces/client.d.ts.map +1 -1
  55. package/dest/interfaces/client.js +1 -0
  56. package/dest/interfaces/l2_logs_source.d.ts +3 -5
  57. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  58. package/dest/interfaces/proving-job.d.ts +166 -166
  59. package/dest/interfaces/validator.d.ts +17 -37
  60. package/dest/interfaces/validator.d.ts.map +1 -1
  61. package/dest/interfaces/validator.js +2 -2
  62. package/dest/kernel/claimed_length_array.js +1 -1
  63. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +1 -1
  64. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  65. package/dest/kernel/padded_side_effects.js +1 -1
  66. package/dest/kernel/private_to_avm_accumulated_data.js +2 -2
  67. package/dest/kernel/private_to_public_accumulated_data.js +2 -2
  68. package/dest/kernel/private_to_rollup_accumulated_data.js +1 -1
  69. package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
  70. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
  71. package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
  72. package/dest/logs/message_context.d.ts +4 -7
  73. package/dest/logs/message_context.d.ts.map +1 -1
  74. package/dest/logs/message_context.js +23 -9
  75. package/dest/logs/pending_tagged_log.d.ts +2 -3
  76. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  77. package/dest/logs/pending_tagged_log.js +2 -2
  78. package/dest/logs/private_log.js +1 -1
  79. package/dest/logs/public_log.d.ts +1 -1
  80. package/dest/logs/public_log.d.ts.map +1 -1
  81. package/dest/logs/public_log.js +7 -1
  82. package/dest/logs/shared_secret_derivation.d.ts +11 -10
  83. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  84. package/dest/logs/shared_secret_derivation.js +15 -9
  85. package/dest/logs/siloed_tag.d.ts +4 -1
  86. package/dest/logs/siloed_tag.d.ts.map +1 -1
  87. package/dest/logs/siloed_tag.js +7 -3
  88. package/dest/messaging/l1_to_l2_message.d.ts +3 -2
  89. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  90. package/dest/messaging/l1_to_l2_message.js +11 -13
  91. package/dest/messaging/l1_to_l2_message_source.d.ts +2 -4
  92. package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
  93. package/dest/note/note_dao.d.ts +1 -1
  94. package/dest/note/note_dao.d.ts.map +1 -1
  95. package/dest/note/note_dao.js +1 -4
  96. package/dest/p2p/block_proposal.d.ts +2 -2
  97. package/dest/p2p/block_proposal.d.ts.map +1 -1
  98. package/dest/p2p/block_proposal.js +1 -1
  99. package/dest/p2p/checkpoint_proposal.d.ts +2 -2
  100. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  101. package/dest/p2p/checkpoint_proposal.js +1 -1
  102. package/dest/parity/parity_base_private_inputs.js +1 -1
  103. package/dest/proofs/chonk_proof.d.ts +1 -1
  104. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  105. package/dest/proofs/chonk_proof.js +7 -1
  106. package/dest/rollup/base_rollup_hints.js +2 -2
  107. package/dest/rollup/block_root_rollup_private_inputs.js +5 -5
  108. package/dest/rollup/checkpoint_rollup_public_inputs.js +1 -1
  109. package/dest/rollup/checkpoint_root_rollup_private_inputs.js +3 -3
  110. package/dest/rollup/root_rollup_public_inputs.js +1 -1
  111. package/dest/rollup/tree_snapshot_diff_hints.js +2 -2
  112. package/dest/tests/factories.js +1 -1
  113. package/dest/tests/mocks.d.ts +1 -1
  114. package/dest/tests/mocks.d.ts.map +1 -1
  115. package/dest/tests/mocks.js +2 -2
  116. package/dest/tx/capsule.d.ts +6 -2
  117. package/dest/tx/capsule.d.ts.map +1 -1
  118. package/dest/tx/capsule.js +9 -3
  119. package/dest/tx/protocol_contracts.js +2 -2
  120. package/dest/tx/simulated_tx.d.ts +29 -154
  121. package/dest/tx/simulated_tx.d.ts.map +1 -1
  122. package/dest/tx/simulated_tx.js +3 -3
  123. package/dest/tx/tx_receipt.d.ts +8 -4
  124. package/dest/tx/tx_receipt.d.ts.map +1 -1
  125. package/dest/tx/tx_receipt.js +8 -15
  126. package/dest/tx/validator/error_texts.d.ts +5 -1
  127. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  128. package/dest/tx/validator/error_texts.js +6 -0
  129. package/dest/vks/vk_data.js +1 -1
  130. package/package.json +10 -11
  131. package/src/abi/abi.ts +67 -14
  132. package/src/abi/buffer.ts +25 -4
  133. package/src/abi/decoder.ts +23 -78
  134. package/src/abi/function_selector.ts +1 -1
  135. package/src/abi/function_signature_decoder.ts +77 -0
  136. package/src/abi/index.ts +1 -0
  137. package/src/abi/selector.ts +1 -1
  138. package/src/avm/avm_accumulated_data.ts +6 -6
  139. package/src/avm/avm_circuit_public_inputs.ts +4 -4
  140. package/src/avm/revert_code.ts +25 -39
  141. package/src/block/l2_block_source.ts +4 -2
  142. package/src/block/l2_block_stream/interfaces.ts +6 -2
  143. package/src/config/index.ts +0 -1
  144. package/src/config/sequencer-config.ts +0 -3
  145. package/src/contract/contract_address.ts +3 -3
  146. package/src/contract/contract_class_id.ts +2 -2
  147. package/src/epoch-helpers/index.ts +19 -0
  148. package/src/gas/gas_settings.ts +65 -12
  149. package/src/hash/hash.ts +5 -0
  150. package/src/interfaces/aztec-node-debug.ts +40 -0
  151. package/src/interfaces/client.ts +1 -0
  152. package/src/interfaces/l2_logs_source.ts +1 -4
  153. package/src/interfaces/validator.ts +34 -40
  154. package/src/kernel/claimed_length_array.ts +2 -2
  155. package/src/kernel/hints/private_kernel_reset_hints.ts +5 -2
  156. package/src/kernel/hints/read_request_hints.ts +3 -3
  157. package/src/kernel/padded_side_effects.ts +3 -3
  158. package/src/kernel/private_to_avm_accumulated_data.ts +4 -4
  159. package/src/kernel/private_to_public_accumulated_data.ts +10 -10
  160. package/src/kernel/private_to_rollup_accumulated_data.ts +5 -5
  161. package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
  162. package/src/logs/message_context.ts +17 -7
  163. package/src/logs/pending_tagged_log.ts +1 -3
  164. package/src/logs/private_log.ts +1 -1
  165. package/src/logs/public_log.ts +11 -1
  166. package/src/logs/shared_secret_derivation.ts +21 -10
  167. package/src/logs/siloed_tag.ts +7 -2
  168. package/src/messaging/l1_to_l2_message.ts +12 -9
  169. package/src/messaging/l1_to_l2_message_source.ts +1 -3
  170. package/src/note/note_dao.ts +1 -4
  171. package/src/p2p/block_proposal.ts +1 -1
  172. package/src/p2p/checkpoint_proposal.ts +1 -1
  173. package/src/parity/parity_base_private_inputs.ts +1 -1
  174. package/src/proofs/chonk_proof.ts +9 -1
  175. package/src/rollup/base_rollup_hints.ts +2 -2
  176. package/src/rollup/block_root_rollup_private_inputs.ts +8 -8
  177. package/src/rollup/checkpoint_rollup_public_inputs.ts +2 -2
  178. package/src/rollup/checkpoint_root_rollup_private_inputs.ts +4 -4
  179. package/src/rollup/root_rollup_public_inputs.ts +2 -2
  180. package/src/rollup/tree_snapshot_diff_hints.ts +5 -5
  181. package/src/tests/factories.ts +1 -1
  182. package/src/tests/mocks.ts +2 -2
  183. package/src/tx/capsule.ts +10 -2
  184. package/src/tx/protocol_contracts.ts +2 -2
  185. package/src/tx/simulated_tx.ts +6 -2
  186. package/src/tx/tx_receipt.ts +11 -14
  187. package/src/tx/validator/error_texts.ts +8 -0
  188. package/src/vks/vk_data.ts +1 -1
  189. package/dest/config/pipelining-config.d.ts +0 -19
  190. package/dest/config/pipelining-config.d.ts.map +0 -1
  191. package/dest/config/pipelining-config.js +0 -18
  192. package/dest/ha-signing/config.d.ts +0 -136
  193. package/dest/ha-signing/config.d.ts.map +0 -1
  194. package/dest/ha-signing/config.js +0 -97
  195. package/dest/ha-signing/index.d.ts +0 -4
  196. package/dest/ha-signing/index.d.ts.map +0 -1
  197. package/dest/ha-signing/index.js +0 -3
  198. package/dest/ha-signing/local_config.d.ts +0 -63
  199. package/dest/ha-signing/local_config.d.ts.map +0 -1
  200. package/dest/ha-signing/local_config.js +0 -24
  201. package/dest/ha-signing/types.d.ts +0 -85
  202. package/dest/ha-signing/types.d.ts.map +0 -1
  203. package/dest/ha-signing/types.js +0 -32
  204. package/dest/kv-store/config.d.ts +0 -17
  205. package/dest/kv-store/config.d.ts.map +0 -1
  206. package/dest/kv-store/config.js +0 -26
  207. package/dest/kv-store/index.d.ts +0 -2
  208. package/dest/kv-store/index.d.ts.map +0 -1
  209. package/dest/kv-store/index.js +0 -1
  210. package/src/config/pipelining-config.ts +0 -31
  211. package/src/ha-signing/config.ts +0 -156
  212. package/src/ha-signing/index.ts +0 -27
  213. package/src/ha-signing/local_config.ts +0 -46
  214. package/src/ha-signing/types.ts +0 -112
  215. package/src/kv-store/config.ts +0 -36
  216. package/src/kv-store/index.ts +0 -1
@@ -1,8 +1,7 @@
1
1
  import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
2
+ import { range } from '@aztec/foundation/array';
2
3
  import { Fr } from '@aztec/foundation/curves/bn254';
3
4
 
4
- import type { AztecAddress } from '../aztec-address/index.js';
5
- import type { TxEffect } from '../tx/tx_effect.js';
6
5
  import type { TxHash } from '../tx/tx_hash.js';
7
6
 
8
7
  /**
@@ -19,7 +18,6 @@ export class MessageContext {
19
18
  public txHash: TxHash,
20
19
  public uniqueNoteHashesInTx: Fr[],
21
20
  public firstNullifierInTx: Fr,
22
- public recipient: AztecAddress,
23
21
  ) {}
24
22
 
25
23
  toFields(): Fr[] {
@@ -27,7 +25,6 @@ export class MessageContext {
27
25
  this.txHash.hash,
28
26
  ...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
29
27
  this.firstNullifierInTx,
30
- this.recipient.toField(),
31
28
  ];
32
29
  }
33
30
 
@@ -37,13 +34,22 @@ export class MessageContext {
37
34
  tx_hash: this.txHash.hash,
38
35
  unique_note_hashes_in_tx: this.uniqueNoteHashesInTx,
39
36
  first_nullifier_in_tx: this.firstNullifierInTx,
40
- recipient: this.recipient,
41
37
  };
42
38
  /* eslint-enable camelcase */
43
39
  }
44
40
 
45
- static fromTxEffectAndRecipient(txEffect: TxEffect, recipient: AztecAddress): MessageContext {
46
- return new MessageContext(txEffect.txHash, txEffect.noteHashes, txEffect.nullifiers[0], recipient);
41
+ static toEmptyFields(): Fr[] {
42
+ const serializationLen =
43
+ 1 /* txHash */ + MAX_NOTE_HASHES_PER_TX + 1 /* uniqueNoteHashesInTx BVec */ + 1; /* firstNullifierInTx */
44
+ return range(serializationLen).map(_ => Fr.zero());
45
+ }
46
+
47
+ static toSerializedOption(response: MessageContext | null): Fr[] {
48
+ if (response) {
49
+ return [new Fr(1), ...response.toFields()];
50
+ } else {
51
+ return [new Fr(0), ...MessageContext.toEmptyFields()];
52
+ }
47
53
  }
48
54
  }
49
55
 
@@ -55,6 +61,10 @@ export class MessageContext {
55
61
  * @dev Copied over from pending_tagged_log.ts.
56
62
  */
57
63
  function serializeBoundedVec(values: Fr[], maxLength: number): Fr[] {
64
+ if (values.length > maxLength) {
65
+ throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
66
+ }
67
+
58
68
  const lengthDiff = maxLength - values.length;
59
69
  const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
60
70
  const storage = values.concat(zeroPaddingArray);
@@ -1,7 +1,6 @@
1
1
  import { PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
3
 
4
- import type { AztecAddress } from '../aztec-address/index.js';
5
4
  import type { TxHash } from '../tx/tx_hash.js';
6
5
  import { MessageContext } from './message_context.js';
7
6
 
@@ -17,9 +16,8 @@ export class PendingTaggedLog {
17
16
  txHash: TxHash,
18
17
  uniqueNoteHashesInTx: Fr[],
19
18
  firstNullifierInTx: Fr,
20
- recipient: AztecAddress,
21
19
  ) {
22
- this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx, recipient);
20
+ this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx);
23
21
  }
24
22
 
25
23
  toFields(): Fr[] {
@@ -73,7 +73,7 @@ export class PrivateLog {
73
73
 
74
74
  static fromBuffer(buffer: Buffer | BufferReader) {
75
75
  const reader = BufferReader.asReader(buffer);
76
- return new PrivateLog(reader.readArray(PRIVATE_LOG_SIZE_IN_FIELDS, Fr), reader.readNumber());
76
+ return new PrivateLog(reader.readTuple(PRIVATE_LOG_SIZE_IN_FIELDS, Fr), reader.readNumber());
77
77
  }
78
78
 
79
79
  static random(tag = Fr.random()) {
@@ -1,4 +1,8 @@
1
- import { FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH, PUBLIC_LOG_HEADER_LENGTH } from '@aztec/constants';
1
+ import {
2
+ FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH,
3
+ MAX_PUBLIC_LOG_SIZE_IN_FIELDS,
4
+ PUBLIC_LOG_HEADER_LENGTH,
5
+ } from '@aztec/constants';
2
6
  import type { FieldsOf } from '@aztec/foundation/array';
3
7
  import { Fr } from '@aztec/foundation/curves/bn254';
4
8
  import { type ZodFor, schemas } from '@aztec/foundation/schemas';
@@ -76,6 +80,9 @@ export class FlatPublicLogs {
76
80
  static fromBuffer(buffer: Buffer | BufferReader) {
77
81
  const reader = BufferReader.asReader(buffer);
78
82
  const length = reader.readNumber();
83
+ if (length > FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH) {
84
+ throw new Error(`FlatPublicLogs length ${length} exceeds maximum ${FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH}`);
85
+ }
79
86
  return this.fromUnpaddedPayload(reader.readArray(length, Fr));
80
87
  }
81
88
 
@@ -171,6 +178,9 @@ export class PublicLog {
171
178
  static fromBuffer(buffer: Buffer | BufferReader) {
172
179
  const reader = BufferReader.asReader(buffer);
173
180
  const fieldsLength = reader.readNumber();
181
+ if (fieldsLength > MAX_PUBLIC_LOG_SIZE_IN_FIELDS) {
182
+ throw new Error(`PublicLog fields length ${fieldsLength} exceeds maximum ${MAX_PUBLIC_LOG_SIZE_IN_FIELDS}`);
183
+ }
174
184
  return new PublicLog(reader.readObject(AztecAddress), reader.readArray(fieldsLength, Fr));
175
185
  }
176
186
 
@@ -1,26 +1,37 @@
1
+ import { DomainSeparator } from '@aztec/constants';
1
2
  import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
2
- import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
3
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
+ import type { Fr } from '@aztec/foundation/curves/bn254';
5
+ import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
3
6
 
7
+ import type { AztecAddress } from '../aztec-address/index.js';
4
8
  import type { PublicKey } from '../keys/public_key.js';
5
9
 
6
10
  /**
7
- * Derive an Elliptic Curve Diffie-Hellman (ECDH) Shared Secret.
8
- * The function takes in an ECDH public key, a private key, and a Grumpkin instance to compute
9
- * the shared secret.
11
+ * Derives an app-siloed ECDH shared secret.
12
+ *
13
+ * Computes the raw ECDH shared secret `S = secretKey * publicKey`, then app-silos it:
14
+ * `s_app = h(DOM_SEP__APP_SILOED_ECDH_SHARED_SECRET, S.x, S.y, contractAddress)`
10
15
  *
11
16
  * @param secretKey - The secret key used to derive shared secret.
12
17
  * @param publicKey - The public key used to derive shared secret.
13
- * @returns A derived shared secret.
18
+ * @param contractAddress - The address of the calling contract, used for app-siloing.
19
+ * @returns The app-siloed shared secret as a Field.
14
20
  * @throws If the publicKey is zero.
15
- *
16
- * TODO(#12656): This function is kept around because of the utilityGetSharedSecret oracle. Nuke this once returning
17
- * the app-siloed secret.
18
21
  */
19
- export function deriveEcdhSharedSecret(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point> {
22
+ export async function deriveAppSiloedSharedSecret(
23
+ secretKey: GrumpkinScalar,
24
+ publicKey: PublicKey,
25
+ contractAddress: AztecAddress,
26
+ ): Promise<Fr> {
20
27
  if (publicKey.isZero()) {
21
28
  throw new Error(
22
29
  `Attempting to derive a shared secret with a zero public key. You have probably passed a zero public key in your Noir code somewhere thinking that the note won't be broadcast... but it was.`,
23
30
  );
24
31
  }
25
- return Grumpkin.mul(publicKey, secretKey);
32
+ const rawSharedSecret = await Grumpkin.mul(publicKey, secretKey);
33
+ return poseidon2HashWithSeparator(
34
+ [rawSharedSecret.x, rawSharedSecret.y, contractAddress],
35
+ DomainSeparator.APP_SILOED_ECDH_SHARED_SECRET,
36
+ );
26
37
  }
@@ -1,8 +1,9 @@
1
+ import { DomainSeparator } from '@aztec/constants';
1
2
  import type { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import type { ZodFor } from '@aztec/foundation/schemas';
3
4
 
4
5
  import type { AztecAddress } from '../aztec-address/index.js';
5
- import { computeSiloedPrivateLogFirstField } from '../hash/hash.js';
6
+ import { computeLogTag, computeSiloedPrivateLogFirstField } from '../hash/hash.js';
6
7
  import { schemas } from '../schemas/schemas.js';
7
8
  import type { PreTag } from './pre_tag.js';
8
9
  import { Tag } from './tag.js';
@@ -24,9 +25,13 @@ export class SiloedTag {
24
25
 
25
26
  static async compute(preTag: PreTag): Promise<SiloedTag> {
26
27
  const tag = await Tag.compute(preTag);
27
- return SiloedTag.computeFromTagAndApp(tag, preTag.extendedSecret.app);
28
+ const logTag = await computeLogTag(tag.value, DomainSeparator.UNCONSTRAINED_MSG_LOG_TAG);
29
+ return SiloedTag.computeFromTagAndApp(new Tag(logTag), preTag.extendedSecret.app);
28
30
  }
29
31
 
32
+ /**
33
+ * Unlike `compute`, this expects a tag whose value is already domain-separated.
34
+ */
30
35
  static async computeFromTagAndApp(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
31
36
  const siloedTag = await computeSiloedPrivateLogFirstField(app, tag.value);
32
37
  return new SiloedTag(siloedTag);
@@ -6,6 +6,7 @@ import { bufferToHex } from '@aztec/foundation/string';
6
6
  import { SiblingPath } from '@aztec/foundation/trees';
7
7
 
8
8
  import type { AztecAddress } from '../aztec-address/index.js';
9
+ import type { BlockParameter } from '../block/block_parameter.js';
9
10
  import { computeL1ToL2MessageNullifier } from '../hash/hash.js';
10
11
  import type { AztecNode } from '../interfaces/aztec-node.js';
11
12
  import { MerkleTreeId } from '../trees/merkle_tree_id.js';
@@ -79,20 +80,22 @@ export async function getNonNullifiedL1ToL2MessageWitness(
79
80
  contractAddress: AztecAddress,
80
81
  messageHash: Fr,
81
82
  secret: Fr,
83
+ referenceBlock: BlockParameter = 'latest',
82
84
  ): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]> {
83
- const response = await node.getL1ToL2MessageMembershipWitness('latest', messageHash);
84
- if (!response) {
85
- throw new Error(`No L1 to L2 message found for message hash ${messageHash.toString()}`);
86
- }
85
+ const messageNullifier = await computeL1ToL2MessageNullifier(contractAddress, messageHash, secret);
87
86
 
88
- const [messageIndex, siblingPath] = response;
87
+ const [l1ToL2Response, nullifierResponse] = await Promise.all([
88
+ node.getL1ToL2MessageMembershipWitness(referenceBlock, messageHash),
89
+ node.findLeavesIndexes(referenceBlock, MerkleTreeId.NULLIFIER_TREE, [messageNullifier]),
90
+ ]);
89
91
 
90
- const messageNullifier = await computeL1ToL2MessageNullifier(contractAddress, messageHash, secret);
92
+ if (!l1ToL2Response) {
93
+ throw new Error(`No L1 to L2 message found for message hash ${messageHash.toString()}`);
94
+ }
91
95
 
92
- const [nullifierIndex] = await node.findLeavesIndexes('latest', MerkleTreeId.NULLIFIER_TREE, [messageNullifier]);
93
- if (nullifierIndex !== undefined) {
96
+ if (nullifierResponse[0] !== undefined) {
94
97
  throw new Error(`No non-nullified L1 to L2 message found for message hash ${messageHash.toString()}`);
95
98
  }
96
99
 
97
- return [messageIndex, siblingPath];
100
+ return l1ToL2Response;
98
101
  }
@@ -10,9 +10,7 @@ export interface L1ToL2MessageSource {
10
10
  /**
11
11
  * Gets new L1 to L2 message (to be) included in a given checkpoint.
12
12
  * @param checkpointNumber - Checkpoint number to get messages for.
13
- * @returns The L1 to L2 messages/leaves of the messages subtree.
14
- * @throws If the message tree for the given checkpoint has not yet been sealed on L1
15
- * (i.e., checkpointNumber >= inbox treeInProgress).
13
+ * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
16
14
  */
17
15
  getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
18
16
 
@@ -1,6 +1,5 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { Point } from '@aztec/foundation/curves/grumpkin';
4
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
5
  import { Note } from '@aztec/stdlib/note';
@@ -148,9 +147,7 @@ export class NoteDao {
148
147
  * @returns - Its size in bytes.
149
148
  */
150
149
  public getSize() {
151
- const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
152
- // 2 numbers for txIndexInBlock and noteIndexInTx (4 bytes each)
153
- return noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + 8;
150
+ return this.toBuffer().length;
154
151
  }
155
152
 
156
153
  static async random({
@@ -6,11 +6,11 @@ import { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import type { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
9
+ import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
9
10
 
10
11
  import type { L2Block } from '../block/l2_block.js';
11
12
  import type { L2BlockInfo } from '../block/l2_block_info.js';
12
13
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
13
- import { DutyType, type SigningContext } from '../ha-signing/index.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
16
16
  import type { Tx } from '../tx/tx.js';
@@ -6,10 +6,10 @@ import { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import type { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
9
+ import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
9
10
 
10
11
  import type { L2BlockInfo } from '../block/l2_block_info.js';
11
12
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
12
- import { DutyType, type SigningContext } from '../ha-signing/index.js';
13
13
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
@@ -41,7 +41,7 @@ export class ParityBasePrivateInputs {
41
41
  */
42
42
  static fromBuffer(buffer: Buffer | BufferReader) {
43
43
  const reader = BufferReader.asReader(buffer);
44
- return new ParityBasePrivateInputs(reader.readArray(NUM_MSGS_PER_BASE_PARITY, Fr), Fr.fromBuffer(reader));
44
+ return new ParityBasePrivateInputs(reader.readTuple(NUM_MSGS_PER_BASE_PARITY, Fr), Fr.fromBuffer(reader));
45
45
  }
46
46
 
47
47
  /**
@@ -56,7 +56,10 @@ export class ChonkProof {
56
56
  static fromBuffer(buffer: Buffer | BufferReader): ChonkProof {
57
57
  const reader = BufferReader.asReader(buffer);
58
58
  const proofLength = reader.readNumber();
59
- const proof = reader.readArray(proofLength, Fr);
59
+ if (proofLength !== CHONK_PROOF_LENGTH) {
60
+ throw new Error(`Invalid ChonkProof length from buffer: ${proofLength}, expected ${CHONK_PROOF_LENGTH}`);
61
+ }
62
+ const proof = reader.readArray(CHONK_PROOF_LENGTH, Fr);
60
63
  return new ChonkProof(proof);
61
64
  }
62
65
 
@@ -106,6 +109,11 @@ export class ChonkProofWithPublicInputs {
106
109
  static fromBuffer(buffer: Buffer | BufferReader): ChonkProofWithPublicInputs {
107
110
  const reader = BufferReader.asReader(buffer);
108
111
  const proofLength = reader.readNumber();
112
+ if (proofLength < CHONK_PROOF_LENGTH) {
113
+ throw new Error(
114
+ `Invalid ChonkProofWithPublicInputs length from buffer: ${proofLength}, expected at least ${CHONK_PROOF_LENGTH}`,
115
+ );
116
+ }
109
117
  const proof = reader.readArray(proofLength, Fr);
110
118
  return new ChonkProofWithPublicInputs(proof);
111
119
  }
@@ -86,7 +86,7 @@ export class PrivateBaseRollupHints {
86
86
  reader.readObject(SpongeBlob),
87
87
  reader.readObject(TreeSnapshotDiffHints),
88
88
  reader.readObject(PublicDataTreeLeafPreimage),
89
- reader.readArray(ARCHIVE_HEIGHT, Fr),
89
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
90
90
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
91
91
  reader.readObject(BlockConstantData),
92
92
  );
@@ -163,7 +163,7 @@ export class PublicBaseRollupHints {
163
163
  return new PublicBaseRollupHints(
164
164
  reader.readObject(SpongeBlob),
165
165
  reader.readObject(AppendOnlyTreeSnapshot),
166
- reader.readArray(ARCHIVE_HEIGHT, Fr),
166
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
167
167
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
168
168
  );
169
169
  }
@@ -60,8 +60,8 @@ export class BlockRootFirstRollupPrivateInputs {
60
60
  ProofData.fromBuffer(reader, ParityPublicInputs),
61
61
  [ProofData.fromBuffer(reader, TxRollupPublicInputs), ProofData.fromBuffer(reader, TxRollupPublicInputs)],
62
62
  AppendOnlyTreeSnapshot.fromBuffer(reader),
63
- reader.readArray(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
64
- reader.readArray(ARCHIVE_HEIGHT, Fr),
63
+ reader.readTuple(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
64
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
65
65
  );
66
66
  }
67
67
 
@@ -124,8 +124,8 @@ export class BlockRootSingleTxFirstRollupPrivateInputs {
124
124
  ProofData.fromBuffer(reader, ParityPublicInputs),
125
125
  ProofData.fromBuffer(reader, TxRollupPublicInputs),
126
126
  AppendOnlyTreeSnapshot.fromBuffer(reader),
127
- reader.readArray(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
128
- reader.readArray(ARCHIVE_HEIGHT, Fr),
127
+ reader.readTuple(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
128
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
129
129
  );
130
130
  }
131
131
 
@@ -206,8 +206,8 @@ export class BlockRootEmptyTxFirstRollupPrivateInputs {
206
206
  StateReference.fromBuffer(reader),
207
207
  CheckpointConstantData.fromBuffer(reader),
208
208
  reader.readUInt64(),
209
- reader.readArray(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
210
- reader.readArray(ARCHIVE_HEIGHT, Fr),
209
+ reader.readTuple(L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
210
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
211
211
  );
212
212
  }
213
213
 
@@ -248,7 +248,7 @@ export class BlockRootRollupPrivateInputs {
248
248
  const reader = BufferReader.asReader(buffer);
249
249
  return new BlockRootRollupPrivateInputs(
250
250
  [ProofData.fromBuffer(reader, TxRollupPublicInputs), ProofData.fromBuffer(reader, TxRollupPublicInputs)],
251
- reader.readArray(ARCHIVE_HEIGHT, Fr),
251
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
252
252
  );
253
253
  }
254
254
 
@@ -289,7 +289,7 @@ export class BlockRootSingleTxRollupPrivateInputs {
289
289
  const reader = BufferReader.asReader(buffer);
290
290
  return new BlockRootSingleTxRollupPrivateInputs(
291
291
  ProofData.fromBuffer(reader, TxRollupPublicInputs),
292
- reader.readArray(ARCHIVE_HEIGHT, Fr),
292
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
293
293
  );
294
294
  }
295
295
 
@@ -65,8 +65,8 @@ export class CheckpointRollupPublicInputs {
65
65
  reader.readObject(AppendOnlyTreeSnapshot),
66
66
  reader.readObject(AppendOnlyTreeSnapshot),
67
67
  reader.readObject(AppendOnlyTreeSnapshot),
68
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, Fr),
69
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
68
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, Fr),
69
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
70
70
  reader.readObject(BlobAccumulator),
71
71
  reader.readObject(BlobAccumulator),
72
72
  reader.readObject(FinalBlobBatchingChallenges),
@@ -81,15 +81,15 @@ export class CheckpointRootRollupHints {
81
81
  const reader = BufferReader.asReader(buffer);
82
82
  return new CheckpointRootRollupHints(
83
83
  BlockHeader.fromBuffer(reader),
84
- reader.readArray(ARCHIVE_HEIGHT, Fr),
84
+ reader.readTuple(ARCHIVE_HEIGHT, Fr),
85
85
  reader.readObject(AppendOnlyTreeSnapshot),
86
- reader.readArray(OUT_HASH_TREE_HEIGHT, Fr),
86
+ reader.readTuple(OUT_HASH_TREE_HEIGHT, Fr),
87
87
  reader.readObject(BlobAccumulator),
88
88
  reader.readObject(FinalBlobBatchingChallenges),
89
89
  // Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
90
- // reader.readArray(FIELDS_PER_BLOB, Fr),
90
+ // reader.readTuple(FIELDS_PER_BLOB, Fr),
91
91
  Array.from({ length: FIELDS_PER_BLOB * BLOBS_PER_CHECKPOINT }, () => Fr.fromBuffer(reader)),
92
- reader.readArray(BLOBS_PER_CHECKPOINT, BLS12Point),
92
+ reader.readTuple(BLOBS_PER_CHECKPOINT, BLS12Point),
93
93
  Fr.fromBuffer(reader),
94
94
  );
95
95
  }
@@ -68,8 +68,8 @@ export class RootRollupPublicInputs {
68
68
  Fr.fromBuffer(reader),
69
69
  Fr.fromBuffer(reader),
70
70
  Fr.fromBuffer(reader),
71
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, Fr),
72
- reader.readArray(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
71
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, Fr),
72
+ reader.readTuple(MAX_CHECKPOINTS_PER_EPOCH, FeeRecipient),
73
73
  EpochConstantData.fromBuffer(reader),
74
74
  reader.readObject(FinalBlobAccumulator),
75
75
  );
@@ -85,14 +85,14 @@ export class TreeSnapshotDiffHints {
85
85
  static fromBuffer(buffer: Buffer | BufferReader): TreeSnapshotDiffHints {
86
86
  const reader = BufferReader.asReader(buffer);
87
87
  return new TreeSnapshotDiffHints(
88
- reader.readArray(NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
89
- reader.readArray(MAX_NULLIFIERS_PER_TX, NullifierLeafPreimage),
90
- reader.readArray(MAX_NULLIFIERS_PER_TX, {
88
+ reader.readTuple(NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
89
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, NullifierLeafPreimage),
90
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, {
91
91
  fromBuffer: buffer => MembershipWitness.fromBuffer(buffer, NULLIFIER_TREE_HEIGHT),
92
92
  }),
93
- reader.readArray(MAX_NULLIFIERS_PER_TX, Fr),
93
+ reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
94
94
  reader.readNumbers(MAX_NULLIFIERS_PER_TX),
95
- reader.readArray(NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
95
+ reader.readTuple(NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, Fr),
96
96
  MembershipWitness.fromBuffer(reader, PUBLIC_DATA_TREE_HEIGHT),
97
97
  );
98
98
  }
@@ -234,7 +234,7 @@ export function makeTxContext(seed: number = 1): TxContext {
234
234
  * Creates a default instance of gas settings. No seed value is used to ensure we allocate a sensible amount of gas for testing.
235
235
  */
236
236
  export function makeGasSettings() {
237
- return GasSettings.default({ maxFeesPerGas: new GasFees(10, 10) });
237
+ return GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) });
238
238
  }
239
239
 
240
240
  /**
@@ -134,7 +134,7 @@ export const mockTx = async (
134
134
  const data = PrivateKernelTailCircuitPublicInputs.empty();
135
135
  const firstNullifier = new Nullifier(new Fr(seed + 1), Fr.ZERO, 0);
136
136
  data.constants.anchorBlockHeader = anchorBlockHeader;
137
- data.constants.txContext.gasSettings = GasSettings.default({ gasLimits, maxFeesPerGas, maxPriorityFeesPerGas });
137
+ data.constants.txContext.gasSettings = GasSettings.fallback({ gasLimits, maxFeesPerGas, maxPriorityFeesPerGas });
138
138
  data.feePayer = feePayer ?? (await AztecAddress.random());
139
139
  data.gasUsed = gasUsed;
140
140
  data.constants.txContext.chainId = chainId;
@@ -200,7 +200,7 @@ export async function mockProcessedTx({
200
200
  db,
201
201
  chainId = Fr.ZERO,
202
202
  version = Fr.ZERO,
203
- gasSettings = GasSettings.default({ maxFeesPerGas: new GasFees(10, 10) }),
203
+ gasSettings = GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) }),
204
204
  vkTreeRoot = Fr.ZERO,
205
205
  protocolContracts = makeProtocolContracts(seed + 0x100),
206
206
  globalVariables = GlobalVariables.empty(),
package/src/tx/capsule.ts CHANGED
@@ -19,6 +19,8 @@ export class Capsule {
19
19
  public readonly storageSlot: Fr,
20
20
  /** Data passed to the contract */
21
21
  public readonly data: Fr[],
22
+ /** Optional namespace for the capsule contents */
23
+ public readonly scope?: AztecAddress,
22
24
  ) {}
23
25
 
24
26
  static get schema() {
@@ -30,12 +32,18 @@ export class Capsule {
30
32
  }
31
33
 
32
34
  toBuffer() {
33
- return serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data));
35
+ return this.scope
36
+ ? serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data), true, this.scope)
37
+ : serializeToBuffer(this.contractAddress, this.storageSlot, new Vector(this.data), false);
34
38
  }
35
39
 
36
40
  static fromBuffer(buffer: Buffer | BufferReader): Capsule {
37
41
  const reader = BufferReader.asReader(buffer);
38
- return new Capsule(AztecAddress.fromBuffer(reader), Fr.fromBuffer(reader), reader.readVector(Fr));
42
+ const contractAddress = AztecAddress.fromBuffer(reader);
43
+ const storageSlot = Fr.fromBuffer(reader);
44
+ const data = reader.readVector(Fr);
45
+ const hasScope = reader.readBoolean();
46
+ return new Capsule(contractAddress, storageSlot, data, hasScope ? AztecAddress.fromBuffer(reader) : undefined);
39
47
  }
40
48
 
41
49
  toString() {
@@ -30,7 +30,7 @@ export class ProtocolContracts {
30
30
 
31
31
  static fromFields(fields: Fr[] | FieldReader): ProtocolContracts {
32
32
  const reader = FieldReader.asReader(fields);
33
- return new ProtocolContracts(reader.readArray(MAX_PROTOCOL_CONTRACTS, AztecAddress));
33
+ return new ProtocolContracts(reader.readTuple(MAX_PROTOCOL_CONTRACTS, AztecAddress));
34
34
  }
35
35
 
36
36
  toFields(): Fr[] {
@@ -39,7 +39,7 @@ export class ProtocolContracts {
39
39
 
40
40
  static fromBuffer(buffer: Buffer | BufferReader): ProtocolContracts {
41
41
  const reader = BufferReader.asReader(buffer);
42
- return new ProtocolContracts(reader.readArray(MAX_PROTOCOL_CONTRACTS, AztecAddress));
42
+ return new ProtocolContracts(reader.readTuple(MAX_PROTOCOL_CONTRACTS, AztecAddress));
43
43
  }
44
44
 
45
45
  toBuffer() {
@@ -38,7 +38,11 @@ export type ContractOverrides = Record<
38
38
  * set, it *must* be run without the kernel circuits, or validations will fail
39
39
  */
40
40
  export class SimulationOverrides {
41
- constructor(public contracts?: ContractOverrides) {}
41
+ public contracts?: ContractOverrides;
42
+
43
+ constructor(contracts: ContractOverrides = {}) {
44
+ this.contracts = Object.keys(contracts).length > 0 ? contracts : undefined;
45
+ }
42
46
 
43
47
  static get schema() {
44
48
  return z
@@ -157,7 +161,7 @@ export class TxSimulationResult {
157
161
  }
158
162
 
159
163
  /**
160
- * Recursively accummulate the return values of a call result and its nested executions,
164
+ * Recursively accumulate the return values of a call result and its nested executions,
161
165
  * so they can be retrieved in order.
162
166
  * @param executionResult
163
167
  * @returns
@@ -31,9 +31,16 @@ export const SortedTxStatuses: TxStatus[] = [
31
31
  /** Execution result - only set when tx is in a block. */
32
32
  export enum TxExecutionResult {
33
33
  SUCCESS = 'success',
34
- APP_LOGIC_REVERTED = 'app_logic_reverted',
35
- TEARDOWN_REVERTED = 'teardown_reverted',
36
- BOTH_REVERTED = 'both_reverted',
34
+ REVERTED = 'reverted',
35
+ /** @deprecated Use REVERTED instead. */
36
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
37
+ APP_LOGIC_REVERTED = 'reverted',
38
+ /** @deprecated Use REVERTED instead. */
39
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
40
+ TEARDOWN_REVERTED = 'reverted',
41
+ /** @deprecated Use REVERTED instead. */
42
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
43
+ BOTH_REVERTED = 'reverted',
37
44
  }
38
45
 
39
46
  /**
@@ -143,16 +150,6 @@ export class TxReceipt {
143
150
  }
144
151
 
145
152
  public static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult {
146
- if (revertCode.equals(RevertCode.OK)) {
147
- return TxExecutionResult.SUCCESS;
148
- } else if (revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
149
- return TxExecutionResult.APP_LOGIC_REVERTED;
150
- } else if (revertCode.equals(RevertCode.TEARDOWN_REVERTED)) {
151
- return TxExecutionResult.TEARDOWN_REVERTED;
152
- } else if (revertCode.equals(RevertCode.BOTH_REVERTED)) {
153
- return TxExecutionResult.BOTH_REVERTED;
154
- } else {
155
- throw new Error(`Unknown revert code: ${revertCode.getCode()}`);
156
- }
153
+ return revertCode.isOK() ? TxExecutionResult.SUCCESS : TxExecutionResult.REVERTED;
157
154
  }
158
155
  }
@@ -41,5 +41,13 @@ export const TX_ERROR_SIZE_ABOVE_LIMIT = 'Transaction size above size limit';
41
41
  // Block header
42
42
  export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
43
43
 
44
+ // Contract instance
45
+ export const TX_ERROR_INCORRECT_CONTRACT_ADDRESS = 'Incorrect contract instance deployment address';
46
+ export const TX_ERROR_MALFORMED_CONTRACT_INSTANCE_LOG = 'Failed to parse contract instance deployment log';
47
+
48
+ // Contract class
49
+ export const TX_ERROR_INCORRECT_CONTRACT_CLASS_ID = 'Incorrect contract class id';
50
+ export const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = 'Failed to parse contract class registration log';
51
+
44
52
  // General
45
53
  export const TX_ERROR_DURING_VALIDATION = 'Unexpected error during validation';
@@ -29,7 +29,7 @@ export class VkData {
29
29
  return new VkData(
30
30
  reader.readObject(VerificationKeyData),
31
31
  reader.readNumber(),
32
- reader.readArray(VK_TREE_HEIGHT, Fr),
32
+ reader.readTuple(VK_TREE_HEIGHT, Fr),
33
33
  );
34
34
  }
35
35