@aztec/ethereum 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0
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/dest/client.d.ts +25 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +60 -4
- package/dest/config.d.ts +45 -73
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +114 -386
- package/dest/contracts/chain_state_override.d.ts +78 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +137 -0
- package/dest/contracts/empire_base.d.ts +2 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +6 -5
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +11 -9
- package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +656 -0
- package/dest/contracts/governance.d.ts +110 -33
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +207 -16
- package/dest/contracts/governance_proposer.d.ts +34 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +447 -10
- package/dest/contracts/gse.d.ts +4 -2
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/gse.js +2 -2
- package/dest/contracts/inbox.d.ts +24 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +42 -2
- package/dest/contracts/index.d.ts +6 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +5 -2
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/multicall.d.ts +130 -13
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +203 -93
- package/dest/contracts/outbox.d.ts +64 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +113 -0
- package/dest/contracts/registry.d.ts +3 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +30 -1
- package/dest/contracts/rollup.d.ts +5571 -102
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1076 -192
- package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +5 -5
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +18 -13
- package/dest/deploy_aztec_l1_contracts.d.ts +267 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +424 -0
- package/dest/deploy_l1_contract.d.ts +68 -0
- package/dest/deploy_l1_contract.d.ts.map +1 -0
- package/dest/deploy_l1_contract.js +312 -0
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- package/dest/foundry_binary.d.ts +13 -0
- package/dest/foundry_binary.d.ts.map +1 -0
- package/dest/foundry_binary.js +52 -0
- package/dest/l1_artifacts.d.ts +19674 -16606
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +61 -65
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +99 -80
- package/dest/l1_reader.d.ts +7 -5
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +15 -7
- package/dest/l1_tx_utils/config.d.ts +9 -3
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +34 -7
- package/dest/l1_tx_utils/constants.d.ts +8 -2
- package/dest/l1_tx_utils/constants.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.js +27 -2
- package/dest/l1_tx_utils/factory.d.ts +18 -10
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +17 -7
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +4 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +3 -0
- package/dest/l1_tx_utils/interfaces.d.ts +2 -2
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +252 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +568 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -7
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +202 -92
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +4 -15
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +63 -165
- package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +70 -39
- package/dest/l1_tx_utils/types.d.ts +27 -1
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/types.js +10 -0
- package/dest/publisher_manager.d.ts +34 -7
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +119 -8
- package/dest/queries.d.ts +14 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +80 -7
- package/dest/test/blob_kzg_warmup.d.ts +19 -0
- package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
- package/dest/test/blob_kzg_warmup.js +64 -0
- package/dest/test/chain_monitor.d.ts +55 -4
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +105 -5
- package/dest/test/eth_cheat_codes.d.ts +49 -6
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +93 -43
- package/dest/test/index.d.ts +2 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -2
- package/dest/test/rollup_cheat_codes.d.ts +64 -4
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +109 -8
- package/dest/test/start_anvil.d.ts +24 -2
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +182 -32
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +24 -4
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +112 -16
- package/package.json +31 -15
- package/src/client.ts +66 -2
- package/src/config.ts +153 -469
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +200 -0
- package/src/contracts/empire_base.ts +1 -1
- package/src/contracts/fee_asset_handler.ts +10 -7
- package/src/contracts/fee_asset_price_oracle.ts +285 -0
- package/src/contracts/governance.ts +279 -13
- package/src/contracts/governance_proposer.ts +64 -3
- package/src/contracts/gse.ts +7 -2
- package/src/contracts/inbox.ts +64 -4
- package/src/contracts/index.ts +5 -2
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +247 -103
- package/src/contracts/outbox.ts +132 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +789 -154
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +18 -14
- package/src/deploy_aztec_l1_contracts.ts +664 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/foundry_binary.ts +57 -0
- package/src/l1_artifacts.ts +12 -35
- package/src/l1_contract_addresses.ts +120 -92
- package/src/l1_reader.ts +25 -10
- package/src/l1_tx_utils/config.ts +47 -9
- package/src/l1_tx_utils/constants.ts +13 -2
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +3 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_fee_analyzer.ts +875 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +194 -72
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +77 -211
- package/src/{test → l1_tx_utils}/tx_delayer.ts +97 -58
- package/src/l1_tx_utils/types.ts +32 -0
- package/src/publisher_manager.ts +145 -12
- package/src/queries.ts +87 -7
- package/src/test/blob_kzg_warmup.ts +65 -0
- package/src/test/chain_monitor.ts +150 -4
- package/src/test/eth_cheat_codes.ts +84 -47
- package/src/test/index.ts +1 -2
- package/src/test/rollup_cheat_codes.ts +136 -8
- package/src/test/start_anvil.ts +213 -31
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +128 -19
- package/dest/contracts/empire_slashing_proposer.d.ts +0 -66
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -200
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.d.ts +0 -673
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1491
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
- package/dest/test/delayed_tx_utils.d.ts +0 -13
- package/dest/test/delayed_tx_utils.d.ts.map +0 -1
- package/dest/test/delayed_tx_utils.js +0 -28
- package/dest/test/tx_delayer.d.ts +0 -36
- package/dest/test/tx_delayer.d.ts.map +0 -1
- package/src/contracts/empire_slashing_proposer.ts +0 -265
- package/src/deploy_l1_contracts.ts +0 -1869
- package/src/index.ts +0 -17
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
- package/src/test/delayed_tx_utils.ts +0 -52
package/src/config.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ConfigMappingsType,
|
|
3
|
-
type NetworkNames,
|
|
4
3
|
bigintConfigHelper,
|
|
5
4
|
booleanConfigHelper,
|
|
6
|
-
enumConfigHelper,
|
|
7
5
|
getConfigFromMappings,
|
|
6
|
+
getDefaultConfig,
|
|
8
7
|
numberConfigHelper,
|
|
8
|
+
omitConfigMappings,
|
|
9
9
|
optionalNumberConfigHelper,
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
|
+
import l1ContractsDefaultEnv from '@aztec/l1-artifacts/network-defaults.json' with { type: 'json' };
|
|
12
13
|
|
|
13
|
-
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/
|
|
14
|
+
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
|
|
14
15
|
|
|
15
16
|
export type GenesisStateConfig = {
|
|
16
17
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
17
18
|
testAccounts: boolean;
|
|
18
19
|
/** Whether to populate the genesis state with initial fee juice for the sponsored FPC */
|
|
19
20
|
sponsoredFPC: boolean;
|
|
21
|
+
/** Additional addresses to prefund with fee juice at genesis */
|
|
22
|
+
prefundAddresses: string[];
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
export type L1ContractsConfig = {
|
|
@@ -32,6 +35,8 @@ export type L1ContractsConfig = {
|
|
|
32
35
|
lagInEpochsForValidatorSet: number;
|
|
33
36
|
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
34
37
|
lagInEpochsForRandao: number;
|
|
38
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
39
|
+
inboxLag: number;
|
|
35
40
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
36
41
|
aztecProofSubmissionEpochs: number;
|
|
37
42
|
/** The deposit amount for a validator */
|
|
@@ -54,332 +59,127 @@ export type L1ContractsConfig = {
|
|
|
54
59
|
slashingOffsetInRounds: number;
|
|
55
60
|
/** How long slashing can be disabled for in seconds when vetoer disables it */
|
|
56
61
|
slashingDisableDuration: number;
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
/** Minimum amount that can be slashed
|
|
62
|
+
/** Whether to deploy a slasher proposer */
|
|
63
|
+
slasherEnabled: boolean;
|
|
64
|
+
/** Minimum amount that can be slashed */
|
|
60
65
|
slashAmountSmall: bigint;
|
|
61
|
-
/** Medium amount to slash
|
|
66
|
+
/** Medium amount to slash */
|
|
62
67
|
slashAmountMedium: bigint;
|
|
63
|
-
/** Largest amount that can be slashed per round
|
|
68
|
+
/** Largest amount that can be slashed per round */
|
|
64
69
|
slashAmountLarge: bigint;
|
|
65
70
|
/** Governance proposing quorum (defaults to roundSize/2 + 1) */
|
|
66
71
|
governanceProposerQuorum?: number;
|
|
67
72
|
/** Governance proposing round size */
|
|
68
73
|
governanceProposerRoundSize: number;
|
|
74
|
+
/** Governance voting duration in seconds (only for local/devnet/next-net, default 3600) */
|
|
75
|
+
governanceVotingDuration?: number;
|
|
69
76
|
/** The mana target for the rollup */
|
|
70
77
|
manaTarget: bigint;
|
|
71
78
|
/** The proving cost per mana */
|
|
72
79
|
provingCostPerMana: bigint;
|
|
80
|
+
/** The initial ETH per fee asset price (with 1e12 precision) */
|
|
81
|
+
initialEthPerFeeAsset: bigint;
|
|
73
82
|
/** The number of seconds to wait for an exit */
|
|
74
83
|
exitDelaySeconds: number;
|
|
84
|
+
/** Validator set size at or below which the entry queue uses the bootstrap flush size. */
|
|
85
|
+
entryQueueBootstrapValidatorSetSize: number;
|
|
86
|
+
/** Number of validators admitted from the entry queue per flush during the bootstrap phase. */
|
|
87
|
+
entryQueueBootstrapFlushSize: number;
|
|
88
|
+
/** Minimum number of validators admitted from the entry queue per flush. */
|
|
89
|
+
entryQueueFlushSizeMin: number;
|
|
90
|
+
/** Divisor applied to the queue size to derive the normal per-flush admission count. */
|
|
91
|
+
entryQueueFlushSizeQuotient: number;
|
|
92
|
+
/** Maximum number of validators admitted from the entry queue per flush. */
|
|
93
|
+
entryQueueMaxFlushSize: number;
|
|
75
94
|
} & L1TxUtilsConfig;
|
|
76
95
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
lagInEpochsForValidatorSet: 2,
|
|
83
|
-
lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
|
|
84
|
-
aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
|
|
85
|
-
activationThreshold: 100n * 10n ** 18n,
|
|
86
|
-
ejectionThreshold: 50n * 10n ** 18n,
|
|
87
|
-
localEjectionThreshold: 98n * 10n ** 18n,
|
|
88
|
-
slashAmountSmall: 10n * 10n ** 18n,
|
|
89
|
-
slashAmountMedium: 20n * 10n ** 18n,
|
|
90
|
-
slashAmountLarge: 50n * 10n ** 18n,
|
|
91
|
-
slashingRoundSizeInEpochs: 4,
|
|
92
|
-
slashingLifetimeInRounds: 5,
|
|
93
|
-
slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
|
|
94
|
-
slashingVetoer: EthAddress.ZERO,
|
|
95
|
-
governanceProposerRoundSize: 300,
|
|
96
|
-
manaTarget: BigInt(100e6),
|
|
97
|
-
provingCostPerMana: BigInt(100),
|
|
98
|
-
exitDelaySeconds: 2 * 24 * 60 * 60,
|
|
99
|
-
slasherFlavor: 'tally' as const,
|
|
100
|
-
slashingOffsetInRounds: 2,
|
|
101
|
-
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
|
|
102
|
-
} satisfies L1ContractsConfig;
|
|
103
|
-
|
|
104
|
-
const LocalGovernanceConfiguration = {
|
|
105
|
-
proposeConfig: {
|
|
106
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
107
|
-
lockAmount: 1n * 10n ** 24n,
|
|
108
|
-
},
|
|
109
|
-
votingDelay: 60n,
|
|
110
|
-
votingDuration: 60n * 60n,
|
|
111
|
-
executionDelay: 60n,
|
|
112
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
113
|
-
quorum: 1n * 10n ** 17n, // 10%
|
|
114
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
115
|
-
minimumVotes: 400n * 10n ** 18n,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const StagingPublicGovernanceConfiguration = {
|
|
119
|
-
proposeConfig: {
|
|
120
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
121
|
-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
|
|
122
|
-
},
|
|
123
|
-
votingDelay: 60n,
|
|
124
|
-
votingDuration: 60n * 60n,
|
|
125
|
-
executionDelay: 60n,
|
|
126
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
127
|
-
quorum: 3n * 10n ** 17n, // 30%
|
|
128
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
129
|
-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, // >= 200 validators must vote
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const TestnetGovernanceConfiguration = {
|
|
133
|
-
proposeConfig: {
|
|
134
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
135
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n,
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
votingDelay: 12n * 60n * 60n, // 12 hours
|
|
139
|
-
votingDuration: 1n * 24n * 60n * 60n, // 1 day
|
|
140
|
-
executionDelay: 12n * 60n * 60n, // 12 hours
|
|
141
|
-
gracePeriod: 1n * 24n * 60n * 60n, // 1 day
|
|
142
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
143
|
-
requiredYeaMargin: 1n * 10n ** 17n, // 10%
|
|
144
|
-
minimumVotes: 100n * 200_000n * 10n ** 18n,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const StagingIgnitionGovernanceConfiguration = {
|
|
148
|
-
proposeConfig: {
|
|
149
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
150
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n,
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
votingDelay: 7n * 24n * 60n * 60n,
|
|
154
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
155
|
-
executionDelay: 30n * 24n * 60n * 60n,
|
|
156
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
157
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
158
|
-
requiredYeaMargin: 1n * 10n ** 17n, // 10%
|
|
159
|
-
minimumVotes: 1250n * 200_000n * 10n ** 18n,
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const MainnetGovernanceConfiguration = {
|
|
163
|
-
proposeConfig: {
|
|
164
|
-
lockDelay: 90n * 24n * 60n * 60n,
|
|
165
|
-
lockAmount: 258_750_000n * 10n ** 18n,
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
votingDelay: 3n * 24n * 60n * 60n,
|
|
169
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
170
|
-
executionDelay: 7n * 24n * 60n * 60n,
|
|
171
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
172
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
173
|
-
requiredYeaMargin: 33n * 10n ** 16n, // 33%
|
|
174
|
-
minimumVotes: 1000n * 200_000n * 10n ** 18n,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export const getGovernanceConfiguration = (networkName: NetworkNames) => {
|
|
178
|
-
switch (networkName) {
|
|
179
|
-
case 'local':
|
|
180
|
-
return LocalGovernanceConfiguration;
|
|
181
|
-
case 'next-net':
|
|
182
|
-
return LocalGovernanceConfiguration;
|
|
183
|
-
case 'devnet':
|
|
184
|
-
return LocalGovernanceConfiguration;
|
|
185
|
-
case 'staging-public':
|
|
186
|
-
return StagingPublicGovernanceConfiguration;
|
|
187
|
-
case 'testnet':
|
|
188
|
-
return TestnetGovernanceConfiguration;
|
|
189
|
-
case 'staging-ignition':
|
|
190
|
-
return StagingIgnitionGovernanceConfiguration;
|
|
191
|
-
case 'mainnet':
|
|
192
|
-
return MainnetGovernanceConfiguration;
|
|
193
|
-
default:
|
|
194
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
// Making a default config here as we are only using it thought the deployment
|
|
199
|
-
// and do not expect to be using different setups, so having environment variables
|
|
200
|
-
// for it seems overkill
|
|
201
|
-
|
|
202
|
-
const DefaultRewardConfig = {
|
|
203
|
-
sequencerBps: 8000,
|
|
204
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
205
|
-
booster: EthAddress.ZERO.toString(),
|
|
206
|
-
checkpointReward: 500n * 10n ** 18n,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const MainnetRewardConfig = {
|
|
210
|
-
sequencerBps: 7_000,
|
|
211
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
212
|
-
booster: EthAddress.ZERO.toString(),
|
|
213
|
-
checkpointReward: 400n * 10n ** 18n,
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const getRewardConfig = (networkName: NetworkNames) => {
|
|
217
|
-
switch (networkName) {
|
|
218
|
-
case 'local':
|
|
219
|
-
case 'devnet':
|
|
220
|
-
case 'next-net':
|
|
221
|
-
case 'staging-public':
|
|
222
|
-
case 'testnet':
|
|
223
|
-
case 'staging-ignition':
|
|
224
|
-
return DefaultRewardConfig;
|
|
225
|
-
case 'mainnet':
|
|
226
|
-
return MainnetRewardConfig;
|
|
227
|
-
default:
|
|
228
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export const getRewardBoostConfig = () => {
|
|
233
|
-
// The reward configuration is specified with a precision of 1e5, and we use the same across
|
|
234
|
-
// all networks.
|
|
235
|
-
return {
|
|
236
|
-
increment: 125_000, // 1.25
|
|
237
|
-
maxScore: 15_000_000, // 150
|
|
238
|
-
a: 1_000, // 0.01
|
|
239
|
-
k: 1_000_000, // 10
|
|
240
|
-
minimum: 100_000, // 1
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
// Similar to the above, no need for environment variables for this.
|
|
245
|
-
const LocalEntryQueueConfig = {
|
|
246
|
-
bootstrapValidatorSetSize: 0n,
|
|
247
|
-
bootstrapFlushSize: 0n,
|
|
248
|
-
normalFlushSizeMin: 48n,
|
|
249
|
-
normalFlushSizeQuotient: 2n,
|
|
250
|
-
maxQueueFlushSize: 48n,
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const StagingPublicEntryQueueConfig = {
|
|
254
|
-
bootstrapValidatorSetSize: 48n,
|
|
255
|
-
bootstrapFlushSize: 48n,
|
|
256
|
-
normalFlushSizeMin: 1n,
|
|
257
|
-
normalFlushSizeQuotient: 2475n,
|
|
258
|
-
maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const TestnetEntryQueueConfig = {
|
|
262
|
-
bootstrapValidatorSetSize: 256n,
|
|
263
|
-
bootstrapFlushSize: 256n,
|
|
264
|
-
normalFlushSizeMin: 4n,
|
|
265
|
-
normalFlushSizeQuotient: 2048n,
|
|
266
|
-
maxQueueFlushSize: 8n,
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const StagingIgnitionEntryQueueConfig = {
|
|
270
|
-
bootstrapValidatorSetSize: 48n,
|
|
271
|
-
bootstrapFlushSize: 48n,
|
|
272
|
-
normalFlushSizeMin: 1n,
|
|
273
|
-
normalFlushSizeQuotient: 2048n,
|
|
274
|
-
maxQueueFlushSize: 24n,
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const MainnetEntryQueueConfig = {
|
|
278
|
-
bootstrapValidatorSetSize: 1_000n,
|
|
279
|
-
bootstrapFlushSize: 1_000n,
|
|
280
|
-
normalFlushSizeMin: 1n,
|
|
281
|
-
normalFlushSizeQuotient: 2_048n,
|
|
282
|
-
maxQueueFlushSize: 8n,
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
export const getEntryQueueConfig = (networkName: NetworkNames) => {
|
|
286
|
-
switch (networkName) {
|
|
287
|
-
case 'local':
|
|
288
|
-
return LocalEntryQueueConfig;
|
|
289
|
-
case 'next-net':
|
|
290
|
-
return LocalEntryQueueConfig;
|
|
291
|
-
case 'devnet':
|
|
292
|
-
return LocalEntryQueueConfig;
|
|
293
|
-
case 'staging-public':
|
|
294
|
-
return StagingPublicEntryQueueConfig;
|
|
295
|
-
case 'testnet':
|
|
296
|
-
return TestnetEntryQueueConfig;
|
|
297
|
-
case 'staging-ignition':
|
|
298
|
-
return StagingIgnitionEntryQueueConfig;
|
|
299
|
-
case 'mainnet':
|
|
300
|
-
return MainnetEntryQueueConfig;
|
|
301
|
-
default:
|
|
302
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Config mappings for L1ContractsConfig.
|
|
98
|
+
* Default values come from l1-contracts/scripts/network-defaults.json (published via @aztec/l1-artifacts).
|
|
99
|
+
* Real deployments use forge scripts which require explicit env vars (vm.envUint).
|
|
100
|
+
*/
|
|
306
101
|
export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> = {
|
|
307
102
|
ethereumSlotDuration: {
|
|
308
103
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
309
104
|
description: 'How many seconds an L1 slot lasts.',
|
|
310
|
-
...numberConfigHelper(
|
|
105
|
+
...numberConfigHelper(l1ContractsDefaultEnv.ETHEREUM_SLOT_DURATION),
|
|
311
106
|
},
|
|
312
107
|
aztecSlotDuration: {
|
|
313
108
|
env: 'AZTEC_SLOT_DURATION',
|
|
314
109
|
description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
|
|
315
|
-
...numberConfigHelper(
|
|
110
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLOT_DURATION),
|
|
316
111
|
},
|
|
317
112
|
aztecEpochDuration: {
|
|
318
113
|
env: 'AZTEC_EPOCH_DURATION',
|
|
319
|
-
description: `How many L2 slots an epoch lasts (maximum
|
|
320
|
-
...numberConfigHelper(
|
|
114
|
+
description: `How many L2 slots an epoch lasts (maximum MAX_CHECKPOINTS_PER_EPOCH).`,
|
|
115
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EPOCH_DURATION),
|
|
321
116
|
},
|
|
322
117
|
aztecTargetCommitteeSize: {
|
|
323
118
|
env: 'AZTEC_TARGET_COMMITTEE_SIZE',
|
|
324
119
|
description: 'The target validator committee size.',
|
|
325
|
-
...numberConfigHelper(
|
|
120
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_TARGET_COMMITTEE_SIZE),
|
|
326
121
|
},
|
|
327
122
|
lagInEpochsForValidatorSet: {
|
|
328
123
|
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
329
124
|
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
330
|
-
...numberConfigHelper(
|
|
125
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET),
|
|
331
126
|
},
|
|
332
127
|
lagInEpochsForRandao: {
|
|
333
128
|
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
334
129
|
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
335
|
-
...numberConfigHelper(
|
|
130
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_RANDAO),
|
|
131
|
+
},
|
|
132
|
+
inboxLag: {
|
|
133
|
+
env: 'AZTEC_INBOX_LAG',
|
|
134
|
+
description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
|
|
135
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_INBOX_LAG),
|
|
336
136
|
},
|
|
337
137
|
aztecProofSubmissionEpochs: {
|
|
338
138
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
339
139
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
340
|
-
...numberConfigHelper(
|
|
140
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_PROOF_SUBMISSION_EPOCHS),
|
|
341
141
|
},
|
|
342
142
|
activationThreshold: {
|
|
343
143
|
env: 'AZTEC_ACTIVATION_THRESHOLD',
|
|
344
144
|
description: 'The deposit amount for a validator',
|
|
345
|
-
...bigintConfigHelper(
|
|
145
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_ACTIVATION_THRESHOLD)),
|
|
346
146
|
},
|
|
347
147
|
ejectionThreshold: {
|
|
348
148
|
env: 'AZTEC_EJECTION_THRESHOLD',
|
|
349
149
|
description: 'The minimum stake for a validator.',
|
|
350
|
-
...bigintConfigHelper(
|
|
150
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_EJECTION_THRESHOLD)),
|
|
351
151
|
},
|
|
352
152
|
localEjectionThreshold: {
|
|
353
153
|
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
354
154
|
description:
|
|
355
155
|
'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
356
|
-
...bigintConfigHelper(
|
|
156
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_LOCAL_EJECTION_THRESHOLD)),
|
|
357
157
|
},
|
|
358
158
|
slashingOffsetInRounds: {
|
|
359
159
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
360
160
|
description:
|
|
361
161
|
'How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset)',
|
|
362
|
-
...numberConfigHelper(
|
|
162
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS),
|
|
363
163
|
},
|
|
364
|
-
|
|
365
|
-
env: '
|
|
366
|
-
description: '
|
|
367
|
-
...
|
|
164
|
+
slasherEnabled: {
|
|
165
|
+
env: 'AZTEC_SLASHER_ENABLED',
|
|
166
|
+
description: 'Whether to deploy a slasher proposer',
|
|
167
|
+
...booleanConfigHelper(true),
|
|
368
168
|
},
|
|
369
169
|
slashAmountSmall: {
|
|
370
170
|
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
371
171
|
description: 'Small slashing amount for light offenses',
|
|
372
|
-
...bigintConfigHelper(
|
|
172
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_SMALL)),
|
|
373
173
|
},
|
|
374
174
|
slashAmountMedium: {
|
|
375
175
|
env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
|
|
376
176
|
description: 'Medium slashing amount for moderate offenses',
|
|
377
|
-
...bigintConfigHelper(
|
|
177
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_MEDIUM)),
|
|
378
178
|
},
|
|
379
179
|
slashAmountLarge: {
|
|
380
180
|
env: 'AZTEC_SLASH_AMOUNT_LARGE',
|
|
381
181
|
description: 'Large slashing amount for severe offenses',
|
|
382
|
-
...bigintConfigHelper(
|
|
182
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_LARGE)),
|
|
383
183
|
},
|
|
384
184
|
slashingQuorum: {
|
|
385
185
|
env: 'AZTEC_SLASHING_QUORUM',
|
|
@@ -389,28 +189,28 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
389
189
|
slashingRoundSizeInEpochs: {
|
|
390
190
|
env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
|
|
391
191
|
description: 'The slashing round size',
|
|
392
|
-
...numberConfigHelper(
|
|
192
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS),
|
|
393
193
|
},
|
|
394
194
|
slashingLifetimeInRounds: {
|
|
395
195
|
env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
|
|
396
196
|
description: 'The slashing lifetime in rounds',
|
|
397
|
-
...numberConfigHelper(
|
|
197
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_LIFETIME_IN_ROUNDS),
|
|
398
198
|
},
|
|
399
199
|
slashingExecutionDelayInRounds: {
|
|
400
200
|
env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
|
|
401
201
|
description: 'The slashing execution delay in rounds',
|
|
402
|
-
...numberConfigHelper(
|
|
202
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS),
|
|
403
203
|
},
|
|
404
204
|
slashingVetoer: {
|
|
405
205
|
env: 'AZTEC_SLASHING_VETOER',
|
|
406
206
|
description: 'The slashing vetoer',
|
|
407
207
|
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
408
|
-
defaultValue:
|
|
208
|
+
defaultValue: EthAddress.fromString(l1ContractsDefaultEnv.AZTEC_SLASHING_VETOER),
|
|
409
209
|
},
|
|
410
210
|
slashingDisableDuration: {
|
|
411
211
|
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
412
212
|
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
413
|
-
...numberConfigHelper(
|
|
213
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_DISABLE_DURATION),
|
|
414
214
|
},
|
|
415
215
|
governanceProposerQuorum: {
|
|
416
216
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
@@ -420,26 +220,102 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
420
220
|
governanceProposerRoundSize: {
|
|
421
221
|
env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
|
|
422
222
|
description: 'The governance proposing round size',
|
|
423
|
-
...numberConfigHelper(
|
|
223
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE),
|
|
224
|
+
},
|
|
225
|
+
governanceVotingDuration: {
|
|
226
|
+
env: 'AZTEC_GOVERNANCE_VOTING_DURATION',
|
|
227
|
+
description: 'Governance voting duration in seconds (only for local/devnet/next-net)',
|
|
228
|
+
...numberConfigHelper(3600), // 1 hour default, not in generated defaults as it's deployment-time only
|
|
424
229
|
},
|
|
425
230
|
manaTarget: {
|
|
426
231
|
env: 'AZTEC_MANA_TARGET',
|
|
427
232
|
description: 'The mana target for the rollup',
|
|
428
|
-
...bigintConfigHelper(
|
|
233
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_MANA_TARGET)),
|
|
429
234
|
},
|
|
430
235
|
provingCostPerMana: {
|
|
431
236
|
env: 'AZTEC_PROVING_COST_PER_MANA',
|
|
432
237
|
description: 'The proving cost per mana',
|
|
433
|
-
...bigintConfigHelper(
|
|
238
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_PROVING_COST_PER_MANA)),
|
|
239
|
+
},
|
|
240
|
+
initialEthPerFeeAsset: {
|
|
241
|
+
env: 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
|
|
242
|
+
description: 'The initial ETH per fee asset price (with 1e12 precision)',
|
|
243
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_INITIAL_ETH_PER_FEE_ASSET)),
|
|
434
244
|
},
|
|
435
245
|
exitDelaySeconds: {
|
|
436
246
|
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
437
247
|
description: 'The delay before a validator can exit the set',
|
|
438
|
-
...numberConfigHelper(
|
|
439
|
-
},
|
|
440
|
-
|
|
248
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS),
|
|
249
|
+
},
|
|
250
|
+
entryQueueBootstrapValidatorSetSize: {
|
|
251
|
+
env: 'AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE',
|
|
252
|
+
description: 'Validator set size at or below which the entry queue uses the bootstrap flush size.',
|
|
253
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE),
|
|
254
|
+
},
|
|
255
|
+
entryQueueBootstrapFlushSize: {
|
|
256
|
+
env: 'AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE',
|
|
257
|
+
description: 'Number of validators admitted from the entry queue per flush during the bootstrap phase.',
|
|
258
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE),
|
|
259
|
+
},
|
|
260
|
+
entryQueueFlushSizeMin: {
|
|
261
|
+
env: 'AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN',
|
|
262
|
+
description: 'Minimum number of validators admitted from the entry queue per flush.',
|
|
263
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN),
|
|
264
|
+
},
|
|
265
|
+
entryQueueFlushSizeQuotient: {
|
|
266
|
+
env: 'AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT',
|
|
267
|
+
description: 'Divisor applied to the queue size to derive the normal per-flush admission count.',
|
|
268
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT),
|
|
269
|
+
},
|
|
270
|
+
entryQueueMaxFlushSize: {
|
|
271
|
+
env: 'AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE',
|
|
272
|
+
description: 'Maximum number of validators admitted from the entry queue per flush.',
|
|
273
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE),
|
|
274
|
+
},
|
|
275
|
+
...omitConfigMappings(l1TxUtilsConfigMappings, ['ethereumSlotDuration']),
|
|
441
276
|
};
|
|
442
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Default L1 contracts configuration derived from l1ContractsConfigMappings.
|
|
280
|
+
* Source of truth: l1-contracts/scripts/network-defaults.json (published via @aztec/l1-artifacts).
|
|
281
|
+
*/
|
|
282
|
+
export const DefaultL1ContractsConfig = getDefaultConfig(l1ContractsConfigMappings);
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Validates that `ethereumSlotDuration` and `aztecSlotDuration` are positive and that the L2 slot is an exact
|
|
286
|
+
* multiple of the L1 slot. Every L2 slot boundary must land on an L1 slot boundary; a non-multiple pairing
|
|
287
|
+
* desyncs the epoch/checkpoint timing math throughout the sequencer, validator client, and timetables. Returns
|
|
288
|
+
* a list of error messages (empty when valid).
|
|
289
|
+
*/
|
|
290
|
+
export function validateSlotDurations(
|
|
291
|
+
config: Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration'>,
|
|
292
|
+
): string[] {
|
|
293
|
+
const errors: string[] = [];
|
|
294
|
+
if (config.ethereumSlotDuration <= 0) {
|
|
295
|
+
errors.push(`ethereumSlotDuration must be positive (got ${config.ethereumSlotDuration})`);
|
|
296
|
+
}
|
|
297
|
+
if (config.aztecSlotDuration <= 0) {
|
|
298
|
+
errors.push(`aztecSlotDuration must be positive (got ${config.aztecSlotDuration})`);
|
|
299
|
+
}
|
|
300
|
+
if (config.ethereumSlotDuration > 0 && config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
301
|
+
errors.push(
|
|
302
|
+
`aztecSlotDuration (${config.aztecSlotDuration}s) must be a multiple of ethereumSlotDuration ` +
|
|
303
|
+
`(${config.ethereumSlotDuration}s)`,
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
return errors;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** Throws if {@link validateSlotDurations} reports any errors. */
|
|
310
|
+
export function assertValidSlotDurations(
|
|
311
|
+
config: Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration'>,
|
|
312
|
+
): void {
|
|
313
|
+
const errors = validateSlotDurations(config);
|
|
314
|
+
if (errors.length > 0) {
|
|
315
|
+
throw new Error(`Invalid slot duration configuration:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
443
319
|
export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig> = {
|
|
444
320
|
testAccounts: {
|
|
445
321
|
env: 'TEST_ACCOUNTS',
|
|
@@ -451,6 +327,16 @@ export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig>
|
|
|
451
327
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
452
328
|
...booleanConfigHelper(false),
|
|
453
329
|
},
|
|
330
|
+
prefundAddresses: {
|
|
331
|
+
env: 'PREFUND_ADDRESSES',
|
|
332
|
+
description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
|
|
333
|
+
parseEnv: (val: string) =>
|
|
334
|
+
val
|
|
335
|
+
.split(',')
|
|
336
|
+
.map(a => a.trim())
|
|
337
|
+
.filter(a => a.length > 0),
|
|
338
|
+
defaultValue: [],
|
|
339
|
+
},
|
|
454
340
|
};
|
|
455
341
|
|
|
456
342
|
export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
|
|
@@ -460,205 +346,3 @@ export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
|
|
|
460
346
|
export function getGenesisStateConfigEnvVars(): GenesisStateConfig {
|
|
461
347
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
462
348
|
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
|
|
466
|
-
* during construction are satisfied before deployment.
|
|
467
|
-
* Accumulates all validation errors and throws an exception listing them all if any are found.
|
|
468
|
-
*/
|
|
469
|
-
export function validateConfig(config: Omit<L1ContractsConfig, keyof L1TxUtilsConfig>): void {
|
|
470
|
-
const errors: string[] = [];
|
|
471
|
-
|
|
472
|
-
// RollupCore constructor validation: normalFlushSizeMin > 0
|
|
473
|
-
// From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
|
|
474
|
-
const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
|
|
475
|
-
if (entryQueueConfig.normalFlushSizeMin <= 0n) {
|
|
476
|
-
errors.push('normalFlushSizeMin must be greater than 0');
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
|
|
480
|
-
// While not explicitly required in constructor, this is a common validation for time-based systems
|
|
481
|
-
if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
482
|
-
errors.push(
|
|
483
|
-
`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`,
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// EmpireBase constructor validations for governance/slashing proposers
|
|
488
|
-
// From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
489
|
-
const { governanceProposerQuorum, governanceProposerRoundSize } = config;
|
|
490
|
-
if (
|
|
491
|
-
governanceProposerQuorum !== undefined &&
|
|
492
|
-
governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)
|
|
493
|
-
) {
|
|
494
|
-
errors.push(
|
|
495
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`,
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
500
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
|
|
501
|
-
errors.push(
|
|
502
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`,
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
// Slashing quorum validations (similar to governance quorum)
|
|
507
|
-
const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
508
|
-
const { slashingQuorum } = config;
|
|
509
|
-
if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
|
|
510
|
-
errors.push(
|
|
511
|
-
`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`,
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
|
|
516
|
-
errors.push(
|
|
517
|
-
`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`,
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// EmpireBase and TallySlashingProposer lifetime and execution delay validation
|
|
522
|
-
// From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
|
|
523
|
-
if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
|
|
524
|
-
errors.push(
|
|
525
|
-
`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`,
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// Staking asset validation: activationThreshold > ejectionThreshold
|
|
530
|
-
if (config.activationThreshold < config.ejectionThreshold) {
|
|
531
|
-
errors.push(
|
|
532
|
-
`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`,
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// TallySlashingProposer constructor validations
|
|
537
|
-
if (config.slasherFlavor === 'tally') {
|
|
538
|
-
validateTallySlasherConfig(config, errors);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// Epoch and slot duration validations
|
|
542
|
-
if (config.aztecSlotDuration <= 0) {
|
|
543
|
-
errors.push('aztecSlotDuration must be greater than 0');
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
if (config.ethereumSlotDuration <= 0) {
|
|
547
|
-
errors.push('ethereumSlotDuration must be greater than 0');
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (config.aztecEpochDuration <= 0) {
|
|
551
|
-
errors.push('aztecEpochDuration must be greater than 0');
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// Committee size validation
|
|
555
|
-
if (config.aztecTargetCommitteeSize < 0) {
|
|
556
|
-
errors.push('aztecTargetCommitteeSize cannot be negative');
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// Proof submission epochs validation
|
|
560
|
-
if (config.aztecProofSubmissionEpochs < 0) {
|
|
561
|
-
errors.push('aztecProofSubmissionEpochs cannot be negative');
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// Exit delay validation
|
|
565
|
-
if (config.exitDelaySeconds < 0) {
|
|
566
|
-
errors.push('exitDelaySeconds cannot be negative');
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// Mana validation
|
|
570
|
-
if (config.manaTarget < 0n) {
|
|
571
|
-
errors.push('manaTarget cannot be negative');
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (config.provingCostPerMana < 0n) {
|
|
575
|
-
errors.push('provingCostPerMana cannot be negative');
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// If any errors were found, throw an exception with all of them
|
|
579
|
-
if (errors.length > 0) {
|
|
580
|
-
throw new Error(
|
|
581
|
-
`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index) => `${index + 1}. ${error}`).join('\n')}`,
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
function validateTallySlasherConfig(config: L1ContractsConfig, errors: string[]) {
|
|
587
|
-
if (config.slasherFlavor !== 'tally') {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
|
|
592
|
-
if (config.slashingOffsetInRounds <= 0) {
|
|
593
|
-
errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
|
|
597
|
-
const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
598
|
-
|
|
599
|
-
// From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
|
|
600
|
-
const { slashingQuorum } = config;
|
|
601
|
-
if (slashingQuorum !== undefined && slashingQuorum <= 0) {
|
|
602
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
|
|
606
|
-
if (roundSizeInSlots <= 1) {
|
|
607
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
// From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
611
|
-
if (config.slashAmountSmall > config.slashAmountMedium) {
|
|
612
|
-
errors.push(
|
|
613
|
-
`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`,
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
// From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
618
|
-
if (config.slashAmountMedium > config.slashAmountLarge) {
|
|
619
|
-
errors.push(
|
|
620
|
-
`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`,
|
|
621
|
-
);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
// From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
|
|
625
|
-
const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
|
|
626
|
-
if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
|
|
627
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
// From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
|
|
631
|
-
if (config.slashingRoundSizeInEpochs <= 0) {
|
|
632
|
-
errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
|
|
636
|
-
const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
|
|
637
|
-
if (roundSizeInSlots >= MAX_ROUND_SIZE) {
|
|
638
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
|
|
642
|
-
if (config.aztecTargetCommitteeSize <= 0) {
|
|
643
|
-
errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
|
|
647
|
-
// voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
|
|
648
|
-
const voteSize = (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) / 4;
|
|
649
|
-
if (voteSize > 128) {
|
|
650
|
-
errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
|
|
654
|
-
if ((config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) % 4 !== 0) {
|
|
655
|
-
errors.push(
|
|
656
|
-
`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`,
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// Slashing offset validation: should be positive to allow proper slashing timing
|
|
661
|
-
if (config.slashingOffsetInRounds < 0) {
|
|
662
|
-
errors.push('slashingOffsetInRounds cannot be negative');
|
|
663
|
-
}
|
|
664
|
-
}
|