@aztec/constants 0.0.1-commit.9ef841308 → 0.0.1-commit.a4600f49

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,16 +4,38 @@ 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,
10
- MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT,
11
- MAX_PROCESSABLE_L2_GAS,
11
+ MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT as MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT_RAW,
12
+ MAX_TX_BLOB_DATA_SIZE_IN_FIELDS,
12
13
  } from './constants.gen.js';
13
14
 
14
15
  // Typescript-land-only constants
15
16
  export const SPONSORED_FPC_SALT = BigInt(0);
16
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
+
17
39
  // Autogenerated constants loaded from noir-land
18
40
  // eslint-disable-next-line import-x/export
19
41
  export * from './constants.gen.js';
@@ -30,13 +52,14 @@ export const INITIAL_CHECKPOINT_NUMBER: CheckpointNumber = CheckpointNumber(INIT
30
52
  // eslint-disable-next-line import-x/export
31
53
  export const GENESIS_BLOCK_HEADER_HASH = new Fr(GENESIS_BLOCK_HEADER_HASH_BIGINT);
32
54
 
33
- // Override the default gas limits set in noir-protocol-circuit constants with saner ones
34
- // Note that these values are not used in noir-land and are only for use in TypeScript code, so we can set them to whatever we want.
35
- // eslint-disable-next-line import-x/export
36
- export const DEFAULT_L2_GAS_LIMIT = MAX_PROCESSABLE_L2_GAS;
37
- // eslint-disable-next-line import-x/export
38
- export const DEFAULT_TEARDOWN_L2_GAS_LIMIT = DEFAULT_L2_GAS_LIMIT / 8;
39
- // eslint-disable-next-line import-x/export
40
- export const DEFAULT_DA_GAS_LIMIT = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT / 4;
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
+ */
41
64
  // eslint-disable-next-line import-x/export
42
- export const DEFAULT_TEARDOWN_DA_GAS_LIMIT = DEFAULT_DA_GAS_LIMIT / 2;
65
+ export const MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT_RAW;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmluLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NyaXB0cy9jb25zdGFudHMuaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.in.d.ts","sourceRoot":"","sources":["../../src/scripts/constants.in.ts"],"names":[],"mappings":""}