@aztec/constants 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5a9928

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/src/constants.ts CHANGED
@@ -4,29 +4,62 @@ import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  // Re-export L2 block number constants with proper BlockNumber type
5
5
  // Note: The generated constants are plain numbers, but we provide typed versions here
6
6
  import {
7
+ DA_GAS_PER_FIELD,
7
8
  GENESIS_BLOCK_HEADER_HASH as GENESIS_BLOCK_HEADER_HASH_BIGINT,
8
9
  INITIAL_CHECKPOINT_NUMBER as INITIAL_CHECKPOINT_NUM_RAW,
9
10
  INITIAL_L2_BLOCK_NUM as INITIAL_L2_BLOCK_NUM_RAW,
11
+ MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT as MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT_RAW,
12
+ MAX_TX_BLOB_DATA_SIZE_IN_FIELDS,
10
13
  } from './constants.gen.js';
11
14
 
12
15
  // Typescript-land-only constants
13
16
  export const SPONSORED_FPC_SALT = BigInt(0);
14
17
 
18
+ /**
19
+ * Network-minimum per-block budget multiplier for L2 gas / tx count. Operators may configure a higher value,
20
+ * but never lower: a node admitting txs under a smaller multiplier would accept work it can never pack.
21
+ */
22
+ export const MIN_PER_BLOCK_ALLOCATION_MULTIPLIER = 1.2;
23
+
24
+ /**
25
+ * Network-minimum per-block budget multiplier for DA gas / blob fields. See
26
+ * {@link MIN_PER_BLOCK_ALLOCATION_MULTIPLIER}. The DA-specific operator knob and its runtime enforcement land
27
+ * with the network tx admission limits (#23947); until then this constant is documentation of the network
28
+ * minimum only.
29
+ */
30
+ export const MIN_PER_BLOCK_DA_ALLOCATION_MULTIPLIER = 1.5;
31
+
32
+ /**
33
+ * The most DA gas a single tx can consume. A tx's effects cannot encode more than
34
+ * MAX_TX_BLOB_DATA_SIZE_IN_FIELDS fields in a blob, each costing DA_GAS_PER_FIELD, so this is the maximum
35
+ * DA gas a tx could ever use; declaring a higher limit is rejected by inbound validation.
36
+ */
37
+ export const MAX_TX_DA_GAS = MAX_TX_BLOB_DATA_SIZE_IN_FIELDS * DA_GAS_PER_FIELD;
38
+
15
39
  // Autogenerated constants loaded from noir-land
16
40
  // eslint-disable-next-line import-x/export
17
41
  export * from './constants.gen.js';
18
42
 
19
43
  /** The initial L2 block number (typed as BlockNumber). This is the first block number in the Aztec L2 chain. */
20
- // Shadow the export from constants.gen above
21
44
  // eslint-disable-next-line import-x/export
22
45
  export const INITIAL_L2_BLOCK_NUM: BlockNumber = BlockNumber(INITIAL_L2_BLOCK_NUM_RAW);
23
46
 
24
47
  /** The initial L2 checkpoint number (typed as CheckpointNumber). This is the first checkpoint number in the Aztec L2 chain. */
25
- // Shadow the export from constants.gen above
26
-
27
- export const INITIAL_L2_CHECKPOINT_NUM: CheckpointNumber = CheckpointNumber(INITIAL_CHECKPOINT_NUM_RAW);
48
+ // eslint-disable-next-line import-x/export
49
+ export const INITIAL_CHECKPOINT_NUMBER: CheckpointNumber = CheckpointNumber(INITIAL_CHECKPOINT_NUM_RAW);
28
50
 
29
51
  /** The block header hash for the genesis block 0. */
30
- // Shadow the export from constants.gen above
31
52
  // eslint-disable-next-line import-x/export
32
53
  export const GENESIS_BLOCK_HEADER_HASH = new Fr(GENESIS_BLOCK_HEADER_HASH_BIGINT);
54
+
55
+ /**
56
+ * The RAW DA capacity of a checkpoint's blobs: `BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB * DA_GAS_PER_FIELD`.
57
+ * This value is NOT attainable by transactions. The blob encoding reserves overhead fields that no tx pays
58
+ * DA gas for: a checkpoint-end marker field plus per-block block-end fields (7 for the first block in a
59
+ * checkpoint, 6 for each subsequent block — see `@aztec/blob-lib` encoding). The true tx-usable DA budget
60
+ * is lower and block-count-dependent; consumers budgeting tx data should subtract the encoding overhead (as
61
+ * `CheckpointBuilder` and the network tx gas limits in `@aztec/stdlib/gas` do) rather than use this value
62
+ * directly.
63
+ */
64
+ // eslint-disable-next-line import-x/export
65
+ export const MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT_RAW;