@aztec/stdlib 0.0.1-commit.1bea0213 → 0.0.1-commit.23b0eb0

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 (111) hide show
  1. package/dest/block/block_hash.d.ts +14 -17
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +21 -34
  4. package/dest/block/block_parameter.d.ts +2 -2
  5. package/dest/block/block_parameter.d.ts.map +1 -1
  6. package/dest/block/in_block.d.ts +5 -5
  7. package/dest/block/in_block.js +1 -1
  8. package/dest/block/l2_block.d.ts +3 -2
  9. package/dest/block/l2_block.d.ts.map +1 -1
  10. package/dest/block/l2_block.js +2 -3
  11. package/dest/block/l2_block_source.d.ts +5 -4
  12. package/dest/block/l2_block_source.d.ts.map +1 -1
  13. package/dest/contract/contract_address.js +1 -1
  14. package/dest/contract/contract_class_id.d.ts +1 -1
  15. package/dest/contract/contract_class_id.js +1 -1
  16. package/dest/contract/private_function.js +1 -1
  17. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  18. package/dest/contract/private_function_membership_proof.js +1 -1
  19. package/dest/database-version/database_version.d.ts +58 -0
  20. package/dest/database-version/database_version.d.ts.map +1 -0
  21. package/dest/database-version/database_version.js +69 -0
  22. package/dest/database-version/version_manager.d.ts +2 -50
  23. package/dest/database-version/version_manager.d.ts.map +1 -1
  24. package/dest/database-version/version_manager.js +1 -66
  25. package/dest/epoch-helpers/index.d.ts +3 -1
  26. package/dest/epoch-helpers/index.d.ts.map +1 -1
  27. package/dest/epoch-helpers/index.js +4 -0
  28. package/dest/hash/hash.js +2 -2
  29. package/dest/hash/map_slot.d.ts +1 -1
  30. package/dest/hash/map_slot.d.ts.map +1 -1
  31. package/dest/hash/map_slot.js +4 -3
  32. package/dest/interfaces/archiver.d.ts +1 -1
  33. package/dest/interfaces/archiver.d.ts.map +1 -1
  34. package/dest/interfaces/archiver.js +4 -3
  35. package/dest/interfaces/aztec-node-admin.d.ts +2 -2
  36. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  37. package/dest/interfaces/aztec-node-admin.js +3 -1
  38. package/dest/interfaces/aztec-node.d.ts +30 -51
  39. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  40. package/dest/interfaces/aztec-node.js +3 -7
  41. package/dest/interfaces/block-builder.d.ts +10 -4
  42. package/dest/interfaces/block-builder.d.ts.map +1 -1
  43. package/dest/interfaces/block-builder.js +7 -0
  44. package/dest/interfaces/get_logs_response.d.ts +6 -6
  45. package/dest/interfaces/validator.d.ts +28 -2
  46. package/dest/interfaces/validator.d.ts.map +1 -1
  47. package/dest/keys/derivation.d.ts +3 -3
  48. package/dest/keys/derivation.js +8 -8
  49. package/dest/keys/key_types.d.ts +1 -1
  50. package/dest/keys/utils.d.ts +1 -1
  51. package/dest/keys/utils.d.ts.map +1 -1
  52. package/dest/keys/utils.js +7 -3
  53. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  54. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  55. package/dest/l1-contracts/slash_factory.js +1 -0
  56. package/dest/logs/extended_public_log.d.ts +5 -5
  57. package/dest/logs/log_id.d.ts +4 -4
  58. package/dest/logs/log_id.d.ts.map +1 -1
  59. package/dest/logs/log_id.js +2 -1
  60. package/dest/logs/siloed_tag.d.ts +1 -1
  61. package/dest/logs/siloed_tag.d.ts.map +1 -1
  62. package/dest/logs/siloed_tag.js +4 -3
  63. package/dest/p2p/block_proposal.d.ts +10 -3
  64. package/dest/p2p/block_proposal.d.ts.map +1 -1
  65. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  66. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  67. package/dest/stats/stats.d.ts +1 -3
  68. package/dest/stats/stats.d.ts.map +1 -1
  69. package/dest/tests/mocks.d.ts +6 -2
  70. package/dest/tests/mocks.d.ts.map +1 -1
  71. package/dest/tests/mocks.js +4 -3
  72. package/dest/tx/block_header.js +2 -2
  73. package/dest/tx/in_tx.d.ts +2 -2
  74. package/dest/tx/indexed_tx_effect.d.ts +3 -3
  75. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  76. package/dest/tx/indexed_tx_effect.js +2 -1
  77. package/package.json +11 -10
  78. package/src/block/block_hash.ts +25 -50
  79. package/src/block/in_block.ts +1 -1
  80. package/src/block/l2_block.ts +3 -3
  81. package/src/block/l2_block_source.ts +4 -3
  82. package/src/contract/contract_address.ts +1 -1
  83. package/src/contract/contract_class_id.ts +1 -1
  84. package/src/contract/private_function.ts +1 -1
  85. package/src/contract/private_function_membership_proof.ts +1 -1
  86. package/src/database-version/database_version.ts +87 -0
  87. package/src/database-version/version_manager.ts +1 -77
  88. package/src/epoch-helpers/index.ts +9 -0
  89. package/src/hash/hash.ts +2 -2
  90. package/src/hash/map_slot.ts +3 -2
  91. package/src/interfaces/archiver.ts +4 -3
  92. package/src/interfaces/aztec-node-admin.ts +3 -2
  93. package/src/interfaces/aztec-node.ts +37 -88
  94. package/src/interfaces/block-builder.ts +12 -2
  95. package/src/interfaces/validator.ts +1 -2
  96. package/src/keys/derivation.ts +8 -8
  97. package/src/keys/key_types.ts +1 -1
  98. package/src/keys/utils.ts +7 -3
  99. package/src/l1-contracts/slash_factory.ts +1 -0
  100. package/src/logs/log_id.ts +2 -1
  101. package/src/logs/siloed_tag.ts +3 -2
  102. package/src/p2p/block_proposal.ts +9 -2
  103. package/src/p2p/checkpoint_proposal.ts +9 -2
  104. package/src/stats/stats.ts +0 -2
  105. package/src/tests/mocks.ts +6 -4
  106. package/src/tx/block_header.ts +3 -3
  107. package/src/tx/indexed_tx_effect.ts +2 -1
  108. package/dest/database-version/index.d.ts +0 -2
  109. package/dest/database-version/index.d.ts.map +0 -1
  110. package/dest/database-version/index.js +0 -1
  111. package/src/database-version/index.ts +0 -1
