@aztec/stdlib 5.0.0-nightly.20260318 → 5.0.0-nightly.20260320

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 (42) hide show
  1. package/dest/abi/abi.d.ts +138 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +10 -2
  4. package/dest/checkpoint/validate.js +2 -2
  5. package/dest/config/index.d.ts +2 -1
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +1 -0
  8. package/dest/config/pipelining-config.d.ts +19 -0
  9. package/dest/config/pipelining-config.d.ts.map +1 -0
  10. package/dest/config/pipelining-config.js +18 -0
  11. package/dest/contract/contract_address.d.ts +3 -3
  12. package/dest/contract/contract_address.js +3 -3
  13. package/dest/contract/contract_class_id.d.ts +2 -2
  14. package/dest/contract/contract_class_id.js +2 -2
  15. package/dest/interfaces/aztec-node-admin.d.ts +1 -4
  16. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  17. package/dest/interfaces/block-builder.d.ts +26 -7
  18. package/dest/interfaces/block-builder.d.ts.map +1 -1
  19. package/dest/interfaces/block-builder.js +1 -4
  20. package/dest/interfaces/configs.d.ts +2 -7
  21. package/dest/interfaces/configs.d.ts.map +1 -1
  22. package/dest/interfaces/configs.js +0 -1
  23. package/dest/interfaces/proving-job.d.ts +166 -166
  24. package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
  25. package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
  26. package/dest/logs/tx_scoped_l2_log.js +7 -0
  27. package/dest/p2p/checkpoint_proposal.d.ts +1 -1
  28. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  29. package/dest/p2p/checkpoint_proposal.js +13 -11
  30. package/dest/tx/simulated_tx.d.ts +109 -1
  31. package/dest/tx/simulated_tx.d.ts.map +1 -1
  32. package/package.json +8 -8
  33. package/src/abi/abi.ts +25 -2
  34. package/src/checkpoint/validate.ts +2 -2
  35. package/src/config/index.ts +1 -0
  36. package/src/config/pipelining-config.ts +31 -0
  37. package/src/contract/contract_address.ts +3 -3
  38. package/src/contract/contract_class_id.ts +2 -2
  39. package/src/interfaces/block-builder.ts +27 -9
  40. package/src/interfaces/configs.ts +1 -6
  41. package/src/logs/tx_scoped_l2_log.ts +16 -0
  42. package/src/p2p/checkpoint_proposal.ts +23 -20
@@ -29,8 +29,6 @@ export interface SequencerConfig {
29
29
  perBlockAllocationMultiplier?: number;
30
30
  /** Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget. */
31
31
  redistributeCheckpointBudget?: boolean;
32
- /** Computed max number of blocks per checkpoint from timetable. */
33
- maxBlocksPerCheckpoint?: number;
34
32
  /** Recipient of block reward. */
35
33
  coinbase?: EthAddress;
36
34
  /** Address to receive fees. */
@@ -99,7 +97,6 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
99
97
  maxDABlockGas: z.number().optional(),
100
98
  perBlockAllocationMultiplier: z.number().optional(),
101
99
  redistributeCheckpointBudget: z.boolean().optional(),
102
- maxBlocksPerCheckpoint: z.number().optional(),
103
100
  coinbase: schemas.EthAddress.optional(),
104
101
  feeRecipient: schemas.AztecAddress.optional(),
105
102
  acvmWorkingDirectory: z.string().optional(),
@@ -148,9 +145,7 @@ type SequencerConfigOptionalKeys =
148
145
  | 'maxTxsPerCheckpoint'
149
146
  | 'maxL2BlockGas'
150
147
  | 'maxDABlockGas'
151
- | 'perBlockAllocationMultiplier'
152
- | 'redistributeCheckpointBudget'
153
- | 'maxBlocksPerCheckpoint';
148
+ | 'redistributeCheckpointBudget';
154
149
 
155
150
  export type ResolvedSequencerConfig = Prettify<
156
151
  Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
@@ -1,4 +1,5 @@
1
1
  import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
2
+ import { times } from '@aztec/foundation/collection';
2
3
  import { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import { schemas as foundationSchemas } from '@aztec/foundation/schemas';
4
5
  import {
@@ -83,6 +84,21 @@ export class TxScopedL2Log {
83
84
  return new TxScopedL2Log(txHash, blockNumber, blockTimestamp, logData, noteHashes, firstNullifier);
84
85
  }
85
86
 
87
+ static getBlockNumberFromBuffer(buffer: Buffer) {
88
+ return BlockNumber(buffer.readUint32BE(Fr.SIZE_IN_BYTES));
89
+ }
90
+
91
+ static random() {
92
+ return new TxScopedL2Log(
93
+ TxHash.fromField(Fr.random()),
94
+ BlockNumber(Math.floor(Math.random() * 100000) + 1),
95
+ BigInt(Math.floor(Date.now() / 1000)),
96
+ times(3, Fr.random),
97
+ times(3, Fr.random),
98
+ Fr.random(),
99
+ );
100
+ }
101
+
86
102
  equals(other: TxScopedL2Log) {
87
103
  return (
88
104
  this.txHash.equals(other.txHash) &&
@@ -178,29 +178,32 @@ export class CheckpointProposal extends Gossipable {
178
178
  blockNumber: lastBlockInfo?.blockHeader?.globalVariables.blockNumber ?? BlockNumber(0),
179
179
  dutyType: DutyType.CHECKPOINT_PROPOSAL,
180
180
  };
181
- const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
182
181
 
183
- if (!lastBlockInfo) {
184
- return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature);
182
+ if (lastBlockInfo) {
183
+ // Sign block proposal before signing checkpoint proposal to ensure HA protection
184
+ const lastBlockProposal = await BlockProposal.createProposalFromSigner(
185
+ lastBlockInfo.blockHeader,
186
+ lastBlockInfo.indexWithinCheckpoint,
187
+ checkpointHeader.inHash,
188
+ archiveRoot,
189
+ lastBlockInfo.txHashes,
190
+ lastBlockInfo.txs,
191
+ payloadSigner,
192
+ );
193
+
194
+ const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
195
+
196
+ return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, {
197
+ blockHeader: lastBlockInfo.blockHeader,
198
+ indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
199
+ txHashes: lastBlockInfo.txHashes,
200
+ signature: lastBlockProposal.signature,
201
+ signedTxs: lastBlockProposal.signedTxs,
202
+ });
185
203
  }
186
204
 
187
- const lastBlockProposal = await BlockProposal.createProposalFromSigner(
188
- lastBlockInfo.blockHeader,
189
- lastBlockInfo.indexWithinCheckpoint,
190
- checkpointHeader.inHash,
191
- archiveRoot,
192
- lastBlockInfo.txHashes,
193
- lastBlockInfo.txs,
194
- payloadSigner,
195
- );
196
-
197
- return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, {
198
- blockHeader: lastBlockInfo.blockHeader,
199
- indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
200
- txHashes: lastBlockInfo.txHashes,
201
- signature: lastBlockProposal.signature,
202
- signedTxs: lastBlockProposal.signedTxs,
203
- });
205
+ const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
206
+ return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature);
204
207
  }
205
208
 
206
209
  /**