@@ -1,4 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
1
+ import { GeneratorIndex } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
2
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import type { ZodFor } from '@aztec/foundation/schemas';
4
5
 
@@ -22,7 +23,7 @@ export class SiloedTag {
22
23
  constructor(public readonly value: Fr) {}
23
24
 
24
25
  static async compute(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
25
- const siloedTag = await poseidon2Hash([app, tag.value]);
26
+ const siloedTag = await poseidon2HashWithSeparator([app, tag.value], GeneratorIndex.PRIVATE_LOG_FIRST_FIELD);
26
27
  return new SiloedTag(siloedTag);
27
28
  }
28
29
 
@@ -30,8 +30,15 @@ export class BlockProposalHash extends Buffer32 {
30
30
  }
31
31
 
32
32
  export type BlockProposalOptions = {
33
- publishFullTxs: boolean;
34
- /** Whether to generate an invalid block proposal for broadcasting. Use only for testing. */
33
+ /**
34
+ * Whether to include the tx objects along with the block proposal.
35
+ * Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
36
+ */
37
+ publishFullTxs?: boolean;
38
+ /**
39
+ * Whether to generate an invalid block proposal for broadcasting.
40
+ * Use only for testing.
41
+ */
35
42
  broadcastInvalidBlockProposal?: boolean;
36
43
  };
37
44
 
@@ -32,8 +32,15 @@ export class CheckpointProposalHash extends Buffer32 {
32
32
  }
33
33
 
34
34
  export type CheckpointProposalOptions = {
35
- publishFullTxs: boolean;
36
- /** Whether to generate an invalid checkpoint proposal for broadcasting. Use only for testing. */
35
+ /**
36
+ * Whether to include the tx objects along with the block proposal.
37
+ * Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
38
+ */
39
+ publishFullTxs?: boolean;
40
+ /**
41
+ * Whether to generate an invalid checkpoint proposal for broadcasting.
42
+ * Use only for testing.
43
+ */
37
44
  broadcastInvalidCheckpointProposal?: boolean;
38
45
  };
39
46
 
@@ -202,8 +202,6 @@ export type L2BlockBuiltStats = {
202
202
  duration: number;
203
203
  /** Time for processing public txs in ms. */
204
204
  publicProcessDuration: number;
205
- /** Time for running rollup circuits in ms. */
206
- rollupCircuitsDuration: number;
207
205
  } & L2BlockStats;
208
206
 
209
207
  /** Stats for an L2 block processed by the world state synchronizer. */
@@ -97,12 +97,14 @@ export const mockTx = async (
97
97
  publicCalldataSize = 2,
98
98
  feePayer,
99
99
  chonkProof = ChonkProof.random(),
100
+ maxFeesPerGas = new GasFees(10, 10),
100
101
  maxPriorityFeesPerGas,
101
102
  gasUsed = Gas.empty(),
102
103
  chainId = Fr.ZERO,
103
104
  version = Fr.ZERO,
104
105
  vkTreeRoot = Fr.ZERO,
105
106
  protocolContractsHash = Fr.ZERO,
107
+ anchorBlockHeader = BlockHeader.empty(),
106
108
  }: {
107
109
  numberOfNonRevertiblePublicCallRequests?: number;
108
110
  numberOfRevertiblePublicCallRequests?: number;
@@ -111,12 +113,14 @@ export const mockTx = async (
111
113
  publicCalldataSize?: number;
112
114
  feePayer?: AztecAddress;
113
115
  chonkProof?: ChonkProof;
116
+ maxFeesPerGas?: GasFees;
114
117
  maxPriorityFeesPerGas?: GasFees;
115
118
  gasUsed?: Gas;
116
119
  chainId?: Fr;
117
120
  version?: Fr;
118
121
  vkTreeRoot?: Fr;
119
122
  protocolContractsHash?: Fr;
123
+ anchorBlockHeader?: BlockHeader;
120
124
  } = {},
121
125
  ) => {
122
126
  const totalPublicCallRequests =
@@ -126,10 +130,8 @@ export const mockTx = async (
126
130
  const isForPublic = totalPublicCallRequests > 0;
127
131
  const data = PrivateKernelTailCircuitPublicInputs.empty();
128
132
  const firstNullifier = new Nullifier(new Fr(seed + 1), Fr.ZERO, 0);
129
- data.constants.txContext.gasSettings = GasSettings.default({
130
- maxFeesPerGas: new GasFees(10, 10),
131
- maxPriorityFeesPerGas,
132
- });
133
+ data.constants.anchorBlockHeader = anchorBlockHeader;
134
+ data.constants.txContext.gasSettings = GasSettings.default({ maxFeesPerGas, maxPriorityFeesPerGas });
133
135
  data.feePayer = feePayer ?? (await AztecAddress.random());
134
136
  data.gasUsed = gasUsed;
135
137
  data.constants.txContext.chainId = chainId;
@@ -164,8 +164,8 @@ export class BlockHeader {
164
164
 
165
165
  hash(): Promise<BlockHash> {
166
166
  if (!this._cachedHash) {
167
- this._cachedHash = poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.BLOCK_HASH).then(fr =>
168
- BlockHash.fromField(fr),
167
+ this._cachedHash = poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.BLOCK_HEADER_HASH).then(
168
+ fr => new BlockHash(fr),
169
169
  );
170
170
  }
171
171
  return this._cachedHash;
@@ -173,7 +173,7 @@ export class BlockHeader {
173
173
 
174
174
  /** Manually set the hash for this block header if already computed */
175
175
  setHash(hashed: Fr) {
176
- this._cachedHash = Promise.resolve(BlockHash.fromField(hashed));
176
+ this._cachedHash = Promise.resolve(new BlockHash(hashed));
177
177
  }
178
178
 
179
179
  static random(overrides: Partial<FieldsOf<BlockHeader>> & Partial<FieldsOf<GlobalVariables>> = {}): BlockHeader {
@@ -1,4 +1,5 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import { schemas } from '@aztec/foundation/schemas';
3
4
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
5
 
@@ -26,7 +27,7 @@ export function serializeIndexedTxEffect(effect: IndexedTxEffect): Buffer {
26
27
  export function deserializeIndexedTxEffect(buffer: Buffer): IndexedTxEffect {
27
28
  const reader = BufferReader.asReader(buffer);
28
29
 
29
- const l2BlockHash = reader.readObject(BlockHash);
30
+ const l2BlockHash = new BlockHash(reader.readObject(Fr));
30
31
  const l2BlockNumber = BlockNumber(reader.readNumber());
31
32
  const txIndexInBlock = reader.readNumber();
32
33
  const data = reader.readObject(TxEffect);
@@ -1,2 +0,0 @@
1
- export * from './version_manager.js';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kYXRhYmFzZS12ZXJzaW9uL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsc0JBQXNCLENBQUMifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database-version/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- export * from './version_manager.js';
@@ -1 +0,0 @@
1
- export * from './version_manager.js';